| 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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 } | 1287 } |
| 1255 } | 1288 } |
| 1256 | 1289 |
| 1257 | 1290 |
| 1258 Register BaseLoadStubCompiler::CallbackHandlerFrontend( | 1291 Register BaseLoadStubCompiler::CallbackHandlerFrontend( |
| 1259 Handle<JSObject> object, | 1292 Handle<JSObject> object, |
| 1260 Register object_reg, | 1293 Register object_reg, |
| 1261 Handle<JSObject> holder, | 1294 Handle<JSObject> holder, |
| 1262 Handle<Name> name, | 1295 Handle<Name> name, |
| 1263 Label* success, | 1296 Label* success, |
| 1264 Handle<ExecutableAccessorInfo> callback) { | 1297 Handle<Object> callback) { |
| 1265 Label miss; | 1298 Label miss; |
| 1266 | 1299 |
| 1267 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss); | 1300 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss); |
| 1268 | 1301 |
| 1269 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { | 1302 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { |
| 1270 ASSERT(!reg.is(scratch2())); | 1303 ASSERT(!reg.is(scratch2())); |
| 1271 ASSERT(!reg.is(scratch3())); | 1304 ASSERT(!reg.is(scratch3())); |
| 1272 Register dictionary = scratch1(); | 1305 Register dictionary = scratch1(); |
| 1273 bool must_preserve_dictionary_reg = reg.is(dictionary); | 1306 bool must_preserve_dictionary_reg = reg.is(dictionary); |
| 1274 | 1307 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1348 } else { | 1381 } else { |
| 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( |
| 1391 const CallOptimization& call_optimization) { |
| 1392 GenerateFastApiCall( |
| 1393 masm(), call_optimization, receiver(), scratch3(), 0, NULL); |
| 1394 } |
| 1395 |
| 1396 |
| 1397 void BaseLoadStubCompiler::GenerateLoadCallback( |
| 1358 Register reg, | 1398 Register reg, |
| 1359 Handle<ExecutableAccessorInfo> callback) { | 1399 Handle<ExecutableAccessorInfo> callback) { |
| 1360 // Insert additional parameters into the stack frame above return address. | 1400 // Insert additional parameters into the stack frame above return address. |
| 1361 ASSERT(!scratch3().is(reg)); | 1401 ASSERT(!scratch3().is(reg)); |
| 1362 __ pop(scratch3()); // Get return address to place it below. | 1402 __ pop(scratch3()); // Get return address to place it below. |
| 1363 | 1403 |
| 1364 __ push(receiver()); // receiver | 1404 __ push(receiver()); // receiver |
| 1365 __ mov(scratch2(), esp); | 1405 __ mov(scratch2(), esp); |
| 1366 ASSERT(!scratch2().is(reg)); | 1406 ASSERT(!scratch2().is(reg)); |
| 1367 __ push(reg); // holder | 1407 __ push(reg); // holder |
| (...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2872 // Do tail-call to the runtime system. | 2912 // Do tail-call to the runtime system. |
| 2873 ExternalReference store_callback_property = | 2913 ExternalReference store_callback_property = |
| 2874 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 2914 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
| 2875 __ TailCallExternalReference(store_callback_property, 4, 1); | 2915 __ TailCallExternalReference(store_callback_property, 4, 1); |
| 2876 | 2916 |
| 2877 // Return the generated code. | 2917 // Return the generated code. |
| 2878 return GetCode(kind(), Code::CALLBACKS, name); | 2918 return GetCode(kind(), Code::CALLBACKS, name); |
| 2879 } | 2919 } |
| 2880 | 2920 |
| 2881 | 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 |
| 2882 #undef __ | 2940 #undef __ |
| 2883 #define __ ACCESS_MASM(masm) | 2941 #define __ ACCESS_MASM(masm) |
| 2884 | 2942 |
| 2885 | 2943 |
| 2886 void StoreStubCompiler::GenerateStoreViaSetter( | 2944 void StoreStubCompiler::GenerateStoreViaSetter( |
| 2887 MacroAssembler* masm, | 2945 MacroAssembler* masm, |
| 2888 Handle<JSFunction> setter) { | 2946 Handle<JSFunction> setter) { |
| 2889 // ----------- S t a t e ------------- | 2947 // ----------- S t a t e ------------- |
| 2890 // -- eax : value | 2948 // -- eax : value |
| 2891 // -- ecx : name | 2949 // -- ecx : name |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3242 // ----------------------------------- | 3300 // ----------------------------------- |
| 3243 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3301 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
| 3244 } | 3302 } |
| 3245 | 3303 |
| 3246 | 3304 |
| 3247 #undef __ | 3305 #undef __ |
| 3248 | 3306 |
| 3249 } } // namespace v8::internal | 3307 } } // namespace v8::internal |
| 3250 | 3308 |
| 3251 #endif // V8_TARGET_ARCH_IA32 | 3309 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |