Commit 649db6b8 authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[ia32, roots] Preserve 'ebx' in ReflectConstruct

R=jgruber@chromium.org

Bug: v8:6666
Change-Id: I3ece4039297f837a3677c62c4a76433b73ebbe15
Reviewed-on: https://chromium-review.googlesource.com/1233916Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Simon Zünd <szuend@google.com>
Cr-Commit-Position: refs/heads/master@{#56118}
parent c63cbbdd
...@@ -1592,6 +1592,8 @@ void Builtins::Generate_ReflectApply(MacroAssembler* masm) { ...@@ -1592,6 +1592,8 @@ void Builtins::Generate_ReflectApply(MacroAssembler* masm) {
} }
void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { void Builtins::Generate_ReflectConstruct(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
...@@ -1601,7 +1603,7 @@ void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { ...@@ -1601,7 +1603,7 @@ void Builtins::Generate_ReflectConstruct(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 ecx (if present),
// new.target into edx (if present, otherwise use target), remove all // new.target into edx (if present, otherwise use target), remove all
// arguments from the stack (including the receiver), and push thisArgument // arguments from the stack (including the receiver), and push thisArgument
// (if present) instead. // (if present) instead.
...@@ -1609,25 +1611,32 @@ void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { ...@@ -1609,25 +1611,32 @@ void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) {
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));
__ mov(edx, edi); __ mov(edx, edi);
__ j(equal, &done, Label::kNear); __ j(equal, &done, Label::kNear);
__ mov(ebx, 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(edx, Operand(esp, eax, times_pointer_size, -2 * kPointerSize)); __ mov(edx, Operand(esp, eax, times_pointer_size, -2 * kPointerSize));
__ bind(&done); __ bind(&done);
// Spill argumentsList to use ecx as a scratch register.
__ movd(xmm0, ecx);
__ PopReturnAddressTo(ecx); __ PopReturnAddressTo(ecx);
__ lea(esp, Operand(esp, eax, times_pointer_size, kPointerSize)); __ lea(esp, Operand(esp, eax, times_pointer_size, kPointerSize));
__ PushRoot(RootIndex::kUndefinedValue); __ PushRoot(RootIndex::kUndefinedValue);
__ PushReturnAddressFrom(ecx); __ PushReturnAddressFrom(ecx);
// Restore argumentsList.
__ movd(ecx, xmm0);
} }
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- ebx : argumentsList // -- ecx : argumentsList
// -- edx : new.target // -- edx : new.target
// -- edi : target // -- edi : target
// -- esp[0] : return address // -- esp[0] : return address
...@@ -1643,7 +1652,6 @@ void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { ...@@ -1643,7 +1652,6 @@ void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) {
// builtins will do. // builtins will do.
// 4. Construct the target with the given new.target and argumentsList. // 4. Construct the target with the given new.target and argumentsList.
__ MoveForRootRegisterRefactoring(ecx, ebx);
__ Jump(BUILTIN_CODE(masm->isolate(), ConstructWithArrayLike), __ Jump(BUILTIN_CODE(masm->isolate(), ConstructWithArrayLike),
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