Commit 29fa45ce authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[ia32, root] Preserve 'ebx' in ReflectApply

R=jgruber@chromium.org

Bug: v8:6666
Change-Id: Icdf9ab0770cc4d6dd1c7c3a3911ffcc7a493d127
Reviewed-on: https://chromium-review.googlesource.com/1233915
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56085}
parent e4949df3
......@@ -1530,6 +1530,8 @@ void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) {
}
void Builtins::Generate_ReflectApply(MacroAssembler* masm) {
Assembler::SupportsRootRegisterScope supports_root_register(masm);
// ----------- S t a t e -------------
// -- eax : argc
// -- esp[0] : return address
......@@ -1539,31 +1541,38 @@ void Builtins::Generate_ReflectApply(MacroAssembler* masm) {
// -- esp[16] : receiver
// -----------------------------------
// 1. Load target into edi (if present), argumentsList into ebx (if present),
// 1. Load target into edi (if present), argumentsList into edx (if present),
// remove all arguments from the stack (including the receiver), and push
// thisArgument (if present) instead.
{
Label done;
__ LoadRoot(edi, RootIndex::kUndefinedValue);
__ mov(edx, edi);
__ mov(ebx, edi);
__ mov(ecx, edi);
__ cmp(eax, Immediate(1));
__ j(below, &done, Label::kNear);
__ mov(edi, Operand(esp, eax, times_pointer_size, -0 * kPointerSize));
__ j(equal, &done, Label::kNear);
__ mov(edx, Operand(esp, eax, times_pointer_size, -1 * kPointerSize));
__ mov(ecx, Operand(esp, eax, times_pointer_size, -1 * kPointerSize));
__ cmp(eax, Immediate(3));
__ j(below, &done, Label::kNear);
__ mov(ebx, Operand(esp, eax, times_pointer_size, -2 * kPointerSize));
__ mov(edx, Operand(esp, eax, times_pointer_size, -2 * kPointerSize));
__ bind(&done);
__ PopReturnAddressTo(ecx);
// Spill argumentsList to use edx as a scratch register.
__ movd(xmm0, edx);
__ PopReturnAddressTo(edx);
__ lea(esp, Operand(esp, eax, times_pointer_size, kPointerSize));
__ Push(edx);
__ PushReturnAddressFrom(ecx);
__ Push(ecx);
__ PushReturnAddressFrom(edx);
// Restore argumentsList.
__ movd(edx, xmm0);
}
// ----------- S t a t e -------------
// -- ebx : argumentsList
// -- edx : argumentsList
// -- edi : target
// -- esp[0] : return address
// -- esp[4] : thisArgument
......@@ -1574,7 +1583,6 @@ void Builtins::Generate_ReflectApply(MacroAssembler* masm) {
// will do.
// 3. Apply the target to the given argumentsList.
__ MoveForRootRegisterRefactoring(edx, ebx);
__ Jump(BUILTIN_CODE(masm->isolate(), CallWithArrayLike),
RelocInfo::CODE_TARGET);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment