author | Jeff Walden <jwalden@mit.edu> |
Thu, 11 Oct 2018 13:54:42 -0700 | |
changeset 502412 | 2792e47984ee1fa13fe2442864cab100a4b425b3 |
parent 502411 | b0c005ef9cee4271fd458298d4f4a0f1d8c81cb3 |
child 502413 | 1737079f61dd46af29ab735da95acf814274caa8 |
push id | 10290 |
push user | ffxbld-merge |
push date | Mon, 03 Dec 2018 16:23:23 +0000 |
treeherder | mozilla-beta@700bed2445e6 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | tcampbell |
bugs | 1498320 |
milestone | 65.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
|
--- a/js/src/frontend/BytecodeCompiler.cpp +++ b/js/src/frontend/BytecodeCompiler.cpp @@ -46,25 +46,25 @@ class MOZ_STACK_CLASS BytecodeCompiler // Construct an object passing mandatory arguments. BytecodeCompiler(JSContext* cx, const ReadOnlyCompileOptions& options, SourceBufferHolder& sourceBuffer, HandleScope enclosingScope); // Call this before calling compile{Global,Eval}Script. MOZ_MUST_USE bool prepareScriptParse() { - return createSourceAndParser(ParseGoal::Script) && createScript(); + return createSourceAndParser(ParseGoal::Script) && createCompleteScript(); } JSScript* compileGlobalScript(ScopeKind scopeKind); JSScript* compileEvalScript(HandleObject environment, HandleScope enclosingScope); // Call this before calling compileModule. MOZ_MUST_USE bool prepareModuleParse() { - return createSourceAndParser(ParseGoal::Module) && createScript(); + return createSourceAndParser(ParseGoal::Module) && createCompleteScript(); } ModuleObject* compileModule(); // Call this before calling compileStandaloneFunction. MOZ_MUST_USE bool prepareStandaloneFunctionParse(const Maybe<uint32_t>& parameterListEnd) { return createSourceAndParser(ParseGoal::Script, parameterListEnd); } @@ -91,20 +91,23 @@ class MOZ_STACK_CLASS BytecodeCompiler JSScript* compileScript(HandleObject environment, SharedContext* sc); bool checkLength(); bool createScriptSource(const Maybe<uint32_t>& parameterListEnd); bool canLazilyParse(); bool createParser(ParseGoal goal); bool createSourceAndParser(ParseGoal goal, const Maybe<uint32_t>& parameterListEnd = Nothing()); - // If toString{Start,End} are not explicitly passed, assume the script's - // offsets in the source used to parse it are the same as what should be - // used to compute its Function.prototype.toString() value. - bool createScript(); + // This assumes the created script's offsets in the source used to parse it + // are the same as are used to compute its Function.prototype.toString() + // value. + bool createCompleteScript(); + + // This uses explicitly-provided toString offsets as the created script's + // 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); @@ -278,17 +281,17 @@ bool BytecodeCompiler::createSourceAndParser(ParseGoal goal, const Maybe<uint32_t>& parameterListEnd /* = Nothing() */) { return createScriptSource(parameterListEnd) && createParser(goal); } bool -BytecodeCompiler::createScript() +BytecodeCompiler::createCompleteScript() { return createScript(0, sourceBuffer.length()); } bool BytecodeCompiler::createScript(uint32_t toStringStart, uint32_t toStringEnd) { script = JSScript::Create(cx, options,