Bug 1498320 - Move BytecodeCompiler's members to the top of the class definition. r=tcampbell
authorJeff Walden <jwalden@mit.edu>
Thu, 01 Nov 2018 17:34:54 -0700
changeset 502414 49b72ccc968279c7264d47b8e9b609c25ece0650
parent 502413 1737079f61dd46af29ab735da95acf814274caa8
child 502415 0db3c534950cc51af7e106971113ff718170d352
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1498320
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1498320 - Move BytecodeCompiler's members to the top of the class definition. r=tcampbell
js/src/frontend/BytecodeCompiler.cpp
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -37,16 +37,36 @@ using mozilla::Nothing;
 using JS::CompileOptions;
 using JS::ReadOnlyCompileOptions;
 using JS::SourceBufferHolder;
 
 // The BytecodeCompiler class contains resources common to compiling scripts and
 // function bodies.
 class MOZ_STACK_CLASS BytecodeCompiler
 {
+  protected:
+    AutoKeepAtoms keepAtoms;
+
+    JSContext* cx;
+    const ReadOnlyCompileOptions& options;
+    SourceBufferHolder& sourceBuffer;
+
+    RootedScope enclosingScope;
+
+    RootedScriptSourceObject sourceObject;
+    ScriptSource* scriptSource;
+
+    Maybe<UsedNameTracker> usedNames;
+    Maybe<Parser<SyntaxParseHandler, char16_t>> syntaxParser;
+    Maybe<Parser<FullParseHandler, char16_t>> parser;
+
+    Directives directives;
+
+    RootedScript script;
+
   public:
     // Construct an object passing mandatory arguments.
     BytecodeCompiler(JSContext* cx,
                      const ReadOnlyCompileOptions& options,
                      SourceBufferHolder& sourceBuffer,
                      HandleScope enclosingScope);
 
     // Call this before calling compile{Global,Eval}Script.
@@ -108,35 +128,16 @@ class MOZ_STACK_CLASS BytecodeCompiler
     // offsets in the source.
     bool createScript(uint32_t toStringStart, uint32_t toStringEnd);
 
     using TokenStreamPosition = frontend::TokenStreamPosition<char16_t>;
 
     bool emplaceEmitter(Maybe<BytecodeEmitter>& emitter, SharedContext* sharedContext);
     bool handleParseFailure(const Directives& newDirectives, TokenStreamPosition& startPosition);
     bool deoptimizeArgumentsInEnclosingScripts(JSContext* cx, HandleObject environment);
-
-    AutoKeepAtoms keepAtoms;
-
-    JSContext* cx;
-    const ReadOnlyCompileOptions& options;
-    SourceBufferHolder& sourceBuffer;
-
-    RootedScope enclosingScope;
-
-    RootedScriptSourceObject sourceObject;
-    ScriptSource* scriptSource;
-
-    Maybe<UsedNameTracker> usedNames;
-    Maybe<Parser<SyntaxParseHandler, char16_t>> syntaxParser;
-    Maybe<Parser<FullParseHandler, char16_t>> parser;
-
-    Directives directives;
-
-    RootedScript script;
 };
 
 AutoFrontendTraceLog::AutoFrontendTraceLog(JSContext* cx, const TraceLoggerTextId id,
                                            const ErrorReporter& errorReporter)
 #ifdef JS_TRACE_LOGGING
   : logger_(TraceLoggerForCurrentThread(cx))
 {
     // If the tokenizer hasn't yet gotten any tokens, use the line and column