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) { ...@@ -1530,6 +1530,8 @@ void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) {
} }
void Builtins::Generate_ReflectApply(MacroAssembler* masm) { void Builtins::Generate_ReflectApply(MacroAssembler* masm) {
Assembler::SupportsRootRegisterScope supports_root_register(masm);
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- eax : argc // -- eax : argc
// -- esp[0] : return address // -- esp[0] : return address
...@@ -1539,31 +1541,38 @@ void Builtins::Generate_ReflectApply(MacroAssembler* masm) { ...@@ -1539,31 +1541,38 @@ void Builtins::Generate_ReflectApply(MacroAssembler* masm) {
// -- esp[16] : receiver // -- 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 // remove all arguments from the stack (including the receiver), and push
// thisArgument (if present) instead. // thisArgument (if present) instead.
{ {
Label done; Label done;
__ LoadRoot(edi, RootIndex::kUndefinedValue); __ LoadRoot(edi, RootIndex::kUndefinedValue);
__ mov(edx, edi); __ mov(edx, edi);
__ mov(ebx, edi); __ mov(ecx, edi);
__ cmp(eax, Immediate(1)); __ cmp(eax, Immediate(1));
__ j(below, &done, Label::kNear); __ j(below, &done, Label::kNear);
__ mov(edi, Operand(esp, eax, times_pointer_size, -0 * kPointerSize)); __ mov(edi, Operand(esp, eax, times_pointer_size, -0 * kPointerSize));
__ j(equal, &done, Label::kNear); __ 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)); __ cmp(eax, Immediate(3));
__ j(below, &done, Label::kNear); __ 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); __ 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)); __ lea(esp, Operand(esp, eax, times_pointer_size, kPointerSize));
__ Push(edx); __ Push(ecx);
__ PushReturnAddressFrom(ecx); __ PushReturnAddressFrom(edx);
// Restore argumentsList.
__ movd(edx, xmm0);
} }
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- ebx : argumentsList // -- edx : argumentsList
// -- edi : target // -- edi : target
// -- esp[0] : return address // -- esp[0] : return address
// -- esp[4] : thisArgument // -- esp[4] : thisArgument
...@@ -1574,7 +1583,6 @@ void Builtins::Generate_ReflectApply(MacroAssembler* masm) { ...@@ -1574,7 +1583,6 @@ void Builtins::Generate_ReflectApply(MacroAssembler* masm) {
// will do. // will do.
// 3. Apply the target to the given argumentsList. // 3. Apply the target to the given argumentsList.
__ MoveForRootRegisterRefactoring(edx, ebx);
__ Jump(BUILTIN_CODE(masm->isolate(), CallWithArrayLike), __ Jump(BUILTIN_CODE(masm->isolate(), CallWithArrayLike),
RelocInfo::CODE_TARGET); 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