Index: src/x87/code-stubs-x87.cc |
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc |
index a90d83a09ffe156b8f29b15ff5325ce60d812cf5..729e63fc9cebd0065ae0fa4fce1ae877098e8ab7 100644 |
--- a/src/x87/code-stubs-x87.cc |
+++ b/src/x87/code-stubs-x87.cc |
@@ -4248,7 +4248,7 @@ static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register receiver, |
Label start_polymorphic; |
Label pop_and_miss; |
ExternalReference virtual_register = |
- ExternalReference::vector_store_virtual_register(masm->isolate()); |
+ ExternalReference::virtual_handler_register(masm->isolate()); |
__ push(receiver); |
__ push(vector); |
@@ -4332,7 +4332,7 @@ static void HandleMonomorphicStoreCase(MacroAssembler* masm, Register receiver, |
// The store ic value is on the stack. |
DCHECK(weak_cell.is(VectorStoreICDescriptor::ValueRegister())); |
ExternalReference virtual_register = |
- ExternalReference::vector_store_virtual_register(masm->isolate()); |
+ ExternalReference::virtual_handler_register(masm->isolate()); |
// feedback initially contains the feedback array |
Label compare_smi_map; |
@@ -4440,13 +4440,16 @@ static void HandlePolymorphicKeyedStoreCase(MacroAssembler* masm, |
Label transition_call; |
Label pop_and_miss; |
ExternalReference virtual_register = |
- ExternalReference::vector_store_virtual_register(masm->isolate()); |
+ ExternalReference::virtual_handler_register(masm->isolate()); |
+ ExternalReference virtual_slot = |
+ ExternalReference::virtual_slot_register(masm->isolate()); |
__ push(receiver); |
__ push(vector); |
Register receiver_map = receiver; |
Register cached_map = vector; |
+ Register value = StoreDescriptor::ValueRegister(); |
// Receiver might not be a heap object. |
__ JumpIfSmi(receiver, &load_smi_map); |
@@ -4455,11 +4458,17 @@ static void HandlePolymorphicKeyedStoreCase(MacroAssembler* masm, |
// Polymorphic, we have to loop from 0 to N - 1 |
__ push(key); |
- // On the stack we have: |
- // key (esp) |
- // vector |
- // receiver |
- // value |
+ // Current stack layout: |
+ // - esp[0] -- key |
+ // - esp[4] -- vector |
+ // - esp[8] -- receiver |
+ // - esp[12] -- value |
+ // - esp[16] -- return address |
+ // |
+ // Required stack layout for handler call: |
+ // - esp[0] -- return address |
+ // - receiver, key, value, vector, slot in registers. |
+ // - handler in virtual register. |
Register counter = key; |
__ mov(counter, Immediate(Smi::FromInt(0))); |
__ bind(&next_loop); |
@@ -4478,32 +4487,39 @@ static void HandlePolymorphicKeyedStoreCase(MacroAssembler* masm, |
__ pop(receiver); |
__ lea(feedback, FieldOperand(feedback, Code::kHeaderSize)); |
__ mov(Operand::StaticVariable(virtual_register), feedback); |
- __ pop(feedback); // Pop "value". |
+ __ pop(value); |
__ jmp(Operand::StaticVariable(virtual_register)); |
__ bind(&transition_call); |
- // Oh holy hell this will be tough. |
- // The map goes in vector register. |
- __ mov(receiver, FieldOperand(cached_map, WeakCell::kValueOffset)); |
- // The weak cell may have been cleared. |
- __ JumpIfSmi(receiver, &pop_and_miss); |
- // slot goes on the stack, and holds return address. |
- __ xchg(slot, Operand(esp, 4 * kPointerSize)); |
- // Get the handler in value. |
+ // Current stack layout: |
+ // - esp[0] -- key |
+ // - esp[4] -- vector |
+ // - esp[8] -- receiver |
+ // - esp[12] -- value |
+ // - esp[16] -- return address |
+ // |
+ // Required stack layout for handler call: |
+ // - esp[0] -- return address |
+ // - receiver, key, value, map, vector in registers. |
+ // - handler and slot in virtual registers. |
+ __ mov(Operand::StaticVariable(virtual_slot), slot); |
__ mov(feedback, FieldOperand(feedback, counter, times_half_pointer_size, |
FixedArray::kHeaderSize + 2 * kPointerSize)); |
__ lea(feedback, FieldOperand(feedback, Code::kHeaderSize)); |
+ __ mov(Operand::StaticVariable(virtual_register), feedback); |
+ |
+ __ mov(cached_map, FieldOperand(cached_map, WeakCell::kValueOffset)); |
+ // The weak cell may have been cleared. |
+ __ JumpIfSmi(cached_map, &pop_and_miss); |
+ DCHECK(!cached_map.is(VectorStoreTransitionDescriptor::MapRegister())); |
+ __ mov(VectorStoreTransitionDescriptor::MapRegister(), cached_map); |
+ |
// Pop key into place. |
__ pop(key); |
- // Put the return address on top of stack, vector goes in slot. |
- __ xchg(slot, Operand(esp, 0)); |
- // put the map on the stack, receiver holds receiver. |
- __ xchg(receiver, Operand(esp, 1 * kPointerSize)); |
- // put the vector on the stack, slot holds value. |
- __ xchg(slot, Operand(esp, 2 * kPointerSize)); |
- // feedback (value) = value, slot = handler. |
- __ xchg(feedback, slot); |
- __ jmp(slot); |
+ __ pop(vector); |
+ __ pop(receiver); |
+ __ pop(value); |
+ __ jmp(Operand::StaticVariable(virtual_register)); |
__ bind(&prepare_next); |
__ add(counter, Immediate(Smi::FromInt(3))); |