| 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 { |
| 11 | 11 |
| 12 FrameInspector::FrameInspector(StandardFrame* frame, int inlined_jsframe_index, | 12 FrameInspector::FrameInspector(StandardFrame* frame, int inlined_jsframe_index, |
| 13 Isolate* isolate) | 13 Isolate* isolate) |
| 14 : frame_(frame), deoptimized_frame_(NULL), isolate_(isolate) { | 14 : frame_(frame), deoptimized_frame_(NULL), isolate_(isolate) { |
| 15 JavaScriptFrame* js_frame = | 15 JavaScriptFrame* js_frame = |
| 16 frame->is_java_script() ? javascript_frame() : nullptr; | 16 frame->is_java_script() ? javascript_frame() : nullptr; |
| 17 DCHECK(js_frame || frame->is_wasm()); | 17 DCHECK(js_frame || frame->is_wasm()); |
| 18 has_adapted_arguments_ = js_frame && js_frame->has_adapted_arguments(); | 18 has_adapted_arguments_ = js_frame && js_frame->has_adapted_arguments(); |
| 19 is_bottommost_ = inlined_jsframe_index == 0; | 19 is_bottommost_ = inlined_jsframe_index == 0; |
| 20 is_optimized_ = frame_->is_optimized(); | 20 is_optimized_ = frame_->is_optimized(); |
| 21 is_interpreted_ = frame_->is_interpreted(); | 21 is_interpreted_ = frame_->is_interpreted(); |
| 22 // Calculate the deoptimized frame. | 22 // Calculate the deoptimized frame. |
| 23 if (frame->is_optimized()) { | 23 if (frame->is_optimized()) { |
| 24 DCHECK(js_frame != nullptr); | 24 DCHECK(js_frame != nullptr); |
| 25 // TODO(turbofan): Revisit once we support deoptimization. | 25 // TODO(turbofan): Revisit once we support deoptimization. |
| 26 if (js_frame->LookupCode()->is_turbofanned() && | 26 if (js_frame->LookupCode()->is_turbofanned() && |
| 27 js_frame->function()->shared()->asm_function() && | 27 js_frame->function()->shared()->asm_function()) { |
| 28 !FLAG_turbo_asm_deoptimization) { | |
| 29 is_optimized_ = false; | 28 is_optimized_ = false; |
| 30 return; | 29 return; |
| 31 } | 30 } |
| 32 | 31 |
| 33 deoptimized_frame_ = Deoptimizer::DebuggerInspectableFrame( | 32 deoptimized_frame_ = Deoptimizer::DebuggerInspectableFrame( |
| 34 js_frame, inlined_jsframe_index, isolate); | 33 js_frame, inlined_jsframe_index, isolate); |
| 35 } | 34 } |
| 36 } | 35 } |
| 37 | 36 |
| 38 FrameInspector::~FrameInspector() { | 37 FrameInspector::~FrameInspector() { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 62 | 61 |
| 63 Handle<Object> FrameInspector::GetParameter(int index) { | 62 Handle<Object> FrameInspector::GetParameter(int index) { |
| 64 return is_optimized_ ? deoptimized_frame_->GetParameter(index) | 63 return is_optimized_ ? deoptimized_frame_->GetParameter(index) |
| 65 : handle(frame_->GetParameter(index), isolate_); | 64 : handle(frame_->GetParameter(index), isolate_); |
| 66 } | 65 } |
| 67 | 66 |
| 68 Handle<Object> FrameInspector::GetExpression(int index) { | 67 Handle<Object> FrameInspector::GetExpression(int index) { |
| 69 // TODO(turbofan): Revisit once we support deoptimization. | 68 // TODO(turbofan): Revisit once we support deoptimization. |
| 70 if (frame_->is_java_script() && | 69 if (frame_->is_java_script() && |
| 71 javascript_frame()->LookupCode()->is_turbofanned() && | 70 javascript_frame()->LookupCode()->is_turbofanned() && |
| 72 javascript_frame()->function()->shared()->asm_function() && | 71 javascript_frame()->function()->shared()->asm_function()) { |
| 73 !FLAG_turbo_asm_deoptimization) { | |
| 74 return isolate_->factory()->undefined_value(); | 72 return isolate_->factory()->undefined_value(); |
| 75 } | 73 } |
| 76 return is_optimized_ ? deoptimized_frame_->GetExpression(index) | 74 return is_optimized_ ? deoptimized_frame_->GetExpression(index) |
| 77 : handle(frame_->GetExpression(index), isolate_); | 75 : handle(frame_->GetExpression(index), isolate_); |
| 78 } | 76 } |
| 79 | 77 |
| 80 int FrameInspector::GetSourcePosition() { | 78 int FrameInspector::GetSourcePosition() { |
| 81 return is_optimized_ ? deoptimized_frame_->GetSourcePosition() | 79 return is_optimized_ ? deoptimized_frame_->GetSourcePosition() |
| 82 : frame_->position(); | 80 : frame_->position(); |
| 83 } | 81 } |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 if (!frames[i].function()->shared()->IsSubjectToDebugging()) continue; | 220 if (!frames[i].function()->shared()->IsSubjectToDebugging()) continue; |
| 223 if (++count == index) return i; | 221 if (++count == index) return i; |
| 224 } | 222 } |
| 225 } | 223 } |
| 226 return -1; | 224 return -1; |
| 227 } | 225 } |
| 228 | 226 |
| 229 | 227 |
| 230 } // namespace internal | 228 } // namespace internal |
| 231 } // namespace v8 | 229 } // namespace v8 |
| OLD | NEW |