michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * vim: set ts=8 sts=4 et sw=4 tw=99: michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef jit_BaselineFrame_inl_h michael@0: #define jit_BaselineFrame_inl_h michael@0: michael@0: #ifdef JS_ION michael@0: michael@0: #include "jit/BaselineFrame.h" michael@0: michael@0: #include "jscntxt.h" michael@0: #include "jscompartment.h" michael@0: michael@0: #include "vm/ScopeObject.h" michael@0: michael@0: namespace js { michael@0: namespace jit { michael@0: michael@0: inline void michael@0: BaselineFrame::pushOnScopeChain(ScopeObject &scope) michael@0: { michael@0: JS_ASSERT(*scopeChain() == scope.enclosingScope() || michael@0: *scopeChain() == scope.as().enclosingScope().as().enclosingScope()); michael@0: scopeChain_ = &scope; michael@0: } michael@0: michael@0: inline void michael@0: BaselineFrame::popOffScopeChain() michael@0: { michael@0: scopeChain_ = &scopeChain_->as().enclosingScope(); michael@0: } michael@0: michael@0: inline void michael@0: BaselineFrame::popWith(JSContext *cx) michael@0: { michael@0: if (MOZ_UNLIKELY(cx->compartment()->debugMode())) michael@0: DebugScopes::onPopWith(this); michael@0: michael@0: JS_ASSERT(scopeChain()->is()); michael@0: popOffScopeChain(); michael@0: } michael@0: michael@0: inline bool michael@0: BaselineFrame::pushBlock(JSContext *cx, Handle block) michael@0: { michael@0: JS_ASSERT(block->needsClone()); michael@0: michael@0: ClonedBlockObject *clone = ClonedBlockObject::create(cx, block, this); michael@0: if (!clone) michael@0: return false; michael@0: pushOnScopeChain(*clone); michael@0: michael@0: return true; michael@0: } michael@0: michael@0: inline void michael@0: BaselineFrame::popBlock(JSContext *cx) michael@0: { michael@0: JS_ASSERT(scopeChain_->is()); michael@0: michael@0: popOffScopeChain(); michael@0: } michael@0: michael@0: inline CallObject & michael@0: BaselineFrame::callObj() const michael@0: { michael@0: JS_ASSERT(hasCallObj()); michael@0: JS_ASSERT(fun()->isHeavyweight()); michael@0: michael@0: JSObject *obj = scopeChain(); michael@0: while (!obj->is()) michael@0: obj = obj->enclosingScope(); michael@0: return obj->as(); michael@0: } michael@0: michael@0: } // namespace jit michael@0: } // namespace js michael@0: michael@0: #endif // JS_ION michael@0: michael@0: #endif /* jit_BaselineFrame_inl_h */