Bug 835277 part 2 - Fix hasBreakpointsAt. r=bhackett

This commit is contained in:
Jan de Mooij 2013-01-31 11:50:01 +01:00
parent ee7cb3966e
commit c199d8e4e6
3 changed files with 16 additions and 5 deletions

View File

@ -2575,6 +2575,16 @@ JSScript::clearBreakpointsIn(FreeOp *fop, js::Debugger *dbg, RawObject handler)
}
}
bool
JSScript::hasBreakpointsAt(jsbytecode *pc)
{
BreakpointSite *site = getBreakpointSite(pc);
if (!site)
return false;
return site->enabledCount > 0 || site->trapHandler;
}
void
JSScript::clearTraps(FreeOp *fop)
{

View File

@ -881,7 +881,7 @@ class JSScript : public js::gc::Cell
void destroyDebugScript(js::FreeOp *fop);
public:
bool hasBreakpointsAt(jsbytecode *pc) { return !!getBreakpointSite(pc); }
bool hasBreakpointsAt(jsbytecode *pc);
bool hasAnyBreakpointsOrStepMode() { return hasDebugScript; }
js::BreakpointSite *getBreakpointSite(jsbytecode *pc)

View File

@ -249,9 +249,9 @@ BreakpointSite::recompile(FreeOp *fop)
void
BreakpointSite::inc(FreeOp *fop)
{
if (enabledCount == 0 && !trapHandler)
recompile(fop);
enabledCount++;
if (enabledCount == 1 && !trapHandler)
recompile(fop);
}
void
@ -266,10 +266,11 @@ BreakpointSite::dec(FreeOp *fop)
void
BreakpointSite::setTrap(FreeOp *fop, JSTrapHandler handler, const Value &closure)
{
if (enabledCount == 0)
recompile(fop);
trapHandler = handler;
trapClosure = closure;
if (enabledCount == 0)
recompile(fop);
}
void