Index: src/debug/debug-frames.cc |
diff --git a/src/debug/debug-frames.cc b/src/debug/debug-frames.cc |
index b1a8af256934d3e5d8ba93c49a9bce0d7c5e8d62..d331087bdd74945eafe6c96781ecc5a7def78332 100644 |
--- a/src/debug/debug-frames.cc |
+++ b/src/debug/debug-frames.cc |
@@ -9,25 +9,29 @@ |
namespace v8 { |
namespace internal { |
-FrameInspector::FrameInspector(JavaScriptFrame* frame, |
- int inlined_jsframe_index, Isolate* isolate) |
+FrameInspector::FrameInspector(StandardFrame* frame, int inlined_jsframe_index, |
+ Isolate* isolate) |
: frame_(frame), deoptimized_frame_(NULL), isolate_(isolate) { |
- has_adapted_arguments_ = frame_->has_adapted_arguments(); |
+ 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_optimized_ = frame_->is_optimized(); |
is_interpreted_ = frame_->is_interpreted(); |
// Calculate the deoptimized frame. |
if (frame->is_optimized()) { |
+ DCHECK(js_frame != nullptr); |
// TODO(turbofan): Revisit once we support deoptimization. |
- if (frame->LookupCode()->is_turbofanned() && |
- frame->function()->shared()->asm_function() && |
+ if (js_frame->LookupCode()->is_turbofanned() && |
+ js_frame->function()->shared()->asm_function() && |
!FLAG_turbo_asm_deoptimization) { |
is_optimized_ = false; |
return; |
} |
deoptimized_frame_ = Deoptimizer::DebuggerInspectableFrame( |
- frame, inlined_jsframe_index, isolate); |
+ js_frame, inlined_jsframe_index, isolate); |
} |
} |
@@ -45,9 +49,17 @@ int FrameInspector::GetParametersCount() { |
: frame_->ComputeParametersCount(); |
} |
-Handle<Object> FrameInspector::GetFunction() { |
+Handle<Script> FrameInspector::GetScript() { |
+ Object* script = is_optimized_ |
+ ? deoptimized_frame_->GetFunction()->shared()->script() |
+ : frame_->script(); |
+ return handle(Script::cast(script), isolate_); |
+} |
+ |
+Handle<JSFunction> FrameInspector::GetFunction() { |
+ DCHECK(!frame_->is_wasm()); |
return is_optimized_ ? deoptimized_frame_->GetFunction() |
- : handle(frame_->function(), isolate_); |
+ : handle(javascript_frame()->function(), isolate_); |
} |
Handle<Object> FrameInspector::GetParameter(int index) { |
@@ -57,8 +69,9 @@ Handle<Object> FrameInspector::GetParameter(int index) { |
Handle<Object> FrameInspector::GetExpression(int index) { |
// TODO(turbofan): Revisit once we support deoptimization. |
- if (frame_->LookupCode()->is_turbofanned() && |
- frame_->function()->shared()->asm_function() && |
+ if (frame_->is_java_script() && |
+ javascript_frame()->LookupCode()->is_turbofanned() && |
+ javascript_frame()->function()->shared()->asm_function() && |
!FLAG_turbo_asm_deoptimization) { |
return isolate_->factory()->undefined_value(); |
} |
@@ -96,8 +109,9 @@ Handle<Object> FrameInspector::GetContext() { |
// To inspect all the provided arguments the frame might need to be |
// replaced with the arguments frame. |
-void FrameInspector::SetArgumentsFrame(JavaScriptFrame* frame) { |
+void FrameInspector::SetArgumentsFrame(StandardFrame* frame) { |
DCHECK(has_adapted_arguments_); |
+ DCHECK(frame->is_arguments_adaptor()); |
frame_ = frame; |
is_optimized_ = frame_->is_optimized(); |
is_interpreted_ = frame_->is_interpreted(); |
@@ -156,10 +170,8 @@ void FrameInspector::MaterializeStackLocals(Handle<JSObject> target, |
void FrameInspector::UpdateStackLocalsFromMaterializedObject( |
Handle<JSObject> target, Handle<ScopeInfo> scope_info) { |
- if (is_optimized_) { |
- // Optimized frames are not supported. Simply give up. |
- return; |
- } |
+ // Optimized frames and wasm frames are not supported. Simply give up. |
+ if (is_optimized_ || frame_->is_wasm()) return; |
HandleScope scope(isolate_); |
@@ -170,10 +182,10 @@ void FrameInspector::UpdateStackLocalsFromMaterializedObject( |
if (ScopeInfo::VariableIsSynthetic(*name)) continue; |
if (ParameterIsShadowedByContextLocal(scope_info, name)) continue; |
- DCHECK(!frame_->GetParameter(i)->IsTheHole(isolate_)); |
+ DCHECK(!javascript_frame()->GetParameter(i)->IsTheHole(isolate_)); |
Handle<Object> value = |
Object::GetPropertyOrElement(target, name).ToHandleChecked(); |
- frame_->SetParameterValue(i, *value); |
+ javascript_frame()->SetParameterValue(i, *value); |
} |
// Stack locals. |
@@ -198,9 +210,8 @@ bool FrameInspector::ParameterIsShadowedByContextLocal( |
&maybe_assigned_flag) != -1; |
} |
- |
-SaveContext* DebugFrameHelper::FindSavedContextForFrame( |
- Isolate* isolate, JavaScriptFrame* frame) { |
+SaveContext* DebugFrameHelper::FindSavedContextForFrame(Isolate* isolate, |
+ StandardFrame* frame) { |
SaveContext* save = isolate->save_context(); |
while (save != NULL && !save->IsBelowFrame(frame)) { |
save = save->prev(); |
@@ -209,13 +220,16 @@ SaveContext* DebugFrameHelper::FindSavedContextForFrame( |
return save; |
} |
- |
-int DebugFrameHelper::FindIndexedNonNativeFrame(JavaScriptFrameIterator* it, |
+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->frame()->Summarize(&frames); |
+ it->javascript_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; |