LCOV - code coverage report
Current view: top level - js/src/jit - BaselineFrame-inl.h (source / functions) Hit Total Coverage
Test: output.info Lines: 25 45 55.6 %
Date: 2017-07-14 16:53:18 Functions: 7 15 46.7 %
Legend: Lines: hit not hit

          Line data    Source code
       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/. */
       6             : 
       7             : #ifndef jit_BaselineFrame_inl_h
       8             : #define jit_BaselineFrame_inl_h
       9             : 
      10             : #include "jit/BaselineFrame.h"
      11             : 
      12             : #include "jscntxt.h"
      13             : #include "jscompartment.h"
      14             : 
      15             : #include "vm/EnvironmentObject.h"
      16             : 
      17             : #include "jsscriptinlines.h"
      18             : 
      19             : #include "vm/EnvironmentObject-inl.h"
      20             : 
      21             : namespace js {
      22             : namespace jit {
      23             : 
      24             : template <typename SpecificEnvironment>
      25             : inline void
      26        4126 : BaselineFrame::pushOnEnvironmentChain(SpecificEnvironment& env)
      27             : {
      28        4126 :     MOZ_ASSERT(*environmentChain() == env.enclosingEnvironment());
      29        4126 :     envChain_ = &env;
      30        4126 :     if (IsFrameInitialEnvironment(this, env))
      31        3124 :         flags_ |= HAS_INITIAL_ENV;
      32        4126 : }
      33             : 
      34             : template <typename SpecificEnvironment>
      35             : inline void
      36        1015 : BaselineFrame::popOffEnvironmentChain()
      37             : {
      38        1015 :     MOZ_ASSERT(envChain_->is<SpecificEnvironment>());
      39        1015 :     envChain_ = &envChain_->as<SpecificEnvironment>().enclosingEnvironment();
      40        1015 : }
      41             : 
      42             : inline void
      43         546 : BaselineFrame::replaceInnermostEnvironment(EnvironmentObject& env)
      44             : {
      45         546 :     MOZ_ASSERT(env.enclosingEnvironment() ==
      46             :                envChain_->as<EnvironmentObject>().enclosingEnvironment());
      47         546 :     envChain_ = &env;
      48         546 : }
      49             : 
      50             : inline bool
      51         993 : BaselineFrame::pushLexicalEnvironment(JSContext* cx, Handle<LexicalScope*> scope)
      52             : {
      53         993 :     LexicalEnvironmentObject* env = LexicalEnvironmentObject::create(cx, scope, this);
      54         993 :     if (!env)
      55           0 :         return false;
      56         993 :     pushOnEnvironmentChain(*env);
      57             : 
      58         993 :     return true;
      59             : }
      60             : 
      61             : inline bool
      62           0 : BaselineFrame::freshenLexicalEnvironment(JSContext* cx)
      63             : {
      64           0 :     Rooted<LexicalEnvironmentObject*> current(cx, &envChain_->as<LexicalEnvironmentObject>());
      65           0 :     LexicalEnvironmentObject* clone = LexicalEnvironmentObject::clone(cx, current);
      66           0 :     if (!clone)
      67           0 :         return false;
      68             : 
      69           0 :     replaceInnermostEnvironment(*clone);
      70           0 :     return true;
      71             : }
      72             : 
      73             : inline bool
      74         546 : BaselineFrame::recreateLexicalEnvironment(JSContext* cx)
      75             : {
      76        1092 :     Rooted<LexicalEnvironmentObject*> current(cx, &envChain_->as<LexicalEnvironmentObject>());
      77         546 :     LexicalEnvironmentObject* clone = LexicalEnvironmentObject::recreate(cx, current);
      78         546 :     if (!clone)
      79           0 :         return false;
      80             : 
      81         546 :     replaceInnermostEnvironment(*clone);
      82         546 :     return true;
      83             : }
      84             : 
      85             : inline CallObject&
      86           0 : BaselineFrame::callObj() const
      87             : {
      88           0 :     MOZ_ASSERT(hasInitialEnvironment());
      89           0 :     MOZ_ASSERT(callee()->needsCallObject());
      90             : 
      91           0 :     JSObject* obj = environmentChain();
      92           0 :     while (!obj->is<CallObject>())
      93           0 :         obj = obj->enclosingEnvironment();
      94           0 :     return obj->as<CallObject>();
      95             : }
      96             : 
      97             : inline void
      98           0 : BaselineFrame::unsetIsDebuggee()
      99             : {
     100           0 :     MOZ_ASSERT(!script()->isDebuggee());
     101           0 :     flags_ &= ~DEBUGGEE;
     102           0 : }
     103             : 
     104             : } // namespace jit
     105             : } // namespace js
     106             : 
     107             : #endif /* jit_BaselineFrame_inl_h */

Generated by: LCOV version 1.13