| 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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( |
| 1377 const CallOptimization& call_optimization) { | 1407 const CallOptimization& call_optimization) { |
| 1378 ASSERT(call_optimization.is_simple_api_call()); | 1408 GenerateFastApiCall( |
| 1379 | 1409 masm(), call_optimization, receiver(), scratch3(), 0, NULL); |
| 1380 // Assign stack space for the call arguments. | |
| 1381 __ Subu(sp, sp, Operand((kFastApiCallArguments + 1) * kPointerSize)); | |
| 1382 | |
| 1383 int argc = 0; | |
| 1384 int api_call_argc = argc + kFastApiCallArguments; | |
| 1385 // Write holder to stack frame. | |
| 1386 __ sw(receiver(), MemOperand(sp, 0)); | |
| 1387 // Write receiver to stack frame. | |
| 1388 __ sw(receiver(), MemOperand(sp, api_call_argc * kPointerSize)); | |
| 1389 | |
| 1390 GenerateFastApiDirectCall(masm(), call_optimization, argc); | |
| 1391 } | 1410 } |
| 1392 | 1411 |
| 1393 | 1412 |
| 1394 void BaseLoadStubCompiler::GenerateLoadCallback( | 1413 void BaseLoadStubCompiler::GenerateLoadCallback( |
| 1395 Register reg, | 1414 Register reg, |
| 1396 Handle<ExecutableAccessorInfo> callback) { | 1415 Handle<ExecutableAccessorInfo> callback) { |
| 1397 // 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 |
| 1398 // 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. |
| 1399 __ push(receiver()); | 1418 __ push(receiver()); |
| 1400 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_ | 1419 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_ |
| (...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2807 // Do tail-call to the runtime system. | 2826 // Do tail-call to the runtime system. |
| 2808 ExternalReference store_callback_property = | 2827 ExternalReference store_callback_property = |
| 2809 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 2828 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
| 2810 __ TailCallExternalReference(store_callback_property, 4, 1); | 2829 __ TailCallExternalReference(store_callback_property, 4, 1); |
| 2811 | 2830 |
| 2812 // Return the generated code. | 2831 // Return the generated code. |
| 2813 return GetCode(kind(), Code::CALLBACKS, name); | 2832 return GetCode(kind(), Code::CALLBACKS, name); |
| 2814 } | 2833 } |
| 2815 | 2834 |
| 2816 | 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 |
| 2817 #undef __ | 2854 #undef __ |
| 2818 #define __ ACCESS_MASM(masm) | 2855 #define __ ACCESS_MASM(masm) |
| 2819 | 2856 |
| 2820 | 2857 |
| 2821 void StoreStubCompiler::GenerateStoreViaSetter( | 2858 void StoreStubCompiler::GenerateStoreViaSetter( |
| 2822 MacroAssembler* masm, | 2859 MacroAssembler* masm, |
| 2823 Handle<JSFunction> setter) { | 2860 Handle<JSFunction> setter) { |
| 2824 // ----------- S t a t e ------------- | 2861 // ----------- S t a t e ------------- |
| 2825 // -- a0 : value | 2862 // -- a0 : value |
| 2826 // -- a1 : receiver | 2863 // -- a1 : receiver |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3187 // ----------------------------------- | 3224 // ----------------------------------- |
| 3188 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3225 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
| 3189 } | 3226 } |
| 3190 | 3227 |
| 3191 | 3228 |
| 3192 #undef __ | 3229 #undef __ |
| 3193 | 3230 |
| 3194 } } // namespace v8::internal | 3231 } } // namespace v8::internal |
| 3195 | 3232 |
| 3196 #endif // V8_TARGET_ARCH_MIPS | 3233 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |