| 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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
| 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 3245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3256 __ ld(a1, MemOperand(fp, parameter_count_offset)); | 3256 __ ld(a1, MemOperand(fp, parameter_count_offset)); |
| 3257 if (function_mode() == JS_FUNCTION_STUB_MODE) { | 3257 if (function_mode() == JS_FUNCTION_STUB_MODE) { |
| 3258 __ Daddu(a1, a1, Operand(1)); | 3258 __ Daddu(a1, a1, Operand(1)); |
| 3259 } | 3259 } |
| 3260 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 3260 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 3261 __ dsll(a1, a1, kPointerSizeLog2); | 3261 __ dsll(a1, a1, kPointerSizeLog2); |
| 3262 __ Ret(USE_DELAY_SLOT); | 3262 __ Ret(USE_DELAY_SLOT); |
| 3263 __ Daddu(sp, sp, a1); | 3263 __ Daddu(sp, sp, a1); |
| 3264 } | 3264 } |
| 3265 | 3265 |
| 3266 | |
| 3267 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { | |
| 3268 __ EmitLoadTypeFeedbackVector(LoadWithVectorDescriptor::VectorRegister()); | |
| 3269 KeyedLoadICStub stub(isolate()); | |
| 3270 stub.GenerateForTrampoline(masm); | |
| 3271 } | |
| 3272 | |
| 3273 | |
| 3274 void CallICTrampolineStub::Generate(MacroAssembler* masm) { | 3266 void CallICTrampolineStub::Generate(MacroAssembler* masm) { |
| 3275 __ EmitLoadTypeFeedbackVector(a2); | 3267 __ EmitLoadTypeFeedbackVector(a2); |
| 3276 CallICStub stub(isolate(), state()); | 3268 CallICStub stub(isolate(), state()); |
| 3277 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 3269 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
| 3278 } | 3270 } |
| 3279 | 3271 |
| 3280 | 3272 |
| 3281 static void HandleArrayCases(MacroAssembler* masm, Register feedback, | 3273 static void HandleArrayCases(MacroAssembler* masm, Register feedback, |
| 3282 Register receiver_map, Register scratch1, | 3274 Register receiver_map, Register scratch1, |
| 3283 Register scratch2, bool is_polymorphic, | 3275 Register scratch2, bool is_polymorphic, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3357 __ Branch(try_array, ne, cached_map, Operand(receiver_map)); | 3349 __ Branch(try_array, ne, cached_map, Operand(receiver_map)); |
| 3358 Register handler = feedback; | 3350 Register handler = feedback; |
| 3359 __ SmiScale(handler, slot, kPointerSizeLog2); | 3351 __ SmiScale(handler, slot, kPointerSizeLog2); |
| 3360 __ Daddu(handler, vector, Operand(handler)); | 3352 __ Daddu(handler, vector, Operand(handler)); |
| 3361 __ ld(handler, | 3353 __ ld(handler, |
| 3362 FieldMemOperand(handler, FixedArray::kHeaderSize + kPointerSize)); | 3354 FieldMemOperand(handler, FixedArray::kHeaderSize + kPointerSize)); |
| 3363 __ Daddu(t9, handler, Code::kHeaderSize - kHeapObjectTag); | 3355 __ Daddu(t9, handler, Code::kHeaderSize - kHeapObjectTag); |
| 3364 __ Jump(t9); | 3356 __ Jump(t9); |
| 3365 } | 3357 } |
| 3366 | 3358 |
| 3367 | |
| 3368 void KeyedLoadICStub::Generate(MacroAssembler* masm) { | |
| 3369 GenerateImpl(masm, false); | |
| 3370 } | |
| 3371 | |
| 3372 | |
| 3373 void KeyedLoadICStub::GenerateForTrampoline(MacroAssembler* masm) { | |
| 3374 GenerateImpl(masm, true); | |
| 3375 } | |
| 3376 | |
| 3377 | |
| 3378 void KeyedLoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | |
| 3379 Register receiver = LoadWithVectorDescriptor::ReceiverRegister(); // a1 | |
| 3380 Register key = LoadWithVectorDescriptor::NameRegister(); // a2 | |
| 3381 Register vector = LoadWithVectorDescriptor::VectorRegister(); // a3 | |
| 3382 Register slot = LoadWithVectorDescriptor::SlotRegister(); // a0 | |
| 3383 Register feedback = a4; | |
| 3384 Register receiver_map = a5; | |
| 3385 Register scratch1 = a6; | |
| 3386 | |
| 3387 __ SmiScale(feedback, slot, kPointerSizeLog2); | |
| 3388 __ Daddu(feedback, vector, Operand(feedback)); | |
| 3389 __ ld(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); | |
| 3390 | |
| 3391 // Try to quickly handle the monomorphic case without knowing for sure | |
| 3392 // if we have a weak cell in feedback. We do know it's safe to look | |
| 3393 // at WeakCell::kValueOffset. | |
| 3394 Label try_array, load_smi_map, compare_map; | |
| 3395 Label not_array, miss; | |
| 3396 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, slot, | |
| 3397 scratch1, &compare_map, &load_smi_map, &try_array); | |
| 3398 | |
| 3399 __ bind(&try_array); | |
| 3400 // Is it a fixed array? | |
| 3401 __ ld(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset)); | |
| 3402 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); | |
| 3403 __ Branch(¬_array, ne, scratch1, Operand(at)); | |
| 3404 // We have a polymorphic element handler. | |
| 3405 __ JumpIfNotSmi(key, &miss); | |
| 3406 | |
| 3407 Label polymorphic, try_poly_name; | |
| 3408 __ bind(&polymorphic); | |
| 3409 HandleArrayCases(masm, feedback, receiver_map, scratch1, a7, true, &miss); | |
| 3410 | |
| 3411 __ bind(¬_array); | |
| 3412 // Is it generic? | |
| 3413 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); | |
| 3414 __ Branch(&try_poly_name, ne, feedback, Operand(at)); | |
| 3415 Handle<Code> megamorphic_stub = | |
| 3416 KeyedLoadIC::ChooseMegamorphicStub(masm->isolate(), GetExtraICState()); | |
| 3417 __ Jump(megamorphic_stub, RelocInfo::CODE_TARGET); | |
| 3418 | |
| 3419 __ bind(&try_poly_name); | |
| 3420 // We might have a name in feedback, and a fixed array in the next slot. | |
| 3421 __ Branch(&miss, ne, key, Operand(feedback)); | |
| 3422 // If the name comparison succeeded, we know we have a fixed array with | |
| 3423 // at least one map/handler pair. | |
| 3424 __ SmiScale(feedback, slot, kPointerSizeLog2); | |
| 3425 __ Daddu(feedback, vector, Operand(feedback)); | |
| 3426 __ ld(feedback, | |
| 3427 FieldMemOperand(feedback, FixedArray::kHeaderSize + kPointerSize)); | |
| 3428 HandleArrayCases(masm, feedback, receiver_map, scratch1, a7, false, &miss); | |
| 3429 | |
| 3430 __ bind(&miss); | |
| 3431 KeyedLoadIC::GenerateMiss(masm); | |
| 3432 | |
| 3433 __ bind(&load_smi_map); | |
| 3434 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | |
| 3435 __ Branch(&compare_map); | |
| 3436 } | |
| 3437 | |
| 3438 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { | 3359 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { |
| 3439 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); | 3360 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); |
| 3440 KeyedStoreICStub stub(isolate(), state()); | 3361 KeyedStoreICStub stub(isolate(), state()); |
| 3441 stub.GenerateForTrampoline(masm); | 3362 stub.GenerateForTrampoline(masm); |
| 3442 } | 3363 } |
| 3443 | 3364 |
| 3444 void KeyedStoreICStub::Generate(MacroAssembler* masm) { | 3365 void KeyedStoreICStub::Generate(MacroAssembler* masm) { |
| 3445 GenerateImpl(masm, false); | 3366 GenerateImpl(masm, false); |
| 3446 } | 3367 } |
| 3447 | 3368 |
| (...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4870 kStackUnwindSpace, kInvalidStackOffset, | 4791 kStackUnwindSpace, kInvalidStackOffset, |
| 4871 return_value_operand, NULL); | 4792 return_value_operand, NULL); |
| 4872 } | 4793 } |
| 4873 | 4794 |
| 4874 #undef __ | 4795 #undef __ |
| 4875 | 4796 |
| 4876 } // namespace internal | 4797 } // namespace internal |
| 4877 } // namespace v8 | 4798 } // namespace v8 |
| 4878 | 4799 |
| 4879 #endif // V8_TARGET_ARCH_MIPS64 | 4800 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |