OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/deoptimizer.h" | 5 #include "src/deoptimizer.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/ast/prettyprinter.h" | 8 #include "src/ast/prettyprinter.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/disasm.h" | 10 #include "src/disasm.h" |
(...skipping 2765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2776 last_reason = static_cast<Deoptimizer::DeoptReason>(info->data()); | 2776 last_reason = static_cast<Deoptimizer::DeoptReason>(info->data()); |
2777 } | 2777 } |
2778 } | 2778 } |
2779 return DeoptInfo(SourcePosition::Unknown(), Deoptimizer::kNoReason, -1); | 2779 return DeoptInfo(SourcePosition::Unknown(), Deoptimizer::kNoReason, -1); |
2780 } | 2780 } |
2781 | 2781 |
2782 | 2782 |
2783 // static | 2783 // static |
2784 int Deoptimizer::ComputeSourcePosition(SharedFunctionInfo* shared, | 2784 int Deoptimizer::ComputeSourcePosition(SharedFunctionInfo* shared, |
2785 BailoutId node_id) { | 2785 BailoutId node_id) { |
2786 if (shared->HasBytecodeArray()) { | 2786 AbstractCode* abstract_code = shared->abstract_code(); |
2787 BytecodeArray* bytecodes = shared->bytecode_array(); | 2787 int code_offset; |
| 2788 if (abstract_code->IsBytecodeArray()) { |
2788 // BailoutId points to the next bytecode in the bytecode aray. Subtract | 2789 // BailoutId points to the next bytecode in the bytecode aray. Subtract |
2789 // 1 to get the end of current bytecode. | 2790 // 1 to get the end of current bytecode. |
2790 return bytecodes->SourcePosition(node_id.ToInt() - 1); | 2791 code_offset = node_id.ToInt() - 1; |
2791 } else { | 2792 } else { |
2792 Code* non_optimized_code = shared->code(); | 2793 FixedArray* raw_data = abstract_code->GetCode()->deoptimization_data(); |
2793 FixedArray* raw_data = non_optimized_code->deoptimization_data(); | |
2794 DeoptimizationOutputData* data = DeoptimizationOutputData::cast(raw_data); | 2794 DeoptimizationOutputData* data = DeoptimizationOutputData::cast(raw_data); |
2795 unsigned pc_and_state = Deoptimizer::GetOutputInfo(data, node_id, shared); | 2795 unsigned pc_and_state = Deoptimizer::GetOutputInfo(data, node_id, shared); |
2796 unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state); | 2796 code_offset = |
2797 return non_optimized_code->SourcePosition(pc_offset); | 2797 static_cast<int>(FullCodeGenerator::PcField::decode(pc_and_state)); |
2798 } | 2798 } |
| 2799 return abstract_code->SourcePosition(code_offset); |
2799 } | 2800 } |
2800 | 2801 |
2801 // static | 2802 // static |
2802 TranslatedValue TranslatedValue::NewArgumentsObject(TranslatedState* container, | 2803 TranslatedValue TranslatedValue::NewArgumentsObject(TranslatedState* container, |
2803 int length, | 2804 int length, |
2804 int object_index) { | 2805 int object_index) { |
2805 TranslatedValue slot(container, kArgumentsObject); | 2806 TranslatedValue slot(container, kArgumentsObject); |
2806 slot.materialization_info_ = {object_index, length}; | 2807 slot.materialization_info_ = {object_index, length}; |
2807 return slot; | 2808 return slot; |
2808 } | 2809 } |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4020 CHECK(value_info->IsMaterializedObject()); | 4021 CHECK(value_info->IsMaterializedObject()); |
4021 | 4022 |
4022 value_info->value_ = | 4023 value_info->value_ = |
4023 Handle<Object>(previously_materialized_objects->get(i), isolate_); | 4024 Handle<Object>(previously_materialized_objects->get(i), isolate_); |
4024 } | 4025 } |
4025 } | 4026 } |
4026 } | 4027 } |
4027 | 4028 |
4028 } // namespace internal | 4029 } // namespace internal |
4029 } // namespace v8 | 4030 } // namespace v8 |
OLD | NEW |