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

Side by Side Diff: src/ia32/deoptimizer-ia32.cc

Issue 6515011: Change kPointerSize to kIntSize in ia32 specific stack check patching.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 PrintF("[forced deoptimization: "); 130 PrintF("[forced deoptimization: ");
131 function->PrintName(); 131 function->PrintName();
132 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); 132 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function));
133 } 133 }
134 } 134 }
135 135
136 136
137 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, 137 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after,
138 Code* check_code, 138 Code* check_code,
139 Code* replacement_code) { 139 Code* replacement_code) {
140 Address call_target_address = pc_after - kPointerSize; 140 Address call_target_address = pc_after - kIntSize;
141 ASSERT(check_code->entry() == 141 ASSERT(check_code->entry() ==
142 Assembler::target_address_at(call_target_address)); 142 Assembler::target_address_at(call_target_address));
143 // The stack check code matches the pattern: 143 // The stack check code matches the pattern:
144 // 144 //
145 // cmp esp, <limit> 145 // cmp esp, <limit>
146 // jae ok 146 // jae ok
147 // call <stack guard> 147 // call <stack guard>
148 // test eax, <loop nesting depth> 148 // test eax, <loop nesting depth>
149 // ok: ... 149 // ok: ...
150 // 150 //
151 // We will patch away the branch so the code is: 151 // We will patch away the branch so the code is:
152 // 152 //
153 // cmp esp, <limit> ;; Not changed 153 // cmp esp, <limit> ;; Not changed
154 // nop 154 // nop
155 // nop 155 // nop
156 // call <on-stack replacment> 156 // call <on-stack replacment>
157 // test eax, <loop nesting depth> 157 // test eax, <loop nesting depth>
158 // ok: 158 // ok:
159 ASSERT(*(call_target_address - 3) == 0x73 && // jae 159 ASSERT(*(call_target_address - 3) == 0x73 && // jae
160 *(call_target_address - 2) == 0x07 && // offset 160 *(call_target_address - 2) == 0x07 && // offset
161 *(call_target_address - 1) == 0xe8); // call 161 *(call_target_address - 1) == 0xe8); // call
162 *(call_target_address - 3) = 0x90; // nop 162 *(call_target_address - 3) = 0x90; // nop
163 *(call_target_address - 2) = 0x90; // nop 163 *(call_target_address - 2) = 0x90; // nop
164 Assembler::set_target_address_at(call_target_address, 164 Assembler::set_target_address_at(call_target_address,
165 replacement_code->entry()); 165 replacement_code->entry());
166 } 166 }
167 167
168 168
169 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after, 169 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after,
170 Code* check_code, 170 Code* check_code,
171 Code* replacement_code) { 171 Code* replacement_code) {
172 Address call_target_address = pc_after - kPointerSize; 172 Address call_target_address = pc_after - kIntSize;
173 ASSERT(replacement_code->entry() == 173 ASSERT(replacement_code->entry() ==
174 Assembler::target_address_at(call_target_address)); 174 Assembler::target_address_at(call_target_address));
175 // Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to 175 // Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to
176 // restore the conditional branch. 176 // restore the conditional branch.
177 ASSERT(*(call_target_address - 3) == 0x90 && // nop 177 ASSERT(*(call_target_address - 3) == 0x90 && // nop
178 *(call_target_address - 2) == 0x90 && // nop 178 *(call_target_address - 2) == 0x90 && // nop
179 *(call_target_address - 1) == 0xe8); // call 179 *(call_target_address - 1) == 0xe8); // call
180 *(call_target_address - 3) = 0x73; // jae 180 *(call_target_address - 3) = 0x73; // jae
181 *(call_target_address - 2) = 0x07; // offset 181 *(call_target_address - 2) = 0x07; // offset
182 Assembler::set_target_address_at(call_target_address, 182 Assembler::set_target_address_at(call_target_address,
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 } 651 }
652 __ bind(&done); 652 __ bind(&done);
653 } 653 }
654 654
655 #undef __ 655 #undef __
656 656
657 657
658 } } // namespace v8::internal 658 } } // namespace v8::internal
659 659
660 #endif // V8_TARGET_ARCH_IA32 660 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698