Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * vim: set ts=8 sts=4 et sw=4 tw=99: |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef jit_BaselineFrame_inl_h |
michael@0 | 8 | #define jit_BaselineFrame_inl_h |
michael@0 | 9 | |
michael@0 | 10 | #ifdef JS_ION |
michael@0 | 11 | |
michael@0 | 12 | #include "jit/BaselineFrame.h" |
michael@0 | 13 | |
michael@0 | 14 | #include "jscntxt.h" |
michael@0 | 15 | #include "jscompartment.h" |
michael@0 | 16 | |
michael@0 | 17 | #include "vm/ScopeObject.h" |
michael@0 | 18 | |
michael@0 | 19 | namespace js { |
michael@0 | 20 | namespace jit { |
michael@0 | 21 | |
michael@0 | 22 | inline void |
michael@0 | 23 | BaselineFrame::pushOnScopeChain(ScopeObject &scope) |
michael@0 | 24 | { |
michael@0 | 25 | JS_ASSERT(*scopeChain() == scope.enclosingScope() || |
michael@0 | 26 | *scopeChain() == scope.as<CallObject>().enclosingScope().as<DeclEnvObject>().enclosingScope()); |
michael@0 | 27 | scopeChain_ = &scope; |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | inline void |
michael@0 | 31 | BaselineFrame::popOffScopeChain() |
michael@0 | 32 | { |
michael@0 | 33 | scopeChain_ = &scopeChain_->as<ScopeObject>().enclosingScope(); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | inline void |
michael@0 | 37 | BaselineFrame::popWith(JSContext *cx) |
michael@0 | 38 | { |
michael@0 | 39 | if (MOZ_UNLIKELY(cx->compartment()->debugMode())) |
michael@0 | 40 | DebugScopes::onPopWith(this); |
michael@0 | 41 | |
michael@0 | 42 | JS_ASSERT(scopeChain()->is<DynamicWithObject>()); |
michael@0 | 43 | popOffScopeChain(); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | inline bool |
michael@0 | 47 | BaselineFrame::pushBlock(JSContext *cx, Handle<StaticBlockObject *> block) |
michael@0 | 48 | { |
michael@0 | 49 | JS_ASSERT(block->needsClone()); |
michael@0 | 50 | |
michael@0 | 51 | ClonedBlockObject *clone = ClonedBlockObject::create(cx, block, this); |
michael@0 | 52 | if (!clone) |
michael@0 | 53 | return false; |
michael@0 | 54 | pushOnScopeChain(*clone); |
michael@0 | 55 | |
michael@0 | 56 | return true; |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | inline void |
michael@0 | 60 | BaselineFrame::popBlock(JSContext *cx) |
michael@0 | 61 | { |
michael@0 | 62 | JS_ASSERT(scopeChain_->is<ClonedBlockObject>()); |
michael@0 | 63 | |
michael@0 | 64 | popOffScopeChain(); |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | inline CallObject & |
michael@0 | 68 | BaselineFrame::callObj() const |
michael@0 | 69 | { |
michael@0 | 70 | JS_ASSERT(hasCallObj()); |
michael@0 | 71 | JS_ASSERT(fun()->isHeavyweight()); |
michael@0 | 72 | |
michael@0 | 73 | JSObject *obj = scopeChain(); |
michael@0 | 74 | while (!obj->is<CallObject>()) |
michael@0 | 75 | obj = obj->enclosingScope(); |
michael@0 | 76 | return obj->as<CallObject>(); |
michael@0 | 77 | } |
michael@0 | 78 | |
michael@0 | 79 | } // namespace jit |
michael@0 | 80 | } // namespace js |
michael@0 | 81 | |
michael@0 | 82 | #endif // JS_ION |
michael@0 | 83 | |
michael@0 | 84 | #endif /* jit_BaselineFrame_inl_h */ |