mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1302417: TraceLogging - Don't run the debug check when the item is an error, r=bbouvier
This commit is contained in:
parent
e9fb49f8f5
commit
9b0e31e532
@ -1396,6 +1396,16 @@ OOMTest(JSContext* cx, unsigned argc, Value* vp)
|
||||
cx->clearPendingException();
|
||||
cx->runtime()->hadOutOfMemory = false;
|
||||
|
||||
#ifdef JS_TRACE_LOGGING
|
||||
// Reset the TraceLogger state if enabled.
|
||||
TraceLoggerThread* logger = TraceLoggerForMainThread(cx->runtime());
|
||||
if (logger->enabled()) {
|
||||
while (logger->enabled())
|
||||
logger->disable();
|
||||
logger->enable(cx);
|
||||
}
|
||||
#endif
|
||||
|
||||
allocation++;
|
||||
} while (handledOOM);
|
||||
|
||||
|
20
js/src/jit-test/tests/tracelogger/bug1302417.js
Normal file
20
js/src/jit-test/tests/tracelogger/bug1302417.js
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
if (!('oomTest' in this))
|
||||
quit();
|
||||
|
||||
if (typeof new Debugger().setupTraceLoggerScriptCalls == "function") {
|
||||
lfLogBuffer = `
|
||||
var du = new Debugger;
|
||||
du.setupTraceLoggerScriptCalls();
|
||||
startTraceLogger();
|
||||
`;
|
||||
loadFile(lfLogBuffer);
|
||||
function loadFile(lfVarx) {
|
||||
oomTest(function() {
|
||||
m = parseModule(lfVarx);
|
||||
m.declarationInstantiation();
|
||||
m.evaluation();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -254,8 +254,10 @@ TraceLoggerThread::enable(JSContext* cx)
|
||||
bool
|
||||
TraceLoggerThread::disable(bool force, const char* error)
|
||||
{
|
||||
if (failed)
|
||||
if (failed) {
|
||||
MOZ_ASSERT(enabled_ == 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (enabled_ == 0)
|
||||
return true;
|
||||
@ -535,7 +537,10 @@ TraceLoggerThread::stopEvent(uint32_t id)
|
||||
#ifdef DEBUG
|
||||
if (enabled_ > 0 && !graphStack.empty()) {
|
||||
uint32_t prev = graphStack.popCopy();
|
||||
if (id == TraceLogger_Engine) {
|
||||
if (id == TraceLogger_Error || prev == TraceLogger_Error) {
|
||||
// When encountering an Error id the stack will most likely not be correct anymore.
|
||||
// Ignore this.
|
||||
} else if (id == TraceLogger_Engine) {
|
||||
MOZ_ASSERT(prev == TraceLogger_IonMonkey || prev == TraceLogger_Baseline ||
|
||||
prev == TraceLogger_Interpreter);
|
||||
} else if (id == TraceLogger_Scripts) {
|
||||
@ -571,6 +576,11 @@ TraceLoggerThread::log(uint32_t id)
|
||||
if (enabled_ == 0)
|
||||
return;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (id == TraceLogger_Disable)
|
||||
graphStack.clear();
|
||||
#endif
|
||||
|
||||
MOZ_ASSERT(traceLoggerState);
|
||||
|
||||
// We request for 3 items to add, since if we don't have enough room
|
||||
|
Loading…
Reference in New Issue
Block a user