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

port 1e00bb57a2 (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}
This commit is contained in:
chunyang.dai 2015-09-16 18:25:23 -07:00 committed by Commit bot
parent e97b1938dd
commit ecc6e6c52c
2 changed files with 32 additions and 18 deletions

View File

@ -23,6 +23,8 @@ static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
ExternalReference key_offset(isolate->stub_cache()->key_reference(table));
ExternalReference value_offset(isolate->stub_cache()->value_reference(table));
ExternalReference map_offset(isolate->stub_cache()->map_reference(table));
ExternalReference virtual_register =
ExternalReference::vector_store_virtual_register(masm->isolate());
Label miss;
bool is_vector_store =
@ -67,9 +69,10 @@ static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
DCHECK(extra.is(VectorStoreICDescriptor::SlotRegister()));
__ add(extra, Immediate(Code::kHeaderSize - kHeapObjectTag));
__ 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.
__ ret(0);
__ jmp(Operand::StaticVariable(virtual_register));
} else {
__ pop(LoadWithVectorDescriptor::VectorRegister());
__ pop(LoadDescriptor::SlotRegister());
@ -124,9 +127,10 @@ static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
Register vector = VectorStoreICDescriptor::VectorRegister();
DCHECK(offset.is(VectorStoreICDescriptor::SlotRegister()));
__ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag));
__ mov(Operand::StaticVariable(virtual_register), offset);
__ pop(vector);
__ xchg(offset, Operand(esp, 0));
__ ret(0);
__ pop(offset); // Pop "slot".
__ jmp(Operand::StaticVariable(virtual_register));
} else {
__ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag));
__ jmp(offset);

View File

@ -4243,6 +4243,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);
@ -4269,8 +4271,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
@ -4290,12 +4293,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)));
@ -4320,6 +4324,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;
@ -4336,9 +4342,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.
@ -4348,10 +4355,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));
}
@ -4424,6 +4431,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);
@ -4460,8 +4469,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.