js/src/jit/BaselineFrame-inl.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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

mercurial