Bug 879831, part 6 - Factor out Debugger inlines that depend on other "inlines" headers into vm/Debugger-inl.h. r=njn.

This commit is contained in:
Jason Orendorff 2013-06-06 22:49:03 -05:00
parent c393ee65b1
commit f5d88b2b33
4 changed files with 39 additions and 24 deletions

View File

@ -38,6 +38,7 @@
#include "jsobjinlines.h"
#include "jsscriptinlines.h"
#include "vm/Debugger-inl.h"
#include "vm/Interpreter-inl.h"
#include "vm/Stack-inl.h"

25
js/src/vm/Debugger-inl.h Normal file
View File

@ -0,0 +1,25 @@
/* -*- 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 Debugger_inl_h__
#define Debugger_inl_h__
#include "vm/Debugger.h"
#include "vm/Stack-inl.h"
bool
js::Debugger::onLeaveFrame(JSContext *cx, AbstractFramePtr frame, bool ok)
{
/* Traps must be cleared from eval frames, see slowPathOnLeaveFrame. */
bool evalTraps = frame.isEvalFrame() &&
frame.script()->hasAnyBreakpointsOrStepMode();
if (!cx->compartment->getDebuggees().empty() || evalTraps)
ok = slowPathOnLeaveFrame(cx, frame, ok);
return ok;
}
#endif // Debugger_inl_h__

View File

@ -405,6 +405,13 @@ Debugger::init(JSContext *cx)
return ok;
}
Debugger *
Debugger::fromJSObject(JSObject *obj)
{
JS_ASSERT(js::GetObjectClass(obj) == &jsclass);
return (Debugger *) obj->getPrivate();
}
JS_STATIC_ASSERT(unsigned(JSSLOT_DEBUGFRAME_OWNER) == unsigned(JSSLOT_DEBUGSCRIPT_OWNER));
JS_STATIC_ASSERT(unsigned(JSSLOT_DEBUGFRAME_OWNER) == unsigned(JSSLOT_DEBUGSOURCE_OWNER));
JS_STATIC_ASSERT(unsigned(JSSLOT_DEBUGFRAME_OWNER) == unsigned(JSSLOT_DEBUGOBJECT_OWNER));
@ -3362,6 +3369,12 @@ DebuggerScript_getLineOffsets(JSContext *cx, unsigned argc, Value *vp)
return true;
}
bool
Debugger::observesFrame(AbstractFramePtr frame) const
{
return observesGlobal(&frame.script()->global());
}
bool
Debugger::observesScript(JSScript *script) const
{

View File

@ -628,13 +628,6 @@ Debugger::toJSObjectRef()
return object;
}
Debugger *
Debugger::fromJSObject(JSObject *obj)
{
JS_ASSERT(js::GetObjectClass(obj) == &jsclass);
return (Debugger *) obj->getPrivate();
}
bool
Debugger::observesEnterFrame() const
{
@ -659,12 +652,6 @@ Debugger::observesGlobal(GlobalObject *global) const
return debuggees.has(global);
}
bool
Debugger::observesFrame(AbstractFramePtr frame) const
{
return observesGlobal(&frame.script()->global());
}
JSTrapStatus
Debugger::onEnterFrame(JSContext *cx, AbstractFramePtr frame, MutableHandleValue vp)
{
@ -673,17 +660,6 @@ Debugger::onEnterFrame(JSContext *cx, AbstractFramePtr frame, MutableHandleValue
return slowPathOnEnterFrame(cx, frame, vp);
}
bool
Debugger::onLeaveFrame(JSContext *cx, AbstractFramePtr frame, bool ok)
{
/* Traps must be cleared from eval frames, see slowPathOnLeaveFrame. */
bool evalTraps = frame.isEvalFrame() &&
frame.script()->hasAnyBreakpointsOrStepMode();
if (!cx->compartment->getDebuggees().empty() || evalTraps)
ok = slowPathOnLeaveFrame(cx, frame, ok);
return ok;
}
JSTrapStatus
Debugger::onDebuggerStatement(JSContext *cx, MutableHandleValue vp)
{