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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); | 535 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); |
536 | 536 |
537 __ CallApiFunctionAndReturn(function_address, | 537 __ CallApiFunctionAndReturn(function_address, |
538 thunk_address, | 538 thunk_address, |
539 ApiParameterOperand(1), | 539 ApiParameterOperand(1), |
540 argc + kFastApiCallArguments + 1, | 540 argc + kFastApiCallArguments + 1, |
541 kFastApiCallArguments + 1); | 541 kFastApiCallArguments + 1); |
542 } | 542 } |
543 | 543 |
544 | 544 |
| 545 // Generate call to api function. |
| 546 static void GenerateFastApiCall(MacroAssembler* masm, |
| 547 const CallOptimization& optimization, |
| 548 Register receiver, |
| 549 Register scratch, |
| 550 int argc, |
| 551 Register* values) { |
| 552 ASSERT(optimization.is_simple_api_call()); |
| 553 ASSERT(!receiver.is(scratch)); |
| 554 |
| 555 const int stack_space = kFastApiCallArguments + argc + 1; |
| 556 // Copy return value. |
| 557 __ mov(scratch, Operand(esp, 0)); |
| 558 // Assign stack space for the call arguments. |
| 559 __ sub(esp, Immediate(stack_space * kPointerSize)); |
| 560 // Move the return address on top of the stack. |
| 561 __ mov(Operand(esp, 0), scratch); |
| 562 // Write holder to stack frame. |
| 563 __ mov(Operand(esp, 1 * kPointerSize), receiver); |
| 564 // Write receiver to stack frame. |
| 565 int index = stack_space; |
| 566 __ mov(Operand(esp, index-- * kPointerSize), receiver); |
| 567 // Write the arguments to stack frame. |
| 568 for (int i = 0; i < argc; i++) { |
| 569 ASSERT(!receiver.is(values[i])); |
| 570 ASSERT(!scratch.is(values[i])); |
| 571 __ mov(Operand(esp, index-- * kPointerSize), values[i]); |
| 572 } |
| 573 |
| 574 GenerateFastApiCall(masm, optimization, argc); |
| 575 } |
| 576 |
| 577 |
545 class CallInterceptorCompiler BASE_EMBEDDED { | 578 class CallInterceptorCompiler BASE_EMBEDDED { |
546 public: | 579 public: |
547 CallInterceptorCompiler(StubCompiler* stub_compiler, | 580 CallInterceptorCompiler(StubCompiler* stub_compiler, |
548 const ParameterCount& arguments, | 581 const ParameterCount& arguments, |
549 Register name, | 582 Register name, |
550 Code::ExtraICState extra_state) | 583 Code::ExtraICState extra_state) |
551 : stub_compiler_(stub_compiler), | 584 : stub_compiler_(stub_compiler), |
552 arguments_(arguments), | 585 arguments_(arguments), |
553 name_(name), | 586 name_(name), |
554 extra_state_(extra_state) {} | 587 extra_state_(extra_state) {} |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 KeyedLoadFieldStub stub(field.is_inobject(holder), | 1382 KeyedLoadFieldStub stub(field.is_inobject(holder), |
1350 field.translate(holder), | 1383 field.translate(holder), |
1351 representation); | 1384 representation); |
1352 GenerateTailCall(masm(), stub.GetCode(isolate())); | 1385 GenerateTailCall(masm(), stub.GetCode(isolate())); |
1353 } | 1386 } |
1354 } | 1387 } |
1355 | 1388 |
1356 | 1389 |
1357 void BaseLoadStubCompiler::GenerateLoadCallback( | 1390 void BaseLoadStubCompiler::GenerateLoadCallback( |
1358 const CallOptimization& call_optimization) { | 1391 const CallOptimization& call_optimization) { |
1359 ASSERT(call_optimization.is_simple_api_call()); | 1392 GenerateFastApiCall( |
1360 | 1393 masm(), call_optimization, receiver(), scratch3(), 0, NULL); |
1361 // Copy return value. | |
1362 __ mov(scratch3(), Operand(esp, 0)); | |
1363 // Assign stack space for the call arguments. | |
1364 __ sub(esp, Immediate((kFastApiCallArguments + 1) * kPointerSize)); | |
1365 // Move the return address on top of the stack. | |
1366 __ mov(Operand(esp, 0), scratch3()); | |
1367 | |
1368 int argc = 0; | |
1369 int api_call_argc = argc + kFastApiCallArguments; | |
1370 // Write holder to stack frame. | |
1371 __ mov(Operand(esp, 1 * kPointerSize), receiver()); | |
1372 // Write receiver to stack frame. | |
1373 __ mov(Operand(esp, (api_call_argc + 1) * kPointerSize), receiver()); | |
1374 | |
1375 GenerateFastApiCall(masm(), call_optimization, argc); | |
1376 } | 1394 } |
1377 | 1395 |
1378 | 1396 |
1379 void BaseLoadStubCompiler::GenerateLoadCallback( | 1397 void BaseLoadStubCompiler::GenerateLoadCallback( |
1380 Register reg, | 1398 Register reg, |
1381 Handle<ExecutableAccessorInfo> callback) { | 1399 Handle<ExecutableAccessorInfo> callback) { |
1382 // Insert additional parameters into the stack frame above return address. | 1400 // Insert additional parameters into the stack frame above return address. |
1383 ASSERT(!scratch3().is(reg)); | 1401 ASSERT(!scratch3().is(reg)); |
1384 __ pop(scratch3()); // Get return address to place it below. | 1402 __ pop(scratch3()); // Get return address to place it below. |
1385 | 1403 |
(...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2894 // Do tail-call to the runtime system. | 2912 // Do tail-call to the runtime system. |
2895 ExternalReference store_callback_property = | 2913 ExternalReference store_callback_property = |
2896 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 2914 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
2897 __ TailCallExternalReference(store_callback_property, 4, 1); | 2915 __ TailCallExternalReference(store_callback_property, 4, 1); |
2898 | 2916 |
2899 // Return the generated code. | 2917 // Return the generated code. |
2900 return GetCode(kind(), Code::CALLBACKS, name); | 2918 return GetCode(kind(), Code::CALLBACKS, name); |
2901 } | 2919 } |
2902 | 2920 |
2903 | 2921 |
| 2922 Handle<Code> StoreStubCompiler::CompileStoreCallback( |
| 2923 Handle<JSObject> object, |
| 2924 Handle<JSObject> holder, |
| 2925 Handle<Name> name, |
| 2926 const CallOptimization& call_optimization) { |
| 2927 Label success; |
| 2928 HandlerFrontend(object, receiver(), holder, name, &success); |
| 2929 __ bind(&success); |
| 2930 |
| 2931 Register values[] = { value() }; |
| 2932 GenerateFastApiCall( |
| 2933 masm(), call_optimization, receiver(), scratch1(), 1, values); |
| 2934 |
| 2935 // Return the generated code. |
| 2936 return GetCode(kind(), Code::CALLBACKS, name); |
| 2937 } |
| 2938 |
| 2939 |
2904 #undef __ | 2940 #undef __ |
2905 #define __ ACCESS_MASM(masm) | 2941 #define __ ACCESS_MASM(masm) |
2906 | 2942 |
2907 | 2943 |
2908 void StoreStubCompiler::GenerateStoreViaSetter( | 2944 void StoreStubCompiler::GenerateStoreViaSetter( |
2909 MacroAssembler* masm, | 2945 MacroAssembler* masm, |
2910 Handle<JSFunction> setter) { | 2946 Handle<JSFunction> setter) { |
2911 // ----------- S t a t e ------------- | 2947 // ----------- S t a t e ------------- |
2912 // -- eax : value | 2948 // -- eax : value |
2913 // -- ecx : name | 2949 // -- ecx : name |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3264 // ----------------------------------- | 3300 // ----------------------------------- |
3265 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3301 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
3266 } | 3302 } |
3267 | 3303 |
3268 | 3304 |
3269 #undef __ | 3305 #undef __ |
3270 | 3306 |
3271 } } // namespace v8::internal | 3307 } } // namespace v8::internal |
3272 | 3308 |
3273 #endif // V8_TARGET_ARCH_IA32 | 3309 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |