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

Side by Side Diff: src/arm/deoptimizer-arm.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/arm/assembler-arm.cc ('k') | src/arm/full-codegen-arm.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 ASSERT(Memory::uint32_at(stack_check_address_pointer) == 204 ASSERT(Memory::uint32_at(stack_check_address_pointer) ==
205 reinterpret_cast<uint32_t>(replacement_code->entry())); 205 reinterpret_cast<uint32_t>(replacement_code->entry()));
206 Memory::uint32_at(stack_check_address_pointer) = 206 Memory::uint32_at(stack_check_address_pointer) =
207 reinterpret_cast<uint32_t>(check_code->entry()); 207 reinterpret_cast<uint32_t>(check_code->entry());
208 208
209 check_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( 209 check_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch(
210 unoptimized_code, pc_after - 2 * kInstrSize, check_code); 210 unoptimized_code, pc_after - 2 * kInstrSize, check_code);
211 } 211 }
212 212
213 213
214 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) { 214 static int LookupBailoutId(DeoptimizationInputData* data, BailoutId ast_id) {
215 ByteArray* translations = data->TranslationByteArray(); 215 ByteArray* translations = data->TranslationByteArray();
216 int length = data->DeoptCount(); 216 int length = data->DeoptCount();
217 for (int i = 0; i < length; i++) { 217 for (int i = 0; i < length; i++) {
218 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) { 218 if (data->AstId(i) == ast_id) {
219 TranslationIterator it(translations, data->TranslationIndex(i)->value()); 219 TranslationIterator it(translations, data->TranslationIndex(i)->value());
220 int value = it.Next(); 220 int value = it.Next();
221 ASSERT(Translation::BEGIN == static_cast<Translation::Opcode>(value)); 221 ASSERT(Translation::BEGIN == static_cast<Translation::Opcode>(value));
222 // Read the number of frames. 222 // Read the number of frames.
223 value = it.Next(); 223 value = it.Next();
224 if (value == 1) return i; 224 if (value == 1) return i;
225 } 225 }
226 } 226 }
227 UNREACHABLE(); 227 UNREACHABLE();
228 return -1; 228 return -1;
229 } 229 }
230 230
231 231
232 void Deoptimizer::DoComputeOsrOutputFrame() { 232 void Deoptimizer::DoComputeOsrOutputFrame() {
233 DeoptimizationInputData* data = DeoptimizationInputData::cast( 233 DeoptimizationInputData* data = DeoptimizationInputData::cast(
234 optimized_code_->deoptimization_data()); 234 optimized_code_->deoptimization_data());
235 unsigned ast_id = data->OsrAstId()->value(); 235 unsigned ast_id = data->OsrAstId()->value();
236 236
237 int bailout_id = LookupBailoutId(data, ast_id); 237 int bailout_id = LookupBailoutId(data, BailoutId(ast_id));
238 unsigned translation_index = data->TranslationIndex(bailout_id)->value(); 238 unsigned translation_index = data->TranslationIndex(bailout_id)->value();
239 ByteArray* translations = data->TranslationByteArray(); 239 ByteArray* translations = data->TranslationByteArray();
240 240
241 TranslationIterator iterator(translations, translation_index); 241 TranslationIterator iterator(translations, translation_index);
242 Translation::Opcode opcode = 242 Translation::Opcode opcode =
243 static_cast<Translation::Opcode>(iterator.Next()); 243 static_cast<Translation::Opcode>(iterator.Next());
244 ASSERT(Translation::BEGIN == opcode); 244 ASSERT(Translation::BEGIN == opcode);
245 USE(opcode); 245 USE(opcode);
246 int count = iterator.Next(); 246 int count = iterator.Next();
247 iterator.Skip(1); // Drop JS frame count. 247 iterator.Skip(1); // Drop JS frame count.
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); 590 isolate_->heap()->construct_stub_deopt_pc_offset()->value());
591 output_frame->SetPc(pc); 591 output_frame->SetPc(pc);
592 } 592 }
593 593
594 594
595 // This code is very similar to ia32 code, but relies on register names (fp, sp) 595 // This code is very similar to ia32 code, but relies on register names (fp, sp)
596 // and how the frame is laid out. 596 // and how the frame is laid out.
597 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, 597 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
598 int frame_index) { 598 int frame_index) {
599 // Read the ast node id, function, and frame height for this output frame. 599 // Read the ast node id, function, and frame height for this output frame.
600 int node_id = iterator->Next(); 600 BailoutId node_id = BailoutId(iterator->Next());
601 JSFunction* function; 601 JSFunction* function;
602 if (frame_index != 0) { 602 if (frame_index != 0) {
603 function = JSFunction::cast(ComputeLiteral(iterator->Next())); 603 function = JSFunction::cast(ComputeLiteral(iterator->Next()));
604 } else { 604 } else {
605 int closure_id = iterator->Next(); 605 int closure_id = iterator->Next();
606 USE(closure_id); 606 USE(closure_id);
607 ASSERT_EQ(Translation::kSelfLiteralId, closure_id); 607 ASSERT_EQ(Translation::kSelfLiteralId, closure_id);
608 function = function_; 608 function = function_;
609 } 609 }
610 unsigned height = iterator->Next(); 610 unsigned height = iterator->Next();
611 unsigned height_in_bytes = height * kPointerSize; 611 unsigned height_in_bytes = height * kPointerSize;
612 if (FLAG_trace_deopt) { 612 if (FLAG_trace_deopt) {
613 PrintF(" translating "); 613 PrintF(" translating ");
614 function->PrintName(); 614 function->PrintName();
615 PrintF(" => node=%d, height=%d\n", node_id, height_in_bytes); 615 PrintF(" => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes);
616 } 616 }
617 617
618 // The 'fixed' part of the frame consists of the incoming parameters and 618 // The 'fixed' part of the frame consists of the incoming parameters and
619 // the part described by JavaScriptFrameConstants. 619 // the part described by JavaScriptFrameConstants.
620 unsigned fixed_frame_size = ComputeFixedSize(function); 620 unsigned fixed_frame_size = ComputeFixedSize(function);
621 unsigned input_frame_size = input_->GetFrameSize(); 621 unsigned input_frame_size = input_->GetFrameSize();
622 unsigned output_frame_size = height_in_bytes + fixed_frame_size; 622 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
623 623
624 // Allocate and store the output frame description. 624 // Allocate and store the output frame description.
625 FrameDescription* output_frame = 625 FrameDescription* output_frame =
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 __ push(ip); 1001 __ push(ip);
1002 __ b(&done); 1002 __ b(&done);
1003 ASSERT(masm()->pc_offset() - start == table_entry_size_); 1003 ASSERT(masm()->pc_offset() - start == table_entry_size_);
1004 } 1004 }
1005 __ bind(&done); 1005 __ bind(&done);
1006 } 1006 }
1007 1007
1008 #undef __ 1008 #undef __
1009 1009
1010 } } // namespace v8::internal 1010 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698