Commit 4d69c548 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm][debug] Fix index-named locals

This fixes local names that are the string representation of a valid
element index.
Even though both the Liftoff and the interpreter-based test are changed,
only the latter needs to be fixed right now since Liftoff does not use
the names currently. Modifying the test just ensures that we implement
this correctly once we use the name.

R=jkummerow@chromium.org

Bug: v8:10019
Change-Id: Ib7f7d6e244a344a85ab540b6c2c67f98b1f3078e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1998079
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65751}
parent 356470b0
......@@ -408,7 +408,7 @@ class InterpreterHandle {
JSObject::AddProperty(isolate, local_scope_object, locals_name,
locals_obj, NONE);
for (int i = 0; i < num_locals; ++i) {
MaybeHandle<String> name =
MaybeHandle<Name> name =
GetLocalName(isolate, debug_info, frame->function()->func_index, i);
if (name.is_null()) {
// Parameters should come before locals in alphabetical ordering, so
......@@ -418,9 +418,15 @@ class InterpreterHandle {
}
WasmValue value = frame->GetLocalValue(i);
Handle<Object> value_obj = WasmValueToValueObject(isolate_, value);
JSObject::SetOwnPropertyIgnoreAttributes(
locals_obj, name.ToHandleChecked(), value_obj, NONE)
.Assert();
// {name} can be a string representation of an element index.
LookupIterator::Key lookup_key{isolate, name.ToHandleChecked()};
LookupIterator it(isolate, locals_obj, lookup_key, locals_obj,
LookupIterator::OWN_SKIP_INTERCEPTOR);
if (it.IsFound()) continue;
Object::AddDataProperty(&it, value_obj, NONE,
Just(ShouldThrow::kThrowOnError),
StoreOrigin::kNamed)
.Check();
}
}
......
......@@ -9,13 +9,13 @@ Setting breakpoint on first instruction of second function
scriptId : <scriptId>
}
Paused:
Script wasm://wasm/0aafe946 byte offset 69: Wasm opcode 0x41
Script wasm://wasm/a6e9de16 byte offset 69: Wasm opcode 0x41
Scope:
at func (0:69):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "i32Arg": 4 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
locals: "0": 0 (number), "i32Arg": 4 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack:
at call_func (0:58):
- scope (global):
......@@ -26,13 +26,13 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/0aafe946 byte offset 71: Wasm opcode 0x21
Script wasm://wasm/a6e9de16 byte offset 71: Wasm opcode 0x21
Scope:
at func (0:71):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "i32Arg": 4 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
locals: "0": 0 (number), "i32Arg": 4 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack: "0": 11 (number)
at call_func (0:58):
- scope (global):
......@@ -43,13 +43,13 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/0aafe946 byte offset 73: Wasm opcode 0x41
Script wasm://wasm/a6e9de16 byte offset 73: Wasm opcode 0x41
Scope:
at func (0:73):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "i32Arg": 11 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
locals: "0": 0 (number), "i32Arg": 11 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack:
at call_func (0:58):
- scope (global):
......@@ -60,13 +60,13 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/0aafe946 byte offset 75: Wasm opcode 0x21
Script wasm://wasm/a6e9de16 byte offset 75: Wasm opcode 0x21
Scope:
at func (0:75):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "i32Arg": 11 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
locals: "0": 0 (number), "i32Arg": 11 (number), "local#1": 0 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack: "0": 47 (number)
at call_func (0:58):
- scope (global):
......@@ -77,13 +77,13 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/0aafe946 byte offset 77: Wasm opcode 0x42
Script wasm://wasm/a6e9de16 byte offset 77: Wasm opcode 0x42
Scope:
at func (0:77):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
locals: "0": 0 (number), "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack:
at call_func (0:58):
- scope (global):
......@@ -94,13 +94,13 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/0aafe946 byte offset 88: Wasm opcode 0x21
Script wasm://wasm/a6e9de16 byte offset 88: Wasm opcode 0x21
Scope:
at func (0:88):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
locals: "0": 0 (number), "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 0 (number), "unicode☼f64": 0 (number)
stack: "0": 9223372036854775807 (string)
at call_func (0:58):
- scope (global):
......@@ -111,13 +111,13 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/0aafe946 byte offset 90: Wasm opcode 0x42
Script wasm://wasm/a6e9de16 byte offset 90: Wasm opcode 0x42
Scope:
at func (0:90):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 9223372036854775807 (string), "unicode☼f64": 0 (number)
locals: "0": 0 (number), "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 9223372036854775807 (string), "unicode☼f64": 0 (number)
stack:
at call_func (0:58):
- scope (global):
......@@ -128,13 +128,13 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/0aafe946 byte offset 101: Wasm opcode 0x21
Script wasm://wasm/a6e9de16 byte offset 101: Wasm opcode 0x21
Scope:
at func (0:101):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 9223372036854775807 (string), "unicode☼f64": 0 (number)
locals: "0": 0 (number), "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": 9223372036854775807 (string), "unicode☼f64": 0 (number)
stack: "0": -9223372036854775808 (string)
at call_func (0:58):
- scope (global):
......@@ -145,13 +145,13 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/0aafe946 byte offset 103: Wasm opcode 0x41
Script wasm://wasm/a6e9de16 byte offset 103: Wasm opcode 0x41
Scope:
at func (0:103):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
locals: "0": 0 (number), "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
stack:
at call_func (0:58):
- scope (global):
......@@ -162,13 +162,13 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/0aafe946 byte offset 105: Wasm opcode 0xb8
Script wasm://wasm/a6e9de16 byte offset 105: Wasm opcode 0xb8
Scope:
at func (0:105):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
locals: "0": 0 (number), "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
stack: "0": 1 (number)
at call_func (0:58):
- scope (global):
......@@ -179,13 +179,13 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/0aafe946 byte offset 106: Wasm opcode 0x41
Script wasm://wasm/a6e9de16 byte offset 106: Wasm opcode 0x41
Scope:
at func (0:106):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
locals: "0": 0 (number), "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
stack: "0": 1 (number)
at call_func (0:58):
- scope (global):
......@@ -196,13 +196,13 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/0aafe946 byte offset 108: Wasm opcode 0xb8
Script wasm://wasm/a6e9de16 byte offset 108: Wasm opcode 0xb8
Scope:
at func (0:108):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
locals: "0": 0 (number), "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 (0:58):
- scope (global):
......@@ -213,13 +213,13 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/0aafe946 byte offset 109: Wasm opcode 0xa3
Script wasm://wasm/a6e9de16 byte offset 109: Wasm opcode 0xa3
Scope:
at func (0:109):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
locals: "0": 0 (number), "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 (0:58):
- scope (global):
......@@ -230,13 +230,13 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/0aafe946 byte offset 110: Wasm opcode 0x21
Script wasm://wasm/a6e9de16 byte offset 110: Wasm opcode 0x21
Scope:
at func (0:110):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
locals: "0": 0 (number), "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0 (number)
stack: "0": 0.14285714285714285 (number)
at call_func (0:58):
- scope (global):
......@@ -247,13 +247,13 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/0aafe946 byte offset 112: Wasm opcode 0x41
Script wasm://wasm/a6e9de16 byte offset 112: Wasm opcode 0x41
Scope:
at func (0:112):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0.14285714285714285 (number)
locals: "0": 0 (number), "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0.14285714285714285 (number)
stack:
at call_func (0:58):
- scope (global):
......@@ -264,13 +264,13 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/0aafe946 byte offset 114: Wasm opcode 0x24
Script wasm://wasm/a6e9de16 byte offset 114: Wasm opcode 0x24
Scope:
at func (0:114):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0.14285714285714285 (number)
locals: "0": 0 (number), "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0.14285714285714285 (number)
stack: "0": 15 (number)
at call_func (0:58):
- scope (global):
......@@ -281,13 +281,13 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/0aafe946 byte offset 116: Wasm opcode 0xb
Script wasm://wasm/a6e9de16 byte offset 116: Wasm opcode 0xb
Scope:
at func (0:116):
- scope (global):
globals: "global#0": 15 (number)
- scope (local):
locals: "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0.14285714285714285 (number)
locals: "0": 0 (number), "i32Arg": 11 (number), "local#1": 47 (number), "i64_local": -9223372036854775808 (string), "unicode☼f64": 0.14285714285714285 (number)
stack:
at call_func (0:58):
- scope (global):
......
......@@ -10,7 +10,7 @@ Setting breakpoint on line 2 (first instruction) of third function
scriptId : <scriptId>
}
Paused:
Script wasm://wasm/71172dd6 byte offset 85: Wasm opcode 0x20
Script wasm://wasm/a094dcfe byte offset 85: Wasm opcode 0x20
Scope:
at C (interpreted) (0:85):
- scope (global):
......@@ -22,7 +22,7 @@ at B (liftoff) (0:76):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "arg#0": 0 (number), "local#1": 0 (number), "local#2": 0 (number)
locals: "arg#0": 0 (number), "local#1": 0 (number), "local#2": 0 (number), "local#3": 0 (number), "local#4": 0 (number)
stack: "0": 0 (number), "1": 3 (number)
at A (liftoff) (0:54):
- scope (global):
......@@ -35,7 +35,7 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/71172dd6 byte offset 87: Wasm opcode 0x24
Script wasm://wasm/a094dcfe byte offset 87: Wasm opcode 0x24
Scope:
at C (interpreted) (0:87):
- scope (global):
......@@ -47,7 +47,7 @@ at B (liftoff) (0:76):
- scope (global):
globals: "global#0": 0 (number)
- scope (local):
locals: "arg#0": 0 (number), "local#1": 0 (number), "local#2": 0 (number)
locals: "arg#0": 0 (number), "local#1": 0 (number), "local#2": 0 (number), "local#3": 0 (number), "local#4": 0 (number)
stack: "0": 0 (number), "1": 3 (number)
at A (liftoff) (0:54):
- scope (global):
......@@ -60,7 +60,7 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/71172dd6 byte offset 89: Wasm opcode 0x41
Script wasm://wasm/a094dcfe byte offset 89: Wasm opcode 0x41
Scope:
at C (interpreted) (0:89):
- scope (global):
......@@ -72,7 +72,7 @@ at B (liftoff) (0:76):
- scope (global):
globals: "global#0": 42 (number)
- scope (local):
locals: "arg#0": 0 (number), "local#1": 0 (number), "local#2": 0 (number)
locals: "arg#0": 0 (number), "local#1": 0 (number), "local#2": 0 (number), "local#3": 0 (number), "local#4": 0 (number)
stack: "0": 0 (number), "1": 3 (number)
at A (liftoff) (0:54):
- scope (global):
......@@ -85,7 +85,7 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/71172dd6 byte offset 91: Wasm opcode 0x21
Script wasm://wasm/a094dcfe byte offset 91: Wasm opcode 0x21
Scope:
at C (interpreted) (0:91):
- scope (global):
......@@ -97,7 +97,7 @@ at B (liftoff) (0:76):
- scope (global):
globals: "global#0": 42 (number)
- scope (local):
locals: "arg#0": 0 (number), "local#1": 0 (number), "local#2": 0 (number)
locals: "arg#0": 0 (number), "local#1": 0 (number), "local#2": 0 (number), "local#3": 0 (number), "local#4": 0 (number)
stack: "0": 0 (number), "1": 3 (number)
at A (liftoff) (0:54):
- scope (global):
......@@ -110,7 +110,7 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/71172dd6 byte offset 93: Wasm opcode 0xb
Script wasm://wasm/a094dcfe byte offset 93: Wasm opcode 0xb
Scope:
at C (interpreted) (0:93):
- scope (global):
......@@ -122,7 +122,7 @@ at B (liftoff) (0:76):
- scope (global):
globals: "global#0": 42 (number)
- scope (local):
locals: "arg#0": 0 (number), "local#1": 0 (number), "local#2": 0 (number)
locals: "arg#0": 0 (number), "local#1": 0 (number), "local#2": 0 (number), "local#3": 0 (number), "local#4": 0 (number)
stack: "0": 0 (number), "1": 3 (number)
at A (liftoff) (0:54):
- scope (global):
......
......@@ -84,7 +84,8 @@ async function instantiateWasm() {
builder.addFunction('B (liftoff)', kSig_v_i)
.addLocals(
{i32_count: 1, f32_count: 1}, ['i32_arg', 'i32_local', 'f32_local'])
{i32_count: 1, f32_count: 3},
['i32_arg', 'i32_local', 'f32_local', '0', '0'])
.addBody([
// Load a parameter and a constant onto the operand stack.
kExprLocalGet, 0, kExprI32Const, 3,
......
......@@ -86,8 +86,8 @@ async function instantiateWasm() {
// A second function which will be stepped through.
let func = builder.addFunction('func', kSig_v_i)
.addLocals(
{i32_count: 1, i64_count: 1, f64_count: 1},
['i32Arg', undefined, 'i64_local', 'unicode☼f64'])
{i32_count: 1, i64_count: 1, f64_count: 3},
['i32Arg', undefined, 'i64_local', 'unicode☼f64', '0', '0'])
.addBody([
// Set param 0 to 11.
kExprI32Const, 11, kExprLocalSet, 0,
......
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