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 3033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3044 __ ldr(r1, MemOperand(fp, parameter_count_offset)); | 3044 __ ldr(r1, MemOperand(fp, parameter_count_offset)); |
3045 if (function_mode() == JS_FUNCTION_STUB_MODE) { | 3045 if (function_mode() == JS_FUNCTION_STUB_MODE) { |
3046 __ add(r1, r1, Operand(1)); | 3046 __ add(r1, r1, Operand(1)); |
3047 } | 3047 } |
3048 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 3048 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
3049 __ mov(r1, Operand(r1, LSL, kPointerSizeLog2)); | 3049 __ mov(r1, Operand(r1, LSL, kPointerSizeLog2)); |
3050 __ add(sp, sp, r1); | 3050 __ add(sp, sp, r1); |
3051 __ Ret(); | 3051 __ Ret(); |
3052 } | 3052 } |
3053 | 3053 |
3054 | |
3055 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { | |
3056 __ EmitLoadTypeFeedbackVector(LoadWithVectorDescriptor::VectorRegister()); | |
3057 KeyedLoadICStub stub(isolate()); | |
3058 stub.GenerateForTrampoline(masm); | |
3059 } | |
3060 | |
3061 | |
3062 void CallICTrampolineStub::Generate(MacroAssembler* masm) { | 3054 void CallICTrampolineStub::Generate(MacroAssembler* masm) { |
3063 __ EmitLoadTypeFeedbackVector(r2); | 3055 __ EmitLoadTypeFeedbackVector(r2); |
3064 CallICStub stub(isolate(), state()); | 3056 CallICStub stub(isolate(), state()); |
3065 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 3057 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
3066 } | 3058 } |
3067 | 3059 |
3068 | 3060 |
3069 static void HandleArrayCases(MacroAssembler* masm, Register feedback, | 3061 static void HandleArrayCases(MacroAssembler* masm, Register feedback, |
3070 Register receiver_map, Register scratch1, | 3062 Register receiver_map, Register scratch1, |
3071 Register scratch2, bool is_polymorphic, | 3063 Register scratch2, bool is_polymorphic, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3146 __ ldr(cached_map, FieldMemOperand(feedback, WeakCell::kValueOffset)); | 3138 __ ldr(cached_map, FieldMemOperand(feedback, WeakCell::kValueOffset)); |
3147 __ cmp(cached_map, receiver_map); | 3139 __ cmp(cached_map, receiver_map); |
3148 __ b(ne, try_array); | 3140 __ b(ne, try_array); |
3149 Register handler = feedback; | 3141 Register handler = feedback; |
3150 __ add(handler, vector, Operand::PointerOffsetFromSmiKey(slot)); | 3142 __ add(handler, vector, Operand::PointerOffsetFromSmiKey(slot)); |
3151 __ ldr(handler, | 3143 __ ldr(handler, |
3152 FieldMemOperand(handler, FixedArray::kHeaderSize + kPointerSize)); | 3144 FieldMemOperand(handler, FixedArray::kHeaderSize + kPointerSize)); |
3153 __ add(pc, handler, Operand(Code::kHeaderSize - kHeapObjectTag)); | 3145 __ add(pc, handler, Operand(Code::kHeaderSize - kHeapObjectTag)); |
3154 } | 3146 } |
3155 | 3147 |
3156 | |
3157 void KeyedLoadICStub::Generate(MacroAssembler* masm) { | |
3158 GenerateImpl(masm, false); | |
3159 } | |
3160 | |
3161 | |
3162 void KeyedLoadICStub::GenerateForTrampoline(MacroAssembler* masm) { | |
3163 GenerateImpl(masm, true); | |
3164 } | |
3165 | |
3166 | |
3167 void KeyedLoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | |
3168 Register receiver = LoadWithVectorDescriptor::ReceiverRegister(); // r1 | |
3169 Register key = LoadWithVectorDescriptor::NameRegister(); // r2 | |
3170 Register vector = LoadWithVectorDescriptor::VectorRegister(); // r3 | |
3171 Register slot = LoadWithVectorDescriptor::SlotRegister(); // r0 | |
3172 Register feedback = r4; | |
3173 Register receiver_map = r5; | |
3174 Register scratch1 = r6; | |
3175 | |
3176 __ add(feedback, vector, Operand::PointerOffsetFromSmiKey(slot)); | |
3177 __ ldr(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); | |
3178 | |
3179 // Try to quickly handle the monomorphic case without knowing for sure | |
3180 // if we have a weak cell in feedback. We do know it's safe to look | |
3181 // at WeakCell::kValueOffset. | |
3182 Label try_array, load_smi_map, compare_map; | |
3183 Label not_array, miss; | |
3184 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, slot, | |
3185 scratch1, &compare_map, &load_smi_map, &try_array); | |
3186 | |
3187 __ bind(&try_array); | |
3188 // Is it a fixed array? | |
3189 __ ldr(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset)); | |
3190 __ CompareRoot(scratch1, Heap::kFixedArrayMapRootIndex); | |
3191 __ b(ne, ¬_array); | |
3192 | |
3193 // We have a polymorphic element handler. | |
3194 Label polymorphic, try_poly_name; | |
3195 __ bind(&polymorphic); | |
3196 HandleArrayCases(masm, feedback, receiver_map, scratch1, r9, true, &miss); | |
3197 | |
3198 __ bind(¬_array); | |
3199 // Is it generic? | |
3200 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); | |
3201 __ b(ne, &try_poly_name); | |
3202 Handle<Code> megamorphic_stub = | |
3203 KeyedLoadIC::ChooseMegamorphicStub(masm->isolate(), GetExtraICState()); | |
3204 __ Jump(megamorphic_stub, RelocInfo::CODE_TARGET); | |
3205 | |
3206 __ bind(&try_poly_name); | |
3207 // We might have a name in feedback, and a fixed array in the next slot. | |
3208 __ cmp(key, feedback); | |
3209 __ b(ne, &miss); | |
3210 // If the name comparison succeeded, we know we have a fixed array with | |
3211 // at least one map/handler pair. | |
3212 __ add(feedback, vector, Operand::PointerOffsetFromSmiKey(slot)); | |
3213 __ ldr(feedback, | |
3214 FieldMemOperand(feedback, FixedArray::kHeaderSize + kPointerSize)); | |
3215 HandleArrayCases(masm, feedback, receiver_map, scratch1, r9, false, &miss); | |
3216 | |
3217 __ bind(&miss); | |
3218 KeyedLoadIC::GenerateMiss(masm); | |
3219 | |
3220 __ bind(&load_smi_map); | |
3221 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | |
3222 __ jmp(&compare_map); | |
3223 } | |
3224 | |
3225 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { | 3148 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { |
3226 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); | 3149 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); |
3227 KeyedStoreICStub stub(isolate(), state()); | 3150 KeyedStoreICStub stub(isolate(), state()); |
3228 stub.GenerateForTrampoline(masm); | 3151 stub.GenerateForTrampoline(masm); |
3229 } | 3152 } |
3230 | 3153 |
3231 void KeyedStoreICStub::Generate(MacroAssembler* masm) { | 3154 void KeyedStoreICStub::Generate(MacroAssembler* masm) { |
3232 GenerateImpl(masm, false); | 3155 GenerateImpl(masm, false); |
3233 } | 3156 } |
3234 | 3157 |
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4638 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 4561 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
4639 kStackUnwindSpace, NULL, return_value_operand, NULL); | 4562 kStackUnwindSpace, NULL, return_value_operand, NULL); |
4640 } | 4563 } |
4641 | 4564 |
4642 #undef __ | 4565 #undef __ |
4643 | 4566 |
4644 } // namespace internal | 4567 } // namespace internal |
4645 } // namespace v8 | 4568 } // namespace v8 |
4646 | 4569 |
4647 #endif // V8_TARGET_ARCH_ARM | 4570 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |