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