| 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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 Handle<JSObject> holder_obj, | 776 Handle<JSObject> holder_obj, |
| 777 IC::UtilityId id) { | 777 IC::UtilityId id) { |
| 778 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 778 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
| 779 __ CallExternalReference( | 779 __ CallExternalReference( |
| 780 ExternalReference(IC_Utility(id), masm->isolate()), | 780 ExternalReference(IC_Utility(id), masm->isolate()), |
| 781 StubCache::kInterceptorArgsLength); | 781 StubCache::kInterceptorArgsLength); |
| 782 } | 782 } |
| 783 | 783 |
| 784 | 784 |
| 785 // Generate call to api function. | 785 // Generate call to api function. |
| 786 void StubCompiler::GenerateFastApiCall(MacroAssembler* masm, | 786 static void GenerateFastApiCall(MacroAssembler* masm, |
| 787 const CallOptimization& optimization, | 787 const CallOptimization& optimization, |
| 788 Handle<Map> receiver_map, | 788 Handle<Map> receiver_map, |
| 789 Register receiver, | 789 Register receiver, |
| 790 Register scratch_in, | 790 Register scratch_in, |
| 791 bool is_store, | 791 int argc, |
| 792 int argc, | 792 Register* values) { |
| 793 Register* values) { | |
| 794 ASSERT(!receiver.is(scratch_in)); | 793 ASSERT(!receiver.is(scratch_in)); |
| 795 __ push(receiver); | 794 __ push(receiver); |
| 796 // Write the arguments to stack frame. | 795 // Write the arguments to stack frame. |
| 797 for (int i = 0; i < argc; i++) { | 796 for (int i = 0; i < argc; i++) { |
| 798 Register arg = values[argc-1-i]; | 797 Register arg = values[argc-1-i]; |
| 799 ASSERT(!receiver.is(arg)); | 798 ASSERT(!receiver.is(arg)); |
| 800 ASSERT(!scratch_in.is(arg)); | 799 ASSERT(!scratch_in.is(arg)); |
| 801 __ push(arg); | 800 __ push(arg); |
| 802 } | 801 } |
| 803 ASSERT(optimization.is_simple_api_call()); | 802 ASSERT(optimization.is_simple_api_call()); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 // Put api_function_address in place. | 847 // Put api_function_address in place. |
| 849 Address function_address = v8::ToCData<Address>(api_call_info->callback()); | 848 Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
| 850 ApiFunction fun(function_address); | 849 ApiFunction fun(function_address); |
| 851 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL; | 850 ExternalReference::Type type = ExternalReference::DIRECT_API_CALL; |
| 852 ExternalReference ref = ExternalReference(&fun, | 851 ExternalReference ref = ExternalReference(&fun, |
| 853 type, | 852 type, |
| 854 masm->isolate()); | 853 masm->isolate()); |
| 855 __ mov(api_function_address, Operand(ref)); | 854 __ mov(api_function_address, Operand(ref)); |
| 856 | 855 |
| 857 // Jump to stub. | 856 // Jump to stub. |
| 858 CallApiFunctionStub stub(is_store, call_data_undefined, argc); | 857 CallApiFunctionStub stub(true, call_data_undefined, argc); |
| 859 __ TailCallStub(&stub); | 858 __ TailCallStub(&stub); |
| 860 } | 859 } |
| 861 | 860 |
| 862 | 861 |
| 863 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) { | 862 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) { |
| 864 __ Jump(code, RelocInfo::CODE_TARGET); | 863 __ Jump(code, RelocInfo::CODE_TARGET); |
| 865 } | 864 } |
| 866 | 865 |
| 867 | 866 |
| 868 #undef __ | 867 #undef __ |
| 869 #define __ ACCESS_MASM(masm()) | 868 #define __ ACCESS_MASM(masm()) |
| 870 | 869 |
| 871 | 870 |
| 872 Register StubCompiler::CheckPrototypes(Handle<HeapType> type, | 871 Register StubCompiler::CheckPrototypes(Handle<HeapType> type, |
| 873 Register object_reg, | 872 Register object_reg, |
| 874 Handle<JSObject> holder, | 873 Handle<JSObject> holder, |
| 875 Register holder_reg, | 874 Register holder_reg, |
| 876 Register scratch1, | 875 Register scratch1, |
| 877 Register scratch2, | 876 Register scratch2, |
| 878 Handle<Name> name, | 877 Handle<Name> name, |
| 879 Label* miss, | 878 Label* miss, |
| 880 PrototypeCheckType check) { | 879 PrototypeCheckType check) { |
| 881 Handle<Map> receiver_map(IC::TypeToMap(*type, isolate())); | 880 Handle<Map> receiver_map(IC::TypeToMap(*type, isolate())); |
| 881 // Make sure that the type feedback oracle harvests the receiver map. |
| 882 // TODO(svenpanne) Remove this hack when all ICs are reworked. |
| 883 __ mov(scratch1, Operand(receiver_map)); |
| 882 | 884 |
| 883 // Make sure there's no overlap between holder and object registers. | 885 // Make sure there's no overlap between holder and object registers. |
| 884 ASSERT(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); | 886 ASSERT(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); |
| 885 ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg) | 887 ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg) |
| 886 && !scratch2.is(scratch1)); | 888 && !scratch2.is(scratch1)); |
| 887 | 889 |
| 888 // Keep track of the current object in register reg. | 890 // Keep track of the current object in register reg. |
| 889 Register reg = object_reg; | 891 Register reg = object_reg; |
| 890 int depth = 0; | 892 int depth = 0; |
| 891 | 893 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 | 1069 |
| 1068 | 1070 |
| 1069 void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { | 1071 void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { |
| 1070 // Return the constant value. | 1072 // Return the constant value. |
| 1071 __ Move(r0, value); | 1073 __ Move(r0, value); |
| 1072 __ Ret(); | 1074 __ Ret(); |
| 1073 } | 1075 } |
| 1074 | 1076 |
| 1075 | 1077 |
| 1076 void LoadStubCompiler::GenerateLoadCallback( | 1078 void LoadStubCompiler::GenerateLoadCallback( |
| 1079 const CallOptimization& call_optimization, |
| 1080 Handle<Map> receiver_map) { |
| 1081 GenerateFastApiCall( |
| 1082 masm(), call_optimization, receiver_map, |
| 1083 receiver(), scratch3(), 0, NULL); |
| 1084 } |
| 1085 |
| 1086 |
| 1087 void LoadStubCompiler::GenerateLoadCallback( |
| 1077 Register reg, | 1088 Register reg, |
| 1078 Handle<ExecutableAccessorInfo> callback) { | 1089 Handle<ExecutableAccessorInfo> callback) { |
| 1079 // Build AccessorInfo::args_ list on the stack and push property name below | 1090 // Build AccessorInfo::args_ list on the stack and push property name below |
| 1080 // the exit frame to make GC aware of them and store pointers to them. | 1091 // the exit frame to make GC aware of them and store pointers to them. |
| 1081 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); | 1092 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); |
| 1082 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); | 1093 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); |
| 1083 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); | 1094 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); |
| 1084 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); | 1095 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); |
| 1085 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); | 1096 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); |
| 1086 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); | 1097 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 // Do tail-call to the runtime system. | 1253 // Do tail-call to the runtime system. |
| 1243 ExternalReference store_callback_property = | 1254 ExternalReference store_callback_property = |
| 1244 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 1255 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
| 1245 __ TailCallExternalReference(store_callback_property, 5, 1); | 1256 __ TailCallExternalReference(store_callback_property, 5, 1); |
| 1246 | 1257 |
| 1247 // Return the generated code. | 1258 // Return the generated code. |
| 1248 return GetCode(kind(), Code::FAST, name); | 1259 return GetCode(kind(), Code::FAST, name); |
| 1249 } | 1260 } |
| 1250 | 1261 |
| 1251 | 1262 |
| 1263 Handle<Code> StoreStubCompiler::CompileStoreCallback( |
| 1264 Handle<JSObject> object, |
| 1265 Handle<JSObject> holder, |
| 1266 Handle<Name> name, |
| 1267 const CallOptimization& call_optimization) { |
| 1268 HandlerFrontend(IC::CurrentTypeOf(object, isolate()), |
| 1269 receiver(), holder, name); |
| 1270 |
| 1271 Register values[] = { value() }; |
| 1272 GenerateFastApiCall( |
| 1273 masm(), call_optimization, handle(object->map()), |
| 1274 receiver(), scratch3(), 1, values); |
| 1275 |
| 1276 // Return the generated code. |
| 1277 return GetCode(kind(), Code::FAST, name); |
| 1278 } |
| 1279 |
| 1280 |
| 1252 #undef __ | 1281 #undef __ |
| 1253 #define __ ACCESS_MASM(masm) | 1282 #define __ ACCESS_MASM(masm) |
| 1254 | 1283 |
| 1255 | 1284 |
| 1256 void StoreStubCompiler::GenerateStoreViaSetter( | 1285 void StoreStubCompiler::GenerateStoreViaSetter( |
| 1257 MacroAssembler* masm, | 1286 MacroAssembler* masm, |
| 1258 Handle<HeapType> type, | 1287 Handle<HeapType> type, |
| 1259 Handle<JSFunction> setter) { | 1288 Handle<JSFunction> setter) { |
| 1260 // ----------- S t a t e ------------- | 1289 // ----------- S t a t e ------------- |
| 1261 // -- r0 : value | 1290 // -- r0 : value |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 // ----------------------------------- | 1612 // ----------------------------------- |
| 1584 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1613 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 1585 } | 1614 } |
| 1586 | 1615 |
| 1587 | 1616 |
| 1588 #undef __ | 1617 #undef __ |
| 1589 | 1618 |
| 1590 } } // namespace v8::internal | 1619 } } // namespace v8::internal |
| 1591 | 1620 |
| 1592 #endif // V8_TARGET_ARCH_ARM | 1621 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |