Bug 1224810 - "TraceLogger: Add the script information for the event created by BytecodeCompiler". r=hv1989

This commit is contained in:
Wei Wu 2015-11-14 03:43:00 +01:00
parent 9c2c4014db
commit 891c703c0f

View File

@ -31,7 +31,8 @@ using mozilla::Maybe;
class MOZ_STACK_CLASS AutoCompilationTraceLogger
{
public:
AutoCompilationTraceLogger(ExclusiveContext* cx, const TraceLoggerTextId id);
AutoCompilationTraceLogger(ExclusiveContext* cx, const TraceLoggerTextId id,
const ReadOnlyCompileOptions& options);
private:
TraceLoggerThread* logger;
@ -117,10 +118,11 @@ class MOZ_STACK_CLASS BytecodeCompiler
Maybe<BytecodeEmitter> emitter;
};
AutoCompilationTraceLogger::AutoCompilationTraceLogger(ExclusiveContext* cx, const TraceLoggerTextId id)
AutoCompilationTraceLogger::AutoCompilationTraceLogger(ExclusiveContext* cx,
const TraceLoggerTextId id, const ReadOnlyCompileOptions& options)
: logger(cx->isJSContext() ? TraceLoggerForMainThread(cx->asJSContext()->runtime())
: TraceLoggerForCurrentThread()),
event(logger, TraceLogger_AnnotateScripts),
event(logger, TraceLogger_AnnotateScripts, options),
scriptLogger(logger, event),
typeLogger(logger, id)
{}
@ -131,7 +133,7 @@ BytecodeCompiler::BytecodeCompiler(ExclusiveContext* cx,
SourceBufferHolder& sourceBuffer,
Handle<ScopeObject*> enclosingStaticScope,
TraceLoggerTextId logId)
: traceLogger(cx, logId),
: traceLogger(cx, logId, options),
keepAtoms(cx->perThreadData),
cx(cx),
alloc(alloc),
@ -781,7 +783,7 @@ frontend::CompileLazyFunction(JSContext* cx, Handle<LazyScript*> lazy, const cha
.setNoScriptRval(false)
.setSelfHostingMode(false);
AutoCompilationTraceLogger traceLogger(cx, TraceLogger_ParserCompileLazy);
AutoCompilationTraceLogger traceLogger(cx, TraceLogger_ParserCompileLazy, options);
Parser<FullParseHandler> parser(cx, &cx->tempLifoAlloc(), options, chars, length,
/* foldConstants = */ true, nullptr, lazy);