mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 17:59:39 +00:00
5a4b252252
allocation. When using the `struct.new_default` instruction for object allocation, fields are always nullable and mutable. By using the `struct.new` instruction instead, class fields can now have the same mutability and nullability in Wasm as declared in Dart. In addition, the class ID and type parameters (which are also stored in an object's struct), can now be immutable and nonnullable as well. To do this, object construction is now split into three functions: (1) Initializer: evaluates initializers for instance fields and constructor initializers (this constructor before super constructor). (2) Constructor body: executes the constructor body (super constructor before this constructor), with `this` pointed to the constructed object. (3) Constructor allocator: which calls (1), allocates the object using `struct.new`, then calls (2). Because fields now have the correct mutability and nullability in Wasm, this removes unnecessary null checks for nonnullable fields, and may allow for better optimisations by Binaryen. Fixes https://github.com/dart-lang/sdk/issues/51492 Change-Id: Ib26046686f772a70509a870301217e9b1c91b77e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315820 Commit-Queue: Jess Lally <jessicalally@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com> |
||
---|---|---|
.. | ||
_http | ||
_internal | ||
_wasm | ||
async | ||
cli | ||
collection | ||
convert | ||
core | ||
developer | ||
ffi | ||
html | ||
indexed_db/dart2js | ||
internal | ||
io | ||
isolate | ||
js | ||
js_interop | ||
js_interop_unsafe | ||
js_util | ||
math | ||
mirrors | ||
svg/dart2js | ||
typed_data | ||
vmservice | ||
web_audio/dart2js | ||
web_gl/dart2js | ||
web_sql/dart2js | ||
analysis_options.yaml | ||
libraries.json | ||
libraries.yaml | ||
PRESUBMIT.py | ||
vmservice_libraries.json | ||
vmservice_libraries.yaml |