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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 3428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3439 HandleArrayCases(masm, feedback, receiver_map, scratch1, t5, false, &miss); | 3439 HandleArrayCases(masm, feedback, receiver_map, scratch1, t5, false, &miss); |
3440 | 3440 |
3441 __ bind(&miss); | 3441 __ bind(&miss); |
3442 KeyedLoadIC::GenerateMiss(masm); | 3442 KeyedLoadIC::GenerateMiss(masm); |
3443 | 3443 |
3444 __ bind(&load_smi_map); | 3444 __ bind(&load_smi_map); |
3445 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | 3445 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); |
3446 __ jmp(&compare_map); | 3446 __ jmp(&compare_map); |
3447 } | 3447 } |
3448 | 3448 |
3449 void StoreICTrampolineStub::Generate(MacroAssembler* masm) { | |
3450 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); | |
3451 StoreICStub stub(isolate(), state()); | |
3452 stub.GenerateForTrampoline(masm); | |
3453 } | |
3454 | |
3455 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { | 3449 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { |
3456 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); | 3450 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); |
3457 KeyedStoreICStub stub(isolate(), state()); | 3451 KeyedStoreICStub stub(isolate(), state()); |
3458 stub.GenerateForTrampoline(masm); | 3452 stub.GenerateForTrampoline(masm); |
3459 } | 3453 } |
3460 | 3454 |
3461 void StoreICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); } | |
3462 | |
3463 void StoreICStub::GenerateForTrampoline(MacroAssembler* masm) { | |
3464 GenerateImpl(masm, true); | |
3465 } | |
3466 | |
3467 void StoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | |
3468 Register receiver = StoreWithVectorDescriptor::ReceiverRegister(); // a1 | |
3469 Register key = StoreWithVectorDescriptor::NameRegister(); // a2 | |
3470 Register vector = StoreWithVectorDescriptor::VectorRegister(); // a3 | |
3471 Register slot = StoreWithVectorDescriptor::SlotRegister(); // t0 | |
3472 DCHECK(StoreWithVectorDescriptor::ValueRegister().is(a0)); // a0 | |
3473 Register feedback = t1; | |
3474 Register receiver_map = t2; | |
3475 Register scratch1 = t5; | |
3476 | |
3477 __ Lsa(feedback, vector, slot, kPointerSizeLog2 - kSmiTagSize); | |
3478 __ lw(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); | |
3479 | |
3480 // Try to quickly handle the monomorphic case without knowing for sure | |
3481 // if we have a weak cell in feedback. We do know it's safe to look | |
3482 // at WeakCell::kValueOffset. | |
3483 Label try_array, load_smi_map, compare_map; | |
3484 Label not_array, miss; | |
3485 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, slot, | |
3486 scratch1, &compare_map, &load_smi_map, &try_array); | |
3487 | |
3488 // Is it a fixed array? | |
3489 __ bind(&try_array); | |
3490 __ lw(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset)); | |
3491 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); | |
3492 __ Branch(¬_array, ne, scratch1, Operand(at)); | |
3493 | |
3494 Register scratch2 = t4; | |
3495 HandleArrayCases(masm, feedback, receiver_map, scratch1, scratch2, true, | |
3496 &miss); | |
3497 | |
3498 __ bind(¬_array); | |
3499 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); | |
3500 __ Branch(&miss, ne, feedback, Operand(at)); | |
3501 masm->isolate()->store_stub_cache()->GenerateProbe( | |
3502 masm, receiver, key, feedback, receiver_map, scratch1, scratch2); | |
3503 | |
3504 __ bind(&miss); | |
3505 StoreIC::GenerateMiss(masm); | |
3506 | |
3507 __ bind(&load_smi_map); | |
3508 __ Branch(USE_DELAY_SLOT, &compare_map); | |
3509 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); // In delay slot. | |
3510 } | |
3511 | |
3512 void KeyedStoreICStub::Generate(MacroAssembler* masm) { | 3455 void KeyedStoreICStub::Generate(MacroAssembler* masm) { |
3513 GenerateImpl(masm, false); | 3456 GenerateImpl(masm, false); |
3514 } | 3457 } |
3515 | 3458 |
3516 void KeyedStoreICStub::GenerateForTrampoline(MacroAssembler* masm) { | 3459 void KeyedStoreICStub::GenerateForTrampoline(MacroAssembler* masm) { |
3517 GenerateImpl(masm, true); | 3460 GenerateImpl(masm, true); |
3518 } | 3461 } |
3519 | 3462 |
3520 | 3463 |
3521 static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register feedback, | 3464 static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register feedback, |
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5053 kStackUnwindSpace, kInvalidStackOffset, | 4996 kStackUnwindSpace, kInvalidStackOffset, |
5054 return_value_operand, NULL); | 4997 return_value_operand, NULL); |
5055 } | 4998 } |
5056 | 4999 |
5057 #undef __ | 5000 #undef __ |
5058 | 5001 |
5059 } // namespace internal | 5002 } // namespace internal |
5060 } // namespace v8 | 5003 } // namespace v8 |
5061 | 5004 |
5062 #endif // V8_TARGET_ARCH_MIPS | 5005 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |