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/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/ic/ic.h" | 8 #include "src/ic/ic.h" |
9 #include "src/ic/ic-compiler.h" | 9 #include "src/ic/ic-compiler.h" |
10 #include "src/ic/stub-cache.h" | 10 #include "src/ic/stub-cache.h" |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 // a1: key. | 668 // a1: key. |
669 // a2: receiver. | 669 // a2: receiver. |
670 PropertyICCompiler::GenerateRuntimeSetProperty(masm, language_mode); | 670 PropertyICCompiler::GenerateRuntimeSetProperty(masm, language_mode); |
671 // Never returns to here. | 671 // Never returns to here. |
672 | 672 |
673 __ bind(&maybe_name_key); | 673 __ bind(&maybe_name_key); |
674 __ lw(t0, FieldMemOperand(key, HeapObject::kMapOffset)); | 674 __ lw(t0, FieldMemOperand(key, HeapObject::kMapOffset)); |
675 __ lb(t0, FieldMemOperand(t0, Map::kInstanceTypeOffset)); | 675 __ lb(t0, FieldMemOperand(t0, Map::kInstanceTypeOffset)); |
676 __ JumpIfNotUniqueNameInstanceType(t0, &slow); | 676 __ JumpIfNotUniqueNameInstanceType(t0, &slow); |
677 | 677 |
678 if (FLAG_vector_stores) { | 678 // The handlers in the stub cache expect a vector and slot. Since we won't |
679 // The handlers in the stub cache expect a vector and slot. Since we won't | 679 // change the IC from any downstream misses, a dummy vector can be used. |
680 // change the IC from any downstream misses, a dummy vector can be used. | 680 Register vector = VectorStoreICDescriptor::VectorRegister(); |
681 Register vector = VectorStoreICDescriptor::VectorRegister(); | 681 Register slot = VectorStoreICDescriptor::SlotRegister(); |
682 Register slot = VectorStoreICDescriptor::SlotRegister(); | 682 DCHECK(!AreAliased(vector, slot, t1, t2, t4, t5)); |
683 DCHECK(!AreAliased(vector, slot, t1, t2, t4, t5)); | 683 Handle<TypeFeedbackVector> dummy_vector = |
684 Handle<TypeFeedbackVector> dummy_vector = | 684 TypeFeedbackVector::DummyVector(masm->isolate()); |
685 TypeFeedbackVector::DummyVector(masm->isolate()); | 685 int slot_index = dummy_vector->GetIndex( |
686 int slot_index = dummy_vector->GetIndex( | 686 FeedbackVectorSlot(TypeFeedbackVector::kDummyKeyedStoreICSlot)); |
687 FeedbackVectorSlot(TypeFeedbackVector::kDummyKeyedStoreICSlot)); | 687 __ LoadRoot(vector, Heap::kDummyVectorRootIndex); |
688 __ LoadRoot(vector, Heap::kDummyVectorRootIndex); | 688 __ li(slot, Operand(Smi::FromInt(slot_index))); |
689 __ li(slot, Operand(Smi::FromInt(slot_index))); | |
690 } | |
691 | 689 |
692 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 690 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
693 Code::ComputeHandlerFlags(Code::STORE_IC)); | 691 Code::ComputeHandlerFlags(Code::STORE_IC)); |
694 masm->isolate()->stub_cache()->GenerateProbe(masm, Code::STORE_IC, flags, | 692 masm->isolate()->stub_cache()->GenerateProbe(masm, Code::STORE_IC, flags, |
695 receiver, key, t1, t2, t4, t5); | 693 receiver, key, t1, t2, t4, t5); |
696 // Cache miss. | 694 // Cache miss. |
697 __ Branch(&miss); | 695 __ Branch(&miss); |
698 | 696 |
699 // Extra capacity case: Check if there is extra capacity to | 697 // Extra capacity case: Check if there is extra capacity to |
700 // perform the store and update the length. Used for adding one | 698 // perform the store and update the length. Used for adding one |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 &fast_double_grow, &slow, kDontCheckMap, | 732 &fast_double_grow, &slow, kDontCheckMap, |
735 kIncrementLength, value, key, receiver, | 733 kIncrementLength, value, key, receiver, |
736 receiver_map, elements_map, elements); | 734 receiver_map, elements_map, elements); |
737 | 735 |
738 __ bind(&miss); | 736 __ bind(&miss); |
739 GenerateMiss(masm); | 737 GenerateMiss(masm); |
740 } | 738 } |
741 | 739 |
742 | 740 |
743 static void StoreIC_PushArgs(MacroAssembler* masm) { | 741 static void StoreIC_PushArgs(MacroAssembler* masm) { |
744 if (FLAG_vector_stores) { | 742 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), |
745 __ Push(StoreDescriptor::ReceiverRegister(), | 743 StoreDescriptor::ValueRegister(), |
746 StoreDescriptor::NameRegister(), StoreDescriptor::ValueRegister(), | 744 VectorStoreICDescriptor::SlotRegister(), |
747 VectorStoreICDescriptor::SlotRegister(), | 745 VectorStoreICDescriptor::VectorRegister()); |
748 VectorStoreICDescriptor::VectorRegister()); | |
749 } else { | |
750 __ Push(StoreDescriptor::ReceiverRegister(), | |
751 StoreDescriptor::NameRegister(), StoreDescriptor::ValueRegister()); | |
752 } | |
753 } | 746 } |
754 | 747 |
755 | 748 |
756 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { | 749 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { |
757 StoreIC_PushArgs(masm); | 750 StoreIC_PushArgs(masm); |
758 | 751 |
759 int args = FLAG_vector_stores ? 5 : 3; | 752 __ TailCallRuntime(Runtime::kKeyedStoreIC_Miss, 5, 1); |
760 __ TailCallRuntime(Runtime::kKeyedStoreIC_Miss, args, 1); | |
761 } | 753 } |
762 | 754 |
763 | 755 |
764 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { | 756 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { |
765 Register receiver = StoreDescriptor::ReceiverRegister(); | 757 Register receiver = StoreDescriptor::ReceiverRegister(); |
766 Register name = StoreDescriptor::NameRegister(); | 758 Register name = StoreDescriptor::NameRegister(); |
767 DCHECK(receiver.is(a1)); | 759 DCHECK(receiver.is(a1)); |
768 DCHECK(name.is(a2)); | 760 DCHECK(name.is(a2)); |
769 DCHECK(StoreDescriptor::ValueRegister().is(a0)); | 761 DCHECK(StoreDescriptor::ValueRegister().is(a0)); |
770 | 762 |
771 // Get the receiver from the stack and probe the stub cache. | 763 // Get the receiver from the stack and probe the stub cache. |
772 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 764 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
773 Code::ComputeHandlerFlags(Code::STORE_IC)); | 765 Code::ComputeHandlerFlags(Code::STORE_IC)); |
774 masm->isolate()->stub_cache()->GenerateProbe(masm, Code::STORE_IC, flags, | 766 masm->isolate()->stub_cache()->GenerateProbe(masm, Code::STORE_IC, flags, |
775 receiver, name, a3, t0, t1, t2); | 767 receiver, name, a3, t0, t1, t2); |
776 | 768 |
777 // Cache miss: Jump to runtime. | 769 // Cache miss: Jump to runtime. |
778 GenerateMiss(masm); | 770 GenerateMiss(masm); |
779 } | 771 } |
780 | 772 |
781 | 773 |
782 void StoreIC::GenerateMiss(MacroAssembler* masm) { | 774 void StoreIC::GenerateMiss(MacroAssembler* masm) { |
783 StoreIC_PushArgs(masm); | 775 StoreIC_PushArgs(masm); |
784 | 776 |
785 // Perform tail call to the entry. | 777 // Perform tail call to the entry. |
786 int args = FLAG_vector_stores ? 5 : 3; | 778 __ TailCallRuntime(Runtime::kStoreIC_Miss, 5, 1); |
787 __ TailCallRuntime(Runtime::kStoreIC_Miss, args, 1); | |
788 } | 779 } |
789 | 780 |
790 | 781 |
791 void StoreIC::GenerateNormal(MacroAssembler* masm) { | 782 void StoreIC::GenerateNormal(MacroAssembler* masm) { |
792 Label miss; | 783 Label miss; |
793 Register receiver = StoreDescriptor::ReceiverRegister(); | 784 Register receiver = StoreDescriptor::ReceiverRegister(); |
794 Register name = StoreDescriptor::NameRegister(); | 785 Register name = StoreDescriptor::NameRegister(); |
795 Register value = StoreDescriptor::ValueRegister(); | 786 Register value = StoreDescriptor::ValueRegister(); |
796 Register dictionary = t1; | 787 Register dictionary = t1; |
797 DCHECK(receiver.is(a1)); | 788 DCHECK(receiver.is(a1)); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 break; | 925 break; |
935 default: | 926 default: |
936 UNIMPLEMENTED(); | 927 UNIMPLEMENTED(); |
937 } | 928 } |
938 patcher.ChangeBranchCondition(branch_instr, opcode); | 929 patcher.ChangeBranchCondition(branch_instr, opcode); |
939 } | 930 } |
940 } // namespace internal | 931 } // namespace internal |
941 } // namespace v8 | 932 } // namespace v8 |
942 | 933 |
943 #endif // V8_TARGET_ARCH_MIPS | 934 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |