Bug 922406 - Ion-compile global scripts that use 'this'. r=shu

This commit is contained in:
Jan de Mooij 2015-12-01 11:00:22 +01:00
parent ddbd50b2c1
commit 0b2970741e
2 changed files with 18 additions and 0 deletions

View File

@ -1993,6 +1993,9 @@ IonBuilder::inspectOpcode(JSOp op)
case JSOP_FUNCTIONTHIS:
return jsop_functionthis();
case JSOP_GLOBALTHIS:
return jsop_globalthis();
case JSOP_CALLEE: {
MDefinition* callee = getCallee();
current->push(callee);
@ -12920,6 +12923,20 @@ IonBuilder::jsop_functionthis()
return resumeAfter(thisObj);
}
bool
IonBuilder::jsop_globalthis()
{
if (script()->hasNonSyntacticScope()) {
// Ion does not compile global scripts with a non-syntactic scope, but
// we can end up here when we're compiling an arrow function.
return abort("JSOP_GLOBALTHIS in script with non-syntactic scope");
}
ClonedBlockObject* globalLexical = &script()->global().lexicalScope();
pushConstant(globalLexical->thisValue());
return true;
}
bool
IonBuilder::jsop_typeof()
{

View File

@ -720,6 +720,7 @@ class IonBuilder
bool jsop_lambda(JSFunction* fun);
bool jsop_lambda_arrow(JSFunction* fun);
bool jsop_functionthis();
bool jsop_globalthis();
bool jsop_typeof();
bool jsop_toid();
bool jsop_iter(uint8_t flags);