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

[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/+/1876816Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64547}
parent 53cddab8
......@@ -141,7 +141,9 @@ bool DebugWasmScopeIterator::Done() {
void DebugWasmScopeIterator::Advance() {
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;
} else {
// We use ScopeTypeWith type as marker for done.
......@@ -156,17 +158,18 @@ v8::debug::ScopeIterator::ScopeType DebugWasmScopeIterator::GetType() {
v8::Local<v8::Object> DebugWasmScopeIterator::GetObject() {
DCHECK(!Done());
Handle<WasmDebugInfo> debug_info(
WasmInterpreterEntryFrame::cast(frame_)->debug_info(), isolate_);
switch (type_) {
case debug::ScopeIterator::ScopeTypeGlobal: {
Handle<WasmInstanceObject> instance(debug_info->wasm_instance(),
isolate_);
Handle<WasmInstanceObject> instance =
FrameSummary::GetTop(frame_).AsWasm().wasm_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(
debug_info, frame_->fp(), inlined_frame_index_));
}
default:
return v8::Local<v8::Object>();
}
......
......@@ -156,12 +156,11 @@ std::unique_ptr<v8::debug::ScopeIterator>
DebugStackTraceIterator::GetScopeIterator() const {
DCHECK(!Done());
StandardFrame* frame = iterator_.frame();
if (frame->is_wasm_interpreter_entry()) {
return std::unique_ptr<v8::debug::ScopeIterator>(new DebugWasmScopeIterator(
isolate_, iterator_.frame(), inlined_frame_index_));
if (frame->is_wasm()) {
return std::make_unique<DebugWasmScopeIterator>(isolate_, iterator_.frame(),
inlined_frame_index_);
}
return std::unique_ptr<v8::debug::ScopeIterator>(
new DebugScopeIterator(isolate_, frame_inspector_.get()));
return std::make_unique<DebugScopeIterator>(isolate_, frame_inspector_.get());
}
bool DebugStackTraceIterator::Restart() {
......
......@@ -1913,6 +1913,10 @@ int WasmCompiledFrame::position() const {
return FrameSummary::GetSingle(this).SourcePosition();
}
Object WasmCompiledFrame::context() const {
return wasm_instance().native_context();
}
void WasmCompiledFrame::Summarize(std::vector<FrameSummary>* functions) const {
DCHECK(functions->empty());
// The {WasmCode*} escapes this scope via the {FrameSummary}, which is fine,
......
......@@ -953,6 +953,7 @@ class WasmCompiledFrame : public StandardFrame {
uint32_t function_index() const;
Script script() const override;
int position() const override;
Object context() const override;
bool at_to_number_conversion() const;
void Summarize(std::vector<FrameSummary>* frames) const override;
......
......@@ -23,6 +23,8 @@ at func (2:2):
locals: "i32Arg": 4 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack:
at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17):
- scope (global):
-- skipped globals
......@@ -40,6 +42,8 @@ at func (3:2):
locals: "i32Arg": 4 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack: "0": 11 (number)
at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17):
- scope (global):
-- skipped globals
......@@ -57,6 +61,8 @@ at func (4:2):
locals: "i32Arg": 11 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack:
at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17):
- scope (global):
-- skipped globals
......@@ -74,6 +80,8 @@ at func (5:2):
locals: "i32Arg": 11 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack: "0": 47 (number)
at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17):
- scope (global):
-- skipped globals
......@@ -91,6 +99,8 @@ at func (6:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack:
at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17):
- scope (global):
-- skipped globals
......@@ -108,6 +118,8 @@ at func (7:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack: "0": 9223372036854775807 (string)
at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17):
- scope (global):
-- skipped globals
......@@ -125,6 +137,8 @@ at func (8:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 9223372036854775807 (string), "unicode☼f64": 0 (number)
stack:
at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17):
- scope (global):
-- skipped globals
......@@ -142,6 +156,8 @@ at func (9:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 9223372036854775807 (string), "unicode☼f64": 0 (number)
stack: "0": -9223372036854775808 (string)
at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17):
- scope (global):
-- skipped globals
......@@ -159,6 +175,8 @@ at func (10:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
stack:
at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17):
- scope (global):
-- skipped globals
......@@ -176,6 +194,8 @@ at func (11:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
stack: "0": 1 (number)
at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17):
- scope (global):
-- skipped globals
......@@ -193,6 +213,8 @@ at func (12:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
stack: "0": 1 (number)
at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17):
- scope (global):
-- skipped globals
......@@ -210,6 +232,8 @@ at func (13:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
stack: "0": 1 (number), "1": 7 (number)
at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17):
- scope (global):
-- skipped globals
......@@ -227,6 +251,8 @@ at func (14:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
stack: "0": 1 (number), "1": 7 (number)
at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17):
- scope (global):
-- skipped globals
......@@ -244,6 +270,8 @@ at func (15:2):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
stack: "0": 0.14285714285714285 (number)
at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17):
- scope (global):
-- skipped globals
......@@ -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)
stack:
at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17):
- scope (global):
-- skipped globals
......@@ -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)
stack: "0": 15 (number)
at call_func (5:2):
- scope (global):
globals: "global#0": 0 (number)
at (anonymous) (0:17):
- scope (global):
-- skipped globals
......@@ -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)
stack:
at call_func (5:2):
- scope (global):
globals: "global#0": 15 (number)
at (anonymous) (0:17):
- scope (global):
-- 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