Files
sdk/pkg/dart2wasm/test/ir_tests/interop.int.wat
T
Simon Binder 58f9d88fb2 [dart2wasm, standalone] Migrate String
This migrates the `String` implementation from using JS interop to
explicit host imports for the standalone target.

This moves a few helper methods shared between the JS and standalone
targets to `dart:_string_helper`. This also moves the embedder regexp
implementation to `dart:_string` to be able to access internals in some
string methods (similar to how the JS implementation special-cases
`JSSyntaxRegExp`).

This removes the final real use of JS-interop in the standalone target.
So, we can:

 - Remove internal JS helper libraries from the target.
 - Skip JS-interop transformations in the compiler.
 - Stop emitting a helper module and support script.

Because `js_interop` is imported in `dart:_wasm`, we can't remove the
library entirely. This replaces it with a stub to avoid compilation
errors, a proper removal is tracked in dartbug.com/63166.

Change-Id: Ide495c210c3a272438deebf8fe4f3f44ba314ffa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501960
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2026-05-20 00:22:27 -07:00

71 lines
2.2 KiB
WebAssembly Text Format

(module $module0
(type $#Top (struct
(field $field0 i32)))
(type $BoxedInt (sub final $#Top (struct
(field $field0 i32)
(field $value i64))))
(func $"dart2wasm.M (import)" (import "dart2wasm" "M") (param externref) (result externref))
(func $"dart2wasm.R (import)" (import "dart2wasm" "R") (param externref) (result externref))
(global $"intValueNullable initialized" (mut i32) <...>)
(global $intValueNullable (mut (ref null $BoxedInt)) <...>)
(func $intValue implicit getter (result i64) <...>)
(func $ktrue implicit getter (result i32) <...>)
(func $sinkInt <noInline> (param $var0 i64) <...>)
(func $sinkIntNullable <noInline> (param $var0 (ref null $BoxedInt)) <...>)
(func $"testIntConstant <noInline>"
i64.const 1
call $jsifyInt
call $"dart2wasm.R (import)"
call $toDartInt
call $"sinkInt <noInline>"
)
(func $"testIntConstantNullable <noInline>"
ref.null noextern
call $"dart2wasm.M (import)"
call $toDartNullableInt
call $"sinkIntNullable <noInline>"
)
(func $"testIntValue <noInline>"
call $"intValue implicit getter"
call $jsifyInt
call $"dart2wasm.R (import)"
call $toDartInt
call $"sinkInt <noInline>"
)
(func $"testIntValueNullable <noInline>"
(local $var0 (ref null $BoxedInt))
global.get $"intValueNullable initialized"
if (result (ref null $BoxedInt))
global.get $intValueNullable
else
call $"ktrue implicit getter"
if (result (ref null $BoxedInt))
i32.const 86
call $"intValue implicit getter"
struct.new $BoxedInt
else
ref.null none
end
local.tee $var0
global.set $intValueNullable
i32.const 1
global.set $"intValueNullable initialized"
local.get $var0
end
local.tee $var0
ref.is_null
if (result externref)
ref.null noextern
else
local.get $var0
struct.get $BoxedInt $value
call $jsifyInt
end
call $"dart2wasm.M (import)"
call $toDartNullableInt
call $"sinkIntNullable <noInline>"
)
(func $jsifyInt (param $var0 i64) (result externref) <...>)
(func $toDartInt (param $var0 externref) (result i64) <...>)
(func $toDartNullableInt (param $var0 externref) (result (ref null $BoxedInt)) <...>)
)