Bug 1478393 - Add AutoGeckoProfilerEntry to parsing of script in BytecodeCompiler::compileScript r?sfink draft
authorNazım Can Altınova <canaltinova@gmail.com>
Wed, 25 Jul 2018 17:19:00 +0200
changeset 825282 e34b2418bd7994909378ad78c9ffbaa679c565b8
parent 819019 f6df6a982ee9510ca32dd3afa52dfe9f8c3586a3
child 825283 2a0ff7a2e1784564b9a4b919c8e02b3c4fe37359
push id118059
push userbmo:canaltinova@gmail.com
push dateWed, 01 Aug 2018 09:55:21 +0000
reviewerssfink
bugs1478393
milestone63.0a1
Bug 1478393 - Add AutoGeckoProfilerEntry to parsing of script in BytecodeCompiler::compileScript r?sfink MozReview-Commit-ID: 6voFaKmvZ39
js/src/frontend/BytecodeCompiler.cpp
--- 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.