| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 Handle<JSObject> holder_obj, | 763 Handle<JSObject> holder_obj, |
| 764 IC::UtilityId id) { | 764 IC::UtilityId id) { |
| 765 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 765 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
| 766 __ CallExternalReference( | 766 __ CallExternalReference( |
| 767 ExternalReference(IC_Utility(id), masm->isolate()), | 767 ExternalReference(IC_Utility(id), masm->isolate()), |
| 768 StubCache::kInterceptorArgsLength); | 768 StubCache::kInterceptorArgsLength); |
| 769 } | 769 } |
| 770 | 770 |
| 771 | 771 |
| 772 // Generate call to api function. | 772 // Generate call to api function. |
| 773 void StubCompiler::GenerateFastApiCall(MacroAssembler* masm, | 773 static void GenerateFastApiCall(MacroAssembler* masm, |
| 774 const CallOptimization& optimization, | 774 const CallOptimization& optimization, |
| 775 Handle<Map> receiver_map, | 775 Handle<Map> receiver_map, |
| 776 Register receiver, | 776 Register receiver, |
| 777 Register scratch_in, | 777 Register scratch_in, |
| 778 bool is_store, | 778 int argc, |
| 779 int argc, | 779 Register* values) { |
| 780 Register* values) { | |
| 781 ASSERT(!receiver.is(scratch_in)); | 780 ASSERT(!receiver.is(scratch_in)); |
| 782 // Preparing to push, adjust sp. | 781 // Preparing to push, adjust sp. |
| 783 __ Subu(sp, sp, Operand((argc + 1) * kPointerSize)); | 782 __ Subu(sp, sp, Operand((argc + 1) * kPointerSize)); |
| 784 __ sw(receiver, MemOperand(sp, argc * kPointerSize)); // Push receiver. | 783 __ sw(receiver, MemOperand(sp, argc * kPointerSize)); // Push receiver. |
| 785 // Write the arguments to stack frame. | 784 // Write the arguments to stack frame. |
| 786 for (int i = 0; i < argc; i++) { | 785 for (int i = 0; i < argc; i++) { |
| 787 Register arg = values[argc-1-i]; | 786 Register arg = values[argc-1-i]; |
| 788 ASSERT(!receiver.is(arg)); | 787 ASSERT(!receiver.is(arg)); |
| 789 ASSERT(!scratch_in.is(arg)); | 788 ASSERT(!scratch_in.is(arg)); |
| 790 __ sw(arg, MemOperand(sp, (argc-1-i) * kPointerSize)); // Push arg. | 789 __ sw(arg, MemOperand(sp, (argc-1-i) * kPointerSize)); // Push arg. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 Address function_address = v8::ToCData<Address>(api_call_info->callback()); | 836 Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
| 838 ApiFunction fun(function_address); | 837 ApiFunction fun(function_address); |
| 839 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL; | 838 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL; |
| 840 ExternalReference ref = | 839 ExternalReference ref = |
| 841 ExternalReference(&fun, | 840 ExternalReference(&fun, |
| 842 type, | 841 type, |
| 843 masm->isolate()); | 842 masm->isolate()); |
| 844 __ li(api_function_address, Operand(ref)); | 843 __ li(api_function_address, Operand(ref)); |
| 845 | 844 |
| 846 // Jump to stub. | 845 // Jump to stub. |
| 847 CallApiFunctionStub stub(is_store, call_data_undefined, argc); | 846 CallApiFunctionStub stub(true, call_data_undefined, argc); |
| 848 __ TailCallStub(&stub); | 847 __ TailCallStub(&stub); |
| 849 } | 848 } |
| 850 | 849 |
| 851 | 850 |
| 852 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) { | 851 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) { |
| 853 __ Jump(code, RelocInfo::CODE_TARGET); | 852 __ Jump(code, RelocInfo::CODE_TARGET); |
| 854 } | 853 } |
| 855 | 854 |
| 856 | 855 |
| 857 #undef __ | 856 #undef __ |
| 858 #define __ ACCESS_MASM(masm()) | 857 #define __ ACCESS_MASM(masm()) |
| 859 | 858 |
| 860 | 859 |
| 861 Register StubCompiler::CheckPrototypes(Handle<HeapType> type, | 860 Register StubCompiler::CheckPrototypes(Handle<HeapType> type, |
| 862 Register object_reg, | 861 Register object_reg, |
| 863 Handle<JSObject> holder, | 862 Handle<JSObject> holder, |
| 864 Register holder_reg, | 863 Register holder_reg, |
| 865 Register scratch1, | 864 Register scratch1, |
| 866 Register scratch2, | 865 Register scratch2, |
| 867 Handle<Name> name, | 866 Handle<Name> name, |
| 868 Label* miss, | 867 Label* miss, |
| 869 PrototypeCheckType check) { | 868 PrototypeCheckType check) { |
| 870 Handle<Map> receiver_map(IC::TypeToMap(*type, isolate())); | 869 Handle<Map> receiver_map(IC::TypeToMap(*type, isolate())); |
| 870 // Make sure that the type feedback oracle harvests the receiver map. |
| 871 // TODO(svenpanne) Remove this hack when all ICs are reworked. |
| 872 __ li(scratch1, Operand(receiver_map)); |
| 871 | 873 |
| 872 // Make sure there's no overlap between holder and object registers. | 874 // Make sure there's no overlap between holder and object registers. |
| 873 ASSERT(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); | 875 ASSERT(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); |
| 874 ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg) | 876 ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg) |
| 875 && !scratch2.is(scratch1)); | 877 && !scratch2.is(scratch1)); |
| 876 | 878 |
| 877 // Keep track of the current object in register reg. | 879 // Keep track of the current object in register reg. |
| 878 Register reg = object_reg; | 880 Register reg = object_reg; |
| 879 int depth = 0; | 881 int depth = 0; |
| 880 | 882 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 | 1057 |
| 1056 | 1058 |
| 1057 void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { | 1059 void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { |
| 1058 // Return the constant value. | 1060 // Return the constant value. |
| 1059 __ li(v0, value); | 1061 __ li(v0, value); |
| 1060 __ Ret(); | 1062 __ Ret(); |
| 1061 } | 1063 } |
| 1062 | 1064 |
| 1063 | 1065 |
| 1064 void LoadStubCompiler::GenerateLoadCallback( | 1066 void LoadStubCompiler::GenerateLoadCallback( |
| 1067 const CallOptimization& call_optimization, |
| 1068 Handle<Map> receiver_map) { |
| 1069 GenerateFastApiCall( |
| 1070 masm(), call_optimization, receiver_map, |
| 1071 receiver(), scratch3(), 0, NULL); |
| 1072 } |
| 1073 |
| 1074 |
| 1075 void LoadStubCompiler::GenerateLoadCallback( |
| 1065 Register reg, | 1076 Register reg, |
| 1066 Handle<ExecutableAccessorInfo> callback) { | 1077 Handle<ExecutableAccessorInfo> callback) { |
| 1067 // Build AccessorInfo::args_ list on the stack and push property name below | 1078 // Build AccessorInfo::args_ list on the stack and push property name below |
| 1068 // the exit frame to make GC aware of them and store pointers to them. | 1079 // the exit frame to make GC aware of them and store pointers to them. |
| 1069 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); | 1080 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); |
| 1070 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); | 1081 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); |
| 1071 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); | 1082 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); |
| 1072 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); | 1083 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); |
| 1073 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); | 1084 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); |
| 1074 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); | 1085 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 // Do tail-call to the runtime system. | 1239 // Do tail-call to the runtime system. |
| 1229 ExternalReference store_callback_property = | 1240 ExternalReference store_callback_property = |
| 1230 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 1241 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
| 1231 __ TailCallExternalReference(store_callback_property, 5, 1); | 1242 __ TailCallExternalReference(store_callback_property, 5, 1); |
| 1232 | 1243 |
| 1233 // Return the generated code. | 1244 // Return the generated code. |
| 1234 return GetCode(kind(), Code::FAST, name); | 1245 return GetCode(kind(), Code::FAST, name); |
| 1235 } | 1246 } |
| 1236 | 1247 |
| 1237 | 1248 |
| 1249 Handle<Code> StoreStubCompiler::CompileStoreCallback( |
| 1250 Handle<JSObject> object, |
| 1251 Handle<JSObject> holder, |
| 1252 Handle<Name> name, |
| 1253 const CallOptimization& call_optimization) { |
| 1254 HandlerFrontend(IC::CurrentTypeOf(object, isolate()), |
| 1255 receiver(), holder, name); |
| 1256 |
| 1257 Register values[] = { value() }; |
| 1258 GenerateFastApiCall( |
| 1259 masm(), call_optimization, handle(object->map()), |
| 1260 receiver(), scratch3(), 1, values); |
| 1261 |
| 1262 // Return the generated code. |
| 1263 return GetCode(kind(), Code::FAST, name); |
| 1264 } |
| 1265 |
| 1266 |
| 1238 #undef __ | 1267 #undef __ |
| 1239 #define __ ACCESS_MASM(masm) | 1268 #define __ ACCESS_MASM(masm) |
| 1240 | 1269 |
| 1241 | 1270 |
| 1242 void StoreStubCompiler::GenerateStoreViaSetter( | 1271 void StoreStubCompiler::GenerateStoreViaSetter( |
| 1243 MacroAssembler* masm, | 1272 MacroAssembler* masm, |
| 1244 Handle<HeapType> type, | 1273 Handle<HeapType> type, |
| 1245 Handle<JSFunction> setter) { | 1274 Handle<JSFunction> setter) { |
| 1246 // ----------- S t a t e ------------- | 1275 // ----------- S t a t e ------------- |
| 1247 // -- a0 : value | 1276 // -- a0 : value |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1571 // ----------------------------------- | 1600 // ----------------------------------- |
| 1572 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1601 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 1573 } | 1602 } |
| 1574 | 1603 |
| 1575 | 1604 |
| 1576 #undef __ | 1605 #undef __ |
| 1577 | 1606 |
| 1578 } } // namespace v8::internal | 1607 } } // namespace v8::internal |
| 1579 | 1608 |
| 1580 #endif // V8_TARGET_ARCH_MIPS | 1609 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |