Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index afa3e1c568bdfadbe9e3feb88d51b2efaa56118a..7be2b4f65f9d8a5a06c7ec651452f1192f7199e8 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -7474,6 +7474,38 @@ void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { |
__ ret(0); |
} |
+ |
+void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
+ if (entry_hook_ != NULL) { |
+ ProfileEntryHookStub stub; |
+ masm->CallStub(&stub); |
+ } |
+} |
+ |
+ |
+void ProfileEntryHookStub::Generate(MacroAssembler* masm) { |
+ // Ecx is the only volatile register we must save. |
+ __ push(ecx); |
+ |
+ // Calculate and push the original stack pointer. |
+ __ lea(eax, Operand(esp, kPointerSize)); |
+ __ push(eax); |
+ |
+ // Calculate and push the function address. |
+ __ mov(eax, Operand(eax, 0)); |
+ __ sub(eax, Immediate(Assembler::kCallInstructionLength)); |
+ __ push(eax); |
+ |
+ // Call the entry hook. |
+ int32_t hook_location = reinterpret_cast<int32_t>(&entry_hook_); |
+ __ call(Operand(hook_location, RelocInfo::NONE)); |
+ __ add(esp, Immediate(2 * kPointerSize)); |
+ |
+ // Restore ecx. |
+ __ pop(ecx); |
+ __ ret(0); |
+} |
+ |
#undef __ |
} } // namespace v8::internal |