Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 8cb4725d56f29bdec00df054d9de341e8b88b600..b08203b5fee1309dd9e879376b8f69b63946f858 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -7766,14 +7766,16 @@ void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
void ProfileEntryHookStub::Generate(MacroAssembler* masm) { |
// Ecx is the only volatile register we must save. |
+ const int kNumSavedRegisters = 1; |
__ push(ecx); |
// Calculate and push the original stack pointer. |
- __ lea(eax, Operand(esp, kPointerSize)); |
+ __ lea(eax, Operand(esp, (kNumSavedRegisters + 1) * kPointerSize)); |
__ push(eax); |
- // Calculate and push the function address. |
- __ mov(eax, Operand(eax, 0)); |
+ // Retrieve our return address and use it to calculate the calling |
+ // function's address. |
+ __ mov(eax, Operand(esp, (kNumSavedRegisters + 1) * kPointerSize)); |
__ sub(eax, Immediate(Assembler::kCallInstructionLength)); |
__ push(eax); |