LCOV - code coverage report
Current view: top level - js/src/vm - Debugger-inl.h (source / functions) Hit Total Coverage
Test: output.info Lines: 19 52 36.5 %
Date: 2017-07-14 16:53:18 Functions: 4 12 33.3 %
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 vm_Debugger_inl_h
       8             : #define vm_Debugger_inl_h
       9             : 
      10             : #include "vm/Debugger.h"
      11             : 
      12             : #include "vm/Stack-inl.h"
      13             : 
      14             : /* static */ inline bool
      15       12315 : js::Debugger::onLeaveFrame(JSContext* cx, AbstractFramePtr frame, jsbytecode* pc, bool ok)
      16             : {
      17       12315 :     MOZ_ASSERT_IF(frame.isInterpreterFrame(), frame.asInterpreterFrame() == cx->interpreterFrame());
      18       12315 :     MOZ_ASSERT_IF(frame.hasScript() && frame.script()->isDebuggee(), frame.isDebuggee());
      19             :     /* Traps must be cleared from eval frames, see slowPathOnLeaveFrame. */
      20       24632 :     mozilla::DebugOnly<bool> evalTraps = frame.isEvalFrame() &&
      21       24632 :                                          frame.script()->hasAnyBreakpointsOrStepMode();
      22       12315 :     MOZ_ASSERT_IF(evalTraps, frame.isDebuggee());
      23       12315 :     if (frame.isDebuggee())
      24           0 :         ok = slowPathOnLeaveFrame(cx, frame, pc, ok);
      25       12315 :     MOZ_ASSERT(!inFrameMaps(frame));
      26       24630 :     return ok;
      27             : }
      28             : 
      29             : /* static */ inline js::Debugger*
      30           0 : js::Debugger::fromJSObject(const JSObject* obj)
      31             : {
      32           0 :     MOZ_ASSERT(js::GetObjectClass(obj) == &class_);
      33           0 :     return (Debugger*) obj->as<NativeObject>().getPrivate();
      34             : }
      35             : 
      36             : /* static */ inline bool
      37       17387 : js::Debugger::checkNoExecute(JSContext* cx, HandleScript script)
      38             : {
      39       17387 :     if (!cx->compartment()->isDebuggee() || !cx->noExecuteDebuggerTop)
      40       17387 :         return true;
      41           0 :     return slowPathCheckNoExecute(cx, script);
      42             : }
      43             : 
      44             : /* static */ JSTrapStatus
      45       12101 : js::Debugger::onEnterFrame(JSContext* cx, AbstractFramePtr frame)
      46             : {
      47       12101 :     MOZ_ASSERT_IF(frame.hasScript() && frame.script()->isDebuggee(), frame.isDebuggee());
      48       12101 :     if (!frame.isDebuggee())
      49       12101 :         return JSTRAP_CONTINUE;
      50           0 :     return slowPathOnEnterFrame(cx, frame);
      51             : }
      52             : 
      53             : /* static */ JSTrapStatus
      54           0 : js::Debugger::onDebuggerStatement(JSContext* cx, AbstractFramePtr frame)
      55             : {
      56           0 :     if (!cx->compartment()->isDebuggee())
      57           0 :         return JSTRAP_CONTINUE;
      58           0 :     return slowPathOnDebuggerStatement(cx, frame);
      59             : }
      60             : 
      61             : /* static */ JSTrapStatus
      62        2071 : js::Debugger::onExceptionUnwind(JSContext* cx, AbstractFramePtr frame)
      63             : {
      64        2071 :     if (!cx->compartment()->isDebuggee())
      65        2071 :         return JSTRAP_CONTINUE;
      66           0 :     return slowPathOnExceptionUnwind(cx, frame);
      67             : }
      68             : 
      69             : /* static */ void
      70           0 : js::Debugger::onNewWasmInstance(JSContext* cx, Handle<WasmInstanceObject*> wasmInstance)
      71             : {
      72           0 :     if (cx->compartment()->isDebuggee())
      73           0 :         slowPathOnNewWasmInstance(cx, wasmInstance);
      74           0 : }
      75             : 
      76             : inline bool
      77           0 : js::Debugger::getScriptFrame(JSContext* cx, const FrameIter& iter,
      78             :                              MutableHandle<DebuggerFrame*> result)
      79             : {
      80           0 :     return getScriptFrameWithIter(cx, iter.abstractFramePtr(), &iter, result);
      81             : }
      82             : 
      83             : inline js::Debugger*
      84           0 : js::DebuggerEnvironment::owner() const
      85             : {
      86           0 :     JSObject* dbgobj = &getReservedSlot(OWNER_SLOT).toObject();
      87           0 :     return Debugger::fromJSObject(dbgobj);
      88             : }
      89             : 
      90             : inline js::Debugger*
      91           0 : js::DebuggerFrame::owner() const
      92             : {
      93           0 :     JSObject* dbgobj = &getReservedSlot(OWNER_SLOT).toObject();
      94           0 :     return Debugger::fromJSObject(dbgobj);
      95             : }
      96             : 
      97             : inline js::Debugger*
      98           0 : js::DebuggerObject::owner() const
      99             : {
     100           0 :     JSObject* dbgobj = &getReservedSlot(OWNER_SLOT).toObject();
     101           0 :     return Debugger::fromJSObject(dbgobj);
     102             : }
     103             : 
     104             : inline js::PromiseObject*
     105           0 : js::DebuggerObject::promise() const
     106             : {
     107           0 :     MOZ_ASSERT(isPromise());
     108             : 
     109           0 :     JSObject* referent = this->referent();
     110           0 :     if (IsCrossCompartmentWrapper(referent)) {
     111           0 :         referent = CheckedUnwrap(referent);
     112           0 :         MOZ_ASSERT(referent);
     113             :     }
     114             : 
     115           0 :     return &referent->as<PromiseObject>();
     116             : }
     117             : 
     118             : #endif /* vm_Debugger_inl_h */

Generated by: LCOV version 1.13