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

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

Issue 6880010: Merge (7265, 7271] from bleeding_edge to experimental/gc branch.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 years, 8 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 int new_reloc_size = reloc_end_address - reloc_info_writer.pos(); 112 int new_reloc_size = reloc_end_address - reloc_info_writer.pos();
113 memmove(code->relocation_start(), reloc_info_writer.pos(), new_reloc_size); 113 memmove(code->relocation_start(), reloc_info_writer.pos(), new_reloc_size);
114 114
115 // The relocation info is in place, update the size. 115 // The relocation info is in place, update the size.
116 reloc_info->set_length(new_reloc_size); 116 reloc_info->set_length(new_reloc_size);
117 117
118 // Handle the junk part after the new relocation info. We will create 118 // Handle the junk part after the new relocation info. We will create
119 // a non-live object in the extra space at the end of the former reloc info. 119 // a non-live object in the extra space at the end of the former reloc info.
120 Address junk_address = reloc_info->address() + reloc_info->Size(); 120 Address junk_address = reloc_info->address() + reloc_info->Size();
121 ASSERT(junk_address <= reloc_end_address); 121 ASSERT(junk_address <= reloc_end_address);
122 Heap::CreateFillerObjectAt(junk_address, reloc_end_address - junk_address); 122 HEAP->CreateFillerObjectAt(junk_address, reloc_end_address - junk_address);
123 123
124 // Add the deoptimizing code to the list. 124 // Add the deoptimizing code to the list.
125 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code); 125 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code);
126 node->set_next(deoptimizing_code_list_); 126 DeoptimizerData* data = Isolate::Current()->deoptimizer_data();
127 deoptimizing_code_list_ = node; 127 node->set_next(data->deoptimizing_code_list_);
128 data->deoptimizing_code_list_ = node;
128 129
129 // Set the code for the function to non-optimized version. 130 // Set the code for the function to non-optimized version.
130 function->ReplaceCode(function->shared()->code()); 131 function->ReplaceCode(function->shared()->code());
131 132
132 if (FLAG_trace_deopt) { 133 if (FLAG_trace_deopt) {
133 PrintF("[forced deoptimization: "); 134 PrintF("[forced deoptimization: ");
134 function->PrintName(); 135 function->PrintName();
135 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); 136 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function));
136 #ifdef DEBUG 137 #ifdef DEBUG
137 if (FLAG_print_code) { 138 if (FLAG_print_code) {
(...skipping 28 matching lines...) Expand all
166 // call <on-stack replacment> 167 // call <on-stack replacment>
167 // test eax, <loop nesting depth> 168 // test eax, <loop nesting depth>
168 // ok: 169 // ok:
169 ASSERT(*(call_target_address - 3) == 0x73 && // jae 170 ASSERT(*(call_target_address - 3) == 0x73 && // jae
170 *(call_target_address - 2) == 0x07 && // offset 171 *(call_target_address - 2) == 0x07 && // offset
171 *(call_target_address - 1) == 0xe8); // call 172 *(call_target_address - 1) == 0xe8); // call
172 *(call_target_address - 3) = 0x90; // nop 173 *(call_target_address - 3) = 0x90; // nop
173 *(call_target_address - 2) = 0x90; // nop 174 *(call_target_address - 2) = 0x90; // nop
174 Assembler::set_target_address_at(call_target_address, 175 Assembler::set_target_address_at(call_target_address,
175 replacement_code->entry()); 176 replacement_code->entry());
176 IncrementalMarking::RecordWrite(unoptimized_code, replacement_code); 177 // TODO(gc) ISOLATES MERGE
178 HEAP->incremental_marking()->RecordWrite(unoptimized_code, replacement_code);
177 } 179 }
178 180
179 181
180 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after, 182 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after,
181 Code* check_code, 183 Code* check_code,
182 Code* replacement_code) { 184 Code* replacement_code) {
183 Address call_target_address = pc_after - kIntSize; 185 Address call_target_address = pc_after - kIntSize;
184 ASSERT(replacement_code->entry() == 186 ASSERT(replacement_code->entry() ==
185 Assembler::target_address_at(call_target_address)); 187 Assembler::target_address_at(call_target_address));
186 // Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to 188 // Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to
187 // restore the conditional branch. 189 // restore the conditional branch.
188 ASSERT(*(call_target_address - 3) == 0x90 && // nop 190 ASSERT(*(call_target_address - 3) == 0x90 && // nop
189 *(call_target_address - 2) == 0x90 && // nop 191 *(call_target_address - 2) == 0x90 && // nop
190 *(call_target_address - 1) == 0xe8); // call 192 *(call_target_address - 1) == 0xe8); // call
191 *(call_target_address - 3) = 0x73; // jae 193 *(call_target_address - 3) = 0x73; // jae
192 *(call_target_address - 2) = 0x07; // offset 194 *(call_target_address - 2) = 0x07; // offset
193 Assembler::set_target_address_at(call_target_address, 195 Assembler::set_target_address_at(call_target_address,
194 check_code->entry()); 196 check_code->entry());
195 IncrementalMarking::RecordWriteOf(check_code); 197 // TODO(gc) ISOLATES MERGE
198 HEAP->incremental_marking()->RecordWriteOf(check_code);
196 } 199 }
197 200
198 201
199 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) { 202 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) {
200 ByteArray* translations = data->TranslationByteArray(); 203 ByteArray* translations = data->TranslationByteArray();
201 int length = data->DeoptCount(); 204 int length = data->DeoptCount();
202 for (int i = 0; i < length; i++) { 205 for (int i = 0; i < length; i++) {
203 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) { 206 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) {
204 TranslationIterator it(translations, data->TranslationIndex(i)->value()); 207 TranslationIterator it(translations, data->TranslationIndex(i)->value());
205 int value = it.Next(); 208 int value = it.Next();
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 } else { 323 } else {
321 // Setup the frame pointer and the context pointer. 324 // Setup the frame pointer and the context pointer.
322 output_[0]->SetRegister(ebp.code(), input_->GetRegister(ebp.code())); 325 output_[0]->SetRegister(ebp.code(), input_->GetRegister(ebp.code()));
323 output_[0]->SetRegister(esi.code(), input_->GetRegister(esi.code())); 326 output_[0]->SetRegister(esi.code(), input_->GetRegister(esi.code()));
324 327
325 unsigned pc_offset = data->OsrPcOffset()->value(); 328 unsigned pc_offset = data->OsrPcOffset()->value();
326 uint32_t pc = reinterpret_cast<uint32_t>( 329 uint32_t pc = reinterpret_cast<uint32_t>(
327 optimized_code_->entry() + pc_offset); 330 optimized_code_->entry() + pc_offset);
328 output_[0]->SetPc(pc); 331 output_[0]->SetPc(pc);
329 } 332 }
330 Code* continuation = Builtins::builtin(Builtins::NotifyOSR); 333 Code* continuation =
334 Isolate::Current()->builtins()->builtin(Builtins::NotifyOSR);
331 output_[0]->SetContinuation( 335 output_[0]->SetContinuation(
332 reinterpret_cast<uint32_t>(continuation->entry())); 336 reinterpret_cast<uint32_t>(continuation->entry()));
333 337
334 if (FLAG_trace_osr) { 338 if (FLAG_trace_osr) {
335 PrintF("[on-stack replacement translation %s: 0x%08" V8PRIxPTR " ", 339 PrintF("[on-stack replacement translation %s: 0x%08" V8PRIxPTR " ",
336 ok ? "finished" : "aborted", 340 ok ? "finished" : "aborted",
337 reinterpret_cast<intptr_t>(function)); 341 reinterpret_cast<intptr_t>(function));
338 function->PrintName(); 342 function->PrintName();
339 PrintF(" => pc=0x%0x]\n", output_[0]->GetPc()); 343 PrintF(" => pc=0x%0x]\n", output_[0]->GetPc());
340 } 344 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state); 491 unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state);
488 uint32_t pc_value = reinterpret_cast<uint32_t>(start + pc_offset); 492 uint32_t pc_value = reinterpret_cast<uint32_t>(start + pc_offset);
489 output_frame->SetPc(pc_value); 493 output_frame->SetPc(pc_value);
490 494
491 FullCodeGenerator::State state = 495 FullCodeGenerator::State state =
492 FullCodeGenerator::StateField::decode(pc_and_state); 496 FullCodeGenerator::StateField::decode(pc_and_state);
493 output_frame->SetState(Smi::FromInt(state)); 497 output_frame->SetState(Smi::FromInt(state));
494 498
495 // Set the continuation for the topmost frame. 499 // Set the continuation for the topmost frame.
496 if (is_topmost) { 500 if (is_topmost) {
501 Builtins* builtins = isolate_->builtins();
497 Code* continuation = (bailout_type_ == EAGER) 502 Code* continuation = (bailout_type_ == EAGER)
498 ? Builtins::builtin(Builtins::NotifyDeoptimized) 503 ? builtins->builtin(Builtins::NotifyDeoptimized)
499 : Builtins::builtin(Builtins::NotifyLazyDeoptimized); 504 : builtins->builtin(Builtins::NotifyLazyDeoptimized);
500 output_frame->SetContinuation( 505 output_frame->SetContinuation(
501 reinterpret_cast<uint32_t>(continuation->entry())); 506 reinterpret_cast<uint32_t>(continuation->entry()));
502 } 507 }
503 508
504 if (output_count_ - 1 == frame_index) iterator->Done(); 509 if (output_count_ - 1 == frame_index) iterator->Done();
505 } 510 }
506 511
507 512
508 #define __ masm()-> 513 #define __ masm()->
509 514
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 } 670 }
666 __ bind(&done); 671 __ bind(&done);
667 } 672 }
668 673
669 #undef __ 674 #undef __
670 675
671 676
672 } } // namespace v8::internal 677 } } // namespace v8::internal
673 678
674 #endif // V8_TARGET_ARCH_IA32 679 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698