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

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

Issue 23588002: cleanup api callbacks now that handles are never returned directly (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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/x64/macro-assembler-x64.cc ('k') | no next file » | 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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); 486 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
487 __ movq(args.GetArgumentOperand(api_call_argc - 4), kScratchRegister); 487 __ movq(args.GetArgumentOperand(api_call_argc - 4), kScratchRegister);
488 __ movq(args.GetArgumentOperand(api_call_argc - 5), kScratchRegister); 488 __ movq(args.GetArgumentOperand(api_call_argc - 5), kScratchRegister);
489 489
490 // Prepare arguments. 490 // Prepare arguments.
491 STATIC_ASSERT(kFastApiCallArguments == 6); 491 STATIC_ASSERT(kFastApiCallArguments == 6);
492 __ lea(rbx, Operand(rsp, kFastApiCallArguments * kPointerSize)); 492 __ lea(rbx, Operand(rsp, kFastApiCallArguments * kPointerSize));
493 493
494 // Function address is a foreign pointer outside V8's heap. 494 // Function address is a foreign pointer outside V8's heap.
495 Address function_address = v8::ToCData<Address>(api_call_info->callback()); 495 Address function_address = v8::ToCData<Address>(api_call_info->callback());
496 // TODO(dcarney): fix signatures using returns_handle
497 const bool returns_handle = false;
498 496
499 #if defined(__MINGW64__) 497 #if defined(__MINGW64__)
500 Register arguments_arg = rcx; 498 Register arguments_arg = rcx;
501 Register callback_arg = rdx; 499 Register callback_arg = rdx;
502 #elif defined(_WIN64) 500 #elif defined(_WIN64)
Sven Panne 2013/08/27 12:43:57 Perhaps we should merge this with the __MINGW64__
dcarney 2013/08/27 12:52:05 Done.
503 // Win64 uses first register--rcx--for returned value. 501 // Win64 uses first register--rcx--for returned value.
504 Register arguments_arg = returns_handle ? rdx : rcx; 502 Register arguments_arg = rcx;
505 Register callback_arg = returns_handle ? r8 : rdx; 503 Register callback_arg = rdx;
506 #else 504 #else
507 Register arguments_arg = rdi; 505 Register arguments_arg = rdi;
508 Register callback_arg = rsi; 506 Register callback_arg = rsi;
509 #endif 507 #endif
510 508
511 // Allocate the v8::Arguments structure in the arguments' space since 509 // Allocate the v8::Arguments structure in the arguments' space since
512 // it's not controlled by GC. 510 // it's not controlled by GC.
513 const int kApiStackSpace = 4; 511 const int kApiStackSpace = 4;
514 512
515 __ PrepareCallApiFunction(kApiStackSpace, returns_handle); 513 __ PrepareCallApiFunction(kApiStackSpace);
516 514
517 __ movq(StackSpaceOperand(0), rbx); // v8::Arguments::implicit_args_. 515 __ movq(StackSpaceOperand(0), rbx); // v8::Arguments::implicit_args_.
518 __ addq(rbx, Immediate(argc * kPointerSize)); 516 __ addq(rbx, Immediate(argc * kPointerSize));
519 __ movq(StackSpaceOperand(1), rbx); // v8::Arguments::values_. 517 __ movq(StackSpaceOperand(1), rbx); // v8::Arguments::values_.
520 __ Set(StackSpaceOperand(2), argc); // v8::Arguments::length_. 518 __ Set(StackSpaceOperand(2), argc); // v8::Arguments::length_.
521 // v8::Arguments::is_construct_call_. 519 // v8::Arguments::is_construct_call_.
522 __ Set(StackSpaceOperand(3), 0); 520 __ Set(StackSpaceOperand(3), 0);
523 521
524 // v8::InvocationCallback's argument. 522 // v8::InvocationCallback's argument.
525 __ lea(arguments_arg, StackSpaceOperand(0)); 523 __ lea(arguments_arg, StackSpaceOperand(0));
526 524
527 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); 525 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback);
528 526
529 __ CallApiFunctionAndReturn(function_address, 527 __ CallApiFunctionAndReturn(function_address,
530 thunk_address, 528 thunk_address,
531 callback_arg, 529 callback_arg,
532 api_call_argc + 1, 530 api_call_argc + 1,
533 returns_handle,
534 kFastApiCallArguments + 1); 531 kFastApiCallArguments + 1);
535 } 532 }
536 533
537 534
538 class CallInterceptorCompiler BASE_EMBEDDED { 535 class CallInterceptorCompiler BASE_EMBEDDED {
539 public: 536 public:
540 CallInterceptorCompiler(StubCompiler* stub_compiler, 537 CallInterceptorCompiler(StubCompiler* stub_compiler,
541 const ParameterCount& arguments, 538 const ParameterCount& arguments,
542 Register name, 539 Register name,
543 Code::ExtraICState extra_ic_state) 540 Code::ExtraICState extra_ic_state)
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 } 1297 }
1301 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); 1298 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
1302 __ push(kScratchRegister); // return value 1299 __ push(kScratchRegister); // return value
1303 __ push(kScratchRegister); // return value default 1300 __ push(kScratchRegister); // return value default
1304 __ PushAddress(ExternalReference::isolate_address(isolate())); 1301 __ PushAddress(ExternalReference::isolate_address(isolate()));
1305 __ push(name()); // name 1302 __ push(name()); // name
1306 // Save a pointer to where we pushed the arguments pointer. This will be 1303 // Save a pointer to where we pushed the arguments pointer. This will be
1307 // passed as the const ExecutableAccessorInfo& to the C++ callback. 1304 // passed as the const ExecutableAccessorInfo& to the C++ callback.
1308 1305
1309 Address getter_address = v8::ToCData<Address>(callback->getter()); 1306 Address getter_address = v8::ToCData<Address>(callback->getter());
1310 // TODO(dcarney): fix signatures using returns_handle
1311 const bool returns_handle = false;
1312 1307
1313 #if defined(__MINGW64__) 1308 #if defined(__MINGW64__)
1314 Register getter_arg = r8; 1309 Register getter_arg = r8;
1315 Register accessor_info_arg = rdx; 1310 Register accessor_info_arg = rdx;
1316 Register name_arg = rcx; 1311 Register name_arg = rcx;
1317 #elif defined(_WIN64) 1312 #elif defined(_WIN64)
Sven Panne 2013/08/27 12:43:57 Same here.
dcarney 2013/08/27 12:52:05 Done.
1318 // Win64 uses first register--rcx--for returned value. 1313 // Win64 uses first register--rcx--for returned value.
1319 Register getter_arg = returns_handle ? r9 : r8; 1314 Register getter_arg = r8;
1320 Register accessor_info_arg = returns_handle ? r8 : rdx; 1315 Register accessor_info_arg = rdx;
1321 Register name_arg = returns_handle ? rdx : rcx; 1316 Register name_arg = rcx;
1322 #else 1317 #else
1323 Register getter_arg = rdx; 1318 Register getter_arg = rdx;
1324 Register accessor_info_arg = rsi; 1319 Register accessor_info_arg = rsi;
1325 Register name_arg = rdi; 1320 Register name_arg = rdi;
1326 #endif 1321 #endif
1327 1322
1328 ASSERT(!name_arg.is(scratch4())); 1323 ASSERT(!name_arg.is(scratch4()));
1329 __ movq(name_arg, rsp); 1324 __ movq(name_arg, rsp);
1330 __ PushReturnAddressFrom(scratch4()); 1325 __ PushReturnAddressFrom(scratch4());
1331 1326
1332 // v8::Arguments::values_ and handler for name. 1327 // v8::Arguments::values_ and handler for name.
1333 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 1; 1328 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 1;
1334 1329
1335 // Allocate v8::AccessorInfo in non-GCed stack space. 1330 // Allocate v8::AccessorInfo in non-GCed stack space.
1336 const int kArgStackSpace = 1; 1331 const int kArgStackSpace = 1;
1337 1332
1338 __ PrepareCallApiFunction(kArgStackSpace, returns_handle); 1333 __ PrepareCallApiFunction(kArgStackSpace);
1339 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); 1334 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6);
1340 __ lea(rax, Operand(name_arg, 6 * kPointerSize)); 1335 __ lea(rax, Operand(name_arg, 6 * kPointerSize));
1341 1336
1342 // v8::AccessorInfo::args_. 1337 // v8::AccessorInfo::args_.
1343 __ movq(StackSpaceOperand(0), rax); 1338 __ movq(StackSpaceOperand(0), rax);
1344 1339
1345 // The context register (rsi) has been saved in PrepareCallApiFunction and 1340 // The context register (rsi) has been saved in PrepareCallApiFunction and
1346 // could be used to pass arguments. 1341 // could be used to pass arguments.
1347 __ lea(accessor_info_arg, StackSpaceOperand(0)); 1342 __ lea(accessor_info_arg, StackSpaceOperand(0));
1348 1343
1349 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); 1344 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback);
1350 1345
1351 __ CallApiFunctionAndReturn(getter_address, 1346 __ CallApiFunctionAndReturn(getter_address,
1352 thunk_address, 1347 thunk_address,
1353 getter_arg, 1348 getter_arg,
1354 kStackSpace, 1349 kStackSpace,
1355 returns_handle,
1356 5); 1350 5);
1357 } 1351 }
1358 1352
1359 1353
1360 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { 1354 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
1361 // Return the constant value. 1355 // Return the constant value.
1362 __ LoadObject(rax, value); 1356 __ LoadObject(rax, value);
1363 __ ret(0); 1357 __ ret(0);
1364 } 1358 }
1365 1359
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
3156 // ----------------------------------- 3150 // -----------------------------------
3157 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3151 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3158 } 3152 }
3159 3153
3160 3154
3161 #undef __ 3155 #undef __
3162 3156
3163 } } // namespace v8::internal 3157 } } // namespace v8::internal
3164 3158
3165 #endif // V8_TARGET_ARCH_X64 3159 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698