зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1661530: Attach FunApply and FunCall before scripted calls r=jandem
Despite looking directly at this code while adding the assertion in bug 1660553, I somehow missed that scripted calls were being attached too early. It's not a problem for Ion, because we only inline `FunCall`/`FunApply` if we're calling the jsnative, but it matters for Warp. Differential Revision: https://phabricator.services.mozilla.com/D88463
This commit is contained in:
Родитель
b5b7c7cac5
Коммит
91d7a5c7cc
|
@ -0,0 +1,7 @@
|
|||
Function.prototype.call = function() {};
|
||||
var sum = 0;
|
||||
function foo() { sum++; }
|
||||
for (var i = 0; i < 1000; i++) {
|
||||
foo.call({}, 0);
|
||||
}
|
||||
assertEq(sum, 0);
|
|
@ -7632,8 +7632,7 @@ AttachDecision CallIRGenerator::tryAttachObjectIs(HandleFunction callee) {
|
|||
}
|
||||
|
||||
AttachDecision CallIRGenerator::tryAttachFunCall(HandleFunction callee) {
|
||||
MOZ_ASSERT(callee->isNativeWithoutJitEntry());
|
||||
if (callee->native() != fun_call) {
|
||||
if (!callee->isNativeWithoutJitEntry() || callee->native() != fun_call) {
|
||||
return AttachDecision::NoAction;
|
||||
}
|
||||
|
||||
|
@ -8312,8 +8311,8 @@ AttachDecision CallIRGenerator::tryAttachTypedArrayConstructor(
|
|||
}
|
||||
|
||||
AttachDecision CallIRGenerator::tryAttachFunApply(HandleFunction calleeFunc) {
|
||||
MOZ_ASSERT(calleeFunc->isNativeWithoutJitEntry());
|
||||
if (calleeFunc->native() != fun_apply) {
|
||||
if (!calleeFunc->isNativeWithoutJitEntry() ||
|
||||
calleeFunc->native() != fun_apply) {
|
||||
return AttachDecision::NoAction;
|
||||
}
|
||||
|
||||
|
@ -9126,7 +9125,7 @@ AttachDecision CallIRGenerator::tryAttachCallNative(HandleFunction calleeFunc) {
|
|||
}
|
||||
|
||||
AttachDecision CallIRGenerator::tryAttachCallHook(HandleObject calleeObj) {
|
||||
if (op_ == JSOp::FunApply) {
|
||||
if (op_ == JSOp::FunCall || op_ == JSOp::FunApply) {
|
||||
return AttachDecision::NoAction;
|
||||
}
|
||||
|
||||
|
@ -9205,6 +9204,13 @@ AttachDecision CallIRGenerator::tryAttachStub() {
|
|||
|
||||
HandleFunction calleeFunc = calleeObj.as<JSFunction>();
|
||||
|
||||
if (op_ == JSOp::FunCall) {
|
||||
return tryAttachFunCall(calleeFunc);
|
||||
}
|
||||
if (op_ == JSOp::FunApply) {
|
||||
return tryAttachFunApply(calleeFunc);
|
||||
}
|
||||
|
||||
// Check for scripted optimizations.
|
||||
if (calleeFunc->hasJitEntry()) {
|
||||
return tryAttachCallScripted(calleeFunc);
|
||||
|
@ -9213,12 +9219,6 @@ AttachDecision CallIRGenerator::tryAttachStub() {
|
|||
// Check for native-function optimizations.
|
||||
MOZ_ASSERT(calleeFunc->isNativeWithoutJitEntry());
|
||||
|
||||
if (op_ == JSOp::FunCall) {
|
||||
return tryAttachFunCall(calleeFunc);
|
||||
}
|
||||
if (op_ == JSOp::FunApply) {
|
||||
return tryAttachFunApply(calleeFunc);
|
||||
}
|
||||
return tryAttachCallNative(calleeFunc);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче