OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/ic/call-optimization.h" | 9 #include "src/ic/call-optimization.h" |
10 #include "src/ic/ic-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 #define __ ACCESS_MASM(masm) | 15 #define __ ACCESS_MASM(masm) |
16 | 16 |
17 | 17 |
| 18 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( |
| 19 MacroAssembler* masm, Handle<HeapType> type, Register receiver, |
| 20 Handle<JSFunction> getter) { |
| 21 // ----------- S t a t e ------------- |
| 22 // -- a0 : receiver |
| 23 // -- a2 : name |
| 24 // -- ra : return address |
| 25 // ----------------------------------- |
| 26 { |
| 27 FrameScope scope(masm, StackFrame::INTERNAL); |
| 28 |
| 29 if (!getter.is_null()) { |
| 30 // Call the JavaScript getter with the receiver on the stack. |
| 31 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
| 32 // Swap in the global receiver. |
| 33 __ lw(receiver, |
| 34 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
| 35 } |
| 36 __ push(receiver); |
| 37 ParameterCount actual(0); |
| 38 ParameterCount expected(getter); |
| 39 __ InvokeFunction(getter, expected, actual, CALL_FUNCTION, |
| 40 NullCallWrapper()); |
| 41 } else { |
| 42 // If we generate a global code snippet for deoptimization only, remember |
| 43 // the place to continue after deoptimization. |
| 44 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); |
| 45 } |
| 46 |
| 47 // Restore context register. |
| 48 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 49 } |
| 50 __ Ret(); |
| 51 } |
| 52 |
| 53 |
| 54 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( |
| 55 MacroAssembler* masm, Handle<HeapType> type, Register receiver, |
| 56 Handle<JSFunction> setter) { |
| 57 // ----------- S t a t e ------------- |
| 58 // -- ra : return address |
| 59 // ----------------------------------- |
| 60 { |
| 61 FrameScope scope(masm, StackFrame::INTERNAL); |
| 62 |
| 63 // Save value register, so we can restore it later. |
| 64 __ push(value()); |
| 65 |
| 66 if (!setter.is_null()) { |
| 67 // Call the JavaScript setter with receiver and value on the stack. |
| 68 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
| 69 // Swap in the global receiver. |
| 70 __ lw(receiver, |
| 71 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
| 72 } |
| 73 __ Push(receiver, value()); |
| 74 ParameterCount actual(1); |
| 75 ParameterCount expected(setter); |
| 76 __ InvokeFunction(setter, expected, actual, CALL_FUNCTION, |
| 77 NullCallWrapper()); |
| 78 } else { |
| 79 // If we generate a global code snippet for deoptimization only, remember |
| 80 // the place to continue after deoptimization. |
| 81 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
| 82 } |
| 83 |
| 84 // We have to return the passed value, not the return value of the setter. |
| 85 __ pop(v0); |
| 86 |
| 87 // Restore context register. |
| 88 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 89 } |
| 90 __ Ret(); |
| 91 } |
| 92 |
| 93 |
18 void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( | 94 void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( |
19 MacroAssembler* masm, Label* miss_label, Register receiver, | 95 MacroAssembler* masm, Label* miss_label, Register receiver, |
20 Handle<Name> name, Register scratch0, Register scratch1) { | 96 Handle<Name> name, Register scratch0, Register scratch1) { |
21 DCHECK(name->IsUniqueName()); | 97 DCHECK(name->IsUniqueName()); |
22 DCHECK(!receiver.is(scratch0)); | 98 DCHECK(!receiver.is(scratch0)); |
23 Counters* counters = masm->isolate()->counters(); | 99 Counters* counters = masm->isolate()->counters(); |
24 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); | 100 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); |
25 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); | 101 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); |
26 | 102 |
27 Label done; | 103 Label done; |
28 | 104 |
29 const int kInterceptorOrAccessCheckNeededMask = | 105 const int kInterceptorOrAccessCheckNeededMask = |
30 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); | 106 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); |
31 | 107 |
32 // Bail out if the receiver has a named interceptor or requires access checks. | 108 // Bail out if the receiver has a named interceptor or requires access checks. |
33 Register map = scratch1; | 109 Register map = scratch1; |
34 __ lw(map, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 110 __ lw(map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
35 __ lbu(scratch0, FieldMemOperand(map, Map::kBitFieldOffset)); | 111 __ lbu(scratch0, FieldMemOperand(map, Map::kBitFieldOffset)); |
36 __ And(scratch0, scratch0, Operand(kInterceptorOrAccessCheckNeededMask)); | 112 __ And(scratch0, scratch0, Operand(kInterceptorOrAccessCheckNeededMask)); |
37 __ Branch(miss_label, ne, scratch0, Operand(zero_reg)); | 113 __ Branch(miss_label, ne, scratch0, Operand(zero_reg)); |
38 | 114 |
39 // Check that receiver is a JSObject. | 115 // Check that receiver is a JSObject. |
40 __ lbu(scratch0, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 116 __ lbu(scratch0, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 161 |
86 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( | 162 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( |
87 MacroAssembler* masm, Register receiver, Register scratch1, | 163 MacroAssembler* masm, Register receiver, Register scratch1, |
88 Register scratch2, Label* miss_label) { | 164 Register scratch2, Label* miss_label) { |
89 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 165 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
90 __ Ret(USE_DELAY_SLOT); | 166 __ Ret(USE_DELAY_SLOT); |
91 __ mov(v0, scratch1); | 167 __ mov(v0, scratch1); |
92 } | 168 } |
93 | 169 |
94 | 170 |
| 171 // Generate code to check that a global property cell is empty. Create |
| 172 // the property cell at compilation time if no cell exists for the |
| 173 // property. |
95 void PropertyHandlerCompiler::GenerateCheckPropertyCell( | 174 void PropertyHandlerCompiler::GenerateCheckPropertyCell( |
96 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, | 175 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, |
97 Register scratch, Label* miss) { | 176 Register scratch, Label* miss) { |
98 Handle<Cell> cell = JSGlobalObject::EnsurePropertyCell(global, name); | 177 Handle<Cell> cell = JSGlobalObject::EnsurePropertyCell(global, name); |
99 DCHECK(cell->value()->IsTheHole()); | 178 DCHECK(cell->value()->IsTheHole()); |
100 __ li(scratch, Operand(cell)); | 179 __ li(scratch, Operand(cell)); |
101 __ lw(scratch, FieldMemOperand(scratch, Cell::kValueOffset)); | 180 __ lw(scratch, FieldMemOperand(scratch, Cell::kValueOffset)); |
102 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 181 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
103 __ Branch(miss, ne, scratch, Operand(at)); | 182 __ Branch(miss, ne, scratch, Operand(at)); |
104 } | 183 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL; | 274 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL; |
196 ExternalReference ref = ExternalReference(&fun, type, masm->isolate()); | 275 ExternalReference ref = ExternalReference(&fun, type, masm->isolate()); |
197 __ li(api_function_address, Operand(ref)); | 276 __ li(api_function_address, Operand(ref)); |
198 | 277 |
199 // Jump to stub. | 278 // Jump to stub. |
200 CallApiFunctionStub stub(isolate, is_store, call_data_undefined, argc); | 279 CallApiFunctionStub stub(isolate, is_store, call_data_undefined, argc); |
201 __ TailCallStub(&stub); | 280 __ TailCallStub(&stub); |
202 } | 281 } |
203 | 282 |
204 | 283 |
| 284 void ElementHandlerCompiler::GenerateLoadDictionaryElement( |
| 285 MacroAssembler* masm) { |
| 286 // The return address is in ra. |
| 287 Label slow, miss; |
| 288 |
| 289 Register key = LoadIC::NameRegister(); |
| 290 Register receiver = LoadIC::ReceiverRegister(); |
| 291 DCHECK(receiver.is(a1)); |
| 292 DCHECK(key.is(a2)); |
| 293 |
| 294 __ UntagAndJumpIfNotSmi(t2, key, &miss); |
| 295 __ lw(t0, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 296 __ LoadFromNumberDictionary(&slow, t0, key, v0, t2, a3, t1); |
| 297 __ Ret(); |
| 298 |
| 299 // Slow case, key and receiver still unmodified. |
| 300 __ bind(&slow); |
| 301 __ IncrementCounter( |
| 302 masm->isolate()->counters()->keyed_load_external_array_slow(), 1, a2, a3); |
| 303 |
| 304 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Slow); |
| 305 |
| 306 // Miss case, call the runtime. |
| 307 __ bind(&miss); |
| 308 |
| 309 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 310 } |
| 311 |
| 312 |
205 #undef __ | 313 #undef __ |
206 #define __ ACCESS_MASM(masm()) | 314 #define __ ACCESS_MASM(masm()) |
207 | 315 |
208 | 316 |
209 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, | 317 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, |
210 Handle<Name> name) { | 318 Handle<Name> name) { |
211 if (!label->is_unused()) { | 319 if (!label->is_unused()) { |
212 __ bind(label); | 320 __ bind(label); |
213 __ li(this->name(), Operand(name)); | 321 __ li(this->name(), Operand(name)); |
214 } | 322 } |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 // Do tail-call to the runtime system. | 781 // Do tail-call to the runtime system. |
674 ExternalReference store_callback_property = | 782 ExternalReference store_callback_property = |
675 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 783 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
676 __ TailCallExternalReference(store_callback_property, 5, 1); | 784 __ TailCallExternalReference(store_callback_property, 5, 1); |
677 | 785 |
678 // Return the generated code. | 786 // Return the generated code. |
679 return GetCode(kind(), Code::FAST, name); | 787 return GetCode(kind(), Code::FAST, name); |
680 } | 788 } |
681 | 789 |
682 | 790 |
683 #undef __ | |
684 #define __ ACCESS_MASM(masm) | |
685 | |
686 | |
687 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( | |
688 MacroAssembler* masm, Handle<HeapType> type, Register receiver, | |
689 Handle<JSFunction> setter) { | |
690 // ----------- S t a t e ------------- | |
691 // -- ra : return address | |
692 // ----------------------------------- | |
693 { | |
694 FrameScope scope(masm, StackFrame::INTERNAL); | |
695 | |
696 // Save value register, so we can restore it later. | |
697 __ push(value()); | |
698 | |
699 if (!setter.is_null()) { | |
700 // Call the JavaScript setter with receiver and value on the stack. | |
701 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | |
702 // Swap in the global receiver. | |
703 __ lw(receiver, | |
704 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | |
705 } | |
706 __ Push(receiver, value()); | |
707 ParameterCount actual(1); | |
708 ParameterCount expected(setter); | |
709 __ InvokeFunction(setter, expected, actual, CALL_FUNCTION, | |
710 NullCallWrapper()); | |
711 } else { | |
712 // If we generate a global code snippet for deoptimization only, remember | |
713 // the place to continue after deoptimization. | |
714 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); | |
715 } | |
716 | |
717 // We have to return the passed value, not the return value of the setter. | |
718 __ pop(v0); | |
719 | |
720 // Restore context register. | |
721 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
722 } | |
723 __ Ret(); | |
724 } | |
725 | |
726 | |
727 #undef __ | |
728 #define __ ACCESS_MASM(masm()) | |
729 | |
730 | |
731 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( | 791 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( |
732 Handle<Name> name) { | 792 Handle<Name> name) { |
733 __ Push(receiver(), this->name(), value()); | 793 __ Push(receiver(), this->name(), value()); |
734 | 794 |
735 // Do tail-call to the runtime system. | 795 // Do tail-call to the runtime system. |
736 ExternalReference store_ic_property = ExternalReference( | 796 ExternalReference store_ic_property = ExternalReference( |
737 IC_Utility(IC::kStorePropertyWithInterceptor), isolate()); | 797 IC_Utility(IC::kStorePropertyWithInterceptor), isolate()); |
738 __ TailCallExternalReference(store_ic_property, 3, 1); | 798 __ TailCallExternalReference(store_ic_property, 3, 1); |
739 | 799 |
740 // Return the generated code. | 800 // Return the generated code. |
741 return GetCode(kind(), Code::FAST, name); | 801 return GetCode(kind(), Code::FAST, name); |
742 } | 802 } |
743 | 803 |
744 | 804 |
745 Register NamedStoreHandlerCompiler::value() { return StoreIC::ValueRegister(); } | 805 Register NamedStoreHandlerCompiler::value() { return StoreIC::ValueRegister(); } |
746 | 806 |
747 | 807 |
748 #undef __ | |
749 #define __ ACCESS_MASM(masm) | |
750 | |
751 | |
752 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( | |
753 MacroAssembler* masm, Handle<HeapType> type, Register receiver, | |
754 Handle<JSFunction> getter) { | |
755 // ----------- S t a t e ------------- | |
756 // -- a0 : receiver | |
757 // -- a2 : name | |
758 // -- ra : return address | |
759 // ----------------------------------- | |
760 { | |
761 FrameScope scope(masm, StackFrame::INTERNAL); | |
762 | |
763 if (!getter.is_null()) { | |
764 // Call the JavaScript getter with the receiver on the stack. | |
765 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | |
766 // Swap in the global receiver. | |
767 __ lw(receiver, | |
768 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | |
769 } | |
770 __ push(receiver); | |
771 ParameterCount actual(0); | |
772 ParameterCount expected(getter); | |
773 __ InvokeFunction(getter, expected, actual, CALL_FUNCTION, | |
774 NullCallWrapper()); | |
775 } else { | |
776 // If we generate a global code snippet for deoptimization only, remember | |
777 // the place to continue after deoptimization. | |
778 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); | |
779 } | |
780 | |
781 // Restore context register. | |
782 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
783 } | |
784 __ Ret(); | |
785 } | |
786 | |
787 | |
788 #undef __ | |
789 #define __ ACCESS_MASM(masm()) | |
790 | |
791 | |
792 Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal( | 808 Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal( |
793 Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) { | 809 Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) { |
794 Label miss; | 810 Label miss; |
795 | 811 |
796 FrontendHeader(receiver(), name, &miss); | 812 FrontendHeader(receiver(), name, &miss); |
797 | 813 |
798 // Get the value from the cell. | 814 // Get the value from the cell. |
799 Register result = StoreIC::ValueRegister(); | 815 Register result = StoreIC::ValueRegister(); |
800 __ li(result, Operand(cell)); | 816 __ li(result, Operand(cell)); |
801 __ lw(result, FieldMemOperand(result, Cell::kValueOffset)); | 817 __ lw(result, FieldMemOperand(result, Cell::kValueOffset)); |
802 | 818 |
803 // Check for deleted property if property can actually be deleted. | 819 // Check for deleted property if property can actually be deleted. |
804 if (is_configurable) { | 820 if (is_configurable) { |
805 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 821 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
806 __ Branch(&miss, eq, result, Operand(at)); | 822 __ Branch(&miss, eq, result, Operand(at)); |
807 } | 823 } |
808 | 824 |
809 Counters* counters = isolate()->counters(); | 825 Counters* counters = isolate()->counters(); |
810 __ IncrementCounter(counters->named_load_global_stub(), 1, a1, a3); | 826 __ IncrementCounter(counters->named_load_global_stub(), 1, a1, a3); |
811 __ Ret(USE_DELAY_SLOT); | 827 __ Ret(USE_DELAY_SLOT); |
812 __ mov(v0, result); | 828 __ mov(v0, result); |
813 | 829 |
814 FrontendFooter(name, &miss); | 830 FrontendFooter(name, &miss); |
815 | 831 |
816 // Return the generated code. | 832 // Return the generated code. |
817 return GetCode(kind(), Code::NORMAL, name); | 833 return GetCode(kind(), Code::NORMAL, name); |
818 } | 834 } |
819 | 835 |
820 | 836 |
821 Handle<Code> PropertyICCompiler::CompilePolymorphic(TypeHandleList* types, | |
822 CodeHandleList* handlers, | |
823 Handle<Name> name, | |
824 Code::StubType type, | |
825 IcCheckType check) { | |
826 Label miss; | |
827 | |
828 if (check == PROPERTY && | |
829 (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC)) { | |
830 // In case we are compiling an IC for dictionary loads and stores, just | |
831 // check whether the name is unique. | |
832 if (name.is_identical_to(isolate()->factory()->normal_ic_symbol())) { | |
833 __ JumpIfNotUniqueName(this->name(), &miss); | |
834 } else { | |
835 __ Branch(&miss, ne, this->name(), Operand(name)); | |
836 } | |
837 } | |
838 | |
839 Label number_case; | |
840 Register match = scratch2(); | |
841 Label* smi_target = IncludesNumberType(types) ? &number_case : &miss; | |
842 __ JumpIfSmi(receiver(), smi_target, match); // Reg match is 0 if Smi. | |
843 | |
844 // Polymorphic keyed stores may use the map register | |
845 Register map_reg = scratch1(); | |
846 DCHECK(kind() != Code::KEYED_STORE_IC || | |
847 map_reg.is(KeyedStoreIC::MapRegister())); | |
848 | |
849 int receiver_count = types->length(); | |
850 int number_of_handled_maps = 0; | |
851 __ lw(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); | |
852 for (int current = 0; current < receiver_count; ++current) { | |
853 Handle<HeapType> type = types->at(current); | |
854 Handle<Map> map = IC::TypeToMap(*type, isolate()); | |
855 if (!map->is_deprecated()) { | |
856 number_of_handled_maps++; | |
857 // Check map and tail call if there's a match. | |
858 // Separate compare from branch, to provide path for above JumpIfSmi(). | |
859 __ Subu(match, map_reg, Operand(map)); | |
860 if (type->Is(HeapType::Number())) { | |
861 DCHECK(!number_case.is_unused()); | |
862 __ bind(&number_case); | |
863 } | |
864 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET, eq, match, | |
865 Operand(zero_reg)); | |
866 } | |
867 } | |
868 DCHECK(number_of_handled_maps != 0); | |
869 | |
870 __ bind(&miss); | |
871 TailCallBuiltin(masm(), MissBuiltin(kind())); | |
872 | |
873 // Return the generated code. | |
874 InlineCacheState state = | |
875 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; | |
876 return GetCode(kind(), type, name, state); | |
877 } | |
878 | |
879 | |
880 Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( | |
881 MapHandleList* receiver_maps, CodeHandleList* handler_stubs, | |
882 MapHandleList* transitioned_maps) { | |
883 Label miss; | |
884 __ JumpIfSmi(receiver(), &miss); | |
885 | |
886 int receiver_count = receiver_maps->length(); | |
887 __ lw(scratch1(), FieldMemOperand(receiver(), HeapObject::kMapOffset)); | |
888 for (int i = 0; i < receiver_count; ++i) { | |
889 if (transitioned_maps->at(i).is_null()) { | |
890 __ Jump(handler_stubs->at(i), RelocInfo::CODE_TARGET, eq, scratch1(), | |
891 Operand(receiver_maps->at(i))); | |
892 } else { | |
893 Label next_map; | |
894 __ Branch(&next_map, ne, scratch1(), Operand(receiver_maps->at(i))); | |
895 __ li(transition_map(), Operand(transitioned_maps->at(i))); | |
896 __ Jump(handler_stubs->at(i), RelocInfo::CODE_TARGET); | |
897 __ bind(&next_map); | |
898 } | |
899 } | |
900 | |
901 __ bind(&miss); | |
902 TailCallBuiltin(masm(), MissBuiltin(kind())); | |
903 | |
904 // Return the generated code. | |
905 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); | |
906 } | |
907 | |
908 | |
909 #undef __ | |
910 #define __ ACCESS_MASM(masm) | |
911 | |
912 | |
913 void ElementHandlerCompiler::GenerateLoadDictionaryElement( | |
914 MacroAssembler* masm) { | |
915 // The return address is in ra. | |
916 Label slow, miss; | |
917 | |
918 Register key = LoadIC::NameRegister(); | |
919 Register receiver = LoadIC::ReceiverRegister(); | |
920 DCHECK(receiver.is(a1)); | |
921 DCHECK(key.is(a2)); | |
922 | |
923 __ UntagAndJumpIfNotSmi(t2, key, &miss); | |
924 __ lw(t0, FieldMemOperand(receiver, JSObject::kElementsOffset)); | |
925 __ LoadFromNumberDictionary(&slow, t0, key, v0, t2, a3, t1); | |
926 __ Ret(); | |
927 | |
928 // Slow case, key and receiver still unmodified. | |
929 __ bind(&slow); | |
930 __ IncrementCounter( | |
931 masm->isolate()->counters()->keyed_load_external_array_slow(), 1, a2, a3); | |
932 | |
933 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Slow); | |
934 | |
935 // Miss case, call the runtime. | |
936 __ bind(&miss); | |
937 | |
938 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | |
939 } | |
940 | |
941 | |
942 void PropertyICCompiler::GenerateRuntimeSetProperty(MacroAssembler* masm, | |
943 StrictMode strict_mode) { | |
944 __ Push(StoreIC::ReceiverRegister(), StoreIC::NameRegister(), | |
945 StoreIC::ValueRegister()); | |
946 | |
947 __ li(a0, Operand(Smi::FromInt(strict_mode))); | |
948 __ Push(a0); | |
949 | |
950 // Do tail-call to runtime routine. | |
951 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); | |
952 } | |
953 | |
954 | |
955 #undef __ | 837 #undef __ |
956 } | 838 } |
957 } // namespace v8::internal | 839 } // namespace v8::internal |
958 | 840 |
959 #endif // V8_TARGET_ARCH_MIPS | 841 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |