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

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 10706002: Implements a new API to set a function entry hook for profiling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Sketch ARM code stub. Created 8 years, 5 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 6402 matching lines...) Expand 10 before | Expand all | Expand 10 after
6413 __ movq(r9, FieldOperand(rbx, JSObject::kElementsOffset)); 6413 __ movq(r9, FieldOperand(rbx, JSObject::kElementsOffset));
6414 __ SmiToInteger32(r11, rcx); 6414 __ SmiToInteger32(r11, rcx);
6415 __ StoreNumberToDoubleElements(rax, 6415 __ StoreNumberToDoubleElements(rax,
6416 r9, 6416 r9,
6417 r11, 6417 r11,
6418 xmm0, 6418 xmm0,
6419 &slow_elements); 6419 &slow_elements);
6420 __ ret(0); 6420 __ ret(0);
6421 } 6421 }
6422 6422
6423 void ProfileEntryHookStub::Generate(MacroAssembler* masm) {
6424 // Grab the cycle counter immediately.
6425 __ db(0x0F); // rdtsc();
danno 2012/07/10 09:37:13 Add to the assembler?
Sigurður Ásgeirsson 2012/07/11 14:50:34 Gone, as in the ia32 case.
6426 __ db(0x31);
6427
6428 // RCX is the only volatile register we must save.
6429 __ push(rcx);
6430
6431 // Move the cycle time from EDX/EAX to R8, which is the third argument.
6432 __ movq(r8, rax);
6433 __ shl(rdx, Immediate(32));
6434 __ addq(r8, rdx);
6435
6436 // Calculate the original stack pointer and store it in RDX, the second arg.
6437 __ lea(rdx, Operand(rsp, 0x8));
6438
6439 // Calculate the function address to RCX, the first arg.
6440 __ movq(rcx, Operand(rdx, 0));
6441 __ subq(rcx, Immediate(5));
6442
6443 // Reserve stack for the first 4 args.
6444 __ subq(rsp, Immediate(0x20));
6445
6446 // Call the entry hook.
6447 int64_t hook_location =
6448 reinterpret_cast<int64_t>(V8::GetFunctionEntryHookLocation());
6449 __ movq(rax, hook_location, RelocInfo::NONE);
6450 __ call(Operand(rax, 0));
6451 __ addq(rsp, Immediate(0x20));
6452
6453 // Restore RCX.
6454 __ pop(rcx);
6455 __ ret(0);
6456 }
6457
6458
6459 void ProfileEntryHookStub::GenerateAheadOfTime() {
6460 ProfileEntryHookStub stub;
6461 Handle<Code> code = stub.GetCode();
6462 code->set_is_pregenerated(true);
danno 2012/07/10 09:37:13 Why do you need to pre-generate on x64 and ia32 bu
Sigurður Ásgeirsson 2012/07/11 14:50:34 I need to discuss this with you, or someone else k
6463 }
6464
6423 #undef __ 6465 #undef __
6424 6466
6425 } } // namespace v8::internal 6467 } } // namespace v8::internal
6426 6468
6427 #endif // V8_TARGET_ARCH_X64 6469 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/v8.cc ('K') | « src/v8.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698