Commit ecc6e6c5 authored by chunyang.dai's avatar chunyang.dai Committed by Commit bot

X87: Reland VectorICs: ia32 store ics need a virtual register.

port 1e00bb57 (r30737).

original commit message:

    (reason for revert/reland: patch incorrectly left --vector-stores flag
     on, helpfully revealing some gcstress issues to look at, but they
     don't need to block this CL).

    Some pretty hacky code was used to carry out the tail-call
    handler dispatch on ia32 vector stores due to a lack
    of free registers. It really tanks performance. A better
    approach is to use a virtual register on the isolate.

BUG=

Review URL: https://codereview.chromium.org/1344383002

Cr-Commit-Position: refs/heads/master@{#30781}
parent e97b1938
...@@ -23,6 +23,8 @@ static void ProbeTable(Isolate* isolate, MacroAssembler* masm, ...@@ -23,6 +23,8 @@ static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
ExternalReference key_offset(isolate->stub_cache()->key_reference(table)); ExternalReference key_offset(isolate->stub_cache()->key_reference(table));
ExternalReference value_offset(isolate->stub_cache()->value_reference(table)); ExternalReference value_offset(isolate->stub_cache()->value_reference(table));
ExternalReference map_offset(isolate->stub_cache()->map_reference(table)); ExternalReference map_offset(isolate->stub_cache()->map_reference(table));
ExternalReference virtual_register =
ExternalReference::vector_store_virtual_register(masm->isolate());
Label miss; Label miss;
bool is_vector_store = bool is_vector_store =
...@@ -67,9 +69,10 @@ static void ProbeTable(Isolate* isolate, MacroAssembler* masm, ...@@ -67,9 +69,10 @@ static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
DCHECK(extra.is(VectorStoreICDescriptor::SlotRegister())); DCHECK(extra.is(VectorStoreICDescriptor::SlotRegister()));
__ add(extra, Immediate(Code::kHeaderSize - kHeapObjectTag)); __ add(extra, Immediate(Code::kHeaderSize - kHeapObjectTag));
__ pop(vector); __ pop(vector);
__ xchg(extra, Operand(esp, 0)); __ mov(Operand::StaticVariable(virtual_register), extra);
__ pop(extra); // Pop "slot".
// Jump to the first instruction in the code stub. // Jump to the first instruction in the code stub.
__ ret(0); __ jmp(Operand::StaticVariable(virtual_register));
} else { } else {
__ pop(LoadWithVectorDescriptor::VectorRegister()); __ pop(LoadWithVectorDescriptor::VectorRegister());
__ pop(LoadDescriptor::SlotRegister()); __ pop(LoadDescriptor::SlotRegister());
...@@ -124,9 +127,10 @@ static void ProbeTable(Isolate* isolate, MacroAssembler* masm, ...@@ -124,9 +127,10 @@ static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
Register vector = VectorStoreICDescriptor::VectorRegister(); Register vector = VectorStoreICDescriptor::VectorRegister();
DCHECK(offset.is(VectorStoreICDescriptor::SlotRegister())); DCHECK(offset.is(VectorStoreICDescriptor::SlotRegister()));
__ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag)); __ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag));
__ mov(Operand::StaticVariable(virtual_register), offset);
__ pop(vector); __ pop(vector);
__ xchg(offset, Operand(esp, 0)); __ pop(offset); // Pop "slot".
__ ret(0); __ jmp(Operand::StaticVariable(virtual_register));
} else { } else {
__ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag)); __ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag));
__ jmp(offset); __ jmp(offset);
......
...@@ -4243,6 +4243,8 @@ static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register receiver, ...@@ -4243,6 +4243,8 @@ static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register receiver,
Label next, next_loop, prepare_next; Label next, next_loop, prepare_next;
Label load_smi_map, compare_map; Label load_smi_map, compare_map;
Label start_polymorphic; Label start_polymorphic;
ExternalReference virtual_register =
ExternalReference::vector_store_virtual_register(masm->isolate());
__ push(receiver); __ push(receiver);
__ push(vector); __ push(vector);
...@@ -4269,8 +4271,9 @@ static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register receiver, ...@@ -4269,8 +4271,9 @@ static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register receiver,
__ pop(vector); __ pop(vector);
__ pop(receiver); __ pop(receiver);
__ lea(handler, FieldOperand(handler, Code::kHeaderSize)); __ lea(handler, FieldOperand(handler, Code::kHeaderSize));
__ xchg(handler, Operand(esp, 0)); __ mov(Operand::StaticVariable(virtual_register), handler);
__ ret(0); __ pop(handler); // Pop "value".
__ jmp(Operand::StaticVariable(virtual_register));
// Polymorphic, we have to loop from 2 to N // Polymorphic, we have to loop from 2 to N
...@@ -4290,12 +4293,13 @@ static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register receiver, ...@@ -4290,12 +4293,13 @@ static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register receiver,
__ j(not_equal, &prepare_next); __ j(not_equal, &prepare_next);
__ mov(handler, FieldOperand(feedback, counter, times_half_pointer_size, __ mov(handler, FieldOperand(feedback, counter, times_half_pointer_size,
FixedArray::kHeaderSize + kPointerSize)); FixedArray::kHeaderSize + kPointerSize));
__ lea(handler, FieldOperand(handler, Code::kHeaderSize));
__ pop(key); __ pop(key);
__ pop(vector); __ pop(vector);
__ pop(receiver); __ pop(receiver);
__ lea(handler, FieldOperand(handler, Code::kHeaderSize)); __ mov(Operand::StaticVariable(virtual_register), handler);
__ xchg(handler, Operand(esp, 0)); __ pop(handler); // Pop "value".
__ ret(0); __ jmp(Operand::StaticVariable(virtual_register));
__ bind(&prepare_next); __ bind(&prepare_next);
__ add(counter, Immediate(Smi::FromInt(2))); __ add(counter, Immediate(Smi::FromInt(2)));
...@@ -4320,6 +4324,8 @@ static void HandleMonomorphicStoreCase(MacroAssembler* masm, Register receiver, ...@@ -4320,6 +4324,8 @@ static void HandleMonomorphicStoreCase(MacroAssembler* masm, Register receiver,
Label* miss) { Label* miss) {
// The store ic value is on the stack. // The store ic value is on the stack.
DCHECK(weak_cell.is(VectorStoreICDescriptor::ValueRegister())); DCHECK(weak_cell.is(VectorStoreICDescriptor::ValueRegister()));
ExternalReference virtual_register =
ExternalReference::vector_store_virtual_register(masm->isolate());
// feedback initially contains the feedback array // feedback initially contains the feedback array
Label compare_smi_map; Label compare_smi_map;
...@@ -4336,9 +4342,10 @@ static void HandleMonomorphicStoreCase(MacroAssembler* masm, Register receiver, ...@@ -4336,9 +4342,10 @@ static void HandleMonomorphicStoreCase(MacroAssembler* masm, Register receiver,
FixedArray::kHeaderSize + kPointerSize)); FixedArray::kHeaderSize + kPointerSize));
__ lea(weak_cell, FieldOperand(weak_cell, Code::kHeaderSize)); __ lea(weak_cell, FieldOperand(weak_cell, Code::kHeaderSize));
// Put the store ic value back in it's register. // Put the store ic value back in it's register.
__ xchg(weak_cell, Operand(esp, 0)); __ mov(Operand::StaticVariable(virtual_register), weak_cell);
// "return" to the handler. __ pop(weak_cell); // Pop "value".
__ ret(0); // jump to the handler.
__ jmp(Operand::StaticVariable(virtual_register));
// In microbenchmarks, it made sense to unroll this code so that the call to // 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. // the handler is duplicated for a HeapObject receiver and a Smi receiver.
...@@ -4348,10 +4355,10 @@ static void HandleMonomorphicStoreCase(MacroAssembler* masm, Register receiver, ...@@ -4348,10 +4355,10 @@ static void HandleMonomorphicStoreCase(MacroAssembler* masm, Register receiver,
__ mov(weak_cell, FieldOperand(vector, slot, times_half_pointer_size, __ mov(weak_cell, FieldOperand(vector, slot, times_half_pointer_size,
FixedArray::kHeaderSize + kPointerSize)); FixedArray::kHeaderSize + kPointerSize));
__ lea(weak_cell, FieldOperand(weak_cell, Code::kHeaderSize)); __ lea(weak_cell, FieldOperand(weak_cell, Code::kHeaderSize));
// Put the store ic value back in it's register. __ mov(Operand::StaticVariable(virtual_register), weak_cell);
__ xchg(weak_cell, Operand(esp, 0)); __ pop(weak_cell); // Pop "value".
// "return" to the handler. // jump to the handler.
__ ret(0); __ jmp(Operand::StaticVariable(virtual_register));
} }
...@@ -4424,6 +4431,8 @@ static void HandlePolymorphicKeyedStoreCase(MacroAssembler* masm, ...@@ -4424,6 +4431,8 @@ static void HandlePolymorphicKeyedStoreCase(MacroAssembler* masm,
Label load_smi_map, compare_map; Label load_smi_map, compare_map;
Label transition_call; Label transition_call;
Label pop_and_miss; Label pop_and_miss;
ExternalReference virtual_register =
ExternalReference::vector_store_virtual_register(masm->isolate());
__ push(receiver); __ push(receiver);
__ push(vector); __ push(vector);
...@@ -4460,8 +4469,9 @@ static void HandlePolymorphicKeyedStoreCase(MacroAssembler* masm, ...@@ -4460,8 +4469,9 @@ static void HandlePolymorphicKeyedStoreCase(MacroAssembler* masm,
__ pop(vector); __ pop(vector);
__ pop(receiver); __ pop(receiver);
__ lea(feedback, FieldOperand(feedback, Code::kHeaderSize)); __ lea(feedback, FieldOperand(feedback, Code::kHeaderSize));
__ xchg(feedback, Operand(esp, 0)); __ mov(Operand::StaticVariable(virtual_register), feedback);
__ ret(0); __ pop(feedback); // Pop "value".
__ jmp(Operand::StaticVariable(virtual_register));
__ bind(&transition_call); __ bind(&transition_call);
// Oh holy hell this will be tough. // Oh holy hell this will be tough.
......
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