Bug 1478393 - Add AutoGeckoProfilerEntry to parsing of script in BytecodeCompiler::compileScript r?sfink
MozReview-Commit-ID: 6voFaKmvZ39
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -20,16 +20,17 @@
#include "frontend/Parser.h"
#include "vm/GlobalObject.h"
#include "vm/JSContext.h"
#include "vm/JSScript.h"
#include "vm/TraceLogging.h"
#include "wasm/AsmJS.h"
#include "vm/EnvironmentObject-inl.h"
+#include "vm/GeckoProfiler-inl.h"
#include "vm/JSObject-inl.h"
#include "vm/JSScript-inl.h"
using namespace js;
using namespace js::frontend;
using mozilla::Maybe;
using mozilla::Nothing;
@@ -325,20 +326,23 @@ BytecodeCompiler::compileScript(HandleOb
return nullptr;
Maybe<BytecodeEmitter> emitter;
if (!emplaceEmitter(emitter, sc))
return nullptr;
for (;;) {
ParseNode* pn;
- if (sc->isEvalContext())
- pn = parser->evalBody(sc->asEvalContext());
- else
- pn = parser->globalBody(sc->asGlobalContext());
+ {
+ AutoGeckoProfilerEntry pseudoFrame(cx, "script parsing");
+ if (sc->isEvalContext())
+ pn = parser->evalBody(sc->asEvalContext());
+ else
+ pn = parser->globalBody(sc->asGlobalContext());
+ }
// Successfully parsed. Emit the script.
if (pn) {
if (sc->isEvalContext() && sc->hasDebuggerStatement() && !cx->helperThread()) {
// If the eval'ed script contains any debugger statement, force construction
// of arguments objects for the caller script and any other scripts it is
// transitively nested inside. The debugger can access any variable on the
// scope chain.