X87: [runtime] Replace many buggy uses of %_CallFunction with %_Call.
port db2ba190db
(r30634).
original commit message:
The semantics of the %_CallFunction intrinsic seem to be very unclear,
which resulted in a lot of bugs. Especially the combination with
%IsSloppyModeFunction is always a bug, because the receiver would be
wrapped in the wrong context. So the %IsSloppyModeFunction helper is
gone now, and many of the buggy uses of %_CallFunction are also
eliminated.
If you ever need to call something with a different receiver, then
%_Call is your friend now. It does what you want and implements the
call sequence fully (and correct).
Review URL: https://codereview.chromium.org/1336443002
Cr-Commit-Position: refs/heads/master@{#30667}
This commit is contained in:
parent
f852f56cb2
commit
0cfa52d055
@ -3955,6 +3955,26 @@ void FullCodeGenerator::EmitStringAdd(CallRuntime* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FullCodeGenerator::EmitCall(CallRuntime* expr) {
|
||||||
|
ZoneList<Expression*>* args = expr->arguments();
|
||||||
|
DCHECK_LE(2, args->length());
|
||||||
|
// Push target, receiver and arguments onto the stack.
|
||||||
|
for (Expression* const arg : *args) {
|
||||||
|
VisitForStackValue(arg);
|
||||||
|
}
|
||||||
|
// Move target to edi.
|
||||||
|
int const argc = args->length() - 2;
|
||||||
|
__ mov(edi, Operand(esp, (argc + 1) * kPointerSize));
|
||||||
|
// Call the target.
|
||||||
|
__ mov(eax, Immediate(argc));
|
||||||
|
__ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
|
||||||
|
// Restore context register.
|
||||||
|
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
|
||||||
|
// Discard the function left on TOS.
|
||||||
|
context()->DropAndPlug(1, eax);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
|
void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
|
||||||
ZoneList<Expression*>* args = expr->arguments();
|
ZoneList<Expression*>* args = expr->arguments();
|
||||||
DCHECK(args->length() >= 2);
|
DCHECK(args->length() >= 2);
|
||||||
@ -3980,7 +4000,7 @@ void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
|
|||||||
|
|
||||||
__ bind(&runtime);
|
__ bind(&runtime);
|
||||||
__ push(eax);
|
__ push(eax);
|
||||||
__ CallRuntime(Runtime::kCall, args->length());
|
__ CallRuntime(Runtime::kCallFunction, args->length());
|
||||||
__ bind(&done);
|
__ bind(&done);
|
||||||
|
|
||||||
context()->Plug(eax);
|
context()->Plug(eax);
|
||||||
|
@ -198,6 +198,15 @@ void CallConstructDescriptor::InitializePlatformSpecific(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CallTrampolineDescriptor::InitializePlatformSpecific(
|
||||||
|
CallInterfaceDescriptorData* data) {
|
||||||
|
// eax : number of arguments
|
||||||
|
// edi : the target to call
|
||||||
|
Register registers[] = {edi, eax};
|
||||||
|
data->InitializePlatformSpecific(arraysize(registers), registers);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void RegExpConstructResultDescriptor::InitializePlatformSpecific(
|
void RegExpConstructResultDescriptor::InitializePlatformSpecific(
|
||||||
CallInterfaceDescriptorData* data) {
|
CallInterfaceDescriptorData* data) {
|
||||||
Register registers[] = {ecx, ebx, eax};
|
Register registers[] = {ecx, ebx, eax};
|
||||||
|
Loading…
Reference in New Issue
Block a user