mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 889599, part 2 - Remove unnecessary FunctionBox out-parameter from Parser::standaloneFunctionBody. r=Waldo.
This commit is contained in:
parent
22ea8dbac9
commit
a68f8013b5
@ -472,11 +472,9 @@ frontend::CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, CompileO
|
|||||||
parser.tokenStream.tell(&start);
|
parser.tokenStream.tell(&start);
|
||||||
bool strict = options.strictOption;
|
bool strict = options.strictOption;
|
||||||
bool becameStrict;
|
bool becameStrict;
|
||||||
FunctionBox *funbox;
|
|
||||||
ParseNode *pn;
|
ParseNode *pn;
|
||||||
while (true) {
|
while (true) {
|
||||||
pn = parser.standaloneFunctionBody(fun, formals, script, fn, &funbox,
|
pn = parser.standaloneFunctionBody(fun, formals, script, fn, strict, &becameStrict);
|
||||||
strict, &becameStrict);
|
|
||||||
if (pn)
|
if (pn)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -498,12 +496,10 @@ frontend::CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, CompileO
|
|||||||
if (!NameFunctions(cx, pn))
|
if (!NameFunctions(cx, pn))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (fn->pn_body) {
|
JS_ASSERT(fn->pn_body == argsbody);
|
||||||
JS_ASSERT(fn->pn_body->isKind(PNK_ARGSBODY));
|
JS_ASSERT(fn->pn_body->isKind(PNK_ARGSBODY));
|
||||||
fn->pn_body->append(pn);
|
fn->pn_body->append(pn);
|
||||||
fn->pn_body->pn_pos = pn->pn_pos;
|
fn->pn_body->pn_pos = pn->pn_pos;
|
||||||
pn = fn->pn_body;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool generateBytecode = true;
|
bool generateBytecode = true;
|
||||||
#ifdef JS_ION
|
#ifdef JS_ION
|
||||||
@ -516,7 +512,7 @@ frontend::CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, CompileO
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (moduleFun) {
|
if (moduleFun) {
|
||||||
funbox->object = moduleFun;
|
fn->pn_funbox->object = moduleFun;
|
||||||
fun.set(moduleFun); // replace the existing function with the LinkAsmJS native
|
fun.set(moduleFun); // replace the existing function with the LinkAsmJS native
|
||||||
generateBytecode = false;
|
generateBytecode = false;
|
||||||
}
|
}
|
||||||
@ -531,14 +527,14 @@ frontend::CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, CompileO
|
|||||||
* NULL environment. This compiled function is never used, but instead
|
* NULL environment. This compiled function is never used, but instead
|
||||||
* is cloned immediately onto the right scope chain.
|
* is cloned immediately onto the right scope chain.
|
||||||
*/
|
*/
|
||||||
BytecodeEmitter funbce(/* parent = */ NULL, &parser, funbox, script,
|
BytecodeEmitter funbce(/* parent = */ NULL, &parser, fn->pn_funbox, script,
|
||||||
/* insideEval = */ false, /* evalCaller = */ NullPtr(),
|
/* insideEval = */ false, /* evalCaller = */ NullPtr(),
|
||||||
fun->environment() && fun->environment()->is<GlobalObject>(),
|
fun->environment() && fun->environment()->is<GlobalObject>(),
|
||||||
options.lineno);
|
options.lineno);
|
||||||
if (!funbce.init())
|
if (!funbce.init())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!EmitFunctionScript(cx, &funbce, pn))
|
if (!EmitFunctionScript(cx, &funbce, fn->pn_body))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -836,18 +836,18 @@ Parser<ParseHandler>::checkStrictBinding(HandlePropertyName name, Node pn)
|
|||||||
template <>
|
template <>
|
||||||
ParseNode *
|
ParseNode *
|
||||||
Parser<FullParseHandler>::standaloneFunctionBody(HandleFunction fun, const AutoNameVector &formals,
|
Parser<FullParseHandler>::standaloneFunctionBody(HandleFunction fun, const AutoNameVector &formals,
|
||||||
HandleScript script, Node fn, FunctionBox **funbox,
|
HandleScript script, Node fn,
|
||||||
bool strict, bool *becameStrict)
|
bool strict, bool *becameStrict)
|
||||||
{
|
{
|
||||||
if (becameStrict)
|
if (becameStrict)
|
||||||
*becameStrict = false;
|
*becameStrict = false;
|
||||||
|
|
||||||
*funbox = newFunctionBox(fun, /* outerpc = */ NULL, strict);
|
FunctionBox *funbox = newFunctionBox(fun, /* outerpc = */ NULL, strict);
|
||||||
if (!funbox)
|
if (!funbox)
|
||||||
return null();
|
return null();
|
||||||
handler.setFunctionBox(fn, *funbox);
|
handler.setFunctionBox(fn, funbox);
|
||||||
|
|
||||||
ParseContext<FullParseHandler> funpc(this, pc, *funbox, /* staticLevel = */ 0, /* bodyid = */ 0);
|
ParseContext<FullParseHandler> funpc(this, pc, funbox, /* staticLevel = */ 0, /* bodyid = */ 0);
|
||||||
if (!funpc.init())
|
if (!funpc.init())
|
||||||
return null();
|
return null();
|
||||||
|
|
||||||
@ -878,7 +878,7 @@ Parser<FullParseHandler>::standaloneFunctionBody(HandleFunction fun, const AutoN
|
|||||||
// Also populate the internal bindings of the function box, so that
|
// Also populate the internal bindings of the function box, so that
|
||||||
// heavyweight tests while emitting bytecode work.
|
// heavyweight tests while emitting bytecode work.
|
||||||
InternalHandle<Bindings*> funboxBindings =
|
InternalHandle<Bindings*> funboxBindings =
|
||||||
InternalHandle<Bindings*>::fromMarkedLocation(&(*funbox)->bindings);
|
InternalHandle<Bindings*>::fromMarkedLocation(&funbox->bindings);
|
||||||
if (!funpc.generateFunctionBindings(context, alloc, funboxBindings))
|
if (!funpc.generateFunctionBindings(context, alloc, funboxBindings))
|
||||||
return null();
|
return null();
|
||||||
|
|
||||||
|
@ -402,8 +402,8 @@ class Parser : private AutoGCRooter, public StrictModeGetter
|
|||||||
bool maybeParseDirective(Node pn, bool *cont);
|
bool maybeParseDirective(Node pn, bool *cont);
|
||||||
|
|
||||||
// Parse a function, given only its body. Used for the Function constructor.
|
// Parse a function, given only its body. Used for the Function constructor.
|
||||||
Node standaloneFunctionBody(HandleFunction fun, const AutoNameVector &formals, HandleScript script,
|
Node standaloneFunctionBody(HandleFunction fun, const AutoNameVector &formals,
|
||||||
Node fn, FunctionBox **funbox, bool strict,
|
HandleScript script, Node fn, bool strict,
|
||||||
bool *becameStrict = NULL);
|
bool *becameStrict = NULL);
|
||||||
|
|
||||||
// Parse a function, given only its arguments and body. Used for lazily
|
// Parse a function, given only its arguments and body. Used for lazily
|
||||||
|
Loading…
Reference in New Issue
Block a user