| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 if (frame_->is_java_script() && | 70 if (frame_->is_java_script() && |
| 71 javascript_frame()->LookupCode()->is_turbofanned() && | 71 javascript_frame()->LookupCode()->is_turbofanned() && |
| 72 javascript_frame()->function()->shared()->asm_function() && | 72 javascript_frame()->function()->shared()->asm_function() && |
| 73 !FLAG_turbo_asm_deoptimization) { | 73 !FLAG_turbo_asm_deoptimization) { |
| 74 return isolate_->factory()->undefined_value(); | 74 return isolate_->factory()->undefined_value(); |
| 75 } | 75 } |
| 76 return is_optimized_ ? deoptimized_frame_->GetExpression(index) | 76 return is_optimized_ ? deoptimized_frame_->GetExpression(index) |
| 77 : handle(frame_->GetExpression(index), isolate_); | 77 : handle(frame_->GetExpression(index), isolate_); |
| 78 } | 78 } |
| 79 | 79 |
| 80 | |
| 81 int FrameInspector::GetSourcePosition() { | 80 int FrameInspector::GetSourcePosition() { |
| 82 if (is_optimized_) return deoptimized_frame_->GetSourcePosition(); | 81 return is_optimized_ ? deoptimized_frame_->GetSourcePosition() |
| 83 AbstractCode* code; | 82 : frame_->position(); |
| 84 int code_offset; | |
| 85 if (is_interpreted_) { | |
| 86 InterpretedFrame* frame = reinterpret_cast<InterpretedFrame*>(frame_); | |
| 87 code = AbstractCode::cast(frame->GetBytecodeArray()); | |
| 88 code_offset = frame->GetBytecodeOffset(); | |
| 89 } else { | |
| 90 code = AbstractCode::cast(frame_->LookupCode()); | |
| 91 code_offset = static_cast<int>(frame_->pc() - code->instruction_start()); | |
| 92 } | |
| 93 return code->SourcePosition(code_offset); | |
| 94 } | 83 } |
| 95 | 84 |
| 96 | |
| 97 bool FrameInspector::IsConstructor() { | 85 bool FrameInspector::IsConstructor() { |
| 98 return is_optimized_ && !is_bottommost_ | 86 return is_optimized_ && !is_bottommost_ |
| 99 ? deoptimized_frame_->HasConstructStub() | 87 ? deoptimized_frame_->HasConstructStub() |
| 100 : frame_->IsConstructor(); | 88 : frame_->IsConstructor(); |
| 101 } | 89 } |
| 102 | 90 |
| 103 Handle<Object> FrameInspector::GetContext() { | 91 Handle<Object> FrameInspector::GetContext() { |
| 104 return is_optimized_ ? deoptimized_frame_->GetContext() | 92 return is_optimized_ ? deoptimized_frame_->GetContext() |
| 105 : handle(frame_->context(), isolate_); | 93 : handle(frame_->context(), isolate_); |
| 106 } | 94 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 if (!frames[i].function()->shared()->IsSubjectToDebugging()) continue; | 222 if (!frames[i].function()->shared()->IsSubjectToDebugging()) continue; |
| 235 if (++count == index) return i; | 223 if (++count == index) return i; |
| 236 } | 224 } |
| 237 } | 225 } |
| 238 return -1; | 226 return -1; |
| 239 } | 227 } |
| 240 | 228 |
| 241 | 229 |
| 242 } // namespace internal | 230 } // namespace internal |
| 243 } // namespace v8 | 231 } // namespace v8 |
| OLD | NEW |