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