v8/test/unittests/wasm/wasm-disassembler-unittest-names.wat.inc
Daniel Lehmann 6d551ef34e [wasm] test disassembler for custom name section
This adds a separate test module and output expectation for names in
the custom "name" section in Wasm binaries.

Also fixes a small inconsistency: The index of both data and element
segments is now printed as a comment, in case one prints their name
(as we do for functions, globals, etc.)

Data segment names are currently not printed for consistency with
legacy behavior.

Change-Id: I8900f54b02e031a811dfd9be8326d6f63d26d4a0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4004717
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Daniel Lehmann <dlehmann@chromium.org>
Auto-Submit: Daniel Lehmann <dlehmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84093}
2022-11-07 14:45:23 +00:00

43 lines
1.7 KiB
C++

;; expected = R"---(;; This is a polyglot C++/WAT file.
;; Comment lines are ignored and not expected in the disassembler output.
(module
;; TODO(jkummerow): This type name is missing from the disassembler ouput.
;; (type $type_with_name (;0;) (func (param f32)))
(global $imported_global_with_name (;0;) (import "env" "imported_global") i32)
(func $imported_function_with_name (;0;) (import "env" "imported_function"))
(table $table_with_name (;0;) 0 funcref)
(memory $memory_with_name (;0;) 0)
(global $global_with_name (;1;) i32 (i32.const 0))
(global $exported_global_with_name (;2;) (export "exported_global") i32 (i32.const 0))
(elem $elem_with_name (;0;) funcref (ref.func $function_with_name))
(func $function_with_name (;1;) (param $param_with_name_1 (;0;) i32) (param $param_with_name_2 (;1;) i32) (param $param_with_name_3 (;2;) i64)
local.get $param_with_name_1
drop
local.get $param_with_name_2
drop
local.get $param_with_name_3
drop
)
(func $exported_function_with_name (;2;) (export "exported_function")
;; Local variables.
(local $local_with_name_1 i32)
(local $local_with_name_2 i32)
(local $local_with_name_3 i64)
local.get $local_with_name_1
drop
local.get $local_with_name_2
drop
local.get $local_with_name_3
drop
)
;; TODO(jkummerow): Functions with a named type are printed with their type
;; inline instead of as follows.
;; (func $another_function (;3;) (type $type_with_name)
;; )
;; For compatibility with the legacy DevTools behavior, we don't print data
;; segment names. If we change that, uncomment the following line.
;; (data $data_with_name (;0;) (i32.const 0) "foo\0a\00")
(data (i32.const 0) "foo\0a\00")
)
;;)---";