[ia32, root] Port FunctionPrototypeCall

This CL is part of the effort to remove the usage of 'ebx' as it will
be the kRootRegister on ia32.

R=jgruber@chromium.org

Bug: v8:6666
Change-Id: Iad3d4718423a22790908d5028b2ec9e8b2253126
Reviewed-on: https://chromium-review.googlesource.com/1233258
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Simon Zünd <szuend@google.com>
Cr-Commit-Position: refs/heads/master@{#56023}
This commit is contained in:
Simon Zünd 2018-09-19 11:16:57 +02:00 committed by Commit Bot
parent bb5724283f
commit deee2c2df6

View File

@ -1449,6 +1449,8 @@ void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) {
// static
void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) {
Assembler::SupportsRootRegisterScope supports_root_register(masm);
// Stack Layout:
// esp[0] : Return address
// esp[8] : Argument n
@ -1464,9 +1466,9 @@ void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) {
Label done;
__ test(eax, eax);
__ j(not_zero, &done, Label::kNear);
__ PopReturnAddressTo(ebx);
__ PopReturnAddressTo(edx);
__ PushRoot(Heap::kUndefinedValueRootIndex);
__ PushReturnAddressFrom(ebx);
__ PushReturnAddressFrom(edx);
__ inc(eax);
__ bind(&done);
}
@ -1481,11 +1483,11 @@ void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) {
Label loop;
__ mov(ecx, eax);
__ bind(&loop);
__ mov(ebx, Operand(esp, ecx, times_pointer_size, 0));
__ mov(Operand(esp, ecx, times_pointer_size, kPointerSize), ebx);
__ mov(edx, Operand(esp, ecx, times_pointer_size, 0));
__ mov(Operand(esp, ecx, times_pointer_size, kPointerSize), edx);
__ dec(ecx);
__ j(not_sign, &loop); // While non-negative (to copy return address).
__ pop(ebx); // Discard copy of return address.
__ pop(edx); // Discard copy of return address.
__ dec(eax); // One fewer argument (first argument is new receiver).
}