OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 3214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3225 HandleArrayCases(masm, feedback, receiver_map, scratch1, r9, false, &miss); | 3225 HandleArrayCases(masm, feedback, receiver_map, scratch1, r9, false, &miss); |
3226 | 3226 |
3227 __ bind(&miss); | 3227 __ bind(&miss); |
3228 KeyedLoadIC::GenerateMiss(masm); | 3228 KeyedLoadIC::GenerateMiss(masm); |
3229 | 3229 |
3230 __ bind(&load_smi_map); | 3230 __ bind(&load_smi_map); |
3231 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | 3231 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); |
3232 __ jmp(&compare_map); | 3232 __ jmp(&compare_map); |
3233 } | 3233 } |
3234 | 3234 |
3235 void StoreICTrampolineStub::Generate(MacroAssembler* masm) { | |
3236 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); | |
3237 StoreICStub stub(isolate(), state()); | |
3238 stub.GenerateForTrampoline(masm); | |
3239 } | |
3240 | |
3241 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { | 3235 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { |
3242 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); | 3236 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); |
3243 KeyedStoreICStub stub(isolate(), state()); | 3237 KeyedStoreICStub stub(isolate(), state()); |
3244 stub.GenerateForTrampoline(masm); | 3238 stub.GenerateForTrampoline(masm); |
3245 } | 3239 } |
3246 | 3240 |
3247 void StoreICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); } | |
3248 | |
3249 void StoreICStub::GenerateForTrampoline(MacroAssembler* masm) { | |
3250 GenerateImpl(masm, true); | |
3251 } | |
3252 | |
3253 void StoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | |
3254 Register receiver = StoreWithVectorDescriptor::ReceiverRegister(); // r1 | |
3255 Register key = StoreWithVectorDescriptor::NameRegister(); // r2 | |
3256 Register vector = StoreWithVectorDescriptor::VectorRegister(); // r3 | |
3257 Register slot = StoreWithVectorDescriptor::SlotRegister(); // r4 | |
3258 DCHECK(StoreWithVectorDescriptor::ValueRegister().is(r0)); // r0 | |
3259 Register feedback = r5; | |
3260 Register receiver_map = r6; | |
3261 Register scratch1 = r9; | |
3262 | |
3263 __ add(feedback, vector, Operand::PointerOffsetFromSmiKey(slot)); | |
3264 __ ldr(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); | |
3265 | |
3266 // Try to quickly handle the monomorphic case without knowing for sure | |
3267 // if we have a weak cell in feedback. We do know it's safe to look | |
3268 // at WeakCell::kValueOffset. | |
3269 Label try_array, load_smi_map, compare_map; | |
3270 Label not_array, miss; | |
3271 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, slot, | |
3272 scratch1, &compare_map, &load_smi_map, &try_array); | |
3273 | |
3274 // Is it a fixed array? | |
3275 __ bind(&try_array); | |
3276 __ ldr(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset)); | |
3277 __ CompareRoot(scratch1, Heap::kFixedArrayMapRootIndex); | |
3278 __ b(ne, ¬_array); | |
3279 | |
3280 // We are using register r8, which is used for the embedded constant pool | |
3281 // when FLAG_enable_embedded_constant_pool is true. | |
3282 DCHECK(!FLAG_enable_embedded_constant_pool); | |
3283 Register scratch2 = r8; | |
3284 HandleArrayCases(masm, feedback, receiver_map, scratch1, scratch2, true, | |
3285 &miss); | |
3286 | |
3287 __ bind(¬_array); | |
3288 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); | |
3289 __ b(ne, &miss); | |
3290 masm->isolate()->store_stub_cache()->GenerateProbe( | |
3291 masm, receiver, key, feedback, receiver_map, scratch1, scratch2); | |
3292 | |
3293 __ bind(&miss); | |
3294 StoreIC::GenerateMiss(masm); | |
3295 | |
3296 __ bind(&load_smi_map); | |
3297 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | |
3298 __ jmp(&compare_map); | |
3299 } | |
3300 | |
3301 void KeyedStoreICStub::Generate(MacroAssembler* masm) { | 3241 void KeyedStoreICStub::Generate(MacroAssembler* masm) { |
3302 GenerateImpl(masm, false); | 3242 GenerateImpl(masm, false); |
3303 } | 3243 } |
3304 | 3244 |
3305 void KeyedStoreICStub::GenerateForTrampoline(MacroAssembler* masm) { | 3245 void KeyedStoreICStub::GenerateForTrampoline(MacroAssembler* masm) { |
3306 GenerateImpl(masm, true); | 3246 GenerateImpl(masm, true); |
3307 } | 3247 } |
3308 | 3248 |
3309 | 3249 |
3310 static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register feedback, | 3250 static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register feedback, |
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4856 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 4796 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
4857 kStackUnwindSpace, NULL, return_value_operand, NULL); | 4797 kStackUnwindSpace, NULL, return_value_operand, NULL); |
4858 } | 4798 } |
4859 | 4799 |
4860 #undef __ | 4800 #undef __ |
4861 | 4801 |
4862 } // namespace internal | 4802 } // namespace internal |
4863 } // namespace v8 | 4803 } // namespace v8 |
4864 | 4804 |
4865 #endif // V8_TARGET_ARCH_ARM | 4805 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |