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

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

Issue 10831172: Introduced TypeFeedbackId and BailoutId types. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Incorporated review feedback. Created 8 years, 4 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/mips/assembler-mips.cc ('k') | src/mips/full-codegen-mips.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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 Assembler::target_address_at(pc_after - 4 * kInstrSize)) == 194 Assembler::target_address_at(pc_after - 4 * kInstrSize)) ==
195 reinterpret_cast<uint32_t>(replacement_code->entry())); 195 reinterpret_cast<uint32_t>(replacement_code->entry()));
196 Assembler::set_target_address_at(pc_after - 4 * kInstrSize, 196 Assembler::set_target_address_at(pc_after - 4 * kInstrSize,
197 check_code->entry()); 197 check_code->entry());
198 198
199 check_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( 199 check_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch(
200 unoptimized_code, pc_after - 4 * kInstrSize, check_code); 200 unoptimized_code, pc_after - 4 * kInstrSize, check_code);
201 } 201 }
202 202
203 203
204 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) { 204 static int LookupBailoutId(DeoptimizationInputData* data, BailoutId ast_id) {
205 ByteArray* translations = data->TranslationByteArray(); 205 ByteArray* translations = data->TranslationByteArray();
206 int length = data->DeoptCount(); 206 int length = data->DeoptCount();
207 for (int i = 0; i < length; i++) { 207 for (int i = 0; i < length; i++) {
208 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) { 208 if (data->AstId(i) == ast_id) {
209 TranslationIterator it(translations, data->TranslationIndex(i)->value()); 209 TranslationIterator it(translations, data->TranslationIndex(i)->value());
210 int value = it.Next(); 210 int value = it.Next();
211 ASSERT(Translation::BEGIN == static_cast<Translation::Opcode>(value)); 211 ASSERT(Translation::BEGIN == static_cast<Translation::Opcode>(value));
212 // Read the number of frames. 212 // Read the number of frames.
213 value = it.Next(); 213 value = it.Next();
214 if (value == 1) return i; 214 if (value == 1) return i;
215 } 215 }
216 } 216 }
217 UNREACHABLE(); 217 UNREACHABLE();
218 return -1; 218 return -1;
219 } 219 }
220 220
221 221
222 void Deoptimizer::DoComputeOsrOutputFrame() { 222 void Deoptimizer::DoComputeOsrOutputFrame() {
223 DeoptimizationInputData* data = DeoptimizationInputData::cast( 223 DeoptimizationInputData* data = DeoptimizationInputData::cast(
224 optimized_code_->deoptimization_data()); 224 optimized_code_->deoptimization_data());
225 unsigned ast_id = data->OsrAstId()->value(); 225 unsigned ast_id = data->OsrAstId()->value();
226 226
227 int bailout_id = LookupBailoutId(data, ast_id); 227 int bailout_id = LookupBailoutId(data, BailoutId(ast_id));
228 unsigned translation_index = data->TranslationIndex(bailout_id)->value(); 228 unsigned translation_index = data->TranslationIndex(bailout_id)->value();
229 ByteArray* translations = data->TranslationByteArray(); 229 ByteArray* translations = data->TranslationByteArray();
230 230
231 TranslationIterator iterator(translations, translation_index); 231 TranslationIterator iterator(translations, translation_index);
232 Translation::Opcode opcode = 232 Translation::Opcode opcode =
233 static_cast<Translation::Opcode>(iterator.Next()); 233 static_cast<Translation::Opcode>(iterator.Next());
234 ASSERT(Translation::BEGIN == opcode); 234 ASSERT(Translation::BEGIN == opcode);
235 USE(opcode); 235 USE(opcode);
236 int count = iterator.Next(); 236 int count = iterator.Next();
237 iterator.Skip(1); // Drop JS frame count. 237 iterator.Skip(1); // Drop JS frame count.
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); 580 isolate_->heap()->construct_stub_deopt_pc_offset()->value());
581 output_frame->SetPc(pc); 581 output_frame->SetPc(pc);
582 } 582 }
583 583
584 584
585 // This code is very similar to ia32/arm code, but relies on register names 585 // This code is very similar to ia32/arm code, but relies on register names
586 // (fp, sp) and how the frame is laid out. 586 // (fp, sp) and how the frame is laid out.
587 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, 587 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
588 int frame_index) { 588 int frame_index) {
589 // Read the ast node id, function, and frame height for this output frame. 589 // Read the ast node id, function, and frame height for this output frame.
590 int node_id = iterator->Next(); 590 BailoutId node_id = BailoutId(iterator->Next());
591 JSFunction* function; 591 JSFunction* function;
592 if (frame_index != 0) { 592 if (frame_index != 0) {
593 function = JSFunction::cast(ComputeLiteral(iterator->Next())); 593 function = JSFunction::cast(ComputeLiteral(iterator->Next()));
594 } else { 594 } else {
595 int closure_id = iterator->Next(); 595 int closure_id = iterator->Next();
596 USE(closure_id); 596 USE(closure_id);
597 ASSERT_EQ(Translation::kSelfLiteralId, closure_id); 597 ASSERT_EQ(Translation::kSelfLiteralId, closure_id);
598 function = function_; 598 function = function_;
599 } 599 }
600 unsigned height = iterator->Next(); 600 unsigned height = iterator->Next();
601 unsigned height_in_bytes = height * kPointerSize; 601 unsigned height_in_bytes = height * kPointerSize;
602 if (FLAG_trace_deopt) { 602 if (FLAG_trace_deopt) {
603 PrintF(" translating "); 603 PrintF(" translating ");
604 function->PrintName(); 604 function->PrintName();
605 PrintF(" => node=%d, height=%d\n", node_id, height_in_bytes); 605 PrintF(" => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes);
606 } 606 }
607 607
608 // The 'fixed' part of the frame consists of the incoming parameters and 608 // The 'fixed' part of the frame consists of the incoming parameters and
609 // the part described by JavaScriptFrameConstants. 609 // the part described by JavaScriptFrameConstants.
610 unsigned fixed_frame_size = ComputeFixedSize(function); 610 unsigned fixed_frame_size = ComputeFixedSize(function);
611 unsigned input_frame_size = input_->GetFrameSize(); 611 unsigned input_frame_size = input_->GetFrameSize();
612 unsigned output_frame_size = height_in_bytes + fixed_frame_size; 612 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
613 613
614 // Allocate and store the output frame description. 614 // Allocate and store the output frame description.
615 FrameDescription* output_frame = 615 FrameDescription* output_frame =
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 } 1015 }
1016 1016
1017 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), 1017 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start),
1018 count() * table_entry_size_); 1018 count() * table_entry_size_);
1019 } 1019 }
1020 1020
1021 #undef __ 1021 #undef __
1022 1022
1023 1023
1024 } } // namespace v8::internal 1024 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/assembler-mips.cc ('k') | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698