Commit c573bdeb authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

Reland "[wasm][debug] Report global scope also for compiled frames"

This is a reland of bc8ad334.
The CL was innocent, thus unmodified reland with TBR.

Original change's description:
> [wasm][debug] Report global scope also for compiled frames
>
> The global scope (containing global values and the memory) can be
> produced from the instance alone, hence we can also report it for
> compiled frames.
>
> R=mstarzinger@chromium.org, jgruber@chromium.org
>
> Bug: v8:9676
> Change-Id: I20fbb74a98b00b128b6ed305b92fb56ad7dc7558
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1876816
> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Commit-Queue: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#64547}

TBR=mstarzinger@chromium.org

Bug: v8:9676
Change-Id: I2486a007156b7197d523f62ca3c30e29e7650b63
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1879929
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64558}
parent f737febb
...@@ -141,7 +141,9 @@ bool DebugWasmScopeIterator::Done() { ...@@ -141,7 +141,9 @@ bool DebugWasmScopeIterator::Done() {
void DebugWasmScopeIterator::Advance() { void DebugWasmScopeIterator::Advance() {
DCHECK(!Done()); DCHECK(!Done());
if (type_ == debug::ScopeIterator::ScopeTypeGlobal) { // Local scope information is only available for interpreted frames currently.
if (type_ == debug::ScopeIterator::ScopeTypeGlobal &&
frame_->is_wasm_interpreter_entry()) {
type_ = debug::ScopeIterator::ScopeTypeLocal; type_ = debug::ScopeIterator::ScopeTypeLocal;
} else { } else {
// We use ScopeTypeWith type as marker for done. // We use ScopeTypeWith type as marker for done.
...@@ -156,17 +158,18 @@ v8::debug::ScopeIterator::ScopeType DebugWasmScopeIterator::GetType() { ...@@ -156,17 +158,18 @@ v8::debug::ScopeIterator::ScopeType DebugWasmScopeIterator::GetType() {
v8::Local<v8::Object> DebugWasmScopeIterator::GetObject() { v8::Local<v8::Object> DebugWasmScopeIterator::GetObject() {
DCHECK(!Done()); DCHECK(!Done());
Handle<WasmDebugInfo> debug_info(
WasmInterpreterEntryFrame::cast(frame_)->debug_info(), isolate_);
switch (type_) { switch (type_) {
case debug::ScopeIterator::ScopeTypeGlobal: { case debug::ScopeIterator::ScopeTypeGlobal: {
Handle<WasmInstanceObject> instance(debug_info->wasm_instance(), Handle<WasmInstanceObject> instance =
isolate_); FrameSummary::GetTop(frame_).AsWasm().wasm_instance();
return Utils::ToLocal(wasm::GetGlobalScopeObject(instance)); return Utils::ToLocal(wasm::GetGlobalScopeObject(instance));
} }
case debug::ScopeIterator::ScopeTypeLocal: case debug::ScopeIterator::ScopeTypeLocal: {
Handle<WasmDebugInfo> debug_info(
WasmInterpreterEntryFrame::cast(frame_)->debug_info(), isolate_);
return Utils::ToLocal(WasmDebugInfo::GetLocalScopeObject( return Utils::ToLocal(WasmDebugInfo::GetLocalScopeObject(
debug_info, frame_->fp(), inlined_frame_index_)); debug_info, frame_->fp(), inlined_frame_index_));
}
default: default:
return v8::Local<v8::Object>(); return v8::Local<v8::Object>();
} }
......
...@@ -156,12 +156,11 @@ std::unique_ptr<v8::debug::ScopeIterator> ...@@ -156,12 +156,11 @@ std::unique_ptr<v8::debug::ScopeIterator>
DebugStackTraceIterator::GetScopeIterator() const { DebugStackTraceIterator::GetScopeIterator() const {
DCHECK(!Done()); DCHECK(!Done());
StandardFrame* frame = iterator_.frame(); StandardFrame* frame = iterator_.frame();
if (frame->is_wasm_interpreter_entry()) { if (frame->is_wasm()) {
return std::unique_ptr<v8::debug::ScopeIterator>(new DebugWasmScopeIterator( return std::make_unique<DebugWasmScopeIterator>(isolate_, iterator_.frame(),
isolate_, iterator_.frame(), inlined_frame_index_)); inlined_frame_index_);
} }
return std::unique_ptr<v8::debug::ScopeIterator>( return std::make_unique<DebugScopeIterator>(isolate_, frame_inspector_.get());
new DebugScopeIterator(isolate_, frame_inspector_.get()));
} }
bool DebugStackTraceIterator::Restart() { bool DebugStackTraceIterator::Restart() {
......
...@@ -1913,6 +1913,10 @@ int WasmCompiledFrame::position() const { ...@@ -1913,6 +1913,10 @@ int WasmCompiledFrame::position() const {
return FrameSummary::GetSingle(this).SourcePosition(); return FrameSummary::GetSingle(this).SourcePosition();
} }
Object WasmCompiledFrame::context() const {
return wasm_instance().native_context();
}
void WasmCompiledFrame::Summarize(std::vector<FrameSummary>* functions) const { void WasmCompiledFrame::Summarize(std::vector<FrameSummary>* functions) const {
DCHECK(functions->empty()); DCHECK(functions->empty());
// The {WasmCode*} escapes this scope via the {FrameSummary}, which is fine, // The {WasmCode*} escapes this scope via the {FrameSummary}, which is fine,
......
...@@ -953,6 +953,7 @@ class WasmCompiledFrame : public StandardFrame { ...@@ -953,6 +953,7 @@ class WasmCompiledFrame : public StandardFrame {
uint32_t function_index() const; uint32_t function_index() const;
Script script() const override; Script script() const override;
int position() const override; int position() const override;
Object context() const override;
bool at_to_number_conversion() const; bool at_to_number_conversion() const;
void Summarize(std::vector<FrameSummary>* frames) const override; void Summarize(std::vector<FrameSummary>* frames) const override;
......
...@@ -23,6 +23,8 @@ at func (2:2): ...@@ -23,6 +23,8 @@ at func (2:2):
locals: "i32Arg": 4 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number) locals: "i32Arg": 4 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack: stack:
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
...@@ -40,6 +42,8 @@ at func (3:2): ...@@ -40,6 +42,8 @@ at func (3:2):
locals: "i32Arg": 4 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number) locals: "i32Arg": 4 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack: "0": 11 (number) stack: "0": 11 (number)
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
...@@ -57,6 +61,8 @@ at func (4:2): ...@@ -57,6 +61,8 @@ at func (4:2):
locals: "i32Arg": 11 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number) locals: "i32Arg": 11 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack: stack:
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
...@@ -74,6 +80,8 @@ at func (5:2): ...@@ -74,6 +80,8 @@ at func (5:2):
locals: "i32Arg": 11 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number) locals: "i32Arg": 11 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack: "0": 47 (number) stack: "0": 47 (number)
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
...@@ -91,6 +99,8 @@ at func (6:2): ...@@ -91,6 +99,8 @@ at func (6:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number) locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack: stack:
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
...@@ -108,6 +118,8 @@ at func (7:2): ...@@ -108,6 +118,8 @@ at func (7:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number) locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack: "0": 9223372036854775807 (string) stack: "0": 9223372036854775807 (string)
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
...@@ -125,6 +137,8 @@ at func (8:2): ...@@ -125,6 +137,8 @@ at func (8:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 9223372036854775807 (string), "unicode☼f64": 0 (number) locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 9223372036854775807 (string), "unicode☼f64": 0 (number)
stack: stack:
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
...@@ -142,6 +156,8 @@ at func (9:2): ...@@ -142,6 +156,8 @@ at func (9:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 9223372036854775807 (string), "unicode☼f64": 0 (number) locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 9223372036854775807 (string), "unicode☼f64": 0 (number)
stack: "0": -9223372036854775808 (string) stack: "0": -9223372036854775808 (string)
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
...@@ -159,6 +175,8 @@ at func (10:2): ...@@ -159,6 +175,8 @@ at func (10:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number) locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
stack: stack:
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
...@@ -176,6 +194,8 @@ at func (11:2): ...@@ -176,6 +194,8 @@ at func (11:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number) locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
stack: "0": 1 (number) stack: "0": 1 (number)
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
...@@ -193,6 +213,8 @@ at func (12:2): ...@@ -193,6 +213,8 @@ at func (12:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number) locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
stack: "0": 1 (number) stack: "0": 1 (number)
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
...@@ -210,6 +232,8 @@ at func (13:2): ...@@ -210,6 +232,8 @@ at func (13:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number) locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
stack: "0": 1 (number), "1": 7 (number) stack: "0": 1 (number), "1": 7 (number)
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
...@@ -227,6 +251,8 @@ at func (14:2): ...@@ -227,6 +251,8 @@ at func (14:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number) locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
stack: "0": 1 (number), "1": 7 (number) stack: "0": 1 (number), "1": 7 (number)
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
...@@ -244,6 +270,8 @@ at func (15:2): ...@@ -244,6 +270,8 @@ at func (15:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number) locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
stack: "0": 0.14285714285714285 (number) stack: "0": 0.14285714285714285 (number)
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
...@@ -261,6 +289,8 @@ at func (16:2): ...@@ -261,6 +289,8 @@ at func (16:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0.14285714285714285 (number) locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0.14285714285714285 (number)
stack: stack:
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
...@@ -278,6 +308,8 @@ at func (17:2): ...@@ -278,6 +308,8 @@ at func (17:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0.14285714285714285 (number) locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0.14285714285714285 (number)
stack: "0": 15 (number) stack: "0": 15 (number)
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
...@@ -295,6 +327,8 @@ at func (18:0): ...@@ -295,6 +327,8 @@ at func (18:0):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0.14285714285714285 (number) locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0.14285714285714285 (number)
stack: stack:
at call_func (5:2): at call_func (5:2):
- scope (global):
globals: "global#0": 15 (number)
at (anonymous) (0:17): at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped globals -- skipped globals
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment