Index: src/debug/debug-frames.cc |
diff --git a/src/debug/debug-frames.cc b/src/debug/debug-frames.cc |
index 979b089ee22ca47a952a5a7d23a05c51320f9e05..15d6ed5b4d161092f26f08e7a4d34e8710f5a420 100644 |
--- a/src/debug/debug-frames.cc |
+++ b/src/debug/debug-frames.cc |
@@ -5,22 +5,28 @@ |
#include "src/debug/debug-frames.h" |
#include "src/frames-inl.h" |
+#include "src/wasm/wasm-interpreter.h" |
+#include "src/wasm/wasm-objects.h" |
namespace v8 { |
namespace internal { |
-FrameInspector::FrameInspector(StandardFrame* frame, int inlined_jsframe_index, |
+FrameInspector::FrameInspector(StandardFrame* frame, int inlined_frame_index, |
Isolate* isolate) |
- : frame_(frame), deoptimized_frame_(NULL), isolate_(isolate) { |
+ : frame_(frame), |
+ frame_summary_(FrameSummary::Get(frame, inlined_frame_index)), |
+ deoptimized_frame_(nullptr), |
+ isolate_(isolate) { |
JavaScriptFrame* js_frame = |
frame->is_java_script() ? javascript_frame() : nullptr; |
DCHECK(js_frame || frame->is_wasm()); |
has_adapted_arguments_ = js_frame && js_frame->has_adapted_arguments(); |
- is_bottommost_ = inlined_jsframe_index == 0; |
+ is_bottommost_ = inlined_frame_index == 0; |
is_optimized_ = frame_->is_optimized(); |
is_interpreted_ = frame_->is_interpreted(); |
+ |
// Calculate the deoptimized frame. |
- if (frame->is_optimized()) { |
+ if (is_optimized_) { |
DCHECK(js_frame != nullptr); |
// TODO(turbofan): Revisit once we support deoptimization. |
if (js_frame->LookupCode()->is_turbofanned() && |
@@ -30,7 +36,7 @@ FrameInspector::FrameInspector(StandardFrame* frame, int inlined_jsframe_index, |
} |
deoptimized_frame_ = Deoptimizer::DebuggerInspectableFrame( |
- js_frame, inlined_jsframe_index, isolate); |
+ js_frame, inlined_frame_index, isolate); |
} |
} |
@@ -47,16 +53,11 @@ int FrameInspector::GetParametersCount() { |
} |
Handle<Script> FrameInspector::GetScript() { |
- Object* script = is_optimized_ |
- ? deoptimized_frame_->GetFunction()->shared()->script() |
- : frame_->script(); |
- return handle(Script::cast(script), isolate_); |
+ return Handle<Script>::cast(frame_summary_.script()); |
} |
Handle<JSFunction> FrameInspector::GetFunction() { |
- DCHECK(!frame_->is_wasm()); |
- return is_optimized_ ? deoptimized_frame_->GetFunction() |
- : handle(javascript_frame()->function(), isolate_); |
+ return frame_summary_.AsJavaScript().function(); |
} |
Handle<Object> FrameInspector::GetParameter(int index) { |
@@ -76,22 +77,16 @@ Handle<Object> FrameInspector::GetExpression(int index) { |
} |
int FrameInspector::GetSourcePosition() { |
- return is_optimized_ ? deoptimized_frame_->GetSourcePosition() |
- : frame_->position(); |
+ return frame_summary_.SourcePosition(); |
} |
-bool FrameInspector::IsConstructor() { |
- return is_optimized_ && !is_bottommost_ |
- ? deoptimized_frame_->HasConstructStub() |
- : frame_->IsConstructor(); |
-} |
+bool FrameInspector::IsConstructor() { return frame_summary_.is_constructor(); } |
Handle<Object> FrameInspector::GetContext() { |
return is_optimized_ ? deoptimized_frame_->GetContext() |
: handle(frame_->context(), isolate_); |
} |
- |
// To inspect all the provided arguments the frame might need to be |
// replaced with the arguments frame. |
void FrameInspector::SetArgumentsFrame(StandardFrame* frame) { |
@@ -209,15 +204,11 @@ int DebugFrameHelper::FindIndexedNonNativeFrame(StackTraceFrameIterator* it, |
int index) { |
int count = -1; |
for (; !it->done(); it->Advance()) { |
- if (it->is_wasm()) { |
- if (++count == index) return 0; |
- continue; |
- } |
List<FrameSummary> frames(FLAG_max_inlining_levels + 1); |
- it->javascript_frame()->Summarize(&frames); |
+ it->frame()->Summarize(&frames); |
for (int i = frames.length() - 1; i >= 0; i--) { |
// Omit functions from native and extension scripts. |
- if (!frames[i].function()->shared()->IsSubjectToDebugging()) continue; |
+ if (!frames[i].is_subject_to_debugging()) continue; |
if (++count == index) return i; |
} |
} |