Index: src/x87/code-stubs-x87.cc |
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc |
index c763401d7c4435f99df09321ce82fb11c2ac62e8..2b3b804c564951ee7fb98f99033cb98a55e18861 100644 |
--- a/src/x87/code-stubs-x87.cc |
+++ b/src/x87/code-stubs-x87.cc |
@@ -4247,6 +4247,8 @@ static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register receiver, |
Label next, next_loop, prepare_next; |
Label load_smi_map, compare_map; |
Label start_polymorphic; |
+ ExternalReference virtual_register = |
+ ExternalReference::vector_store_virtual_register(masm->isolate()); |
__ push(receiver); |
__ push(vector); |
@@ -4273,8 +4275,9 @@ static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register receiver, |
__ pop(vector); |
__ pop(receiver); |
__ lea(handler, FieldOperand(handler, Code::kHeaderSize)); |
- __ xchg(handler, Operand(esp, 0)); |
- __ ret(0); |
+ __ mov(Operand::StaticVariable(virtual_register), handler); |
+ __ pop(handler); // Pop "value". |
+ __ jmp(Operand::StaticVariable(virtual_register)); |
// Polymorphic, we have to loop from 2 to N |
@@ -4294,12 +4297,13 @@ static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register receiver, |
__ j(not_equal, &prepare_next); |
__ mov(handler, FieldOperand(feedback, counter, times_half_pointer_size, |
FixedArray::kHeaderSize + kPointerSize)); |
+ __ lea(handler, FieldOperand(handler, Code::kHeaderSize)); |
__ pop(key); |
__ pop(vector); |
__ pop(receiver); |
- __ lea(handler, FieldOperand(handler, Code::kHeaderSize)); |
- __ xchg(handler, Operand(esp, 0)); |
- __ ret(0); |
+ __ mov(Operand::StaticVariable(virtual_register), handler); |
+ __ pop(handler); // Pop "value". |
+ __ jmp(Operand::StaticVariable(virtual_register)); |
__ bind(&prepare_next); |
__ add(counter, Immediate(Smi::FromInt(2))); |
@@ -4324,6 +4328,8 @@ static void HandleMonomorphicStoreCase(MacroAssembler* masm, Register receiver, |
Label* miss) { |
// The store ic value is on the stack. |
DCHECK(weak_cell.is(VectorStoreICDescriptor::ValueRegister())); |
+ ExternalReference virtual_register = |
+ ExternalReference::vector_store_virtual_register(masm->isolate()); |
// feedback initially contains the feedback array |
Label compare_smi_map; |
@@ -4340,9 +4346,10 @@ static void HandleMonomorphicStoreCase(MacroAssembler* masm, Register receiver, |
FixedArray::kHeaderSize + kPointerSize)); |
__ lea(weak_cell, FieldOperand(weak_cell, Code::kHeaderSize)); |
// Put the store ic value back in it's register. |
- __ xchg(weak_cell, Operand(esp, 0)); |
- // "return" to the handler. |
- __ ret(0); |
+ __ mov(Operand::StaticVariable(virtual_register), weak_cell); |
+ __ pop(weak_cell); // Pop "value". |
+ // jump to the handler. |
+ __ jmp(Operand::StaticVariable(virtual_register)); |
// In microbenchmarks, it made sense to unroll this code so that the call to |
// the handler is duplicated for a HeapObject receiver and a Smi receiver. |
@@ -4352,10 +4359,10 @@ static void HandleMonomorphicStoreCase(MacroAssembler* masm, Register receiver, |
__ mov(weak_cell, FieldOperand(vector, slot, times_half_pointer_size, |
FixedArray::kHeaderSize + kPointerSize)); |
__ lea(weak_cell, FieldOperand(weak_cell, Code::kHeaderSize)); |
- // Put the store ic value back in it's register. |
- __ xchg(weak_cell, Operand(esp, 0)); |
- // "return" to the handler. |
- __ ret(0); |
+ __ mov(Operand::StaticVariable(virtual_register), weak_cell); |
+ __ pop(weak_cell); // Pop "value". |
+ // jump to the handler. |
+ __ jmp(Operand::StaticVariable(virtual_register)); |
} |
@@ -4428,6 +4435,8 @@ static void HandlePolymorphicKeyedStoreCase(MacroAssembler* masm, |
Label load_smi_map, compare_map; |
Label transition_call; |
Label pop_and_miss; |
+ ExternalReference virtual_register = |
+ ExternalReference::vector_store_virtual_register(masm->isolate()); |
__ push(receiver); |
__ push(vector); |
@@ -4464,8 +4473,9 @@ static void HandlePolymorphicKeyedStoreCase(MacroAssembler* masm, |
__ pop(vector); |
__ pop(receiver); |
__ lea(feedback, FieldOperand(feedback, Code::kHeaderSize)); |
- __ xchg(feedback, Operand(esp, 0)); |
- __ ret(0); |
+ __ mov(Operand::StaticVariable(virtual_register), feedback); |
+ __ pop(feedback); // Pop "value". |
+ __ jmp(Operand::StaticVariable(virtual_register)); |
__ bind(&transition_call); |
// Oh holy hell this will be tough. |