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

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

Issue 6515012: x64: Port OSR to the x64 platform. (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
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 PrintF("[forced deoptimization: "); 196 PrintF("[forced deoptimization: ");
197 function->PrintName(); 197 function->PrintName();
198 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function)); 198 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function));
199 } 199 }
200 } 200 }
201 201
202 202
203 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, 203 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after,
204 Code* check_code, 204 Code* check_code,
205 Code* replacement_code) { 205 Code* replacement_code) {
206 UNIMPLEMENTED(); 206 Address call_target_address = pc_after - kIntSize;
207 ASSERT(check_code->entry() ==
208 Assembler::target_address_at(call_target_address));
209 // The stack check code matches the pattern:
210 //
211 // cmp rsp, <limit>
212 // jae ok
213 // call <stack guard>
214 // test rax, <loop nesting depth>
215 // ok: ...
216 //
217 // We will patch away the branch so the code is:
218 //
219 // cmp rsp, <limit> ;; Not changed
220 // nop
221 // nop
222 // call <on-stack replacment>
223 // test rax, <loop nesting depth>
224 // ok:
225 //
226 ASSERT(*(call_target_address - 3) == 0x73 && // jae
227 *(call_target_address - 2) == 0x05 && // offset
228 *(call_target_address - 1) == 0xe8); // call
229 *(call_target_address - 3) = 0x90; // nop
230 *(call_target_address - 2) = 0x90; // nop
231 Assembler::set_target_address_at(call_target_address,
232 replacement_code->entry());
207 } 233 }
208 234
209 235
210 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after, 236 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after,
211 Code* check_code, 237 Code* check_code,
212 Code* replacement_code) { 238 Code* replacement_code) {
213 UNIMPLEMENTED(); 239 Address call_target_address = pc_after - kIntSize;
240 ASSERT(replacement_code->entry() ==
241 Assembler::target_address_at(call_target_address));
242 // Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to
243 // restore the conditional branch.
244 ASSERT(*(call_target_address - 3) == 0x90 && // nop
245 *(call_target_address - 2) == 0x90 && // nop
246 *(call_target_address - 1) == 0xe8); // call
247 *(call_target_address - 3) = 0x73; // jae
248 *(call_target_address - 2) = 0x05; // offset
249 Assembler::set_target_address_at(call_target_address,
250 check_code->entry());
214 } 251 }
215 252
216 253
217 void Deoptimizer::DoComputeOsrOutputFrame() { 254 void Deoptimizer::DoComputeOsrOutputFrame() {
218 UNIMPLEMENTED(); 255 UNIMPLEMENTED();
219 } 256 }
220 257
221 258
222 void Deoptimizer::DoComputeFrame(TranslationIterator* iterator, 259 void Deoptimizer::DoComputeFrame(TranslationIterator* iterator,
223 int frame_index) { 260 int frame_index) {
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 } 630 }
594 __ bind(&done); 631 __ bind(&done);
595 } 632 }
596 633
597 #undef __ 634 #undef __
598 635
599 636
600 } } // namespace v8::internal 637 } } // namespace v8::internal
601 638
602 #endif // V8_TARGET_ARCH_X64 639 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698