Commit e05a423
[dart2wasm] Avoid extra global definitions for int constants that are wasmI32.
In a few places we create IntConstants to represent constant fields that are typed as WasmI32. If these are nested within other constants we end up hitting ConstantCreator.visitIntConstant for them. This always generates a global for a BoxedInt constant, whether it's used or not.
The global we create goes unused because in constant intiailizer for the outer constant we use the wasmI32 value directly.
At -O0 this reduced the wasm binary size by ~24k for a simple Flutter app. Binaryen mostly treeshakes these unused globals but I still see a slight improvement even with binaryen running.
Change-Id: I89b8392138269d7322196fa415e56e3062a46088
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408121
Commit-Queue: Nate Biggs <[email protected]>
Reviewed-by: Martin Kustermann <[email protected]>1 parent 07b7cfe commit e05a423
File tree
3 files changed
+13
-3
lines changed- pkg/dart2wasm/lib
3 files changed
+13
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
112 | 117 | | |
113 | 118 | | |
114 | 119 | | |
| |||
225 | 230 | | |
226 | 231 | | |
227 | 232 | | |
228 | | - | |
| 233 | + | |
229 | 234 | | |
230 | 235 | | |
231 | 236 | | |
| |||
593 | 598 | | |
594 | 599 | | |
595 | 600 | | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
596 | 604 | | |
597 | 605 | | |
598 | 606 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1219 | 1219 | | |
1220 | 1220 | | |
1221 | 1221 | | |
1222 | | - | |
| 1222 | + | |
1223 | 1223 | | |
1224 | 1224 | | |
1225 | 1225 | | |
| |||
1233 | 1233 | | |
1234 | 1234 | | |
1235 | 1235 | | |
1236 | | - | |
| 1236 | + | |
| 1237 | + | |
1237 | 1238 | | |
1238 | 1239 | | |
1239 | 1240 | | |
| |||
0 commit comments