OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 3085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3096 &miss); | 3096 &miss); |
3097 | 3097 |
3098 __ bind(&miss); | 3098 __ bind(&miss); |
3099 KeyedLoadIC::GenerateMiss(masm); | 3099 KeyedLoadIC::GenerateMiss(masm); |
3100 | 3100 |
3101 __ bind(&load_smi_map); | 3101 __ bind(&load_smi_map); |
3102 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | 3102 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); |
3103 __ jmp(&compare_map); | 3103 __ jmp(&compare_map); |
3104 } | 3104 } |
3105 | 3105 |
3106 void StoreICTrampolineStub::Generate(MacroAssembler* masm) { | |
3107 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); | |
3108 StoreICStub stub(isolate(), state()); | |
3109 stub.GenerateForTrampoline(masm); | |
3110 } | |
3111 | |
3112 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { | 3106 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { |
3113 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); | 3107 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); |
3114 KeyedStoreICStub stub(isolate(), state()); | 3108 KeyedStoreICStub stub(isolate(), state()); |
3115 stub.GenerateForTrampoline(masm); | 3109 stub.GenerateForTrampoline(masm); |
3116 } | 3110 } |
3117 | 3111 |
3118 void StoreICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); } | |
3119 | |
3120 void StoreICStub::GenerateForTrampoline(MacroAssembler* masm) { | |
3121 GenerateImpl(masm, true); | |
3122 } | |
3123 | |
3124 void StoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | |
3125 Register receiver = StoreWithVectorDescriptor::ReceiverRegister(); // rdx | |
3126 Register key = StoreWithVectorDescriptor::NameRegister(); // rcx | |
3127 Register vector = StoreWithVectorDescriptor::VectorRegister(); // rbx | |
3128 Register slot = StoreWithVectorDescriptor::SlotRegister(); // rdi | |
3129 DCHECK(StoreWithVectorDescriptor::ValueRegister().is(rax)); // rax | |
3130 Register feedback = r8; | |
3131 Register integer_slot = r9; | |
3132 Register receiver_map = r11; | |
3133 DCHECK(!AreAliased(feedback, integer_slot, vector, slot, receiver_map)); | |
3134 | |
3135 __ SmiToInteger32(integer_slot, slot); | |
3136 __ movp(feedback, FieldOperand(vector, integer_slot, times_pointer_size, | |
3137 FixedArray::kHeaderSize)); | |
3138 | |
3139 // Try to quickly handle the monomorphic case without knowing for sure | |
3140 // if we have a weak cell in feedback. We do know it's safe to look | |
3141 // at WeakCell::kValueOffset. | |
3142 Label try_array, load_smi_map, compare_map; | |
3143 Label not_array, miss; | |
3144 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, | |
3145 integer_slot, &compare_map, &load_smi_map, &try_array); | |
3146 | |
3147 // Is it a fixed array? | |
3148 __ bind(&try_array); | |
3149 __ CompareRoot(FieldOperand(feedback, 0), Heap::kFixedArrayMapRootIndex); | |
3150 __ j(not_equal, ¬_array); | |
3151 HandleArrayCases(masm, feedback, receiver_map, integer_slot, r14, r15, true, | |
3152 &miss); | |
3153 | |
3154 __ bind(¬_array); | |
3155 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); | |
3156 __ j(not_equal, &miss); | |
3157 | |
3158 masm->isolate()->store_stub_cache()->GenerateProbe(masm, receiver, key, | |
3159 feedback, no_reg); | |
3160 | |
3161 __ bind(&miss); | |
3162 StoreIC::GenerateMiss(masm); | |
3163 | |
3164 __ bind(&load_smi_map); | |
3165 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | |
3166 __ jmp(&compare_map); | |
3167 } | |
3168 | |
3169 void KeyedStoreICStub::Generate(MacroAssembler* masm) { | 3112 void KeyedStoreICStub::Generate(MacroAssembler* masm) { |
3170 GenerateImpl(masm, false); | 3113 GenerateImpl(masm, false); |
3171 } | 3114 } |
3172 | 3115 |
3173 void KeyedStoreICStub::GenerateForTrampoline(MacroAssembler* masm) { | 3116 void KeyedStoreICStub::GenerateForTrampoline(MacroAssembler* masm) { |
3174 GenerateImpl(masm, true); | 3117 GenerateImpl(masm, true); |
3175 } | 3118 } |
3176 | 3119 |
3177 | 3120 |
3178 static void HandlePolymorphicKeyedStoreCase(MacroAssembler* masm, | 3121 static void HandlePolymorphicKeyedStoreCase(MacroAssembler* masm, |
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4837 kStackUnwindSpace, nullptr, return_value_operand, | 4780 kStackUnwindSpace, nullptr, return_value_operand, |
4838 NULL); | 4781 NULL); |
4839 } | 4782 } |
4840 | 4783 |
4841 #undef __ | 4784 #undef __ |
4842 | 4785 |
4843 } // namespace internal | 4786 } // namespace internal |
4844 } // namespace v8 | 4787 } // namespace v8 |
4845 | 4788 |
4846 #endif // V8_TARGET_ARCH_X64 | 4789 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |