js/src/jit/BaselineFrame-inl.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit/BaselineFrame-inl.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,84 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99:
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef jit_BaselineFrame_inl_h
    1.11 +#define jit_BaselineFrame_inl_h
    1.12 +
    1.13 +#ifdef JS_ION
    1.14 +
    1.15 +#include "jit/BaselineFrame.h"
    1.16 +
    1.17 +#include "jscntxt.h"
    1.18 +#include "jscompartment.h"
    1.19 +
    1.20 +#include "vm/ScopeObject.h"
    1.21 +
    1.22 +namespace js {
    1.23 +namespace jit {
    1.24 +
    1.25 +inline void
    1.26 +BaselineFrame::pushOnScopeChain(ScopeObject &scope)
    1.27 +{
    1.28 +    JS_ASSERT(*scopeChain() == scope.enclosingScope() ||
    1.29 +              *scopeChain() == scope.as<CallObject>().enclosingScope().as<DeclEnvObject>().enclosingScope());
    1.30 +    scopeChain_ = &scope;
    1.31 +}
    1.32 +
    1.33 +inline void
    1.34 +BaselineFrame::popOffScopeChain()
    1.35 +{
    1.36 +    scopeChain_ = &scopeChain_->as<ScopeObject>().enclosingScope();
    1.37 +}
    1.38 +
    1.39 +inline void
    1.40 +BaselineFrame::popWith(JSContext *cx)
    1.41 +{
    1.42 +    if (MOZ_UNLIKELY(cx->compartment()->debugMode()))
    1.43 +        DebugScopes::onPopWith(this);
    1.44 +
    1.45 +    JS_ASSERT(scopeChain()->is<DynamicWithObject>());
    1.46 +    popOffScopeChain();
    1.47 +}
    1.48 +
    1.49 +inline bool
    1.50 +BaselineFrame::pushBlock(JSContext *cx, Handle<StaticBlockObject *> block)
    1.51 +{
    1.52 +    JS_ASSERT(block->needsClone());
    1.53 +
    1.54 +    ClonedBlockObject *clone = ClonedBlockObject::create(cx, block, this);
    1.55 +    if (!clone)
    1.56 +        return false;
    1.57 +    pushOnScopeChain(*clone);
    1.58 +
    1.59 +    return true;
    1.60 +}
    1.61 +
    1.62 +inline void
    1.63 +BaselineFrame::popBlock(JSContext *cx)
    1.64 +{
    1.65 +    JS_ASSERT(scopeChain_->is<ClonedBlockObject>());
    1.66 +
    1.67 +    popOffScopeChain();
    1.68 +}
    1.69 +
    1.70 +inline CallObject &
    1.71 +BaselineFrame::callObj() const
    1.72 +{
    1.73 +    JS_ASSERT(hasCallObj());
    1.74 +    JS_ASSERT(fun()->isHeavyweight());
    1.75 +
    1.76 +    JSObject *obj = scopeChain();
    1.77 +    while (!obj->is<CallObject>())
    1.78 +        obj = obj->enclosingScope();
    1.79 +    return obj->as<CallObject>();
    1.80 +}
    1.81 +
    1.82 +} // namespace jit
    1.83 +} // namespace js
    1.84 +
    1.85 +#endif // JS_ION
    1.86 +
    1.87 +#endif /* jit_BaselineFrame_inl_h */

mercurial