Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index ecdb3926c04dfb321a739312128ed5991904d5af..d95db6860ac8da2f842fdbb7b0ce76ec514b781d 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -6420,6 +6420,48 @@ void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { |
__ ret(0); |
} |
+void ProfileEntryHookStub::Generate(MacroAssembler* masm) { |
+ // Grab the cycle counter immediately. |
+ __ 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.
|
+ __ db(0x31); |
+ |
+ // RCX is the only volatile register we must save. |
+ __ push(rcx); |
+ |
+ // Move the cycle time from EDX/EAX to R8, which is the third argument. |
+ __ movq(r8, rax); |
+ __ shl(rdx, Immediate(32)); |
+ __ addq(r8, rdx); |
+ |
+ // Calculate the original stack pointer and store it in RDX, the second arg. |
+ __ lea(rdx, Operand(rsp, 0x8)); |
+ |
+ // Calculate the function address to RCX, the first arg. |
+ __ movq(rcx, Operand(rdx, 0)); |
+ __ subq(rcx, Immediate(5)); |
+ |
+ // Reserve stack for the first 4 args. |
+ __ subq(rsp, Immediate(0x20)); |
+ |
+ // Call the entry hook. |
+ int64_t hook_location = |
+ reinterpret_cast<int64_t>(V8::GetFunctionEntryHookLocation()); |
+ __ movq(rax, hook_location, RelocInfo::NONE); |
+ __ call(Operand(rax, 0)); |
+ __ addq(rsp, Immediate(0x20)); |
+ |
+ // Restore RCX. |
+ __ pop(rcx); |
+ __ ret(0); |
+} |
+ |
+ |
+void ProfileEntryHookStub::GenerateAheadOfTime() { |
+ ProfileEntryHookStub stub; |
+ Handle<Code> code = stub.GetCode(); |
+ 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
|
+} |
+ |
#undef __ |
} } // namespace v8::internal |