| 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 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 AllowExternalCallThatCantCauseGC scope(masm); | 917 AllowExternalCallThatCantCauseGC scope(masm); |
| 918 __ CallApiFunctionAndReturn(ref, | 918 __ CallApiFunctionAndReturn(ref, |
| 919 function_address, | 919 function_address, |
| 920 thunk_ref, | 920 thunk_ref, |
| 921 r1, | 921 r1, |
| 922 kStackUnwindSpace, | 922 kStackUnwindSpace, |
| 923 kFastApiCallArguments + 1); | 923 kFastApiCallArguments + 1); |
| 924 } | 924 } |
| 925 | 925 |
| 926 | 926 |
| 927 // Generate call to api function. |
| 928 static void GenerateFastApiCall(MacroAssembler* masm, |
| 929 const CallOptimization& optimization, |
| 930 Register receiver, |
| 931 Register scratch, |
| 932 int argc, |
| 933 Register* values) { |
| 934 ASSERT(optimization.is_simple_api_call()); |
| 935 ASSERT(!receiver.is(scratch)); |
| 936 |
| 937 const int stack_space = kFastApiCallArguments + argc + 1; |
| 938 // Assign stack space for the call arguments. |
| 939 __ sub(sp, sp, Operand(stack_space * kPointerSize)); |
| 940 // Write holder to stack frame. |
| 941 __ str(receiver, MemOperand(sp, 0)); |
| 942 // Write receiver to stack frame. |
| 943 int index = stack_space - 1; |
| 944 __ str(receiver, MemOperand(sp, index * kPointerSize)); |
| 945 // Write the arguments to stack frame. |
| 946 for (int i = 0; i < argc; i++) { |
| 947 ASSERT(!receiver.is(values[i])); |
| 948 ASSERT(!scratch.is(values[i])); |
| 949 __ str(receiver, MemOperand(sp, index-- * kPointerSize)); |
| 950 } |
| 951 |
| 952 GenerateFastApiDirectCall(masm, optimization, argc); |
| 953 } |
| 954 |
| 955 |
| 927 class CallInterceptorCompiler BASE_EMBEDDED { | 956 class CallInterceptorCompiler BASE_EMBEDDED { |
| 928 public: | 957 public: |
| 929 CallInterceptorCompiler(StubCompiler* stub_compiler, | 958 CallInterceptorCompiler(StubCompiler* stub_compiler, |
| 930 const ParameterCount& arguments, | 959 const ParameterCount& arguments, |
| 931 Register name, | 960 Register name, |
| 932 Code::ExtraICState extra_ic_state) | 961 Code::ExtraICState extra_ic_state) |
| 933 : stub_compiler_(stub_compiler), | 962 : stub_compiler_(stub_compiler), |
| 934 arguments_(arguments), | 963 arguments_(arguments), |
| 935 name_(name), | 964 name_(name), |
| 936 extra_ic_state_(extra_ic_state) {} | 965 extra_ic_state_(extra_ic_state) {} |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 } | 1314 } |
| 1286 } | 1315 } |
| 1287 | 1316 |
| 1288 | 1317 |
| 1289 Register BaseLoadStubCompiler::CallbackHandlerFrontend( | 1318 Register BaseLoadStubCompiler::CallbackHandlerFrontend( |
| 1290 Handle<JSObject> object, | 1319 Handle<JSObject> object, |
| 1291 Register object_reg, | 1320 Register object_reg, |
| 1292 Handle<JSObject> holder, | 1321 Handle<JSObject> holder, |
| 1293 Handle<Name> name, | 1322 Handle<Name> name, |
| 1294 Label* success, | 1323 Label* success, |
| 1295 Handle<ExecutableAccessorInfo> callback) { | 1324 Handle<Object> callback) { |
| 1296 Label miss; | 1325 Label miss; |
| 1297 | 1326 |
| 1298 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss); | 1327 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss); |
| 1299 | 1328 |
| 1300 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { | 1329 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { |
| 1301 ASSERT(!reg.is(scratch2())); | 1330 ASSERT(!reg.is(scratch2())); |
| 1302 ASSERT(!reg.is(scratch3())); | 1331 ASSERT(!reg.is(scratch3())); |
| 1303 ASSERT(!reg.is(scratch4())); | 1332 ASSERT(!reg.is(scratch4())); |
| 1304 | 1333 |
| 1305 // Load the properties dictionary. | 1334 // Load the properties dictionary. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 | 1402 |
| 1374 | 1403 |
| 1375 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { | 1404 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { |
| 1376 // Return the constant value. | 1405 // Return the constant value. |
| 1377 __ LoadObject(r0, value); | 1406 __ LoadObject(r0, value); |
| 1378 __ Ret(); | 1407 __ Ret(); |
| 1379 } | 1408 } |
| 1380 | 1409 |
| 1381 | 1410 |
| 1382 void BaseLoadStubCompiler::GenerateLoadCallback( | 1411 void BaseLoadStubCompiler::GenerateLoadCallback( |
| 1412 const CallOptimization& call_optimization) { |
| 1413 GenerateFastApiCall( |
| 1414 masm(), call_optimization, receiver(), scratch3(), 0, NULL); |
| 1415 } |
| 1416 |
| 1417 |
| 1418 void BaseLoadStubCompiler::GenerateLoadCallback( |
| 1383 Register reg, | 1419 Register reg, |
| 1384 Handle<ExecutableAccessorInfo> callback) { | 1420 Handle<ExecutableAccessorInfo> callback) { |
| 1385 // Build AccessorInfo::args_ list on the stack and push property name below | 1421 // Build AccessorInfo::args_ list on the stack and push property name below |
| 1386 // the exit frame to make GC aware of them and store pointers to them. | 1422 // the exit frame to make GC aware of them and store pointers to them. |
| 1387 __ push(receiver()); | 1423 __ push(receiver()); |
| 1388 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_ | 1424 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_ |
| 1389 if (heap()->InNewSpace(callback->data())) { | 1425 if (heap()->InNewSpace(callback->data())) { |
| 1390 __ Move(scratch3(), callback); | 1426 __ Move(scratch3(), callback); |
| 1391 __ ldr(scratch3(), FieldMemOperand(scratch3(), | 1427 __ ldr(scratch3(), FieldMemOperand(scratch3(), |
| 1392 ExecutableAccessorInfo::kDataOffset)); | 1428 ExecutableAccessorInfo::kDataOffset)); |
| (...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2768 // Do tail-call to the runtime system. | 2804 // Do tail-call to the runtime system. |
| 2769 ExternalReference store_callback_property = | 2805 ExternalReference store_callback_property = |
| 2770 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 2806 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
| 2771 __ TailCallExternalReference(store_callback_property, 4, 1); | 2807 __ TailCallExternalReference(store_callback_property, 4, 1); |
| 2772 | 2808 |
| 2773 // Return the generated code. | 2809 // Return the generated code. |
| 2774 return GetCode(kind(), Code::CALLBACKS, name); | 2810 return GetCode(kind(), Code::CALLBACKS, name); |
| 2775 } | 2811 } |
| 2776 | 2812 |
| 2777 | 2813 |
| 2814 Handle<Code> StoreStubCompiler::CompileStoreCallback( |
| 2815 Handle<JSObject> object, |
| 2816 Handle<JSObject> holder, |
| 2817 Handle<Name> name, |
| 2818 const CallOptimization& call_optimization) { |
| 2819 Label success; |
| 2820 HandlerFrontend(object, receiver(), holder, name, &success); |
| 2821 __ bind(&success); |
| 2822 |
| 2823 Register values[] = { value() }; |
| 2824 GenerateFastApiCall( |
| 2825 masm(), call_optimization, receiver(), scratch3(), 1, values); |
| 2826 |
| 2827 // Return the generated code. |
| 2828 return GetCode(kind(), Code::CALLBACKS, name); |
| 2829 } |
| 2830 |
| 2831 |
| 2778 #undef __ | 2832 #undef __ |
| 2779 #define __ ACCESS_MASM(masm) | 2833 #define __ ACCESS_MASM(masm) |
| 2780 | 2834 |
| 2781 | 2835 |
| 2782 void StoreStubCompiler::GenerateStoreViaSetter( | 2836 void StoreStubCompiler::GenerateStoreViaSetter( |
| 2783 MacroAssembler* masm, | 2837 MacroAssembler* masm, |
| 2784 Handle<JSFunction> setter) { | 2838 Handle<JSFunction> setter) { |
| 2785 // ----------- S t a t e ------------- | 2839 // ----------- S t a t e ------------- |
| 2786 // -- r0 : value | 2840 // -- r0 : value |
| 2787 // -- r1 : receiver | 2841 // -- r1 : receiver |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2847 // Do tail-call to the runtime system. | 2901 // Do tail-call to the runtime system. |
| 2848 ExternalReference store_ic_property = | 2902 ExternalReference store_ic_property = |
| 2849 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate()); | 2903 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate()); |
| 2850 __ TailCallExternalReference(store_ic_property, 4, 1); | 2904 __ TailCallExternalReference(store_ic_property, 4, 1); |
| 2851 | 2905 |
| 2852 // Handle store cache miss. | 2906 // Handle store cache miss. |
| 2853 __ bind(&miss); | 2907 __ bind(&miss); |
| 2854 TailCallBuiltin(masm(), MissBuiltin(kind())); | 2908 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 2855 | 2909 |
| 2856 // Return the generated code. | 2910 // Return the generated code. |
| 2857 return GetICCode(kind(), Code::INTERCEPTOR, name); | 2911 return GetCode(kind(), Code::INTERCEPTOR, name); |
| 2858 } | 2912 } |
| 2859 | 2913 |
| 2860 | 2914 |
| 2861 Handle<Code> StoreStubCompiler::CompileStoreGlobal( | 2915 Handle<Code> StoreStubCompiler::CompileStoreGlobal( |
| 2862 Handle<GlobalObject> object, | 2916 Handle<GlobalObject> object, |
| 2863 Handle<PropertyCell> cell, | 2917 Handle<PropertyCell> cell, |
| 2864 Handle<Name> name) { | 2918 Handle<Name> name) { |
| 2865 Label miss; | 2919 Label miss; |
| 2866 | 2920 |
| 2867 // Check that the map of the global has not changed. | 2921 // Check that the map of the global has not changed. |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3152 // ----------------------------------- | 3206 // ----------------------------------- |
| 3153 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3207 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
| 3154 } | 3208 } |
| 3155 | 3209 |
| 3156 | 3210 |
| 3157 #undef __ | 3211 #undef __ |
| 3158 | 3212 |
| 3159 } } // namespace v8::internal | 3213 } } // namespace v8::internal |
| 3160 | 3214 |
| 3161 #endif // V8_TARGET_ARCH_ARM | 3215 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |