Commit 215238d3 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[wasm][debug] Ignore empty local names.

Other WebAssembly tools like wabt and wasmparser ignore empty strings
for local variable and parameter names, and just generate their own
names for it. Update V8 to comply with this convention.

Bug: chromium:1134531
Change-Id: Ic724482d93398feaf6b0797eec5a55f8ca508ca5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2448457Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarKim-Anh Tran <kimanh@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70305}
parent 2cf6ee0b
...@@ -164,8 +164,8 @@ MaybeHandle<String> GetLocalNameString(Isolate* isolate, ...@@ -164,8 +164,8 @@ MaybeHandle<String> GetLocalNameString(Isolate* isolate,
ModuleWireBytes wire_bytes{native_module->wire_bytes()}; ModuleWireBytes wire_bytes{native_module->wire_bytes()};
// Bounds were checked during decoding. // Bounds were checked during decoding.
DCHECK(wire_bytes.BoundsCheck(name_ref)); DCHECK(wire_bytes.BoundsCheck(name_ref));
Vector<const char> name = wire_bytes.GetNameOrNull(name_ref); WasmName name = wire_bytes.GetNameOrNull(name_ref);
if (name.begin() == nullptr) return {}; if (name.size() == 0) return {};
return isolate->factory()->NewStringFromUtf8(name); return isolate->factory()->NewStringFromUtf8(name);
} }
......
...@@ -4,14 +4,14 @@ Waiting for wasm script to be parsed. ...@@ -4,14 +4,14 @@ Waiting for wasm script to be parsed.
Got wasm script! Got wasm script!
Setting breakpoint on line 2 (first instruction) of third function Setting breakpoint on line 2 (first instruction) of third function
{ {
columnNumber : 167 columnNumber : 169
lineNumber : 0 lineNumber : 0
scriptId : <scriptId> scriptId : <scriptId>
} }
Paused: Paused:
Script wasm://wasm/ed01bcee byte offset 167: Wasm opcode 0x20 Script wasm://wasm/e33badc2 byte offset 169: Wasm opcode 0x20
Scope: Scope:
at C (interpreted) (0:167): at C (interpreted) (0:169):
- scope (module): - scope (module):
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
exported_memory: Uint8Array(65536) exported_memory: Uint8Array(65536)
...@@ -21,6 +21,7 @@ at C (interpreted) (0:167): ...@@ -21,6 +21,7 @@ at C (interpreted) (0:167):
- scope (local): - scope (local):
i32_arg: 42 (i32) i32_arg: 42 (i32)
i32_local: 0 (i32) i32_local: 0 (i32)
var2: 0 (f32)
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
at B (liftoff) (0:158): at B (liftoff) (0:158):
- scope (module): - scope (module):
...@@ -54,9 +55,9 @@ at (anonymous) (0:17): ...@@ -54,9 +55,9 @@ at (anonymous) (0:17):
-- skipped globals -- skipped globals
Paused: Paused:
Script wasm://wasm/ed01bcee byte offset 169: Wasm opcode 0x24 Script wasm://wasm/e33badc2 byte offset 171: Wasm opcode 0x24
Scope: Scope:
at C (interpreted) (0:169): at C (interpreted) (0:171):
- scope (module): - scope (module):
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
exported_memory: Uint8Array(65536) exported_memory: Uint8Array(65536)
...@@ -66,6 +67,7 @@ at C (interpreted) (0:169): ...@@ -66,6 +67,7 @@ at C (interpreted) (0:169):
- scope (local): - scope (local):
i32_arg: 42 (i32) i32_arg: 42 (i32)
i32_local: 0 (i32) i32_local: 0 (i32)
var2: 0 (f32)
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 42 (i32) 0: 42 (i32)
at B (liftoff) (0:158): at B (liftoff) (0:158):
...@@ -100,9 +102,9 @@ at (anonymous) (0:17): ...@@ -100,9 +102,9 @@ at (anonymous) (0:17):
-- skipped globals -- skipped globals
Paused: Paused:
Script wasm://wasm/ed01bcee byte offset 171: Wasm opcode 0x41 Script wasm://wasm/e33badc2 byte offset 173: Wasm opcode 0x41
Scope: Scope:
at C (interpreted) (0:171): at C (interpreted) (0:173):
- scope (module): - scope (module):
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
exported_memory: Uint8Array(65536) exported_memory: Uint8Array(65536)
...@@ -112,6 +114,7 @@ at C (interpreted) (0:171): ...@@ -112,6 +114,7 @@ at C (interpreted) (0:171):
- scope (local): - scope (local):
i32_arg: 42 (i32) i32_arg: 42 (i32)
i32_local: 0 (i32) i32_local: 0 (i32)
var2: 0 (f32)
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
at B (liftoff) (0:158): at B (liftoff) (0:158):
- scope (module): - scope (module):
...@@ -145,9 +148,9 @@ at (anonymous) (0:17): ...@@ -145,9 +148,9 @@ at (anonymous) (0:17):
-- skipped globals -- skipped globals
Paused: Paused:
Script wasm://wasm/ed01bcee byte offset 173: Wasm opcode 0x21 Script wasm://wasm/e33badc2 byte offset 175: Wasm opcode 0x21
Scope: Scope:
at C (interpreted) (0:173): at C (interpreted) (0:175):
- scope (module): - scope (module):
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
exported_memory: Uint8Array(65536) exported_memory: Uint8Array(65536)
...@@ -157,6 +160,7 @@ at C (interpreted) (0:173): ...@@ -157,6 +160,7 @@ at C (interpreted) (0:173):
- scope (local): - scope (local):
i32_arg: 42 (i32) i32_arg: 42 (i32)
i32_local: 0 (i32) i32_local: 0 (i32)
var2: 0 (f32)
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 47 (i32) 0: 47 (i32)
at B (liftoff) (0:158): at B (liftoff) (0:158):
...@@ -191,9 +195,9 @@ at (anonymous) (0:17): ...@@ -191,9 +195,9 @@ at (anonymous) (0:17):
-- skipped globals -- skipped globals
Paused: Paused:
Script wasm://wasm/ed01bcee byte offset 175: Wasm opcode 0x0b Script wasm://wasm/e33badc2 byte offset 177: Wasm opcode 0x0b
Scope: Scope:
at C (interpreted) (0:175): at C (interpreted) (0:177):
- scope (module): - scope (module):
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
exported_memory: Uint8Array(65536) exported_memory: Uint8Array(65536)
...@@ -203,6 +207,7 @@ at C (interpreted) (0:175): ...@@ -203,6 +207,7 @@ at C (interpreted) (0:175):
- scope (local): - scope (local):
i32_arg: 42 (i32) i32_arg: 42 (i32)
i32_local: 47 (i32) i32_local: 47 (i32)
var2: 0 (f32)
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
at B (liftoff) (0:158): at B (liftoff) (0:158):
- scope (module): - scope (module):
...@@ -236,7 +241,7 @@ at (anonymous) (0:17): ...@@ -236,7 +241,7 @@ at (anonymous) (0:17):
-- skipped globals -- skipped globals
Paused: Paused:
Script wasm://wasm/ed01bcee byte offset 160: Wasm opcode 0x1a Script wasm://wasm/e33badc2 byte offset 160: Wasm opcode 0x1a
Scope: Scope:
at B (liftoff) (0:160): at B (liftoff) (0:160):
- scope (module): - scope (module):
...@@ -270,7 +275,7 @@ at (anonymous) (0:17): ...@@ -270,7 +275,7 @@ at (anonymous) (0:17):
-- skipped globals -- skipped globals
Paused: Paused:
Script wasm://wasm/ed01bcee byte offset 161: Wasm opcode 0x1a Script wasm://wasm/e33badc2 byte offset 161: Wasm opcode 0x1a
Scope: Scope:
at B (liftoff) (0:161): at B (liftoff) (0:161):
- scope (module): - scope (module):
...@@ -303,7 +308,7 @@ at (anonymous) (0:17): ...@@ -303,7 +308,7 @@ at (anonymous) (0:17):
-- skipped globals -- skipped globals
Paused: Paused:
Script wasm://wasm/ed01bcee byte offset 162: Wasm opcode 0x0b Script wasm://wasm/e33badc2 byte offset 162: Wasm opcode 0x0b
Scope: Scope:
at B (liftoff) (0:162): at B (liftoff) (0:162):
- scope (module): - scope (module):
...@@ -335,7 +340,7 @@ at (anonymous) (0:17): ...@@ -335,7 +340,7 @@ at (anonymous) (0:17):
-- skipped globals -- skipped globals
Paused: Paused:
Script wasm://wasm/ed01bcee byte offset 130: Wasm opcode 0x0b Script wasm://wasm/e33badc2 byte offset 130: Wasm opcode 0x0b
Scope: Scope:
at A (liftoff) (0:130): at A (liftoff) (0:130):
- scope (module): - scope (module):
......
...@@ -104,6 +104,7 @@ async function instantiateWasm() { ...@@ -104,6 +104,7 @@ async function instantiateWasm() {
// A third function which will be stepped through. // A third function which will be stepped through.
let func = builder.addFunction('C (interpreted)', kSig_v_i, ['i32_arg']) let func = builder.addFunction('C (interpreted)', kSig_v_i, ['i32_arg'])
.addLocals(kWasmI32, 1, ['i32_local']) .addLocals(kWasmI32, 1, ['i32_local'])
.addLocals(kWasmF32, 1, [''])
.addBody([ .addBody([
// Set global 0 to param 0. // Set global 0 to param 0.
kExprLocalGet, 0, kExprGlobalSet, 0, kExprLocalGet, 0, kExprGlobalSet, 0,
......
...@@ -90,6 +90,7 @@ async function instantiateWasm() { ...@@ -90,6 +90,7 @@ async function instantiateWasm() {
.addLocals(kWasmI64, 1, ['i64_local']) .addLocals(kWasmI64, 1, ['i64_local'])
.addLocals(kWasmF64, 3, ['unicode☼f64', '0', '0']) .addLocals(kWasmF64, 3, ['unicode☼f64', '0', '0'])
.addLocals(kWasmS128, 1) .addLocals(kWasmS128, 1)
.addLocals(kWasmF32, 1, [''])
.addBody([ .addBody([
// Set param 0 to 11. // Set param 0 to 11.
kExprI32Const, 11, kExprLocalSet, 0, kExprI32Const, 11, kExprLocalSet, 0,
...@@ -108,6 +109,9 @@ async function instantiateWasm() { ...@@ -108,6 +109,9 @@ async function instantiateWasm() {
kExprI32Const, 23, kExprI32Const, 23,
kSimdPrefix, kExprI32x4Splat, kSimdPrefix, kExprI32x4Splat,
kExprLocalSet, 6, kExprLocalSet, 6,
// Set local 7 to 21
kExprI32Const, 21, kExprF32UConvertI32,
kExprLocalSet, 7,
// Set global 0 to 15 // Set global 0 to 15
kExprI32Const, 15, kExprGlobalSet, 0, kExprI32Const, 15, kExprGlobalSet, 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