| 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 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 | 910 |
| 911 AllowExternalCallThatCantCauseGC scope(masm); | 911 AllowExternalCallThatCantCauseGC scope(masm); |
| 912 __ CallApiFunctionAndReturn(ref, | 912 __ CallApiFunctionAndReturn(ref, |
| 913 function_address, | 913 function_address, |
| 914 thunk_ref, | 914 thunk_ref, |
| 915 a1, | 915 a1, |
| 916 kStackUnwindSpace, | 916 kStackUnwindSpace, |
| 917 kFastApiCallArguments + 1); | 917 kFastApiCallArguments + 1); |
| 918 } | 918 } |
| 919 | 919 |
| 920 |
| 921 // Generate call to api function. |
| 922 static void GenerateFastApiCall(MacroAssembler* masm, |
| 923 const CallOptimization& optimization, |
| 924 Register receiver, |
| 925 Register scratch, |
| 926 int argc, |
| 927 Register* values) { |
| 928 ASSERT(optimization.is_simple_api_call()); |
| 929 ASSERT(!receiver.is(scratch)); |
| 930 |
| 931 const int stack_space = kFastApiCallArguments + argc + 1; |
| 932 // Assign stack space for the call arguments. |
| 933 __ Subu(sp, sp, Operand(stack_space * kPointerSize)); |
| 934 // Write holder to stack frame. |
| 935 __ sw(receiver, MemOperand(sp, 0)); |
| 936 // Write receiver to stack frame. |
| 937 int index = stack_space - 1; |
| 938 __ sw(receiver, MemOperand(sp, index * kPointerSize)); |
| 939 // Write the arguments to stack frame. |
| 940 for (int i = 0; i < argc; i++) { |
| 941 ASSERT(!receiver.is(values[i])); |
| 942 ASSERT(!scratch.is(values[i])); |
| 943 __ sw(receiver, MemOperand(sp, index-- * kPointerSize)); |
| 944 } |
| 945 |
| 946 GenerateFastApiDirectCall(masm, optimization, argc); |
| 947 } |
| 948 |
| 949 |
| 920 class CallInterceptorCompiler BASE_EMBEDDED { | 950 class CallInterceptorCompiler BASE_EMBEDDED { |
| 921 public: | 951 public: |
| 922 CallInterceptorCompiler(StubCompiler* stub_compiler, | 952 CallInterceptorCompiler(StubCompiler* stub_compiler, |
| 923 const ParameterCount& arguments, | 953 const ParameterCount& arguments, |
| 924 Register name, | 954 Register name, |
| 925 Code::ExtraICState extra_ic_state) | 955 Code::ExtraICState extra_ic_state) |
| 926 : stub_compiler_(stub_compiler), | 956 : stub_compiler_(stub_compiler), |
| 927 arguments_(arguments), | 957 arguments_(arguments), |
| 928 name_(name), | 958 name_(name), |
| 929 extra_ic_state_(extra_ic_state) {} | 959 extra_ic_state_(extra_ic_state) {} |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 } | 1310 } |
| 1281 } | 1311 } |
| 1282 | 1312 |
| 1283 | 1313 |
| 1284 Register BaseLoadStubCompiler::CallbackHandlerFrontend( | 1314 Register BaseLoadStubCompiler::CallbackHandlerFrontend( |
| 1285 Handle<JSObject> object, | 1315 Handle<JSObject> object, |
| 1286 Register object_reg, | 1316 Register object_reg, |
| 1287 Handle<JSObject> holder, | 1317 Handle<JSObject> holder, |
| 1288 Handle<Name> name, | 1318 Handle<Name> name, |
| 1289 Label* success, | 1319 Label* success, |
| 1290 Handle<ExecutableAccessorInfo> callback) { | 1320 Handle<Object> callback) { |
| 1291 Label miss; | 1321 Label miss; |
| 1292 | 1322 |
| 1293 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss); | 1323 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss); |
| 1294 | 1324 |
| 1295 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { | 1325 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { |
| 1296 ASSERT(!reg.is(scratch2())); | 1326 ASSERT(!reg.is(scratch2())); |
| 1297 ASSERT(!reg.is(scratch3())); | 1327 ASSERT(!reg.is(scratch3())); |
| 1298 ASSERT(!reg.is(scratch4())); | 1328 ASSERT(!reg.is(scratch4())); |
| 1299 | 1329 |
| 1300 // Load the properties dictionary. | 1330 // Load the properties dictionary. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1367 | 1397 |
| 1368 | 1398 |
| 1369 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { | 1399 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { |
| 1370 // Return the constant value. | 1400 // Return the constant value. |
| 1371 __ LoadObject(v0, value); | 1401 __ LoadObject(v0, value); |
| 1372 __ Ret(); | 1402 __ Ret(); |
| 1373 } | 1403 } |
| 1374 | 1404 |
| 1375 | 1405 |
| 1376 void BaseLoadStubCompiler::GenerateLoadCallback( | 1406 void BaseLoadStubCompiler::GenerateLoadCallback( |
| 1407 const CallOptimization& call_optimization) { |
| 1408 GenerateFastApiCall( |
| 1409 masm(), call_optimization, receiver(), scratch3(), 0, NULL); |
| 1410 } |
| 1411 |
| 1412 |
| 1413 void BaseLoadStubCompiler::GenerateLoadCallback( |
| 1377 Register reg, | 1414 Register reg, |
| 1378 Handle<ExecutableAccessorInfo> callback) { | 1415 Handle<ExecutableAccessorInfo> callback) { |
| 1379 // Build AccessorInfo::args_ list on the stack and push property name below | 1416 // Build AccessorInfo::args_ list on the stack and push property name below |
| 1380 // the exit frame to make GC aware of them and store pointers to them. | 1417 // the exit frame to make GC aware of them and store pointers to them. |
| 1381 __ push(receiver()); | 1418 __ push(receiver()); |
| 1382 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_ | 1419 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_ |
| 1383 if (heap()->InNewSpace(callback->data())) { | 1420 if (heap()->InNewSpace(callback->data())) { |
| 1384 __ li(scratch3(), callback); | 1421 __ li(scratch3(), callback); |
| 1385 __ lw(scratch3(), FieldMemOperand(scratch3(), | 1422 __ lw(scratch3(), FieldMemOperand(scratch3(), |
| 1386 ExecutableAccessorInfo::kDataOffset)); | 1423 ExecutableAccessorInfo::kDataOffset)); |
| (...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2789 // Do tail-call to the runtime system. | 2826 // Do tail-call to the runtime system. |
| 2790 ExternalReference store_callback_property = | 2827 ExternalReference store_callback_property = |
| 2791 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 2828 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
| 2792 __ TailCallExternalReference(store_callback_property, 4, 1); | 2829 __ TailCallExternalReference(store_callback_property, 4, 1); |
| 2793 | 2830 |
| 2794 // Return the generated code. | 2831 // Return the generated code. |
| 2795 return GetCode(kind(), Code::CALLBACKS, name); | 2832 return GetCode(kind(), Code::CALLBACKS, name); |
| 2796 } | 2833 } |
| 2797 | 2834 |
| 2798 | 2835 |
| 2836 Handle<Code> StoreStubCompiler::CompileStoreCallback( |
| 2837 Handle<JSObject> object, |
| 2838 Handle<JSObject> holder, |
| 2839 Handle<Name> name, |
| 2840 const CallOptimization& call_optimization) { |
| 2841 Label success; |
| 2842 HandlerFrontend(object, receiver(), holder, name, &success); |
| 2843 __ bind(&success); |
| 2844 |
| 2845 Register values[] = { value() }; |
| 2846 GenerateFastApiCall( |
| 2847 masm(), call_optimization, receiver(), scratch3(), 1, values); |
| 2848 |
| 2849 // Return the generated code. |
| 2850 return GetCode(kind(), Code::CALLBACKS, name); |
| 2851 } |
| 2852 |
| 2853 |
| 2799 #undef __ | 2854 #undef __ |
| 2800 #define __ ACCESS_MASM(masm) | 2855 #define __ ACCESS_MASM(masm) |
| 2801 | 2856 |
| 2802 | 2857 |
| 2803 void StoreStubCompiler::GenerateStoreViaSetter( | 2858 void StoreStubCompiler::GenerateStoreViaSetter( |
| 2804 MacroAssembler* masm, | 2859 MacroAssembler* masm, |
| 2805 Handle<JSFunction> setter) { | 2860 Handle<JSFunction> setter) { |
| 2806 // ----------- S t a t e ------------- | 2861 // ----------- S t a t e ------------- |
| 2807 // -- a0 : value | 2862 // -- a0 : value |
| 2808 // -- a1 : receiver | 2863 // -- a1 : receiver |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2869 // Do tail-call to the runtime system. | 2924 // Do tail-call to the runtime system. |
| 2870 ExternalReference store_ic_property = | 2925 ExternalReference store_ic_property = |
| 2871 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate()); | 2926 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate()); |
| 2872 __ TailCallExternalReference(store_ic_property, 4, 1); | 2927 __ TailCallExternalReference(store_ic_property, 4, 1); |
| 2873 | 2928 |
| 2874 // Handle store cache miss. | 2929 // Handle store cache miss. |
| 2875 __ bind(&miss); | 2930 __ bind(&miss); |
| 2876 TailCallBuiltin(masm(), MissBuiltin(kind())); | 2931 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 2877 | 2932 |
| 2878 // Return the generated code. | 2933 // Return the generated code. |
| 2879 return GetICCode(kind(), Code::INTERCEPTOR, name); | 2934 return GetCode(kind(), Code::INTERCEPTOR, name); |
| 2880 } | 2935 } |
| 2881 | 2936 |
| 2882 | 2937 |
| 2883 Handle<Code> StoreStubCompiler::CompileStoreGlobal( | 2938 Handle<Code> StoreStubCompiler::CompileStoreGlobal( |
| 2884 Handle<GlobalObject> object, | 2939 Handle<GlobalObject> object, |
| 2885 Handle<PropertyCell> cell, | 2940 Handle<PropertyCell> cell, |
| 2886 Handle<Name> name) { | 2941 Handle<Name> name) { |
| 2887 Label miss; | 2942 Label miss; |
| 2888 | 2943 |
| 2889 // Check that the map of the global has not changed. | 2944 // Check that the map of the global has not changed. |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3169 // ----------------------------------- | 3224 // ----------------------------------- |
| 3170 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3225 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
| 3171 } | 3226 } |
| 3172 | 3227 |
| 3173 | 3228 |
| 3174 #undef __ | 3229 #undef __ |
| 3175 | 3230 |
| 3176 } } // namespace v8::internal | 3231 } } // namespace v8::internal |
| 3177 | 3232 |
| 3178 #endif // V8_TARGET_ARCH_MIPS | 3233 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |