OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/debug/debug-frames.h" | 5 #include "src/debug/debug-frames.h" |
6 | 6 |
7 #include "src/frames-inl.h" | 7 #include "src/frames-inl.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 frame_->function()->shared()->asm_function() && | 61 frame_->function()->shared()->asm_function() && |
62 !FLAG_turbo_asm_deoptimization) { | 62 !FLAG_turbo_asm_deoptimization) { |
63 return isolate_->factory()->undefined_value(); | 63 return isolate_->factory()->undefined_value(); |
64 } | 64 } |
65 return is_optimized_ ? deoptimized_frame_->GetExpression(index) | 65 return is_optimized_ ? deoptimized_frame_->GetExpression(index) |
66 : handle(frame_->GetExpression(index), isolate_); | 66 : handle(frame_->GetExpression(index), isolate_); |
67 } | 67 } |
68 | 68 |
69 | 69 |
70 int FrameInspector::GetSourcePosition() { | 70 int FrameInspector::GetSourcePosition() { |
71 if (is_optimized_) { | 71 if (is_optimized_) return deoptimized_frame_->GetSourcePosition(); |
72 return deoptimized_frame_->GetSourcePosition(); | 72 AbstractCode* code; |
73 } else if (is_interpreted_) { | 73 int code_offset; |
| 74 if (is_interpreted_) { |
74 InterpretedFrame* frame = reinterpret_cast<InterpretedFrame*>(frame_); | 75 InterpretedFrame* frame = reinterpret_cast<InterpretedFrame*>(frame_); |
75 BytecodeArray* bytecode_array = frame->GetBytecodeArray(); | 76 code = AbstractCode::cast(frame->GetBytecodeArray()); |
76 return bytecode_array->SourcePosition(frame->GetBytecodeOffset()); | 77 code_offset = frame->GetBytecodeOffset(); |
77 } else { | 78 } else { |
78 Code* code = frame_->LookupCode(); | 79 code = AbstractCode::cast(frame_->LookupCode()); |
79 int offset = static_cast<int>(frame_->pc() - code->instruction_start()); | 80 code_offset = static_cast<int>(frame_->pc() - code->instruction_start()); |
80 return code->SourcePosition(offset); | |
81 } | 81 } |
| 82 return code->SourcePosition(code_offset); |
82 } | 83 } |
83 | 84 |
84 | 85 |
85 bool FrameInspector::IsConstructor() { | 86 bool FrameInspector::IsConstructor() { |
86 return is_optimized_ && !is_bottommost_ | 87 return is_optimized_ && !is_bottommost_ |
87 ? deoptimized_frame_->HasConstructStub() | 88 ? deoptimized_frame_->HasConstructStub() |
88 : frame_->IsConstructor(); | 89 : frame_->IsConstructor(); |
89 } | 90 } |
90 | 91 |
91 Handle<Object> FrameInspector::GetContext() { | 92 Handle<Object> FrameInspector::GetContext() { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 if (!frames[i].function()->shared()->IsSubjectToDebugging()) continue; | 222 if (!frames[i].function()->shared()->IsSubjectToDebugging()) continue; |
222 if (++count == index) return i; | 223 if (++count == index) return i; |
223 } | 224 } |
224 } | 225 } |
225 return -1; | 226 return -1; |
226 } | 227 } |
227 | 228 |
228 | 229 |
229 } // namespace internal | 230 } // namespace internal |
230 } // namespace v8 | 231 } // namespace v8 |
OLD | NEW |