Bug 935228 - Toggle debug traps only in debug mode. (r=jandem)

This commit is contained in:
Shu-yu Guo 2013-11-11 14:18:34 -08:00
parent 42735a9594
commit 27f167ce31
3 changed files with 19 additions and 1 deletions

View File

@ -251,6 +251,9 @@ BaselineCompiler::compile()
bytecodeMap[script->nTypeSets] = 0;
}
if (script->compartment()->debugMode())
baselineScript->setDebugMode();
return Method_Compiled;
}

View File

@ -746,6 +746,10 @@ BaselineScript::toggleDebugTraps(JSScript *script, jsbytecode *pc)
{
JS_ASSERT(script->baselineScript() == this);
// Only scripts compiled for debug mode have toggled calls.
if (!debugMode())
return;
SrcNoteLineScanner scanner(script->notes(), script->lineno);
JSRuntime *rt = script->runtimeFromMainThread();

View File

@ -132,7 +132,11 @@ struct BaselineScript
// Flag set when the script contains any writes to its on-stack
// (rather than call object stored) arguments.
MODIFIES_ARGUMENTS = 1 << 2
MODIFIES_ARGUMENTS = 1 << 2,
// Flag set when compiled for use for debug mode. Handles various
// Debugger hooks and compiles toggled calls for traps.
DEBUG_MODE = 1 << 3
};
private:
@ -201,6 +205,13 @@ struct BaselineScript
return flags_ & MODIFIES_ARGUMENTS;
}
void setDebugMode() {
flags_ |= DEBUG_MODE;
}
bool debugMode() const {
return flags_ & DEBUG_MODE;
}
uint32_t prologueOffset() const {
return prologueOffset_;
}