| 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_MIPS64 | 8 #if V8_TARGET_ARCH_MIPS64 |
| 9 | 9 |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 a3); | 592 a3); |
| 593 __ Ret(); | 593 __ Ret(); |
| 594 | 594 |
| 595 __ bind(&index_name); | 595 __ bind(&index_name); |
| 596 __ IndexFromHash(a3, key); | 596 __ IndexFromHash(a3, key); |
| 597 // Now jump to the place where smi keys are handled. | 597 // Now jump to the place where smi keys are handled. |
| 598 __ Branch(&index_smi); | 598 __ Branch(&index_smi); |
| 599 } | 599 } |
| 600 | 600 |
| 601 | 601 |
| 602 static void KeyedStoreGenerateGenericHelper( | 602 static void KeyedStoreGenerateMegamorphicHelper( |
| 603 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, | 603 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, |
| 604 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length, | 604 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length, |
| 605 Register value, Register key, Register receiver, Register receiver_map, | 605 Register value, Register key, Register receiver, Register receiver_map, |
| 606 Register elements_map, Register elements) { | 606 Register elements_map, Register elements) { |
| 607 Label transition_smi_elements; | 607 Label transition_smi_elements; |
| 608 Label finish_object_store, non_double_value, transition_double_elements; | 608 Label finish_object_store, non_double_value, transition_double_elements; |
| 609 Label fast_double_without_map_check; | 609 Label fast_double_without_map_check; |
| 610 | 610 |
| 611 // Fast case: Do the store, could be either Object or double. | 611 // Fast case: Do the store, could be either Object or double. |
| 612 __ bind(fast_object); | 612 __ bind(fast_object); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS, | 742 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS, |
| 743 receiver_map, a4, slow); | 743 receiver_map, a4, slow); |
| 744 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); | 744 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); |
| 745 ElementsTransitionGenerator::GenerateDoubleToObject( | 745 ElementsTransitionGenerator::GenerateDoubleToObject( |
| 746 masm, receiver, key, value, receiver_map, mode, slow); | 746 masm, receiver, key, value, receiver_map, mode, slow); |
| 747 __ ld(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 747 __ ld(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 748 __ jmp(&finish_object_store); | 748 __ jmp(&finish_object_store); |
| 749 } | 749 } |
| 750 | 750 |
| 751 | 751 |
| 752 void KeyedStoreIC::GenerateGeneric( | 752 void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm, |
| 753 MacroAssembler* masm, StrictMode strict_mode, | 753 StrictMode strict_mode) { |
| 754 KeyedStoreStubCacheRequirement handler_requirement) { | |
| 755 // ---------- S t a t e -------------- | 754 // ---------- S t a t e -------------- |
| 756 // -- a0 : value | 755 // -- a0 : value |
| 757 // -- a1 : key | 756 // -- a1 : key |
| 758 // -- a2 : receiver | 757 // -- a2 : receiver |
| 759 // -- ra : return address | 758 // -- ra : return address |
| 760 // ----------------------------------- | 759 // ----------------------------------- |
| 761 Label slow, fast_object, fast_object_grow; | 760 Label slow, fast_object, fast_object_grow; |
| 762 Label fast_double, fast_double_grow; | 761 Label fast_double, fast_double_grow; |
| 763 Label array, extra, check_if_double_array, maybe_name_key, miss; | 762 Label array, extra, check_if_double_array, maybe_name_key, miss; |
| 764 | 763 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 | 806 |
| 808 __ bind(&maybe_name_key); | 807 __ bind(&maybe_name_key); |
| 809 __ ld(a4, FieldMemOperand(key, HeapObject::kMapOffset)); | 808 __ ld(a4, FieldMemOperand(key, HeapObject::kMapOffset)); |
| 810 __ lb(a4, FieldMemOperand(a4, Map::kInstanceTypeOffset)); | 809 __ lb(a4, FieldMemOperand(a4, Map::kInstanceTypeOffset)); |
| 811 __ JumpIfNotUniqueNameInstanceType(a4, &slow); | 810 __ JumpIfNotUniqueNameInstanceType(a4, &slow); |
| 812 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 811 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
| 813 Code::ComputeHandlerFlags(Code::STORE_IC)); | 812 Code::ComputeHandlerFlags(Code::STORE_IC)); |
| 814 masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver, | 813 masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver, |
| 815 key, a3, a4, a5, a6); | 814 key, a3, a4, a5, a6); |
| 816 // Cache miss. | 815 // Cache miss. |
| 817 if (handler_requirement == kCallRuntimeOnMissingHandler) { | 816 __ Branch(&miss); |
| 818 __ Branch(&slow); | |
| 819 } else { | |
| 820 DCHECK(handler_requirement == kMissOnMissingHandler); | |
| 821 __ Branch(&miss); | |
| 822 } | |
| 823 | 817 |
| 824 // Extra capacity case: Check if there is extra capacity to | 818 // Extra capacity case: Check if there is extra capacity to |
| 825 // perform the store and update the length. Used for adding one | 819 // perform the store and update the length. Used for adding one |
| 826 // element to the array by writing to array[array.length]. | 820 // element to the array by writing to array[array.length]. |
| 827 __ bind(&extra); | 821 __ bind(&extra); |
| 828 // Condition code from comparing key and array length is still available. | 822 // Condition code from comparing key and array length is still available. |
| 829 // Only support writing to array[array.length]. | 823 // Only support writing to array[array.length]. |
| 830 __ Branch(&slow, ne, key, Operand(a4)); | 824 __ Branch(&slow, ne, key, Operand(a4)); |
| 831 // Check for room in the elements backing store. | 825 // Check for room in the elements backing store. |
| 832 // Both the key and the length of FixedArray are smis. | 826 // Both the key and the length of FixedArray are smis. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 845 // Array case: Get the length and the elements array from the JS | 839 // Array case: Get the length and the elements array from the JS |
| 846 // array. Check that the array is in fast mode (and writable); if it | 840 // array. Check that the array is in fast mode (and writable); if it |
| 847 // is the length is always a smi. | 841 // is the length is always a smi. |
| 848 __ bind(&array); | 842 __ bind(&array); |
| 849 __ ld(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 843 __ ld(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 850 | 844 |
| 851 // Check the key against the length in the array. | 845 // Check the key against the length in the array. |
| 852 __ ld(a4, FieldMemOperand(receiver, JSArray::kLengthOffset)); | 846 __ ld(a4, FieldMemOperand(receiver, JSArray::kLengthOffset)); |
| 853 __ Branch(&extra, hs, key, Operand(a4)); | 847 __ Branch(&extra, hs, key, Operand(a4)); |
| 854 | 848 |
| 855 KeyedStoreGenerateGenericHelper( | 849 KeyedStoreGenerateMegamorphicHelper( |
| 856 masm, &fast_object, &fast_double, &slow, kCheckMap, kDontIncrementLength, | 850 masm, &fast_object, &fast_double, &slow, kCheckMap, kDontIncrementLength, |
| 857 value, key, receiver, receiver_map, elements_map, elements); | 851 value, key, receiver, receiver_map, elements_map, elements); |
| 858 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow, | 852 KeyedStoreGenerateMegamorphicHelper(masm, &fast_object_grow, |
| 859 &slow, kDontCheckMap, kIncrementLength, value, | 853 &fast_double_grow, &slow, kDontCheckMap, |
| 860 key, receiver, receiver_map, elements_map, | 854 kIncrementLength, value, key, receiver, |
| 861 elements); | 855 receiver_map, elements_map, elements); |
| 862 | 856 |
| 863 __ bind(&miss); | 857 __ bind(&miss); |
| 864 GenerateMiss(masm); | 858 GenerateMiss(masm); |
| 865 } | 859 } |
| 866 | 860 |
| 867 | 861 |
| 868 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { | 862 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { |
| 869 // Push receiver, key and value for runtime call. | 863 // Push receiver, key and value for runtime call. |
| 870 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), | 864 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), |
| 871 StoreDescriptor::ValueRegister()); | 865 StoreDescriptor::ValueRegister()); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 patcher.ChangeBranchCondition(ne); | 1011 patcher.ChangeBranchCondition(ne); |
| 1018 } else { | 1012 } else { |
| 1019 DCHECK(Assembler::IsBne(branch_instr)); | 1013 DCHECK(Assembler::IsBne(branch_instr)); |
| 1020 patcher.ChangeBranchCondition(eq); | 1014 patcher.ChangeBranchCondition(eq); |
| 1021 } | 1015 } |
| 1022 } | 1016 } |
| 1023 } | 1017 } |
| 1024 } // namespace v8::internal | 1018 } // namespace v8::internal |
| 1025 | 1019 |
| 1026 #endif // V8_TARGET_ARCH_MIPS64 | 1020 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |