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 | 5 |
6 #include "src/v8.h" | 6 #include "src/v8.h" |
7 | 7 |
8 #if V8_TARGET_ARCH_MIPS | 8 #if V8_TARGET_ARCH_MIPS |
9 | 9 |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 a3); | 587 a3); |
588 __ Ret(); | 588 __ Ret(); |
589 | 589 |
590 __ bind(&index_name); | 590 __ bind(&index_name); |
591 __ IndexFromHash(a3, key); | 591 __ IndexFromHash(a3, key); |
592 // Now jump to the place where smi keys are handled. | 592 // Now jump to the place where smi keys are handled. |
593 __ Branch(&index_smi); | 593 __ Branch(&index_smi); |
594 } | 594 } |
595 | 595 |
596 | 596 |
597 static void KeyedStoreGenerateGenericHelper( | 597 static void KeyedStoreGenerateMegamorphicHelper( |
598 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, | 598 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, |
599 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length, | 599 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length, |
600 Register value, Register key, Register receiver, Register receiver_map, | 600 Register value, Register key, Register receiver, Register receiver_map, |
601 Register elements_map, Register elements) { | 601 Register elements_map, Register elements) { |
602 Label transition_smi_elements; | 602 Label transition_smi_elements; |
603 Label finish_object_store, non_double_value, transition_double_elements; | 603 Label finish_object_store, non_double_value, transition_double_elements; |
604 Label fast_double_without_map_check; | 604 Label fast_double_without_map_check; |
605 | 605 |
606 // Fast case: Do the store, could be either Object or double. | 606 // Fast case: Do the store, could be either Object or double. |
607 __ bind(fast_object); | 607 __ bind(fast_object); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS, | 733 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS, |
734 receiver_map, t0, slow); | 734 receiver_map, t0, slow); |
735 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); | 735 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); |
736 ElementsTransitionGenerator::GenerateDoubleToObject( | 736 ElementsTransitionGenerator::GenerateDoubleToObject( |
737 masm, receiver, key, value, receiver_map, mode, slow); | 737 masm, receiver, key, value, receiver_map, mode, slow); |
738 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 738 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
739 __ jmp(&finish_object_store); | 739 __ jmp(&finish_object_store); |
740 } | 740 } |
741 | 741 |
742 | 742 |
743 void KeyedStoreIC::GenerateGeneric( | 743 void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm, |
744 MacroAssembler* masm, StrictMode strict_mode, | 744 StrictMode strict_mode) { |
745 KeyedStoreStubCacheRequirement handler_requirement) { | |
746 // ---------- S t a t e -------------- | 745 // ---------- S t a t e -------------- |
747 // -- a0 : value | 746 // -- a0 : value |
748 // -- a1 : key | 747 // -- a1 : key |
749 // -- a2 : receiver | 748 // -- a2 : receiver |
750 // -- ra : return address | 749 // -- ra : return address |
751 // ----------------------------------- | 750 // ----------------------------------- |
752 Label slow, fast_object, fast_object_grow; | 751 Label slow, fast_object, fast_object_grow; |
753 Label fast_double, fast_double_grow; | 752 Label fast_double, fast_double_grow; |
754 Label array, extra, check_if_double_array, maybe_name_key, miss; | 753 Label array, extra, check_if_double_array, maybe_name_key, miss; |
755 | 754 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 | 797 |
799 __ bind(&maybe_name_key); | 798 __ bind(&maybe_name_key); |
800 __ lw(t0, FieldMemOperand(key, HeapObject::kMapOffset)); | 799 __ lw(t0, FieldMemOperand(key, HeapObject::kMapOffset)); |
801 __ lb(t0, FieldMemOperand(t0, Map::kInstanceTypeOffset)); | 800 __ lb(t0, FieldMemOperand(t0, Map::kInstanceTypeOffset)); |
802 __ JumpIfNotUniqueNameInstanceType(t0, &slow); | 801 __ JumpIfNotUniqueNameInstanceType(t0, &slow); |
803 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 802 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
804 Code::ComputeHandlerFlags(Code::STORE_IC)); | 803 Code::ComputeHandlerFlags(Code::STORE_IC)); |
805 masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver, | 804 masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver, |
806 key, a3, t0, t1, t2); | 805 key, a3, t0, t1, t2); |
807 // Cache miss. | 806 // Cache miss. |
808 if (handler_requirement == kCallRuntimeOnMissingHandler) { | 807 __ Branch(&miss); |
809 __ Branch(&slow); | |
810 } else { | |
811 DCHECK(handler_requirement == kMissOnMissingHandler); | |
812 __ Branch(&miss); | |
813 } | |
814 | 808 |
815 // Extra capacity case: Check if there is extra capacity to | 809 // Extra capacity case: Check if there is extra capacity to |
816 // perform the store and update the length. Used for adding one | 810 // perform the store and update the length. Used for adding one |
817 // element to the array by writing to array[array.length]. | 811 // element to the array by writing to array[array.length]. |
818 __ bind(&extra); | 812 __ bind(&extra); |
819 // Condition code from comparing key and array length is still available. | 813 // Condition code from comparing key and array length is still available. |
820 // Only support writing to array[array.length]. | 814 // Only support writing to array[array.length]. |
821 __ Branch(&slow, ne, key, Operand(t0)); | 815 __ Branch(&slow, ne, key, Operand(t0)); |
822 // Check for room in the elements backing store. | 816 // Check for room in the elements backing store. |
823 // Both the key and the length of FixedArray are smis. | 817 // Both the key and the length of FixedArray are smis. |
(...skipping 12 matching lines...) Expand all Loading... |
836 // Array case: Get the length and the elements array from the JS | 830 // Array case: Get the length and the elements array from the JS |
837 // array. Check that the array is in fast mode (and writable); if it | 831 // array. Check that the array is in fast mode (and writable); if it |
838 // is the length is always a smi. | 832 // is the length is always a smi. |
839 __ bind(&array); | 833 __ bind(&array); |
840 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 834 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
841 | 835 |
842 // Check the key against the length in the array. | 836 // Check the key against the length in the array. |
843 __ lw(t0, FieldMemOperand(receiver, JSArray::kLengthOffset)); | 837 __ lw(t0, FieldMemOperand(receiver, JSArray::kLengthOffset)); |
844 __ Branch(&extra, hs, key, Operand(t0)); | 838 __ Branch(&extra, hs, key, Operand(t0)); |
845 | 839 |
846 KeyedStoreGenerateGenericHelper( | 840 KeyedStoreGenerateMegamorphicHelper( |
847 masm, &fast_object, &fast_double, &slow, kCheckMap, kDontIncrementLength, | 841 masm, &fast_object, &fast_double, &slow, kCheckMap, kDontIncrementLength, |
848 value, key, receiver, receiver_map, elements_map, elements); | 842 value, key, receiver, receiver_map, elements_map, elements); |
849 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow, | 843 KeyedStoreGenerateMegamorphicHelper(masm, &fast_object_grow, |
850 &slow, kDontCheckMap, kIncrementLength, value, | 844 &fast_double_grow, &slow, kDontCheckMap, |
851 key, receiver, receiver_map, elements_map, | 845 kIncrementLength, value, key, receiver, |
852 elements); | 846 receiver_map, elements_map, elements); |
853 | 847 |
854 __ bind(&miss); | 848 __ bind(&miss); |
855 GenerateMiss(masm); | 849 GenerateMiss(masm); |
856 } | 850 } |
857 | 851 |
858 | 852 |
859 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { | 853 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { |
860 // Push receiver, key and value for runtime call. | 854 // Push receiver, key and value for runtime call. |
861 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), | 855 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), |
862 StoreDescriptor::ValueRegister()); | 856 StoreDescriptor::ValueRegister()); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 patcher.ChangeBranchCondition(ne); | 1004 patcher.ChangeBranchCondition(ne); |
1011 } else { | 1005 } else { |
1012 DCHECK(Assembler::IsBne(branch_instr)); | 1006 DCHECK(Assembler::IsBne(branch_instr)); |
1013 patcher.ChangeBranchCondition(eq); | 1007 patcher.ChangeBranchCondition(eq); |
1014 } | 1008 } |
1015 } | 1009 } |
1016 } | 1010 } |
1017 } // namespace v8::internal | 1011 } // namespace v8::internal |
1018 | 1012 |
1019 #endif // V8_TARGET_ARCH_MIPS | 1013 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |