| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 *(call_target_address - 2) = kJaeOffset; | 196 *(call_target_address - 2) = kJaeOffset; |
| 197 } | 197 } |
| 198 Assembler::set_target_address_at(call_target_address, | 198 Assembler::set_target_address_at(call_target_address, |
| 199 check_code->entry()); | 199 check_code->entry()); |
| 200 | 200 |
| 201 check_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( | 201 check_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( |
| 202 unoptimized_code, call_target_address, check_code); | 202 unoptimized_code, call_target_address, check_code); |
| 203 } | 203 } |
| 204 | 204 |
| 205 | 205 |
| 206 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) { | 206 static int LookupBailoutId(DeoptimizationInputData* data, BailoutId ast_id) { |
| 207 ByteArray* translations = data->TranslationByteArray(); | 207 ByteArray* translations = data->TranslationByteArray(); |
| 208 int length = data->DeoptCount(); | 208 int length = data->DeoptCount(); |
| 209 for (int i = 0; i < length; i++) { | 209 for (int i = 0; i < length; i++) { |
| 210 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) { | 210 if (data->AstId(i) == ast_id) { |
| 211 TranslationIterator it(translations, data->TranslationIndex(i)->value()); | 211 TranslationIterator it(translations, data->TranslationIndex(i)->value()); |
| 212 int value = it.Next(); | 212 int value = it.Next(); |
| 213 ASSERT(Translation::BEGIN == static_cast<Translation::Opcode>(value)); | 213 ASSERT(Translation::BEGIN == static_cast<Translation::Opcode>(value)); |
| 214 // Read the number of frames. | 214 // Read the number of frames. |
| 215 value = it.Next(); | 215 value = it.Next(); |
| 216 if (value == 1) return i; | 216 if (value == 1) return i; |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 UNREACHABLE(); | 219 UNREACHABLE(); |
| 220 return -1; | 220 return -1; |
| 221 } | 221 } |
| 222 | 222 |
| 223 | 223 |
| 224 void Deoptimizer::DoComputeOsrOutputFrame() { | 224 void Deoptimizer::DoComputeOsrOutputFrame() { |
| 225 DeoptimizationInputData* data = DeoptimizationInputData::cast( | 225 DeoptimizationInputData* data = DeoptimizationInputData::cast( |
| 226 optimized_code_->deoptimization_data()); | 226 optimized_code_->deoptimization_data()); |
| 227 unsigned ast_id = data->OsrAstId()->value(); | 227 unsigned ast_id = data->OsrAstId()->value(); |
| 228 // TODO(kasperl): This should not be the bailout_id_. It should be | 228 // TODO(kasperl): This should not be the bailout_id_. It should be |
| 229 // the ast id. Confusing. | 229 // the ast id. Confusing. |
| 230 ASSERT(bailout_id_ == ast_id); | 230 ASSERT(bailout_id_ == ast_id); |
| 231 | 231 |
| 232 int bailout_id = LookupBailoutId(data, ast_id); | 232 int bailout_id = LookupBailoutId(data, BailoutId(ast_id)); |
| 233 unsigned translation_index = data->TranslationIndex(bailout_id)->value(); | 233 unsigned translation_index = data->TranslationIndex(bailout_id)->value(); |
| 234 ByteArray* translations = data->TranslationByteArray(); | 234 ByteArray* translations = data->TranslationByteArray(); |
| 235 | 235 |
| 236 TranslationIterator iterator(translations, translation_index); | 236 TranslationIterator iterator(translations, translation_index); |
| 237 Translation::Opcode opcode = | 237 Translation::Opcode opcode = |
| 238 static_cast<Translation::Opcode>(iterator.Next()); | 238 static_cast<Translation::Opcode>(iterator.Next()); |
| 239 ASSERT(Translation::BEGIN == opcode); | 239 ASSERT(Translation::BEGIN == opcode); |
| 240 USE(opcode); | 240 USE(opcode); |
| 241 int count = iterator.Next(); | 241 int count = iterator.Next(); |
| 242 iterator.Skip(1); // Drop JS frame count. | 242 iterator.Skip(1); // Drop JS frame count. |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 | 586 |
| 587 intptr_t pc = reinterpret_cast<intptr_t>( | 587 intptr_t pc = reinterpret_cast<intptr_t>( |
| 588 construct_stub->instruction_start() + | 588 construct_stub->instruction_start() + |
| 589 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); | 589 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); |
| 590 output_frame->SetPc(pc); | 590 output_frame->SetPc(pc); |
| 591 } | 591 } |
| 592 | 592 |
| 593 | 593 |
| 594 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, | 594 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, |
| 595 int frame_index) { | 595 int frame_index) { |
| 596 int node_id = iterator->Next(); | 596 BailoutId node_id = BailoutId(iterator->Next()); |
| 597 JSFunction* function; | 597 JSFunction* function; |
| 598 if (frame_index != 0) { | 598 if (frame_index != 0) { |
| 599 function = JSFunction::cast(ComputeLiteral(iterator->Next())); | 599 function = JSFunction::cast(ComputeLiteral(iterator->Next())); |
| 600 } else { | 600 } else { |
| 601 int closure_id = iterator->Next(); | 601 int closure_id = iterator->Next(); |
| 602 USE(closure_id); | 602 USE(closure_id); |
| 603 ASSERT_EQ(Translation::kSelfLiteralId, closure_id); | 603 ASSERT_EQ(Translation::kSelfLiteralId, closure_id); |
| 604 function = function_; | 604 function = function_; |
| 605 } | 605 } |
| 606 unsigned height = iterator->Next(); | 606 unsigned height = iterator->Next(); |
| 607 unsigned height_in_bytes = height * kPointerSize; | 607 unsigned height_in_bytes = height * kPointerSize; |
| 608 if (FLAG_trace_deopt) { | 608 if (FLAG_trace_deopt) { |
| 609 PrintF(" translating "); | 609 PrintF(" translating "); |
| 610 function->PrintName(); | 610 function->PrintName(); |
| 611 PrintF(" => node=%d, height=%d\n", node_id, height_in_bytes); | 611 PrintF(" => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes); |
| 612 } | 612 } |
| 613 | 613 |
| 614 // The 'fixed' part of the frame consists of the incoming parameters and | 614 // The 'fixed' part of the frame consists of the incoming parameters and |
| 615 // the part described by JavaScriptFrameConstants. | 615 // the part described by JavaScriptFrameConstants. |
| 616 unsigned fixed_frame_size = ComputeFixedSize(function); | 616 unsigned fixed_frame_size = ComputeFixedSize(function); |
| 617 unsigned input_frame_size = input_->GetFrameSize(); | 617 unsigned input_frame_size = input_->GetFrameSize(); |
| 618 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 618 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
| 619 | 619 |
| 620 // Allocate and store the output frame description. | 620 // Allocate and store the output frame description. |
| 621 FrameDescription* output_frame = | 621 FrameDescription* output_frame = |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 } | 998 } |
| 999 __ bind(&done); | 999 __ bind(&done); |
| 1000 } | 1000 } |
| 1001 | 1001 |
| 1002 #undef __ | 1002 #undef __ |
| 1003 | 1003 |
| 1004 | 1004 |
| 1005 } } // namespace v8::internal | 1005 } } // namespace v8::internal |
| 1006 | 1006 |
| 1007 #endif // V8_TARGET_ARCH_X64 | 1007 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |