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

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

Issue 23513004: remove old style callbacks (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: inlined a function used once 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
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 bool returns_handle = 496 // TODO(dcarney): fix signatures using returns_handle
497 !CallbackTable::ReturnsVoid(masm->isolate(), function_address); 497 const bool returns_handle = false;
498 498
499 #if defined(__MINGW64__) 499 #if defined(__MINGW64__)
500 Register arguments_arg = rcx; 500 Register arguments_arg = rcx;
501 Register callback_arg = rdx; 501 Register callback_arg = rdx;
502 #elif defined(_WIN64) 502 #elif defined(_WIN64)
503 // Win64 uses first register--rcx--for returned value. 503 // Win64 uses first register--rcx--for returned value.
504 Register arguments_arg = returns_handle ? rdx : rcx; 504 Register arguments_arg = returns_handle ? rdx : rcx;
505 Register callback_arg = returns_handle ? r8 : rdx; 505 Register callback_arg = returns_handle ? r8 : rdx;
506 #else 506 #else
507 Register arguments_arg = rdi; 507 Register arguments_arg = rdi;
508 Register callback_arg = rsi; 508 Register callback_arg = rsi;
509 #endif 509 #endif
510 510
511 // Allocate the v8::Arguments structure in the arguments' space since 511 // Allocate the v8::Arguments structure in the arguments' space since
512 // it's not controlled by GC. 512 // it's not controlled by GC.
513 const int kApiStackSpace = 4; 513 const int kApiStackSpace = 4;
514 514
515 __ PrepareCallApiFunction(kApiStackSpace, returns_handle); 515 __ PrepareCallApiFunction(kApiStackSpace, returns_handle);
516 516
517 __ movq(StackSpaceOperand(0), rbx); // v8::Arguments::implicit_args_. 517 __ movq(StackSpaceOperand(0), rbx); // v8::Arguments::implicit_args_.
518 __ addq(rbx, Immediate(argc * kPointerSize)); 518 __ addq(rbx, Immediate(argc * kPointerSize));
519 __ movq(StackSpaceOperand(1), rbx); // v8::Arguments::values_. 519 __ movq(StackSpaceOperand(1), rbx); // v8::Arguments::values_.
520 __ Set(StackSpaceOperand(2), argc); // v8::Arguments::length_. 520 __ Set(StackSpaceOperand(2), argc); // v8::Arguments::length_.
521 // v8::Arguments::is_construct_call_. 521 // v8::Arguments::is_construct_call_.
522 __ Set(StackSpaceOperand(3), 0); 522 __ Set(StackSpaceOperand(3), 0);
523 523
524 // v8::InvocationCallback's argument. 524 // v8::InvocationCallback's argument.
525 __ lea(arguments_arg, StackSpaceOperand(0)); 525 __ lea(arguments_arg, StackSpaceOperand(0));
526 526
527 Address thunk_address = returns_handle 527 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback);
528 ? FUNCTION_ADDR(&InvokeInvocationCallback)
529 : FUNCTION_ADDR(&InvokeFunctionCallback);
530 528
531 __ CallApiFunctionAndReturn(function_address, 529 __ CallApiFunctionAndReturn(function_address,
532 thunk_address, 530 thunk_address,
533 callback_arg, 531 callback_arg,
534 api_call_argc + 1, 532 api_call_argc + 1,
535 returns_handle, 533 returns_handle,
536 kFastApiCallArguments + 1); 534 kFastApiCallArguments + 1);
537 } 535 }
538 536
539 537
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 } 1300 }
1303 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); 1301 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
1304 __ push(kScratchRegister); // return value 1302 __ push(kScratchRegister); // return value
1305 __ push(kScratchRegister); // return value default 1303 __ push(kScratchRegister); // return value default
1306 __ PushAddress(ExternalReference::isolate_address(isolate())); 1304 __ PushAddress(ExternalReference::isolate_address(isolate()));
1307 __ push(name()); // name 1305 __ push(name()); // name
1308 // Save a pointer to where we pushed the arguments pointer. This will be 1306 // Save a pointer to where we pushed the arguments pointer. This will be
1309 // passed as the const ExecutableAccessorInfo& to the C++ callback. 1307 // passed as the const ExecutableAccessorInfo& to the C++ callback.
1310 1308
1311 Address getter_address = v8::ToCData<Address>(callback->getter()); 1309 Address getter_address = v8::ToCData<Address>(callback->getter());
1312 bool returns_handle = 1310 // TODO(dcarney): fix signatures using returns_handle
1313 !CallbackTable::ReturnsVoid(isolate(), getter_address); 1311 const bool returns_handle = false;
1314 1312
1315 #if defined(__MINGW64__) 1313 #if defined(__MINGW64__)
1316 Register getter_arg = r8; 1314 Register getter_arg = r8;
1317 Register accessor_info_arg = rdx; 1315 Register accessor_info_arg = rdx;
1318 Register name_arg = rcx; 1316 Register name_arg = rcx;
1319 #elif defined(_WIN64) 1317 #elif defined(_WIN64)
1320 // Win64 uses first register--rcx--for returned value. 1318 // Win64 uses first register--rcx--for returned value.
1321 Register getter_arg = returns_handle ? r9 : r8; 1319 Register getter_arg = returns_handle ? r9 : r8;
1322 Register accessor_info_arg = returns_handle ? r8 : rdx; 1320 Register accessor_info_arg = returns_handle ? r8 : rdx;
1323 Register name_arg = returns_handle ? rdx : rcx; 1321 Register name_arg = returns_handle ? rdx : rcx;
(...skipping 17 matching lines...) Expand all
1341 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); 1339 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6);
1342 __ lea(rax, Operand(name_arg, 6 * kPointerSize)); 1340 __ lea(rax, Operand(name_arg, 6 * kPointerSize));
1343 1341
1344 // v8::AccessorInfo::args_. 1342 // v8::AccessorInfo::args_.
1345 __ movq(StackSpaceOperand(0), rax); 1343 __ movq(StackSpaceOperand(0), rax);
1346 1344
1347 // The context register (rsi) has been saved in PrepareCallApiFunction and 1345 // The context register (rsi) has been saved in PrepareCallApiFunction and
1348 // could be used to pass arguments. 1346 // could be used to pass arguments.
1349 __ lea(accessor_info_arg, StackSpaceOperand(0)); 1347 __ lea(accessor_info_arg, StackSpaceOperand(0));
1350 1348
1351 Address thunk_address = returns_handle 1349 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback);
1352 ? FUNCTION_ADDR(&InvokeAccessorGetter)
1353 : FUNCTION_ADDR(&InvokeAccessorGetterCallback);
1354 1350
1355 __ CallApiFunctionAndReturn(getter_address, 1351 __ CallApiFunctionAndReturn(getter_address,
1356 thunk_address, 1352 thunk_address,
1357 getter_arg, 1353 getter_arg,
1358 kStackSpace, 1354 kStackSpace,
1359 returns_handle, 1355 returns_handle,
1360 5); 1356 5);
1361 } 1357 }
1362 1358
1363 1359
(...skipping 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after
3160 // ----------------------------------- 3156 // -----------------------------------
3161 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3157 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3162 } 3158 }
3163 3159
3164 3160
3165 #undef __ 3161 #undef __
3166 3162
3167 } } // namespace v8::internal 3163 } } // namespace v8::internal
3168 3164
3169 #endif // V8_TARGET_ARCH_X64 3165 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698