Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 08abcf115f7f633a034873386cbf1c9c7e97a25a..4431944c1fe5facc5c5329776b42083ee2d7befa 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -4579,7 +4579,7 @@ static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register receiver, |
Label load_smi_map, compare_map; |
Label start_polymorphic; |
ExternalReference virtual_register = |
- ExternalReference::vector_store_virtual_register(masm->isolate()); |
+ ExternalReference::virtual_handler_register(masm->isolate()); |
__ push(receiver); |
__ push(vector); |
@@ -4660,7 +4660,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; |
@@ -4767,13 +4767,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); |
@@ -4782,11 +4785,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); |
@@ -4805,32 +4814,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))); |