Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1088)

Unified Diff: src/x64/code-stubs-x64.cc

Issue 2523473002: [cleanup] Drop handwritten KeyedStoreIC code (Closed)
Patch Set: rebased Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/v8.gyp ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/code-stubs-x64.cc
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
index d62aafe57303109e24b73f23b6b220ffbeb03404..db316daadb5a1e08a7557a05687e433253c59f8a 100644
--- a/src/x64/code-stubs-x64.cc
+++ b/src/x64/code-stubs-x64.cc
@@ -2949,203 +2949,6 @@ void StubFailureTrampolineStub::Generate(MacroAssembler* masm) {
__ jmp(rcx); // Return to IC Miss stub, continuation still on stack.
}
-static void HandleArrayCases(MacroAssembler* masm, Register feedback,
- Register receiver_map, Register scratch1,
- Register scratch2, Register scratch3,
- bool is_polymorphic, Label* miss) {
- // feedback initially contains the feedback array
- Label next_loop, prepare_next;
- Label start_polymorphic;
-
- Register counter = scratch1;
- Register length = scratch2;
- Register cached_map = scratch3;
-
- __ movp(cached_map, FieldOperand(feedback, FixedArray::OffsetOfElementAt(0)));
- __ cmpp(receiver_map, FieldOperand(cached_map, WeakCell::kValueOffset));
- __ j(not_equal, &start_polymorphic);
-
- // found, now call handler.
- Register handler = feedback;
- __ movp(handler, FieldOperand(feedback, FixedArray::OffsetOfElementAt(1)));
- __ leap(handler, FieldOperand(handler, Code::kHeaderSize));
- __ jmp(handler);
-
- // Polymorphic, we have to loop from 2 to N
- __ bind(&start_polymorphic);
- __ SmiToInteger32(length, FieldOperand(feedback, FixedArray::kLengthOffset));
- if (!is_polymorphic) {
- // If the IC could be monomorphic we have to make sure we don't go past the
- // end of the feedback array.
- __ cmpl(length, Immediate(2));
- __ j(equal, miss);
- }
- __ movl(counter, Immediate(2));
-
- __ bind(&next_loop);
- __ movp(cached_map, FieldOperand(feedback, counter, times_pointer_size,
- FixedArray::kHeaderSize));
- __ cmpp(receiver_map, FieldOperand(cached_map, WeakCell::kValueOffset));
- __ j(not_equal, &prepare_next);
- __ movp(handler, FieldOperand(feedback, counter, times_pointer_size,
- FixedArray::kHeaderSize + kPointerSize));
- __ leap(handler, FieldOperand(handler, Code::kHeaderSize));
- __ jmp(handler);
-
- __ bind(&prepare_next);
- __ addl(counter, Immediate(2));
- __ cmpl(counter, length);
- __ j(less, &next_loop);
-
- // We exhausted our array of map handler pairs.
- __ jmp(miss);
-}
-
-
-static void HandleMonomorphicCase(MacroAssembler* masm, Register receiver,
- Register receiver_map, Register feedback,
- Register vector, Register integer_slot,
- Label* compare_map, Label* load_smi_map,
- Label* try_array) {
- __ JumpIfSmi(receiver, load_smi_map);
- __ movp(receiver_map, FieldOperand(receiver, 0));
-
- __ bind(compare_map);
- __ cmpp(receiver_map, FieldOperand(feedback, WeakCell::kValueOffset));
- __ j(not_equal, try_array);
- Register handler = feedback;
- __ movp(handler, FieldOperand(vector, integer_slot, times_pointer_size,
- FixedArray::kHeaderSize + kPointerSize));
- __ leap(handler, FieldOperand(handler, Code::kHeaderSize));
- __ jmp(handler);
-}
-
-void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) {
- __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister());
- KeyedStoreICStub stub(isolate(), state());
- stub.GenerateForTrampoline(masm);
-}
-
-void KeyedStoreICStub::Generate(MacroAssembler* masm) {
- GenerateImpl(masm, false);
-}
-
-void KeyedStoreICStub::GenerateForTrampoline(MacroAssembler* masm) {
- GenerateImpl(masm, true);
-}
-
-
-static void HandlePolymorphicKeyedStoreCase(MacroAssembler* masm,
- Register receiver_map,
- Register feedback, Register scratch,
- Register scratch1,
- Register scratch2, Label* miss) {
- // feedback initially contains the feedback array
- Label next, next_loop, prepare_next;
- Label transition_call;
-
- Register cached_map = scratch;
- Register counter = scratch1;
- Register length = scratch2;
-
- // Polymorphic, we have to loop from 0 to N - 1
- __ movp(counter, Immediate(0));
- __ movp(length, FieldOperand(feedback, FixedArray::kLengthOffset));
- __ SmiToInteger32(length, length);
-
- __ bind(&next_loop);
- __ movp(cached_map, FieldOperand(feedback, counter, times_pointer_size,
- FixedArray::kHeaderSize));
- __ cmpp(receiver_map, FieldOperand(cached_map, WeakCell::kValueOffset));
- __ j(not_equal, &prepare_next);
- __ movp(cached_map, FieldOperand(feedback, counter, times_pointer_size,
- FixedArray::kHeaderSize + kPointerSize));
- __ CompareRoot(cached_map, Heap::kUndefinedValueRootIndex);
- __ j(not_equal, &transition_call);
- __ movp(feedback, FieldOperand(feedback, counter, times_pointer_size,
- FixedArray::kHeaderSize + 2 * kPointerSize));
- __ leap(feedback, FieldOperand(feedback, Code::kHeaderSize));
- __ jmp(feedback);
-
- __ bind(&transition_call);
- DCHECK(receiver_map.is(StoreTransitionDescriptor::MapRegister()));
- __ movp(receiver_map, FieldOperand(cached_map, WeakCell::kValueOffset));
- // The weak cell may have been cleared.
- __ JumpIfSmi(receiver_map, miss);
- // Get the handler in value.
- __ movp(feedback, FieldOperand(feedback, counter, times_pointer_size,
- FixedArray::kHeaderSize + 2 * kPointerSize));
- __ leap(feedback, FieldOperand(feedback, Code::kHeaderSize));
- __ jmp(feedback);
-
- __ bind(&prepare_next);
- __ addl(counter, Immediate(3));
- __ cmpl(counter, length);
- __ j(less, &next_loop);
-
- // We exhausted our array of map handler pairs.
- __ jmp(miss);
-}
-
-void KeyedStoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) {
- Register receiver = StoreWithVectorDescriptor::ReceiverRegister(); // rdx
- Register key = StoreWithVectorDescriptor::NameRegister(); // rcx
- Register vector = StoreWithVectorDescriptor::VectorRegister(); // rbx
- Register slot = StoreWithVectorDescriptor::SlotRegister(); // rdi
- DCHECK(StoreWithVectorDescriptor::ValueRegister().is(rax)); // rax
- Register feedback = r8;
- Register integer_slot = r9;
- Register receiver_map = r11;
- DCHECK(!AreAliased(feedback, integer_slot, vector, slot, receiver_map));
-
- __ SmiToInteger32(integer_slot, slot);
- __ movp(feedback, FieldOperand(vector, integer_slot, times_pointer_size,
- FixedArray::kHeaderSize));
-
- // Try to quickly handle the monomorphic case without knowing for sure
- // if we have a weak cell in feedback. We do know it's safe to look
- // at WeakCell::kValueOffset.
- Label try_array, load_smi_map, compare_map;
- Label not_array, miss;
- HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector,
- integer_slot, &compare_map, &load_smi_map, &try_array);
-
- // Is it a fixed array?
- __ bind(&try_array);
- __ CompareRoot(FieldOperand(feedback, 0), Heap::kFixedArrayMapRootIndex);
- __ j(not_equal, &not_array);
- HandlePolymorphicKeyedStoreCase(masm, receiver_map, feedback, integer_slot,
- r15, r14, &miss);
-
- __ bind(&not_array);
- Label try_poly_name;
- __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex);
- __ j(not_equal, &try_poly_name);
-
- Handle<Code> megamorphic_stub =
- KeyedStoreIC::ChooseMegamorphicStub(masm->isolate(), GetExtraICState());
- __ jmp(megamorphic_stub, RelocInfo::CODE_TARGET);
-
- __ bind(&try_poly_name);
- // We might have a name in feedback, and a fixed array in the next slot.
- __ cmpp(key, feedback);
- __ j(not_equal, &miss);
- // If the name comparison succeeded, we know we have a fixed array with
- // at least one map/handler pair.
- __ movp(feedback, FieldOperand(vector, integer_slot, times_pointer_size,
- FixedArray::kHeaderSize + kPointerSize));
- HandleArrayCases(masm, feedback, receiver_map, integer_slot, r14, r15, false,
- &miss);
-
- __ bind(&miss);
- KeyedStoreIC::GenerateMiss(masm);
-
- __ bind(&load_smi_map);
- __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex);
- __ jmp(&compare_map);
-}
-
-
void CallICTrampolineStub::Generate(MacroAssembler* masm) {
__ EmitLoadTypeFeedbackVector(rbx);
CallICStub stub(isolate(), state());
« no previous file with comments | « src/v8.gyp ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698