Bug 1394490 - Avoid Ion compile for non-syntactic JSOP_FUNCTIONTHIS
Ion does not support non-synactic global environments so don't compile
if JSOP_FUNCTIONTHIS needs non-strict non-syntactic fallback.
MozReview-Commit-ID: BiDAeQljjJx
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -12443,18 +12443,24 @@ IonBuilder::jsop_functionthis()
// Hard case: |this| may be a primitive we have to wrap.
MDefinition* def = current->getSlot(info().thisSlot());
if (def->type() == MIRType::Object) {
current->push(def);
return Ok();
}
+ // Beyond this point we may need to access non-syntactic global. Ion doesn't
+ // currently support this so just abort.
+ if (script()->hasNonSyntacticScope())
+ return abort(AbortReason::Disable, "JSOP_FUNCTIONTHIS would need non-syntactic global");
+
if (IsNullOrUndefined(def->type())) {
- pushConstant(GetThisValue(&script()->global()));
+ LexicalEnvironmentObject* globalLexical = &script()->global().lexicalEnvironment();
+ pushConstant(globalLexical->thisValue());
return Ok();
}
MComputeThis* thisObj = MComputeThis::New(alloc(), def);
current->add(thisObj);
current->push(thisObj);
return resumeAfter(thisObj);