[dart2wasm] Roll binaryen to newest version
It brings in some optimizations for constants: e.g. a string access that
used to look like
(global X (..., (global.get A) (struct.new)))
...
(global.get X) (struct.get)
now looks like:
(global.get A)
See
* https://github.com/WebAssembly/binaryen/issues/8002
* https://github.com/WebAssembly/binaryen/issues/8016
Change-Id: I1b2b444867ea53e6e454e93a400dd17aa8fc53fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/462440
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
diff --git a/DEPS b/DEPS
index ac1cb6d..fbd1955 100644
--- a/DEPS
+++ b/DEPS
@@ -96,7 +96,7 @@
### /third_party/ dependencies
# Prefer to use hashes of binaryen that have been reviewed & rolled into g3.
- "binaryen_rev" : "23f7af14bba0139e61bb8f403c4ef53dfee44023",
+ "binaryen_rev" : "fc3374548433eafaab08985ef0754d19273391d2",
"boringssl_rev": "d409d1853233ede6b69d25c6fd4529fd59791b6d",
"browser-compat-data_tag": "ac8cae697014da1ff7124fba33b0b4245cc6cd1b", # v1.0.22
"cpu_features_rev": "936b9ab5515dead115606559502e3864958f7f6e",
diff --git a/pkg/dart2wasm/test/ir_tests/dyn_closure.wat b/pkg/dart2wasm/test/ir_tests/dyn_closure.wat
index 3884f5d..a5fc2c6 100644
--- a/pkg/dart2wasm/test/ir_tests/dyn_closure.wat
+++ b/pkg/dart2wasm/test/ir_tests/dyn_closure.wat
@@ -24,11 +24,11 @@
(field $vtable (ref $#Vtable-0-2))
(field $functionType (ref $_FunctionType)))))
(type $#DummyStruct <...>)
- (global $global3 (ref $#DummyStruct) <...>)
(global $"C1 WasmArray<_Type>[0]" (ref $Array<_Type>) <...>)
- (global $"C28 _InterfaceType" (ref $_InterfaceType) <...>)
(global $"C311 WasmArray<_NamedParameter>[0]" (ref $Array<_NamedParameter>) <...>)
(global $"C337 _TopType" (ref $_TopType) <...>)
+ (global $"C28 _InterfaceType" (ref $_InterfaceType) <...>)
+ (global $global3 (ref $#DummyStruct) <...>)
(global $"C341 foo tear-off" (ref $#Closure-0-2)
(i32.const 55)
(i32.const 0)
diff --git a/pkg/dart2wasm/test/ir_tests/dyn_closure_function_apply.wat b/pkg/dart2wasm/test/ir_tests/dyn_closure_function_apply.wat
index bed1e911..3745607 100644
--- a/pkg/dart2wasm/test/ir_tests/dyn_closure_function_apply.wat
+++ b/pkg/dart2wasm/test/ir_tests/dyn_closure_function_apply.wat
@@ -24,15 +24,15 @@
(field $vtable (ref $#Vtable-0-2))
(field $functionType (ref $_FunctionType)))))
(type $#DummyStruct <...>)
- (global $global3 (ref $#DummyStruct) <...>)
(global $"C1 WasmArray<_Type>[0]" (ref $Array<_Type>) <...>)
- (global $"C28 _InterfaceType" (ref $_InterfaceType) <...>)
(global $"C311 WasmArray<_NamedParameter>[0]" (ref $Array<_NamedParameter>) <...>)
(global $"C337 _TopType" (ref $_TopType) <...>)
+ (global $"C28 _InterfaceType" (ref $_InterfaceType) <...>)
+ (global $global2 (ref $#DummyStruct) <...>)
(global $"C341 foo tear-off" (ref $#Closure-0-2)
(i32.const 55)
(i32.const 0)
- (global.get $global3)
+ (global.get $global2)
(ref.func $"closure arguments dispatcher representation=0-2")
(ref.func $"foo tear-off trampoline")
(ref.func $"foo tear-off trampoline_303")
@@ -58,7 +58,7 @@
(global $"C346 bar tear-off" (ref $#Closure-0-2)
(i32.const 55)
(i32.const 0)
- (global.get $global3)
+ (global.get $global2)
(ref.func $"closure arguments dispatcher representation=0-2")
(ref.func $"bar tear-off trampoline")
(ref.func $"bar tear-off trampoline_308")
diff --git a/pkg/dart2wasm/test/ir_tests/dyn_closure_function_apply_named.wat b/pkg/dart2wasm/test/ir_tests/dyn_closure_function_apply_named.wat
index bc51799..f9dda5e 100644
--- a/pkg/dart2wasm/test/ir_tests/dyn_closure_function_apply_named.wat
+++ b/pkg/dart2wasm/test/ir_tests/dyn_closure_function_apply_named.wat
@@ -22,15 +22,15 @@
(field $functionType (ref $_FunctionType)))))
(type $_TopType <...>)
(type $#DummyStruct <...>)
- (global $global3 (ref $#DummyStruct) <...>)
(global $"C1 WasmArray<_Type>[0]" (ref $Array<_Type>) <...>)
- (global $"C28 _InterfaceType" (ref $_InterfaceType) <...>)
(global $"C311 WasmArray<_NamedParameter>[0]" (ref $Array<_NamedParameter>) <...>)
(global $"C337 _TopType" (ref $_TopType) <...>)
+ (global $"C28 _InterfaceType" (ref $_InterfaceType) <...>)
+ (global $global2 (ref $#DummyStruct) <...>)
(global $"C341 foo tear-off" (ref $#Closure-0-2)
(i32.const 55)
(i32.const 0)
- (global.get $global3)
+ (global.get $global2)
(ref.func $"foo tear-off dynamic call entry")
(ref.func $"foo tear-off trampoline_307")
(struct.new $#Vtable-0-2)
@@ -56,7 +56,7 @@
(global $"C346 bar tear-off" (ref $#Closure-0-2)
(i32.const 55)
(i32.const 0)
- (global.get $global3)
+ (global.get $global2)
(ref.func $"bar tear-off dynamic call entry")
(ref.func $"bar tear-off trampoline_313")
(struct.new $#Vtable-0-2)
diff --git a/pkg/dart2wasm/test/ir_tests/interop.bool.wat b/pkg/dart2wasm/test/ir_tests/interop.bool.wat
index b348028..fef5a03 100644
--- a/pkg/dart2wasm/test/ir_tests/interop.bool.wat
+++ b/pkg/dart2wasm/test/ir_tests/interop.bool.wat
@@ -7,12 +7,12 @@
(func $"dart2wasm._150 (import)" (import "dart2wasm" "_150") (param i32) (result externref))
(global $"C2 false" (ref $#Top) <...>)
(global $"C40 true" (ref $#Top) <...>)
+ (global $ktrue (mut i32) <...>)
+ (global $boolValue (mut i32) <...>)
+ (global $"ktrue initialized" (mut i32) <...>)
+ (global $"boolValue initialized" (mut i32) <...>)
(global $"boolValueNullable initialized" (mut i32) <...>)
(global $boolValueNullable (mut (ref null $#Top)) <...>)
- (global $"ktrue initialized" (mut i32) <...>)
- (global $ktrue (mut i32) <...>)
- (global $"boolValue initialized" (mut i32) <...>)
- (global $boolValue (mut i32) <...>)
(func $"testBoolConstant <noInline>"
(local $var0 externref)
i32.const 1
diff --git a/pkg/dart2wasm/test/ir_tests/interop.double.wat b/pkg/dart2wasm/test/ir_tests/interop.double.wat
index 3fbd18e..c9cff9e 100644
--- a/pkg/dart2wasm/test/ir_tests/interop.double.wat
+++ b/pkg/dart2wasm/test/ir_tests/interop.double.wat
@@ -8,12 +8,12 @@
(func $"dart2wasm._275 (import)" (import "dart2wasm" "_275") (param externref) (result externref))
(func $"dart2wasm._147 (import)" (import "dart2wasm" "_147") (param externref) (result f64))
(func $"dart2wasm._148 (import)" (import "dart2wasm" "_148") (param f64) (result externref))
+ (global $ktrue (mut i32) <...>)
+ (global $doubleValue (mut f64) <...>)
+ (global $"ktrue initialized" (mut i32) <...>)
+ (global $"doubleValue initialized" (mut i32) <...>)
(global $"doubleValueNullable initialized" (mut i32) <...>)
(global $doubleValueNullable (mut (ref null $BoxedDouble)) <...>)
- (global $"ktrue initialized" (mut i32) <...>)
- (global $ktrue (mut i32) <...>)
- (global $"doubleValue initialized" (mut i32) <...>)
- (global $doubleValue (mut f64) <...>)
(func $"testDoubleConstant <noInline>"
(local $var0 externref)
f64.const 1.1
diff --git a/pkg/dart2wasm/test/ir_tests/interop.int.wat b/pkg/dart2wasm/test/ir_tests/interop.int.wat
index 2a36514..f78965c 100644
--- a/pkg/dart2wasm/test/ir_tests/interop.int.wat
+++ b/pkg/dart2wasm/test/ir_tests/interop.int.wat
@@ -6,12 +6,12 @@
(field $value i64))))
(func $"dart2wasm._274 (import)" (import "dart2wasm" "_274") (param externref) (result externref))
(func $"dart2wasm._275 (import)" (import "dart2wasm" "_275") (param externref) (result externref))
+ (global $ktrue (mut i32) <...>)
+ (global $intValue (mut i64) <...>)
+ (global $"ktrue initialized" (mut i32) <...>)
+ (global $"intValue initialized" (mut i32) <...>)
(global $"intValueNullable initialized" (mut i32) <...>)
(global $intValueNullable (mut (ref null $BoxedInt)) <...>)
- (global $"ktrue initialized" (mut i32) <...>)
- (global $ktrue (mut i32) <...>)
- (global $"intValue initialized" (mut i32) <...>)
- (global $intValue (mut i64) <...>)
(func $"testIntConstant <noInline>"
(local $var0 externref)
i64.const 1
diff --git a/pkg/dart2wasm/test/ir_tests/interop.num.wat b/pkg/dart2wasm/test/ir_tests/interop.num.wat
index f64d1a3..76bfe6e 100644
--- a/pkg/dart2wasm/test/ir_tests/interop.num.wat
+++ b/pkg/dart2wasm/test/ir_tests/interop.num.wat
@@ -19,13 +19,13 @@
(func $"dart2wasm._147 (import)" (import "dart2wasm" "_147") (param externref) (result f64))
(func $"dart2wasm._148 (import)" (import "dart2wasm" "_148") (param f64) (result externref))
(table $dtable1 745 funcref)
+ (global $ktrue (mut i32) <...>)
+ (global $numValue (mut (ref null $#Top)) <...>)
+ (global $"ktrue initialized" (mut i32) <...>)
(global $"C66 WasmArray<WasmArray<_Type>>[729]" (ref $Array<WasmArray<_Type>>) <...>)
(global $"C319 _TopType" (ref $_TopType) <...>)
(global $"numValueNullable initialized" (mut i32) <...>)
(global $numValueNullable (mut (ref null $#Top)) <...>)
- (global $"ktrue initialized" (mut i32) <...>)
- (global $ktrue (mut i32) <...>)
- (global $numValue (mut (ref null $#Top)) <...>)
(elem $dtable1 <...>)
(func $_TypeUniverse.isSubtype (param $var0 (ref $_Type)) (param $var1 (ref null $_Environment)) (param $var2 (ref $_Type)) (param $var3 (ref null $_Environment)) (result i32) <...>)
(func $_TypeUniverse._checkSubclassRelationshipViaTable (param $var0 i32) (param $var1 i32) (result i32) <...>)
diff --git a/pkg/dart2wasm/test/ir_tests/interop.string.wat b/pkg/dart2wasm/test/ir_tests/interop.string.wat
index d55668b..0b05153 100644
--- a/pkg/dart2wasm/test/ir_tests/interop.string.wat
+++ b/pkg/dart2wasm/test/ir_tests/interop.string.wat
@@ -6,17 +6,16 @@
(field $_ref externref))))
(func $"dart2wasm._274 (import)" (import "dart2wasm" "_274") (param externref) (result externref))
(func $"dart2wasm._275 (import)" (import "dart2wasm" "_275") (param externref) (result externref))
- (global $"stringValueNullable initialized" (mut i32) <...>)
- (global $stringValueNullable (mut (ref null $JSStringImpl)) <...>)
- (global $"ktrue initialized" (mut i32) <...>)
+ (global $.a (import "" "a") (ref extern))
(global $ktrue (mut i32) <...>)
(global $stringValue (mut (ref null $JSStringImpl)) <...>)
- (global $"C366 \"a\"" (ref $JSStringImpl) <...>)
+ (global $"ktrue initialized" (mut i32) <...>)
+ (global $"stringValueNullable initialized" (mut i32) <...>)
+ (global $stringValueNullable (mut (ref null $JSStringImpl)) <...>)
(func $new JSStringImpl.fromRef (param $var0 externref) (result (ref $JSStringImpl)) <...>)
(func $"testStringConstant <noInline>"
(local $var0 externref)
- global.get $"C366 \"a\""
- struct.get $JSStringImpl $_ref
+ global.get $.a
call $"dart2wasm._274 (import)"
local.tee $var0
call $isDartNull