Commit 38c8b823 authored by ricow@chromium.org's avatar ricow@chromium.org

Change kPointerSize to kIntSize in ia32 specific stack check patching.

The call uses a 32 bit displacement relative to the next instruction. Althoug this has no actual impact on the 32 bit platform I think this is more correct (and will make the x64 and ia32 code more alike).

Review URL: http://codereview.chromium.org/6515011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6774 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ad70b7de
...@@ -137,39 +137,39 @@ void Deoptimizer::DeoptimizeFunction(JSFunction* function) { ...@@ -137,39 +137,39 @@ void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, void Deoptimizer::PatchStackCheckCodeAt(Address pc_after,
Code* check_code, Code* check_code,
Code* replacement_code) { Code* replacement_code) {
Address call_target_address = pc_after - kPointerSize; Address call_target_address = pc_after - kIntSize;
ASSERT(check_code->entry() == ASSERT(check_code->entry() ==
Assembler::target_address_at(call_target_address)); Assembler::target_address_at(call_target_address));
// The stack check code matches the pattern: // The stack check code matches the pattern:
// //
// cmp esp, <limit> // cmp esp, <limit>
// jae ok // jae ok
// call <stack guard> // call <stack guard>
// test eax, <loop nesting depth> // test eax, <loop nesting depth>
// ok: ... // ok: ...
// //
// We will patch away the branch so the code is: // We will patch away the branch so the code is:
// //
// cmp esp, <limit> ;; Not changed // cmp esp, <limit> ;; Not changed
// nop // nop
// nop // nop
// call <on-stack replacment> // call <on-stack replacment>
// test eax, <loop nesting depth> // test eax, <loop nesting depth>
// ok: // ok:
ASSERT(*(call_target_address - 3) == 0x73 && // jae ASSERT(*(call_target_address - 3) == 0x73 && // jae
*(call_target_address - 2) == 0x07 && // offset *(call_target_address - 2) == 0x07 && // offset
*(call_target_address - 1) == 0xe8); // call *(call_target_address - 1) == 0xe8); // call
*(call_target_address - 3) = 0x90; // nop *(call_target_address - 3) = 0x90; // nop
*(call_target_address - 2) = 0x90; // nop *(call_target_address - 2) = 0x90; // nop
Assembler::set_target_address_at(call_target_address, Assembler::set_target_address_at(call_target_address,
replacement_code->entry()); replacement_code->entry());
} }
void Deoptimizer::RevertStackCheckCodeAt(Address pc_after, void Deoptimizer::RevertStackCheckCodeAt(Address pc_after,
Code* check_code, Code* check_code,
Code* replacement_code) { Code* replacement_code) {
Address call_target_address = pc_after - kPointerSize; Address call_target_address = pc_after - kIntSize;
ASSERT(replacement_code->entry() == ASSERT(replacement_code->entry() ==
Assembler::target_address_at(call_target_address)); Assembler::target_address_at(call_target_address));
// Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to // Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment