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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
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 2962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2973 if (function_mode() == JS_FUNCTION_STUB_MODE) { | 2973 if (function_mode() == JS_FUNCTION_STUB_MODE) { |
2974 __ Add(x1, x1, 1); | 2974 __ Add(x1, x1, 1); |
2975 } | 2975 } |
2976 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 2976 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
2977 __ Drop(x1); | 2977 __ Drop(x1); |
2978 // Return to IC Miss stub, continuation still on stack. | 2978 // Return to IC Miss stub, continuation still on stack. |
2979 __ Ret(); | 2979 __ Ret(); |
2980 } | 2980 } |
2981 | 2981 |
2982 | 2982 |
2983 void LoadICTrampolineStub::Generate(MacroAssembler* masm) { | |
2984 __ EmitLoadTypeFeedbackVector(LoadWithVectorDescriptor::VectorRegister()); | |
2985 LoadICStub stub(isolate()); | |
2986 stub.GenerateForTrampoline(masm); | |
2987 } | |
2988 | |
2989 | |
2990 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { | 2983 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { |
2991 __ EmitLoadTypeFeedbackVector(LoadWithVectorDescriptor::VectorRegister()); | 2984 __ EmitLoadTypeFeedbackVector(LoadWithVectorDescriptor::VectorRegister()); |
2992 KeyedLoadICStub stub(isolate()); | 2985 KeyedLoadICStub stub(isolate()); |
2993 stub.GenerateForTrampoline(masm); | 2986 stub.GenerateForTrampoline(masm); |
2994 } | 2987 } |
2995 | 2988 |
2996 | 2989 |
2997 void CallICTrampolineStub::Generate(MacroAssembler* masm) { | 2990 void CallICTrampolineStub::Generate(MacroAssembler* masm) { |
2998 __ EmitLoadTypeFeedbackVector(x2); | 2991 __ EmitLoadTypeFeedbackVector(x2); |
2999 CallICStub stub(isolate(), state()); | 2992 CallICStub stub(isolate(), state()); |
3000 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 2993 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
3001 } | 2994 } |
3002 | 2995 |
3003 | 2996 |
3004 void LoadICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); } | |
3005 | |
3006 | |
3007 void LoadICStub::GenerateForTrampoline(MacroAssembler* masm) { | |
3008 GenerateImpl(masm, true); | |
3009 } | |
3010 | |
3011 | |
3012 static void HandleArrayCases(MacroAssembler* masm, Register feedback, | 2997 static void HandleArrayCases(MacroAssembler* masm, Register feedback, |
3013 Register receiver_map, Register scratch1, | 2998 Register receiver_map, Register scratch1, |
3014 Register scratch2, bool is_polymorphic, | 2999 Register scratch2, bool is_polymorphic, |
3015 Label* miss) { | 3000 Label* miss) { |
3016 // feedback initially contains the feedback array | 3001 // feedback initially contains the feedback array |
3017 Label next_loop, prepare_next; | 3002 Label next_loop, prepare_next; |
3018 Label load_smi_map, compare_map; | 3003 Label load_smi_map, compare_map; |
3019 Label start_polymorphic; | 3004 Label start_polymorphic; |
3020 | 3005 |
3021 Register cached_map = scratch1; | 3006 Register cached_map = scratch1; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3093 | 3078 |
3094 Register handler = feedback; | 3079 Register handler = feedback; |
3095 __ Add(handler, vector, Operand::UntagSmiAndScale(slot, kPointerSizeLog2)); | 3080 __ Add(handler, vector, Operand::UntagSmiAndScale(slot, kPointerSizeLog2)); |
3096 __ Ldr(handler, | 3081 __ Ldr(handler, |
3097 FieldMemOperand(handler, FixedArray::kHeaderSize + kPointerSize)); | 3082 FieldMemOperand(handler, FixedArray::kHeaderSize + kPointerSize)); |
3098 __ Add(handler, handler, Code::kHeaderSize - kHeapObjectTag); | 3083 __ Add(handler, handler, Code::kHeaderSize - kHeapObjectTag); |
3099 __ Jump(handler); | 3084 __ Jump(handler); |
3100 } | 3085 } |
3101 | 3086 |
3102 | 3087 |
3103 void LoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | |
3104 Register receiver = LoadWithVectorDescriptor::ReceiverRegister(); // x1 | |
3105 Register name = LoadWithVectorDescriptor::NameRegister(); // x2 | |
3106 Register vector = LoadWithVectorDescriptor::VectorRegister(); // x3 | |
3107 Register slot = LoadWithVectorDescriptor::SlotRegister(); // x0 | |
3108 Register feedback = x4; | |
3109 Register receiver_map = x5; | |
3110 Register scratch1 = x6; | |
3111 | |
3112 __ Add(feedback, vector, Operand::UntagSmiAndScale(slot, kPointerSizeLog2)); | |
3113 __ Ldr(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); | |
3114 | |
3115 // Try to quickly handle the monomorphic case without knowing for sure | |
3116 // if we have a weak cell in feedback. We do know it's safe to look | |
3117 // at WeakCell::kValueOffset. | |
3118 Label try_array, load_smi_map, compare_map; | |
3119 Label not_array, miss; | |
3120 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, slot, | |
3121 scratch1, &compare_map, &load_smi_map, &try_array); | |
3122 | |
3123 // Is it a fixed array? | |
3124 __ Bind(&try_array); | |
3125 __ Ldr(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset)); | |
3126 __ JumpIfNotRoot(scratch1, Heap::kFixedArrayMapRootIndex, ¬_array); | |
3127 HandleArrayCases(masm, feedback, receiver_map, scratch1, x7, true, &miss); | |
3128 | |
3129 __ Bind(¬_array); | |
3130 __ JumpIfNotRoot(feedback, Heap::kmegamorphic_symbolRootIndex, &miss); | |
3131 masm->isolate()->load_stub_cache()->GenerateProbe( | |
3132 masm, receiver, name, feedback, receiver_map, scratch1, x7); | |
3133 | |
3134 __ Bind(&miss); | |
3135 LoadIC::GenerateMiss(masm); | |
3136 | |
3137 __ Bind(&load_smi_map); | |
3138 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | |
3139 __ jmp(&compare_map); | |
3140 } | |
3141 | |
3142 | |
3143 void KeyedLoadICStub::Generate(MacroAssembler* masm) { | 3088 void KeyedLoadICStub::Generate(MacroAssembler* masm) { |
3144 GenerateImpl(masm, false); | 3089 GenerateImpl(masm, false); |
3145 } | 3090 } |
3146 | 3091 |
3147 | 3092 |
3148 void KeyedLoadICStub::GenerateForTrampoline(MacroAssembler* masm) { | 3093 void KeyedLoadICStub::GenerateForTrampoline(MacroAssembler* masm) { |
3149 GenerateImpl(masm, true); | 3094 GenerateImpl(masm, true); |
3150 } | 3095 } |
3151 | 3096 |
3152 | 3097 |
(...skipping 2091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5244 kStackUnwindSpace, NULL, spill_offset, | 5189 kStackUnwindSpace, NULL, spill_offset, |
5245 return_value_operand, NULL); | 5190 return_value_operand, NULL); |
5246 } | 5191 } |
5247 | 5192 |
5248 #undef __ | 5193 #undef __ |
5249 | 5194 |
5250 } // namespace internal | 5195 } // namespace internal |
5251 } // namespace v8 | 5196 } // namespace v8 |
5252 | 5197 |
5253 #endif // V8_TARGET_ARCH_ARM64 | 5198 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |