| 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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); | 521 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); |
| 522 | 522 |
| 523 __ CallApiFunctionAndReturn(function_address, | 523 __ CallApiFunctionAndReturn(function_address, |
| 524 thunk_address, | 524 thunk_address, |
| 525 callback_arg, | 525 callback_arg, |
| 526 api_call_argc + 1, | 526 api_call_argc + 1, |
| 527 kFastApiCallArguments + 1); | 527 kFastApiCallArguments + 1); |
| 528 } | 528 } |
| 529 | 529 |
| 530 | 530 |
| 531 // Generate call to api function. |
| 532 static void GenerateFastApiCall(MacroAssembler* masm, |
| 533 const CallOptimization& optimization, |
| 534 Register receiver, |
| 535 Register scratch, |
| 536 int argc, |
| 537 Register* values) { |
| 538 ASSERT(optimization.is_simple_api_call()); |
| 539 ASSERT(!receiver.is(scratch)); |
| 540 |
| 541 const int stack_space = kFastApiCallArguments + argc + 1; |
| 542 // Copy return value. |
| 543 __ movq(scratch, Operand(rsp, 0)); |
| 544 // Assign stack space for the call arguments. |
| 545 __ subq(rsp, Immediate(stack_space * kPointerSize)); |
| 546 // Move the return address on top of the stack. |
| 547 __ movq(Operand(rsp, 0), scratch); |
| 548 // Write holder to stack frame. |
| 549 __ movq(Operand(rsp, 1 * kPointerSize), receiver); |
| 550 // Write receiver to stack frame. |
| 551 int index = stack_space; |
| 552 __ movq(Operand(rsp, index-- * kPointerSize), receiver); |
| 553 // Write the arguments to stack frame. |
| 554 for (int i = 0; i < argc; i++) { |
| 555 ASSERT(!receiver.is(values[i])); |
| 556 ASSERT(!scratch.is(values[i])); |
| 557 __ movq(Operand(rsp, index-- * kPointerSize), values[i]); |
| 558 } |
| 559 |
| 560 GenerateFastApiCall(masm, optimization, argc); |
| 561 } |
| 562 |
| 563 |
| 531 class CallInterceptorCompiler BASE_EMBEDDED { | 564 class CallInterceptorCompiler BASE_EMBEDDED { |
| 532 public: | 565 public: |
| 533 CallInterceptorCompiler(StubCompiler* stub_compiler, | 566 CallInterceptorCompiler(StubCompiler* stub_compiler, |
| 534 const ParameterCount& arguments, | 567 const ParameterCount& arguments, |
| 535 Register name, | 568 Register name, |
| 536 Code::ExtraICState extra_ic_state) | 569 Code::ExtraICState extra_ic_state) |
| 537 : stub_compiler_(stub_compiler), | 570 : stub_compiler_(stub_compiler), |
| 538 arguments_(arguments), | 571 arguments_(arguments), |
| 539 name_(name), | 572 name_(name), |
| 540 extra_ic_state_(extra_ic_state) {} | 573 extra_ic_state_(extra_ic_state) {} |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 } | 1217 } |
| 1185 } | 1218 } |
| 1186 | 1219 |
| 1187 | 1220 |
| 1188 Register BaseLoadStubCompiler::CallbackHandlerFrontend( | 1221 Register BaseLoadStubCompiler::CallbackHandlerFrontend( |
| 1189 Handle<JSObject> object, | 1222 Handle<JSObject> object, |
| 1190 Register object_reg, | 1223 Register object_reg, |
| 1191 Handle<JSObject> holder, | 1224 Handle<JSObject> holder, |
| 1192 Handle<Name> name, | 1225 Handle<Name> name, |
| 1193 Label* success, | 1226 Label* success, |
| 1194 Handle<ExecutableAccessorInfo> callback) { | 1227 Handle<Object> callback) { |
| 1195 Label miss; | 1228 Label miss; |
| 1196 | 1229 |
| 1197 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss); | 1230 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss); |
| 1198 | 1231 |
| 1199 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { | 1232 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { |
| 1200 ASSERT(!reg.is(scratch2())); | 1233 ASSERT(!reg.is(scratch2())); |
| 1201 ASSERT(!reg.is(scratch3())); | 1234 ASSERT(!reg.is(scratch3())); |
| 1202 ASSERT(!reg.is(scratch4())); | 1235 ASSERT(!reg.is(scratch4())); |
| 1203 | 1236 |
| 1204 // Load the properties dictionary. | 1237 // Load the properties dictionary. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 } else { | 1302 } else { |
| 1270 KeyedLoadFieldStub stub(field.is_inobject(holder), | 1303 KeyedLoadFieldStub stub(field.is_inobject(holder), |
| 1271 field.translate(holder), | 1304 field.translate(holder), |
| 1272 representation); | 1305 representation); |
| 1273 GenerateTailCall(masm(), stub.GetCode(isolate())); | 1306 GenerateTailCall(masm(), stub.GetCode(isolate())); |
| 1274 } | 1307 } |
| 1275 } | 1308 } |
| 1276 | 1309 |
| 1277 | 1310 |
| 1278 void BaseLoadStubCompiler::GenerateLoadCallback( | 1311 void BaseLoadStubCompiler::GenerateLoadCallback( |
| 1312 const CallOptimization& call_optimization) { |
| 1313 GenerateFastApiCall( |
| 1314 masm(), call_optimization, receiver(), scratch3(), 0, NULL); |
| 1315 } |
| 1316 |
| 1317 |
| 1318 void BaseLoadStubCompiler::GenerateLoadCallback( |
| 1279 Register reg, | 1319 Register reg, |
| 1280 Handle<ExecutableAccessorInfo> callback) { | 1320 Handle<ExecutableAccessorInfo> callback) { |
| 1281 // Insert additional parameters into the stack frame above return address. | 1321 // Insert additional parameters into the stack frame above return address. |
| 1282 ASSERT(!scratch4().is(reg)); | 1322 ASSERT(!scratch4().is(reg)); |
| 1283 __ PopReturnAddressTo(scratch4()); | 1323 __ PopReturnAddressTo(scratch4()); |
| 1284 | 1324 |
| 1285 __ push(receiver()); // receiver | 1325 __ push(receiver()); // receiver |
| 1286 __ push(reg); // holder | 1326 __ push(reg); // holder |
| 1287 if (heap()->InNewSpace(callback->data())) { | 1327 if (heap()->InNewSpace(callback->data())) { |
| 1288 __ Move(scratch1(), callback); | 1328 __ Move(scratch1(), callback); |
| (...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2765 // Do tail-call to the runtime system. | 2805 // Do tail-call to the runtime system. |
| 2766 ExternalReference store_callback_property = | 2806 ExternalReference store_callback_property = |
| 2767 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 2807 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
| 2768 __ TailCallExternalReference(store_callback_property, 4, 1); | 2808 __ TailCallExternalReference(store_callback_property, 4, 1); |
| 2769 | 2809 |
| 2770 // Return the generated code. | 2810 // Return the generated code. |
| 2771 return GetCode(kind(), Code::CALLBACKS, name); | 2811 return GetCode(kind(), Code::CALLBACKS, name); |
| 2772 } | 2812 } |
| 2773 | 2813 |
| 2774 | 2814 |
| 2815 Handle<Code> StoreStubCompiler::CompileStoreCallback( |
| 2816 Handle<JSObject> object, |
| 2817 Handle<JSObject> holder, |
| 2818 Handle<Name> name, |
| 2819 const CallOptimization& call_optimization) { |
| 2820 Label success; |
| 2821 HandlerFrontend(object, receiver(), holder, name, &success); |
| 2822 __ bind(&success); |
| 2823 |
| 2824 Register values[] = { value() }; |
| 2825 GenerateFastApiCall( |
| 2826 masm(), call_optimization, receiver(), scratch3(), 1, values); |
| 2827 |
| 2828 // Return the generated code. |
| 2829 return GetCode(kind(), Code::CALLBACKS, name); |
| 2830 } |
| 2831 |
| 2832 |
| 2775 #undef __ | 2833 #undef __ |
| 2776 #define __ ACCESS_MASM(masm) | 2834 #define __ ACCESS_MASM(masm) |
| 2777 | 2835 |
| 2778 | 2836 |
| 2779 void StoreStubCompiler::GenerateStoreViaSetter( | 2837 void StoreStubCompiler::GenerateStoreViaSetter( |
| 2780 MacroAssembler* masm, | 2838 MacroAssembler* masm, |
| 2781 Handle<JSFunction> setter) { | 2839 Handle<JSFunction> setter) { |
| 2782 // ----------- S t a t e ------------- | 2840 // ----------- S t a t e ------------- |
| 2783 // -- rax : value | 2841 // -- rax : value |
| 2784 // -- rcx : name | 2842 // -- rcx : name |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3141 // ----------------------------------- | 3199 // ----------------------------------- |
| 3142 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3200 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
| 3143 } | 3201 } |
| 3144 | 3202 |
| 3145 | 3203 |
| 3146 #undef __ | 3204 #undef __ |
| 3147 | 3205 |
| 3148 } } // namespace v8::internal | 3206 } } // namespace v8::internal |
| 3149 | 3207 |
| 3150 #endif // V8_TARGET_ARCH_X64 | 3208 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |