| 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 2956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2967 __ Ldr(x1, MemOperand(fp, parameter_count_offset)); | 2967 __ Ldr(x1, MemOperand(fp, parameter_count_offset)); |
| 2968 if (function_mode() == JS_FUNCTION_STUB_MODE) { | 2968 if (function_mode() == JS_FUNCTION_STUB_MODE) { |
| 2969 __ Add(x1, x1, 1); | 2969 __ Add(x1, x1, 1); |
| 2970 } | 2970 } |
| 2971 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 2971 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 2972 __ Drop(x1); | 2972 __ Drop(x1); |
| 2973 // Return to IC Miss stub, continuation still on stack. | 2973 // Return to IC Miss stub, continuation still on stack. |
| 2974 __ Ret(); | 2974 __ Ret(); |
| 2975 } | 2975 } |
| 2976 | 2976 |
| 2977 | |
| 2978 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { | |
| 2979 __ EmitLoadTypeFeedbackVector(LoadWithVectorDescriptor::VectorRegister()); | |
| 2980 KeyedLoadICStub stub(isolate()); | |
| 2981 stub.GenerateForTrampoline(masm); | |
| 2982 } | |
| 2983 | |
| 2984 | |
| 2985 void CallICTrampolineStub::Generate(MacroAssembler* masm) { | 2977 void CallICTrampolineStub::Generate(MacroAssembler* masm) { |
| 2986 __ EmitLoadTypeFeedbackVector(x2); | 2978 __ EmitLoadTypeFeedbackVector(x2); |
| 2987 CallICStub stub(isolate(), state()); | 2979 CallICStub stub(isolate(), state()); |
| 2988 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 2980 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
| 2989 } | 2981 } |
| 2990 | 2982 |
| 2991 | 2983 |
| 2992 static void HandleArrayCases(MacroAssembler* masm, Register feedback, | 2984 static void HandleArrayCases(MacroAssembler* masm, Register feedback, |
| 2993 Register receiver_map, Register scratch1, | 2985 Register receiver_map, Register scratch1, |
| 2994 Register scratch2, bool is_polymorphic, | 2986 Register scratch2, bool is_polymorphic, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3072 __ B(ne, try_array); | 3064 __ B(ne, try_array); |
| 3073 | 3065 |
| 3074 Register handler = feedback; | 3066 Register handler = feedback; |
| 3075 __ Add(handler, vector, Operand::UntagSmiAndScale(slot, kPointerSizeLog2)); | 3067 __ Add(handler, vector, Operand::UntagSmiAndScale(slot, kPointerSizeLog2)); |
| 3076 __ Ldr(handler, | 3068 __ Ldr(handler, |
| 3077 FieldMemOperand(handler, FixedArray::kHeaderSize + kPointerSize)); | 3069 FieldMemOperand(handler, FixedArray::kHeaderSize + kPointerSize)); |
| 3078 __ Add(handler, handler, Code::kHeaderSize - kHeapObjectTag); | 3070 __ Add(handler, handler, Code::kHeaderSize - kHeapObjectTag); |
| 3079 __ Jump(handler); | 3071 __ Jump(handler); |
| 3080 } | 3072 } |
| 3081 | 3073 |
| 3082 | |
| 3083 void KeyedLoadICStub::Generate(MacroAssembler* masm) { | |
| 3084 GenerateImpl(masm, false); | |
| 3085 } | |
| 3086 | |
| 3087 | |
| 3088 void KeyedLoadICStub::GenerateForTrampoline(MacroAssembler* masm) { | |
| 3089 GenerateImpl(masm, true); | |
| 3090 } | |
| 3091 | |
| 3092 | |
| 3093 void KeyedLoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | |
| 3094 Register receiver = LoadWithVectorDescriptor::ReceiverRegister(); // x1 | |
| 3095 Register key = LoadWithVectorDescriptor::NameRegister(); // x2 | |
| 3096 Register vector = LoadWithVectorDescriptor::VectorRegister(); // x3 | |
| 3097 Register slot = LoadWithVectorDescriptor::SlotRegister(); // x0 | |
| 3098 Register feedback = x4; | |
| 3099 Register receiver_map = x5; | |
| 3100 Register scratch1 = x6; | |
| 3101 | |
| 3102 __ Add(feedback, vector, Operand::UntagSmiAndScale(slot, kPointerSizeLog2)); | |
| 3103 __ Ldr(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); | |
| 3104 | |
| 3105 // Try to quickly handle the monomorphic case without knowing for sure | |
| 3106 // if we have a weak cell in feedback. We do know it's safe to look | |
| 3107 // at WeakCell::kValueOffset. | |
| 3108 Label try_array, load_smi_map, compare_map; | |
| 3109 Label not_array, miss; | |
| 3110 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, slot, | |
| 3111 scratch1, &compare_map, &load_smi_map, &try_array); | |
| 3112 | |
| 3113 __ Bind(&try_array); | |
| 3114 // Is it a fixed array? | |
| 3115 __ Ldr(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset)); | |
| 3116 __ JumpIfNotRoot(scratch1, Heap::kFixedArrayMapRootIndex, ¬_array); | |
| 3117 | |
| 3118 // We have a polymorphic element handler. | |
| 3119 Label polymorphic, try_poly_name; | |
| 3120 __ Bind(&polymorphic); | |
| 3121 HandleArrayCases(masm, feedback, receiver_map, scratch1, x7, true, &miss); | |
| 3122 | |
| 3123 __ Bind(¬_array); | |
| 3124 // Is it generic? | |
| 3125 __ JumpIfNotRoot(feedback, Heap::kmegamorphic_symbolRootIndex, | |
| 3126 &try_poly_name); | |
| 3127 Handle<Code> megamorphic_stub = | |
| 3128 KeyedLoadIC::ChooseMegamorphicStub(masm->isolate(), GetExtraICState()); | |
| 3129 __ Jump(megamorphic_stub, RelocInfo::CODE_TARGET); | |
| 3130 | |
| 3131 __ Bind(&try_poly_name); | |
| 3132 // We might have a name in feedback, and a fixed array in the next slot. | |
| 3133 __ Cmp(key, feedback); | |
| 3134 __ B(ne, &miss); | |
| 3135 // If the name comparison succeeded, we know we have a fixed array with | |
| 3136 // at least one map/handler pair. | |
| 3137 __ Add(feedback, vector, Operand::UntagSmiAndScale(slot, kPointerSizeLog2)); | |
| 3138 __ Ldr(feedback, | |
| 3139 FieldMemOperand(feedback, FixedArray::kHeaderSize + kPointerSize)); | |
| 3140 HandleArrayCases(masm, feedback, receiver_map, scratch1, x7, false, &miss); | |
| 3141 | |
| 3142 __ Bind(&miss); | |
| 3143 KeyedLoadIC::GenerateMiss(masm); | |
| 3144 | |
| 3145 __ Bind(&load_smi_map); | |
| 3146 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | |
| 3147 __ jmp(&compare_map); | |
| 3148 } | |
| 3149 | |
| 3150 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { | 3074 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { |
| 3151 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); | 3075 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); |
| 3152 KeyedStoreICStub stub(isolate(), state()); | 3076 KeyedStoreICStub stub(isolate(), state()); |
| 3153 stub.GenerateForTrampoline(masm); | 3077 stub.GenerateForTrampoline(masm); |
| 3154 } | 3078 } |
| 3155 | 3079 |
| 3156 void KeyedStoreICStub::Generate(MacroAssembler* masm) { | 3080 void KeyedStoreICStub::Generate(MacroAssembler* masm) { |
| 3157 GenerateImpl(masm, false); | 3081 GenerateImpl(masm, false); |
| 3158 } | 3082 } |
| 3159 | 3083 |
| (...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4988 kStackUnwindSpace, NULL, spill_offset, | 4912 kStackUnwindSpace, NULL, spill_offset, |
| 4989 return_value_operand, NULL); | 4913 return_value_operand, NULL); |
| 4990 } | 4914 } |
| 4991 | 4915 |
| 4992 #undef __ | 4916 #undef __ |
| 4993 | 4917 |
| 4994 } // namespace internal | 4918 } // namespace internal |
| 4995 } // namespace v8 | 4919 } // namespace v8 |
| 4996 | 4920 |
| 4997 #endif // V8_TARGET_ARCH_ARM64 | 4921 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |