dart-sdk/sdk
Ömer Sinan Ağacan b6bc3e54d0 [dart2wasm] Refactor and optimize dart2wasm hash map/set types
This CL copies and modifies hash map and set base class `_HashBase`
currently shared with the VM, to improve types of the fields.

The Wasm struct for hash map and set objects was previously:

  (type $_HashBase (sub $Object (struct
    (field $field0 i32)
    (field $field1 (mut i32))
    (field $field2 (mut (ref null $Object)))      ;; _index
    (field $field3 (mut i64))
    (field $field4 (mut (ref $Object)))           ;; _data
    (field $field5 (mut i64))
    (field $field6 (mut i64)))))

Now:

  (type $_HashBase (sub $Object (struct
    (field $field0 i32)
    (field $field1 (mut i32))
    (field $field2 (mut (ref $Array<WasmI32>)))   ;; _index
    (field $field3 (mut i64))
    (field $field4 (mut (ref $Array<Object?>)))   ;; _data
    (field $field5 (mut i64))
    (field $field6 (mut i64)))))

_index and _data fields are now non-nullable Wasm arrays. This removes
downcasts and one layer of indirection when accessing the elements. In
addition, when accessing `_index` this eliminates unboxing the integers.

Fixes #54961.

Change-Id: I4e6bd5129c7c57f5716ccb23e46060d73ffca217
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/354843
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-03-05 16:00:39 +00:00
..
bin [dart2wasm] Remove sdk/bin/dart2wasm{,_developer} scripts 2024-01-19 16:05:27 +00:00
lib [dart2wasm] Refactor and optimize dart2wasm hash map/set types 2024-03-05 16:00:39 +00:00
.gitignore
api_readme.md [docs/api] Minor adjustments and fixes to api.dart.dev homepage 2024-02-01 21:41:38 +00:00
BUILD.gn [macros] Add dart:_macros 2024-02-02 07:47:59 +00:00
OWNERS