OLD | NEW |
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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 *(call_target_address - 2) = kJaeOffset; | 292 *(call_target_address - 2) = kJaeOffset; |
293 } | 293 } |
294 Assembler::set_target_address_at(call_target_address, | 294 Assembler::set_target_address_at(call_target_address, |
295 check_code->entry()); | 295 check_code->entry()); |
296 | 296 |
297 check_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( | 297 check_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( |
298 unoptimized_code, call_target_address, check_code); | 298 unoptimized_code, call_target_address, check_code); |
299 } | 299 } |
300 | 300 |
301 | 301 |
302 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) { | 302 static int LookupBailoutId(DeoptimizationInputData* data, BailoutId ast_id) { |
303 ByteArray* translations = data->TranslationByteArray(); | 303 ByteArray* translations = data->TranslationByteArray(); |
304 int length = data->DeoptCount(); | 304 int length = data->DeoptCount(); |
305 for (int i = 0; i < length; i++) { | 305 for (int i = 0; i < length; i++) { |
306 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) { | 306 if (data->AstId(i) == ast_id) { |
307 TranslationIterator it(translations, data->TranslationIndex(i)->value()); | 307 TranslationIterator it(translations, data->TranslationIndex(i)->value()); |
308 int value = it.Next(); | 308 int value = it.Next(); |
309 ASSERT(Translation::BEGIN == static_cast<Translation::Opcode>(value)); | 309 ASSERT(Translation::BEGIN == static_cast<Translation::Opcode>(value)); |
310 // Read the number of frames. | 310 // Read the number of frames. |
311 value = it.Next(); | 311 value = it.Next(); |
312 if (value == 1) return i; | 312 if (value == 1) return i; |
313 } | 313 } |
314 } | 314 } |
315 UNREACHABLE(); | 315 UNREACHABLE(); |
316 return -1; | 316 return -1; |
317 } | 317 } |
318 | 318 |
319 | 319 |
320 void Deoptimizer::DoComputeOsrOutputFrame() { | 320 void Deoptimizer::DoComputeOsrOutputFrame() { |
321 DeoptimizationInputData* data = DeoptimizationInputData::cast( | 321 DeoptimizationInputData* data = DeoptimizationInputData::cast( |
322 optimized_code_->deoptimization_data()); | 322 optimized_code_->deoptimization_data()); |
323 unsigned ast_id = data->OsrAstId()->value(); | 323 unsigned ast_id = data->OsrAstId()->value(); |
324 // TODO(kasperl): This should not be the bailout_id_. It should be | 324 // TODO(kasperl): This should not be the bailout_id_. It should be |
325 // the ast id. Confusing. | 325 // the ast id. Confusing. |
326 ASSERT(bailout_id_ == ast_id); | 326 ASSERT(bailout_id_ == ast_id); |
327 | 327 |
328 int bailout_id = LookupBailoutId(data, ast_id); | 328 int bailout_id = LookupBailoutId(data, BailoutId(ast_id)); |
329 unsigned translation_index = data->TranslationIndex(bailout_id)->value(); | 329 unsigned translation_index = data->TranslationIndex(bailout_id)->value(); |
330 ByteArray* translations = data->TranslationByteArray(); | 330 ByteArray* translations = data->TranslationByteArray(); |
331 | 331 |
332 TranslationIterator iterator(translations, translation_index); | 332 TranslationIterator iterator(translations, translation_index); |
333 Translation::Opcode opcode = | 333 Translation::Opcode opcode = |
334 static_cast<Translation::Opcode>(iterator.Next()); | 334 static_cast<Translation::Opcode>(iterator.Next()); |
335 ASSERT(Translation::BEGIN == opcode); | 335 ASSERT(Translation::BEGIN == opcode); |
336 USE(opcode); | 336 USE(opcode); |
337 int count = iterator.Next(); | 337 int count = iterator.Next(); |
338 iterator.Next(); // Drop JS frames count. | 338 iterator.Next(); // Drop JS frames count. |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 | 689 |
690 uint32_t pc = reinterpret_cast<uint32_t>( | 690 uint32_t pc = reinterpret_cast<uint32_t>( |
691 construct_stub->instruction_start() + | 691 construct_stub->instruction_start() + |
692 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); | 692 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); |
693 output_frame->SetPc(pc); | 693 output_frame->SetPc(pc); |
694 } | 694 } |
695 | 695 |
696 | 696 |
697 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, | 697 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, |
698 int frame_index) { | 698 int frame_index) { |
699 int node_id = iterator->Next(); | 699 BailoutId node_id = BailoutId(iterator->Next()); |
700 JSFunction* function; | 700 JSFunction* function; |
701 if (frame_index != 0) { | 701 if (frame_index != 0) { |
702 function = JSFunction::cast(ComputeLiteral(iterator->Next())); | 702 function = JSFunction::cast(ComputeLiteral(iterator->Next())); |
703 } else { | 703 } else { |
704 int closure_id = iterator->Next(); | 704 int closure_id = iterator->Next(); |
705 USE(closure_id); | 705 USE(closure_id); |
706 ASSERT_EQ(Translation::kSelfLiteralId, closure_id); | 706 ASSERT_EQ(Translation::kSelfLiteralId, closure_id); |
707 function = function_; | 707 function = function_; |
708 } | 708 } |
709 unsigned height = iterator->Next(); | 709 unsigned height = iterator->Next(); |
710 unsigned height_in_bytes = height * kPointerSize; | 710 unsigned height_in_bytes = height * kPointerSize; |
711 if (FLAG_trace_deopt) { | 711 if (FLAG_trace_deopt) { |
712 PrintF(" translating "); | 712 PrintF(" translating "); |
713 function->PrintName(); | 713 function->PrintName(); |
714 PrintF(" => node=%d, height=%d\n", node_id, height_in_bytes); | 714 PrintF(" => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes); |
715 } | 715 } |
716 | 716 |
717 // The 'fixed' part of the frame consists of the incoming parameters and | 717 // The 'fixed' part of the frame consists of the incoming parameters and |
718 // the part described by JavaScriptFrameConstants. | 718 // the part described by JavaScriptFrameConstants. |
719 unsigned fixed_frame_size = ComputeFixedSize(function); | 719 unsigned fixed_frame_size = ComputeFixedSize(function); |
720 unsigned input_frame_size = input_->GetFrameSize(); | 720 unsigned input_frame_size = input_->GetFrameSize(); |
721 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 721 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
722 | 722 |
723 // Allocate and store the output frame description. | 723 // Allocate and store the output frame description. |
724 FrameDescription* output_frame = | 724 FrameDescription* output_frame = |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 } | 1094 } |
1095 __ bind(&done); | 1095 __ bind(&done); |
1096 } | 1096 } |
1097 | 1097 |
1098 #undef __ | 1098 #undef __ |
1099 | 1099 |
1100 | 1100 |
1101 } } // namespace v8::internal | 1101 } } // namespace v8::internal |
1102 | 1102 |
1103 #endif // V8_TARGET_ARCH_IA32 | 1103 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |