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

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

Issue 16858013: Notify CPU profiler when calling native getters (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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') | 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 STATIC_ASSERT(kFastApiCallArguments == 6); 484 STATIC_ASSERT(kFastApiCallArguments == 6);
485 __ lea(rbx, Operand(rsp, kFastApiCallArguments * kPointerSize)); 485 __ lea(rbx, Operand(rsp, kFastApiCallArguments * kPointerSize));
486 486
487 // Function address is a foreign pointer outside V8's heap. 487 // Function address is a foreign pointer outside V8's heap.
488 Address function_address = v8::ToCData<Address>(api_call_info->callback()); 488 Address function_address = v8::ToCData<Address>(api_call_info->callback());
489 bool returns_handle = 489 bool returns_handle =
490 !CallbackTable::ReturnsVoid(masm->isolate(), function_address); 490 !CallbackTable::ReturnsVoid(masm->isolate(), function_address);
491 491
492 #if defined(__MINGW64__) 492 #if defined(__MINGW64__)
493 Register arguments_arg = rcx; 493 Register arguments_arg = rcx;
494 Register callback_arg = rdx;
494 #elif defined(_WIN64) 495 #elif defined(_WIN64)
495 // Win64 uses first register--rcx--for returned value. 496 // Win64 uses first register--rcx--for returned value.
496 Register arguments_arg = returns_handle ? rdx : rcx; 497 Register arguments_arg = returns_handle ? rdx : rcx;
498 Register callback_arg = returns_handle ? r8 : rdx;
497 #else 499 #else
498 Register arguments_arg = rdi; 500 Register arguments_arg = rdi;
501 Register callback_arg = rsi;
499 #endif 502 #endif
500 503
501 // Allocate the v8::Arguments structure in the arguments' space since 504 // Allocate the v8::Arguments structure in the arguments' space since
502 // it's not controlled by GC. 505 // it's not controlled by GC.
503 const int kApiStackSpace = 4; 506 const int kApiStackSpace = 4;
504 507
505 __ PrepareCallApiFunction(kApiStackSpace, returns_handle); 508 __ PrepareCallApiFunction(kApiStackSpace, returns_handle);
506 509
507 __ movq(StackSpaceOperand(0), rbx); // v8::Arguments::implicit_args_. 510 __ movq(StackSpaceOperand(0), rbx); // v8::Arguments::implicit_args_.
508 __ addq(rbx, Immediate(argc * kPointerSize)); 511 __ addq(rbx, Immediate(argc * kPointerSize));
509 __ movq(StackSpaceOperand(1), rbx); // v8::Arguments::values_. 512 __ movq(StackSpaceOperand(1), rbx); // v8::Arguments::values_.
510 __ Set(StackSpaceOperand(2), argc); // v8::Arguments::length_. 513 __ Set(StackSpaceOperand(2), argc); // v8::Arguments::length_.
511 // v8::Arguments::is_construct_call_. 514 // v8::Arguments::is_construct_call_.
512 __ Set(StackSpaceOperand(3), 0); 515 __ Set(StackSpaceOperand(3), 0);
513 516
514 // v8::InvocationCallback's argument. 517 // v8::InvocationCallback's argument.
515 __ lea(arguments_arg, StackSpaceOperand(0)); 518 __ lea(arguments_arg, StackSpaceOperand(0));
516 519
520 Address thunk_address = returns_handle
521 ? FUNCTION_ADDR(&InvokeInvocationCallback)
522 : FUNCTION_ADDR(&InvokeFunctionCallback);
523
517 __ CallApiFunctionAndReturn(function_address, 524 __ CallApiFunctionAndReturn(function_address,
525 thunk_address,
526 callback_arg,
518 argc + kFastApiCallArguments + 1, 527 argc + kFastApiCallArguments + 1,
519 returns_handle, 528 returns_handle,
520 kFastApiCallArguments + 1); 529 kFastApiCallArguments + 1);
521 } 530 }
522 531
523 532
524 class CallInterceptorCompiler BASE_EMBEDDED { 533 class CallInterceptorCompiler BASE_EMBEDDED {
525 public: 534 public:
526 CallInterceptorCompiler(StubCompiler* stub_compiler, 535 CallInterceptorCompiler(StubCompiler* stub_compiler,
527 const ParameterCount& arguments, 536 const ParameterCount& arguments,
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 __ PushAddress(ExternalReference::isolate_address(isolate())); 1329 __ PushAddress(ExternalReference::isolate_address(isolate()));
1321 __ push(name()); // name 1330 __ push(name()); // name
1322 // Save a pointer to where we pushed the arguments pointer. This will be 1331 // Save a pointer to where we pushed the arguments pointer. This will be
1323 // passed as the const ExecutableAccessorInfo& to the C++ callback. 1332 // passed as the const ExecutableAccessorInfo& to the C++ callback.
1324 1333
1325 Address getter_address = v8::ToCData<Address>(callback->getter()); 1334 Address getter_address = v8::ToCData<Address>(callback->getter());
1326 bool returns_handle = 1335 bool returns_handle =
1327 !CallbackTable::ReturnsVoid(isolate(), getter_address); 1336 !CallbackTable::ReturnsVoid(isolate(), getter_address);
1328 1337
1329 #if defined(__MINGW64__) 1338 #if defined(__MINGW64__)
1339 Register getter_arg = r8;
1330 Register accessor_info_arg = rdx; 1340 Register accessor_info_arg = rdx;
1331 Register name_arg = rcx; 1341 Register name_arg = rcx;
1332 #elif defined(_WIN64) 1342 #elif defined(_WIN64)
1333 // Win64 uses first register--rcx--for returned value. 1343 // Win64 uses first register--rcx--for returned value.
1344 Register getter_arg = returns_handle ? r9 : r8;
1334 Register accessor_info_arg = returns_handle ? r8 : rdx; 1345 Register accessor_info_arg = returns_handle ? r8 : rdx;
1335 Register name_arg = returns_handle ? rdx : rcx; 1346 Register name_arg = returns_handle ? rdx : rcx;
1336 #else 1347 #else
1348 Register getter_arg = rdx;
1337 Register accessor_info_arg = rsi; 1349 Register accessor_info_arg = rsi;
1338 Register name_arg = rdi; 1350 Register name_arg = rdi;
1339 #endif 1351 #endif
1340 1352
1341 ASSERT(!name_arg.is(scratch2())); 1353 ASSERT(!name_arg.is(scratch2()));
1342 __ movq(name_arg, rsp); 1354 __ movq(name_arg, rsp);
1343 __ push(scratch2()); // Restore return address. 1355 __ push(scratch2()); // Restore return address.
1344 1356
1345 // v8::Arguments::values_ and handler for name. 1357 // v8::Arguments::values_ and handler for name.
1346 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 1; 1358 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 1;
1347 1359
1348 // Allocate v8::AccessorInfo in non-GCed stack space. 1360 // Allocate v8::AccessorInfo in non-GCed stack space.
1349 const int kArgStackSpace = 1; 1361 const int kArgStackSpace = 1;
1350 1362
1351 __ PrepareCallApiFunction(kArgStackSpace, returns_handle); 1363 __ PrepareCallApiFunction(kArgStackSpace, returns_handle);
1352 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); 1364 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6);
1353 __ lea(rax, Operand(name_arg, 6 * kPointerSize)); 1365 __ lea(rax, Operand(name_arg, 6 * kPointerSize));
1354 1366
1355 // v8::AccessorInfo::args_. 1367 // v8::AccessorInfo::args_.
1356 __ movq(StackSpaceOperand(0), rax); 1368 __ movq(StackSpaceOperand(0), rax);
1357 1369
1358 // The context register (rsi) has been saved in PrepareCallApiFunction and 1370 // The context register (rsi) has been saved in PrepareCallApiFunction and
1359 // could be used to pass arguments. 1371 // could be used to pass arguments.
1360 __ lea(accessor_info_arg, StackSpaceOperand(0)); 1372 __ lea(accessor_info_arg, StackSpaceOperand(0));
1361 1373
1374 Address thunk_address = returns_handle
1375 ? FUNCTION_ADDR(&InvokeAccessorGetter)
1376 : FUNCTION_ADDR(&InvokeAccessorGetterCallback);
1377
1362 __ CallApiFunctionAndReturn(getter_address, 1378 __ CallApiFunctionAndReturn(getter_address,
1379 thunk_address,
1380 getter_arg,
1363 kStackSpace, 1381 kStackSpace,
1364 returns_handle, 1382 returns_handle,
1365 5); 1383 5);
1366 } 1384 }
1367 1385
1368 1386
1369 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<JSFunction> value) { 1387 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<JSFunction> value) {
1370 // Return the constant value. 1388 // Return the constant value.
1371 __ LoadHeapObject(rax, value); 1389 __ LoadHeapObject(rax, value);
1372 __ ret(0); 1390 __ ret(0);
(...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after
3495 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); 3513 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3496 } 3514 }
3497 } 3515 }
3498 3516
3499 3517
3500 #undef __ 3518 #undef __
3501 3519
3502 } } // namespace v8::internal 3520 } } // namespace v8::internal
3503 3521
3504 #endif // V8_TARGET_ARCH_X64 3522 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698