OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 3120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3131 __ LoadP(r3, MemOperand(fp, parameter_count_offset)); | 3131 __ LoadP(r3, MemOperand(fp, parameter_count_offset)); |
3132 if (function_mode() == JS_FUNCTION_STUB_MODE) { | 3132 if (function_mode() == JS_FUNCTION_STUB_MODE) { |
3133 __ AddP(r3, Operand(1)); | 3133 __ AddP(r3, Operand(1)); |
3134 } | 3134 } |
3135 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 3135 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
3136 __ ShiftLeftP(r3, r3, Operand(kPointerSizeLog2)); | 3136 __ ShiftLeftP(r3, r3, Operand(kPointerSizeLog2)); |
3137 __ la(sp, MemOperand(r3, sp)); | 3137 __ la(sp, MemOperand(r3, sp)); |
3138 __ Ret(); | 3138 __ Ret(); |
3139 } | 3139 } |
3140 | 3140 |
3141 void LoadICTrampolineStub::Generate(MacroAssembler* masm) { | |
3142 __ EmitLoadTypeFeedbackVector(LoadWithVectorDescriptor::VectorRegister()); | |
3143 LoadICStub stub(isolate()); | |
3144 stub.GenerateForTrampoline(masm); | |
3145 } | |
3146 | |
3147 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { | 3141 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { |
3148 __ EmitLoadTypeFeedbackVector(LoadWithVectorDescriptor::VectorRegister()); | 3142 __ EmitLoadTypeFeedbackVector(LoadWithVectorDescriptor::VectorRegister()); |
3149 KeyedLoadICStub stub(isolate()); | 3143 KeyedLoadICStub stub(isolate()); |
3150 stub.GenerateForTrampoline(masm); | 3144 stub.GenerateForTrampoline(masm); |
3151 } | 3145 } |
3152 | 3146 |
3153 void CallICTrampolineStub::Generate(MacroAssembler* masm) { | 3147 void CallICTrampolineStub::Generate(MacroAssembler* masm) { |
3154 __ EmitLoadTypeFeedbackVector(r4); | 3148 __ EmitLoadTypeFeedbackVector(r4); |
3155 CallICStub stub(isolate(), state()); | 3149 CallICStub stub(isolate(), state()); |
3156 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 3150 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
3157 } | 3151 } |
3158 | 3152 |
3159 void LoadICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); } | |
3160 | |
3161 void LoadICStub::GenerateForTrampoline(MacroAssembler* masm) { | |
3162 GenerateImpl(masm, true); | |
3163 } | |
3164 | |
3165 static void HandleArrayCases(MacroAssembler* masm, Register feedback, | 3153 static void HandleArrayCases(MacroAssembler* masm, Register feedback, |
3166 Register receiver_map, Register scratch1, | 3154 Register receiver_map, Register scratch1, |
3167 Register scratch2, bool is_polymorphic, | 3155 Register scratch2, bool is_polymorphic, |
3168 Label* miss) { | 3156 Label* miss) { |
3169 // feedback initially contains the feedback array | 3157 // feedback initially contains the feedback array |
3170 Label next_loop, prepare_next; | 3158 Label next_loop, prepare_next; |
3171 Label start_polymorphic; | 3159 Label start_polymorphic; |
3172 | 3160 |
3173 Register cached_map = scratch1; | 3161 Register cached_map = scratch1; |
3174 | 3162 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3245 __ CmpP(cached_map, receiver_map); | 3233 __ CmpP(cached_map, receiver_map); |
3246 __ bne(try_array); | 3234 __ bne(try_array); |
3247 Register handler = feedback; | 3235 Register handler = feedback; |
3248 __ SmiToPtrArrayOffset(r1, slot); | 3236 __ SmiToPtrArrayOffset(r1, slot); |
3249 __ LoadP(handler, | 3237 __ LoadP(handler, |
3250 FieldMemOperand(r1, vector, FixedArray::kHeaderSize + kPointerSize)); | 3238 FieldMemOperand(r1, vector, FixedArray::kHeaderSize + kPointerSize)); |
3251 __ AddP(ip, handler, Operand(Code::kHeaderSize - kHeapObjectTag)); | 3239 __ AddP(ip, handler, Operand(Code::kHeaderSize - kHeapObjectTag)); |
3252 __ Jump(ip); | 3240 __ Jump(ip); |
3253 } | 3241 } |
3254 | 3242 |
3255 void LoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | |
3256 Register receiver = LoadWithVectorDescriptor::ReceiverRegister(); // r3 | |
3257 Register name = LoadWithVectorDescriptor::NameRegister(); // r4 | |
3258 Register vector = LoadWithVectorDescriptor::VectorRegister(); // r5 | |
3259 Register slot = LoadWithVectorDescriptor::SlotRegister(); // r2 | |
3260 Register feedback = r6; | |
3261 Register receiver_map = r7; | |
3262 Register scratch1 = r8; | |
3263 | |
3264 __ SmiToPtrArrayOffset(r1, slot); | |
3265 __ LoadP(feedback, FieldMemOperand(r1, vector, FixedArray::kHeaderSize)); | |
3266 | |
3267 // Try to quickly handle the monomorphic case without knowing for sure | |
3268 // if we have a weak cell in feedback. We do know it's safe to look | |
3269 // at WeakCell::kValueOffset. | |
3270 Label try_array, load_smi_map, compare_map; | |
3271 Label not_array, miss; | |
3272 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, slot, | |
3273 scratch1, &compare_map, &load_smi_map, &try_array); | |
3274 | |
3275 // Is it a fixed array? | |
3276 __ bind(&try_array); | |
3277 __ LoadP(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset)); | |
3278 __ CompareRoot(scratch1, Heap::kFixedArrayMapRootIndex); | |
3279 __ bne(¬_array, Label::kNear); | |
3280 HandleArrayCases(masm, feedback, receiver_map, scratch1, r9, true, &miss); | |
3281 | |
3282 __ bind(¬_array); | |
3283 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); | |
3284 __ bne(&miss); | |
3285 masm->isolate()->load_stub_cache()->GenerateProbe( | |
3286 masm, receiver, name, feedback, receiver_map, scratch1, r9); | |
3287 | |
3288 __ bind(&miss); | |
3289 LoadIC::GenerateMiss(masm); | |
3290 | |
3291 __ bind(&load_smi_map); | |
3292 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | |
3293 __ b(&compare_map); | |
3294 } | |
3295 | |
3296 void KeyedLoadICStub::Generate(MacroAssembler* masm) { | 3243 void KeyedLoadICStub::Generate(MacroAssembler* masm) { |
3297 GenerateImpl(masm, false); | 3244 GenerateImpl(masm, false); |
3298 } | 3245 } |
3299 | 3246 |
3300 void KeyedLoadICStub::GenerateForTrampoline(MacroAssembler* masm) { | 3247 void KeyedLoadICStub::GenerateForTrampoline(MacroAssembler* masm) { |
3301 GenerateImpl(masm, true); | 3248 GenerateImpl(masm, true); |
3302 } | 3249 } |
3303 | 3250 |
3304 void KeyedLoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | 3251 void KeyedLoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { |
3305 Register receiver = LoadWithVectorDescriptor::ReceiverRegister(); // r3 | 3252 Register receiver = LoadWithVectorDescriptor::ReceiverRegister(); // r3 |
(...skipping 1776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5082 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5029 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5083 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5030 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5084 } | 5031 } |
5085 | 5032 |
5086 #undef __ | 5033 #undef __ |
5087 | 5034 |
5088 } // namespace internal | 5035 } // namespace internal |
5089 } // namespace v8 | 5036 } // namespace v8 |
5090 | 5037 |
5091 #endif // V8_TARGET_ARCH_S390 | 5038 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |