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

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

Issue 7945009: Merge experimental/gc branch to the bleeding_edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 3 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 | « src/x64/code-stubs-x64.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function)); 213 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function));
214 #ifdef DEBUG 214 #ifdef DEBUG
215 if (FLAG_print_code) { 215 if (FLAG_print_code) {
216 code->PrintLn(); 216 code->PrintLn();
217 } 217 }
218 #endif 218 #endif
219 } 219 }
220 } 220 }
221 221
222 222
223 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, 223 void Deoptimizer::PatchStackCheckCodeAt(Code* unoptimized_code,
224 Address pc_after,
224 Code* check_code, 225 Code* check_code,
225 Code* replacement_code) { 226 Code* replacement_code) {
226 Address call_target_address = pc_after - kIntSize; 227 Address call_target_address = pc_after - kIntSize;
227 ASSERT(check_code->entry() == 228 ASSERT(check_code->entry() ==
228 Assembler::target_address_at(call_target_address)); 229 Assembler::target_address_at(call_target_address));
229 // The stack check code matches the pattern: 230 // The stack check code matches the pattern:
230 // 231 //
231 // cmp rsp, <limit> 232 // cmp rsp, <limit>
232 // jae ok 233 // jae ok
233 // call <stack guard> 234 // call <stack guard>
234 // test rax, <loop nesting depth> 235 // test rax, <loop nesting depth>
235 // ok: ... 236 // ok: ...
236 // 237 //
237 // We will patch away the branch so the code is: 238 // We will patch away the branch so the code is:
238 // 239 //
239 // cmp rsp, <limit> ;; Not changed 240 // cmp rsp, <limit> ;; Not changed
240 // nop 241 // nop
241 // nop 242 // nop
242 // call <on-stack replacment> 243 // call <on-stack replacment>
243 // test rax, <loop nesting depth> 244 // test rax, <loop nesting depth>
244 // ok: 245 // ok:
245 // 246 //
246 ASSERT(*(call_target_address - 3) == 0x73 && // jae 247 ASSERT(*(call_target_address - 3) == 0x73 && // jae
247 *(call_target_address - 2) == 0x07 && // offset 248 *(call_target_address - 2) == 0x07 && // offset
248 *(call_target_address - 1) == 0xe8); // call 249 *(call_target_address - 1) == 0xe8); // call
249 *(call_target_address - 3) = 0x90; // nop 250 *(call_target_address - 3) = 0x90; // nop
250 *(call_target_address - 2) = 0x90; // nop 251 *(call_target_address - 2) = 0x90; // nop
251 Assembler::set_target_address_at(call_target_address, 252 Assembler::set_target_address_at(call_target_address,
252 replacement_code->entry()); 253 replacement_code->entry());
254
255 RelocInfo rinfo(call_target_address,
256 RelocInfo::CODE_TARGET,
257 NULL,
258 unoptimized_code);
259 unoptimized_code->GetHeap()->incremental_marking()->RecordWriteIntoCode(
260 unoptimized_code, &rinfo, replacement_code);
253 } 261 }
254 262
255 263
256 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after, 264 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after,
257 Code* check_code, 265 Code* check_code,
258 Code* replacement_code) { 266 Code* replacement_code) {
259 Address call_target_address = pc_after - kIntSize; 267 Address call_target_address = pc_after - kIntSize;
260 ASSERT(replacement_code->entry() == 268 ASSERT(replacement_code->entry() ==
261 Assembler::target_address_at(call_target_address)); 269 Assembler::target_address_at(call_target_address));
262 // Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to 270 // Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to
263 // restore the conditional branch. 271 // restore the conditional branch.
264 ASSERT(*(call_target_address - 3) == 0x90 && // nop 272 ASSERT(*(call_target_address - 3) == 0x90 && // nop
265 *(call_target_address - 2) == 0x90 && // nop 273 *(call_target_address - 2) == 0x90 && // nop
266 *(call_target_address - 1) == 0xe8); // call 274 *(call_target_address - 1) == 0xe8); // call
267 *(call_target_address - 3) = 0x73; // jae 275 *(call_target_address - 3) = 0x73; // jae
268 *(call_target_address - 2) = 0x07; // offset 276 *(call_target_address - 2) = 0x07; // offset
269 Assembler::set_target_address_at(call_target_address, 277 Assembler::set_target_address_at(call_target_address,
270 check_code->entry()); 278 check_code->entry());
279 check_code->GetHeap()->incremental_marking()->
280 RecordCodeTargetPatch(call_target_address, check_code);
271 } 281 }
272 282
273 283
274 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) { 284 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) {
275 ByteArray* translations = data->TranslationByteArray(); 285 ByteArray* translations = data->TranslationByteArray();
276 int length = data->DeoptCount(); 286 int length = data->DeoptCount();
277 for (int i = 0; i < length; i++) { 287 for (int i = 0; i < length; i++) {
278 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) { 288 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) {
279 TranslationIterator it(translations, data->TranslationIndex(i)->value()); 289 TranslationIterator it(translations, data->TranslationIndex(i)->value());
280 int value = it.Next(); 290 int value = it.Next();
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 } 854 }
845 __ bind(&done); 855 __ bind(&done);
846 } 856 }
847 857
848 #undef __ 858 #undef __
849 859
850 860
851 } } // namespace v8::internal 861 } } // namespace v8::internal
852 862
853 #endif // V8_TARGET_ARCH_X64 863 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698