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

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

Issue 16286016: Notify CPU profiler when calling native getters (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Removed check that pthread_kill always succeeds 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 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 __ PushAddress(ExternalReference::isolate_address(isolate())); 1320 __ PushAddress(ExternalReference::isolate_address(isolate()));
1312 __ push(name()); // name 1321 __ push(name()); // name
1313 // Save a pointer to where we pushed the arguments pointer. This will be 1322 // Save a pointer to where we pushed the arguments pointer. This will be
1314 // passed as the const ExecutableAccessorInfo& to the C++ callback. 1323 // passed as the const ExecutableAccessorInfo& to the C++ callback.
1315 1324
1316 Address getter_address = v8::ToCData<Address>(callback->getter()); 1325 Address getter_address = v8::ToCData<Address>(callback->getter());
1317 bool returns_handle = 1326 bool returns_handle =
1318 !CallbackTable::ReturnsVoid(isolate(), getter_address); 1327 !CallbackTable::ReturnsVoid(isolate(), getter_address);
1319 1328
1320 #if defined(__MINGW64__) 1329 #if defined(__MINGW64__)
1330 Register getter_arg = r8;
1321 Register accessor_info_arg = rdx; 1331 Register accessor_info_arg = rdx;
1322 Register name_arg = rcx; 1332 Register name_arg = rcx;
1323 #elif defined(_WIN64) 1333 #elif defined(_WIN64)
1324 // Win64 uses first register--rcx--for returned value. 1334 // Win64 uses first register--rcx--for returned value.
1335 Register getter_arg = returns_handle ? r9 : r8;
1325 Register accessor_info_arg = returns_handle ? r8 : rdx; 1336 Register accessor_info_arg = returns_handle ? r8 : rdx;
1326 Register name_arg = returns_handle ? rdx : rcx; 1337 Register name_arg = returns_handle ? rdx : rcx;
1327 #else 1338 #else
1339 Register getter_arg = rdx;
1328 Register accessor_info_arg = rsi; 1340 Register accessor_info_arg = rsi;
1329 Register name_arg = rdi; 1341 Register name_arg = rdi;
1330 #endif 1342 #endif
1331 1343
1332 ASSERT(!name_arg.is(scratch2())); 1344 ASSERT(!name_arg.is(scratch2()));
1333 __ movq(name_arg, rsp); 1345 __ movq(name_arg, rsp);
1334 __ push(scratch2()); // Restore return address. 1346 __ push(scratch2()); // Restore return address.
1335 1347
1336 // v8::Arguments::values_ and handler for name. 1348 // v8::Arguments::values_ and handler for name.
1337 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 1; 1349 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 1;
1338 1350
1339 // Allocate v8::AccessorInfo in non-GCed stack space. 1351 // Allocate v8::AccessorInfo in non-GCed stack space.
1340 const int kArgStackSpace = 1; 1352 const int kArgStackSpace = 1;
1341 1353
1342 __ PrepareCallApiFunction(kArgStackSpace, returns_handle); 1354 __ PrepareCallApiFunction(kArgStackSpace, returns_handle);
1343 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); 1355 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6);
1344 __ lea(rax, Operand(name_arg, 6 * kPointerSize)); 1356 __ lea(rax, Operand(name_arg, 6 * kPointerSize));
1345 1357
1346 // v8::AccessorInfo::args_. 1358 // v8::AccessorInfo::args_.
1347 __ movq(StackSpaceOperand(0), rax); 1359 __ movq(StackSpaceOperand(0), rax);
1348 1360
1349 // The context register (rsi) has been saved in PrepareCallApiFunction and 1361 // The context register (rsi) has been saved in PrepareCallApiFunction and
1350 // could be used to pass arguments. 1362 // could be used to pass arguments.
1351 __ lea(accessor_info_arg, StackSpaceOperand(0)); 1363 __ lea(accessor_info_arg, StackSpaceOperand(0));
1352 1364
1365 Address thunk_address = returns_handle
1366 ? FUNCTION_ADDR(&InvokeAccessorGetter)
1367 : FUNCTION_ADDR(&InvokeAccessorGetterCallback);
1368
1353 __ CallApiFunctionAndReturn(getter_address, 1369 __ CallApiFunctionAndReturn(getter_address,
1370 thunk_address,
1371 getter_arg,
1354 kStackSpace, 1372 kStackSpace,
1355 returns_handle, 1373 returns_handle,
1356 5); 1374 5);
1357 } 1375 }
1358 1376
1359 1377
1360 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<JSFunction> value) { 1378 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<JSFunction> value) {
1361 // Return the constant value. 1379 // Return the constant value.
1362 __ LoadHeapObject(rax, value); 1380 __ LoadHeapObject(rax, value);
1363 __ ret(0); 1381 __ ret(0);
(...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after
3486 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); 3504 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3487 } 3505 }
3488 } 3506 }
3489 3507
3490 3508
3491 #undef __ 3509 #undef __
3492 3510
3493 } } // namespace v8::internal 3511 } } // namespace v8::internal
3494 3512
3495 #endif // V8_TARGET_ARCH_X64 3513 #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