Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/x64/stub-cache-x64.cc

Issue 23549019: store ics for js api accessors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: no snprintf Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/stub-cache.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(
1279 const CallOptimization& call_optimization) { 1312 const CallOptimization& call_optimization) {
1280 ASSERT(call_optimization.is_simple_api_call()); 1313 GenerateFastApiCall(
1281 1314 masm(), call_optimization, receiver(), scratch3(), 0, NULL);
1282 // Copy return value.
1283 __ movq(scratch3(), Operand(rsp, 0));
1284 // Assign stack space for the call arguments.
1285 __ subq(rsp, Immediate((kFastApiCallArguments + 1) * kPointerSize));
1286 // Move the return address on top of the stack.
1287 __ movq(Operand(rsp, 0), scratch3());
1288
1289 int argc = 0;
1290 int api_call_argc = argc + kFastApiCallArguments;
1291 StackArgumentsAccessor args(rsp, api_call_argc);
1292 // Write holder to stack frame.
1293 __ movq(args.GetArgumentOperand(api_call_argc), receiver());
1294 // Write receiver to stack frame.
1295 __ movq(args.GetArgumentOperand(api_call_argc - 6), receiver());
1296
1297 GenerateFastApiCall(masm(), call_optimization, argc);
1298 } 1315 }
1299 1316
1300 1317
1301 void BaseLoadStubCompiler::GenerateLoadCallback( 1318 void BaseLoadStubCompiler::GenerateLoadCallback(
1302 Register reg, 1319 Register reg,
1303 Handle<ExecutableAccessorInfo> callback) { 1320 Handle<ExecutableAccessorInfo> callback) {
1304 // Insert additional parameters into the stack frame above return address. 1321 // Insert additional parameters into the stack frame above return address.
1305 ASSERT(!scratch4().is(reg)); 1322 ASSERT(!scratch4().is(reg));
1306 __ PopReturnAddressTo(scratch4()); 1323 __ PopReturnAddressTo(scratch4());
1307 1324
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after
2788 // Do tail-call to the runtime system. 2805 // Do tail-call to the runtime system.
2789 ExternalReference store_callback_property = 2806 ExternalReference store_callback_property =
2790 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); 2807 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate());
2791 __ TailCallExternalReference(store_callback_property, 4, 1); 2808 __ TailCallExternalReference(store_callback_property, 4, 1);
2792 2809
2793 // Return the generated code. 2810 // Return the generated code.
2794 return GetCode(kind(), Code::CALLBACKS, name); 2811 return GetCode(kind(), Code::CALLBACKS, name);
2795 } 2812 }
2796 2813
2797 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
2798 #undef __ 2833 #undef __
2799 #define __ ACCESS_MASM(masm) 2834 #define __ ACCESS_MASM(masm)
2800 2835
2801 2836
2802 void StoreStubCompiler::GenerateStoreViaSetter( 2837 void StoreStubCompiler::GenerateStoreViaSetter(
2803 MacroAssembler* masm, 2838 MacroAssembler* masm,
2804 Handle<JSFunction> setter) { 2839 Handle<JSFunction> setter) {
2805 // ----------- S t a t e ------------- 2840 // ----------- S t a t e -------------
2806 // -- rax : value 2841 // -- rax : value
2807 // -- rcx : name 2842 // -- rcx : name
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
3164 // ----------------------------------- 3199 // -----------------------------------
3165 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3200 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3166 } 3201 }
3167 3202
3168 3203
3169 #undef __ 3204 #undef __
3170 3205
3171 } } // namespace v8::internal 3206 } } // namespace v8::internal
3172 3207
3173 #endif // V8_TARGET_ARCH_X64 3208 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/stub-cache.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698