Commit Graph

33 Commits

Author SHA1 Message Date
Mayank Patke 553ac951b3 [dart2js] Add indexable bits to powerset.
Change-Id: I5d4c0b4d15a05cfc30d87003785ca841c46b1a0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426583
Reviewed-by: Stephen Adams <sra@google.com>
2025-05-07 19:18:38 -07:00
Mayank Patke b941f6f0f4 [dart2js] Add modifiable/growable bits to powerset.
Change-Id: Ic8abbe3729a4c3b41fde0a37d8b6afe84bd9ba48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407920
Reviewed-by: Stephen Adams <sra@google.com>
2025-05-07 19:18:38 -07:00
Mayank Patke 7103d43876 [dart2js] Add powerset bits for interceptor domain.
Change-Id: Id9509c6b6eb8143263763e508512c0703d4aa493
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404500
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2025-04-16 18:14:21 -07:00
Mayank Patke d0e09ea091 [dart2js] Print powerset value in typemask toString methods.
We may find it useful later to add a more verbose stringification that
writes out the properties expressed by the powerset. For now, just
printing the int value is sufficient to debug e.g. test failures, and
it's relatively straightforward to manually convert an int to a set of
properties by looking at the definitions of the powerset domains.

Change-Id: I2397ffd83a6e86830f67c7f1ef811e33c0b7ff3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405567
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-03-07 04:20:04 -08:00
Nate Biggs 237742feab [dart2js] Remove '--no-sound-null-safety' flag and make '--sound-null-safety' flag a no-op with warning.
Change-Id: I0225f9306aa2a84494f3fc17c9f7191214404249
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406081
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2025-03-03 15:46:16 -08:00
Nate Biggs b28913c7e1 [dart2js] Make 'load-priority' pragma pass an arbitrary option string.
Change-Id: I4d9fb69dfb4ec040b0e63893e4ace33c6a5dd454
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384360
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2024-09-09 19:47:48 +00:00
Mayank Patke f79ed9301b [dart2js] Remove remaining language version overrides
Now that dart2js only takes migrated files as input, all tests should
use the current language version.

Change-Id: I6c84850f5786aeac04154b67bd7a3c19083c8bba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345344
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2024-01-23 01:26:09 +00:00
Nate Biggs b6e3c5cffd [dart2js] Sort holders before emitting them.
When serializing JS, we can sometimes end up changing the order we visit ModularExpressions. This can mean their indices are not stable against serialization and so the emitted code (and as a result hashes for that code) can change if the compiler did any serializing during the compilation.

We can make the order stable by sorting the holders before we process them.

This removes diff in hashes when running this (`--test-mode` forces serialization):
```
out/ReleaseX64/dart-sdk/bin/dart compile js benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart --out=om1a/m.js
out/ReleaseX64/dart-sdk/bin/dart compile js benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart --test-mode --out=om1b/m.js
```

Bug: https://github.com/dart-lang/sdk/issues/53466
Change-Id: Ibec88ff6acb71f1e96cbdb1d5ef4200d370cc3c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325100
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-09-09 01:50:52 +00:00
Nate Biggs 1f61b1d521 [dart2js] Clean up old IndexedSink/Source logic.
We've been using the Unordered version (which support deferred serialization) of these for a while now. Removing the ordered version (and associated flags) since they're essentially dead code at this point.

Change-Id: I522682b8e0688deda6784628b65d41389cdb9791
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322161
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-08-22 21:18:33 +00:00
Nate Biggs 37fba7b9dc [dart2js] Add alias mapping for deferred import IDs.
Today the deferred import mapping is missing a way to match a specific user-defined deferred load alias to a corresponding runtime load ID. This adds a new field, "importPrefixToLoadId", under each library entry, which is keyed by library URI, which maps from the user-defined deferred load ID to the Dart2JS runtime load ID.

Example using https://github.com/dart-lang/sdk/blob/main/tests/language/deferred/split_constants_canonicalization_test.dart:
```
{
  "_comment": "This mapping shows which compiled `.js` files are needed for a given deferred library import.",
  "split_constants_canonicalization_test.dart": {
    "name": "<unnamed>",
    "imports": {
      "1": [
        "out.js_1.part.js"
      ],
      "4": [
        "out.js_2.part.js"
      ]
    },
    "importPrefixToLoadId": {
      "a": "1",
      "b": "4"
    }
  },
  "split_constants_canonicalization_a.dart": {
    "name": "<unnamed>",
    "imports": {
      "2": [
        "out.js_4.part.js",
        "out.js_3.part.js"
      ],
      "3": [
        "out.js_4.part.js",
        "out.js_5.part.js"
      ]
    },
    "importPrefixToLoadId": {
      "a_1": "2",
      "a_2": "3"
    }
  },
  "split_constants_canonicalization_b.dart": {
    "name": "<unnamed>",
    "imports": {
      "5": [
        "out.js_4.part.js",
        "out.js_6.part.js"
      ],
      "6": [
        "out.js_4.part.js",
        "out.js_7.part.js"
      ]
    },
    "importPrefixToLoadId": {
      "b_1": "5",
      "b_2": "6"
    }
  }
}
```

Change-Id: Ia6a6f8e45613c0081485e3fe5ddc84627749ee8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317222
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-08-03 22:13:40 +00:00
Nate Biggs fe73f0cf5d [dart2js] Reduce size of Dart2JS deferred loading event logs.
- Only include the script tag src if it differs from the previous log entry.
- Use single letters for each event field's key.
- Fix some typos.
- Remove 'uri' from download event as it can be inferred from script tag src and part file name.

Change-Id: Ib7916ea5e92720a10c7e1e1cab2e535fae2bbf49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311180
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-06-26 20:43:32 +00:00
Nate Biggs eb7dc8494a [dart2js] Fix event log init logic.
The bug can be occur when 2 Dart2JS apps load on the same page but 1 uses a version of the Dart2JS runtime prior to https://dart-review.googlesource.com/c/sdk/+/309361 and the other uses the runtime from after 309361. If the one from before 309361 loads onto the page first, the `$__dart_deferred_initializers__` will be initialized without `eventLog`. Then the second app will load and see that `$__dart_deferred_initializers__` is present and try to add to `eventLog`, but `eventLog` will not be present.

This would cause an exception in the Dart2JS runtime and probably prevent the page form loading correctly.

Change-Id: I05b17867e24ae80cb4d7cdc615c8b985321912f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309761
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-06-15 21:58:34 +00:00
Nate Biggs df0382c900 Reland "[dart2js] Simplify event log initialization logic in each part file prologue."
This is a reland of commit 7b2d5baa48

Original change's description:
> [dart2js] Simplify event log initialization logic in each part file prologue.
>
> Change-Id: I0731b78f5b0437f5e5026ee6d9f2511698968804
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308201
> Commit-Queue: Nate Biggs <natebiggs@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>

Change-Id: I0bc53c9d0745ea01af638f47e503c9570dec266b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309361
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-06-14 18:26:55 +00:00
Ilya Yanok 042952ef9b Revert "[dart2js] Simplify event log initialization logic in each part file prologue."
This reverts commit 7b2d5baa48.

Reason for revert: breaks ~600 tests in G3 (though it looks to be just one JS file that got broken), b/287219647

Original change's description:
> [dart2js] Simplify event log initialization logic in each part file prologue.
>
> Change-Id: I0731b78f5b0437f5e5026ee6d9f2511698968804
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308201
> Commit-Queue: Nate Biggs <natebiggs@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>

Change-Id: Iedd1b0a4909f490bc54eebde3462e6bd57c3c1a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309283
Reviewed-by: Alexander Thomas <athom@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
2023-06-14 15:53:07 +00:00
Nate Biggs 7b2d5baa48 [dart2js] Simplify event log initialization logic in each part file prologue.
Change-Id: I0731b78f5b0437f5e5026ee6d9f2511698968804
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308201
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-06-13 00:50:49 +00:00
Nate Biggs ac6150c4c0 [dart2js] Improve deferred part file logging.
Adds an "eventLog" property to the global "$__dart_deferred_initializers__" object. The event log is just a JS Array that gets initialized alongside $__dart_deferred_initializers__.

Each event entry is a String->String JS object. I unified the format of these event objects for easier parsing.

Each printed event is now valid JSON (passed through JSON.stringify) so we can more easily post-process the logs if necessary.

Fully replacing the existing "_eventLog" field makes the logging logic simpler. Having a single array allows us to not include a timestamp because the array captures the event ordering (actual timing doesn't matter). It also makes it easier to stringify the logs when there's only 1 data source/format.

Sample output:
```

{"hunkName":"out.js_1.part.js","event":"loadHunk"}
{"uri":"path_to/out.js_1.part.js","hunkName":"out.js_1.part.js","event":"downloadHunk"}
{"file":"out.js_1","event":"beginLoadPart"}
{"file":"out.js_1","event":"endPartLoad","hash":"aCscY7yv4EHodRPmCqYn5BqMelA="}
{"uri":"path_to/out.js_1.part.js","hunkName":"out.js_1.part.js","event":"downloadHunkSuccess"}
{"hunkName":"out.js_1.part.js","hash":"aCscY7yv4EHodRPmCqYn5BqMelA=","event":"initialize"}

```

Change-Id: Ifee73be0bf7dc53a0e7710ff033dd2b0fae9fb0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307240
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-06-09 17:05:11 +00:00
Nate Biggs e48df2f7f3 [dart2js] Carry library load priorty through to script tag creation.
Change-Id: Ie05b5ffe0f2e1638faf8b784a2e8c5535ec0d76a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272760
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-12-02 05:19:53 +00:00
Nate Biggs 3121b8e3ed [dart2js] Fix goldens for dump info tests (bots failing).
Change-Id: I2c4a56f7e9f7073705b56ebe7a7b819458a1f794
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272400
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-11-28 20:19:37 +00:00
Kevin Moore d359e07aad [dart2js] Fix test breaks from dump-info change
Follow-up to 67015b7175

Change-Id: I6ead83e66a6dda23029b89fbec509861fa9dadd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271861
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
2022-11-24 03:28:28 +00:00
Stephen Adams b8d85b7ad3 [dart2js] loadLibrary priority annotation
Add annotations

    @pragma('dart2js:load-priority:normal')
    @pragma('dart2js:load-priority:high')

The test shows that these annotations are scoped.

This CL is just plumbing the annotation through as an argument to the runtime call to the code that implements `loadLibrary()`. Actual prioritization is not yet implemented.

Change-Id: Iff1404baf34192139dab95e2dbb01c2d4e8dae45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270283
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-11-18 19:22:29 +00:00
Mayank Patke 581db69c7a [dart2js] Avoid adding empty type rules.
The fragment emitter already tries to skip the call to `addRules` if the
ruleset is empty, but this occurs too early. The ruleset encoder strips
tautologies like `T <: T` and `InterfaceType <: Object`, but this occurs
after the empty check.

This CL removes the preprocessing from the encoder and instead performs
checks when entries are added to the ruleset, fixing the issue.

Change-Id: I62f937e0ff6abac12973f82b2c89d8ea6f3162b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258040
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2022-09-08 19:25:43 +00:00
Nate Biggs 4b78f1b6c7 Reland "[dart2js] Enable flag (canary -> shipping) to intern dart type values."
This reverts commit 0e1d24ae80.

Reason for revert: Interning bug fixed by https://dart-review.googlesource.com/c/sdk/+/255257

Original change's description:
> Revert "[dart2js] Enable flag (canary -> shipping) to intern dart type values."
>
> This reverts commit e833510bc5.
>
> Reason for revert: breaks many tests in G3, see b/242822389
>
> Original change's description:
> > [dart2js] Enable flag (canary -> shipping) to intern dart type values.
> >
> > Change-Id: Iebac3a7c57665eccd100146f892b891a4591f554
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255201
> > Reviewed-by: Stephen Adams <sra@google.com>
> > Commit-Queue: Stephen Adams <sra@google.com>
>
> TBR=sra@google.com,natebiggs@google.com
>
> Change-Id: I9b2be8fc119f84f33181245cdfce416d13660daf
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255401
> Reviewed-by: Ilya Yanok <yanok@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>
> Commit-Queue: Ilya Yanok <yanok@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I51336c2e53dd58fed6216e9a5c818f05e8795a8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255663
Reviewed-by: Nate Biggs <natebiggs@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-08-18 21:30:54 +00:00
Ilya Yanok 0e1d24ae80 Revert "[dart2js] Enable flag (canary -> shipping) to intern dart type values."
This reverts commit e833510bc5.

Reason for revert: breaks many tests in G3, see b/242822389

Original change's description:
> [dart2js] Enable flag (canary -> shipping) to intern dart type values.
>
> Change-Id: Iebac3a7c57665eccd100146f892b891a4591f554
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255201
> Reviewed-by: Stephen Adams <sra@google.com>
> Commit-Queue: Stephen Adams <sra@google.com>

TBR=sra@google.com,natebiggs@google.com

Change-Id: I9b2be8fc119f84f33181245cdfce416d13660daf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255401
Reviewed-by: Ilya Yanok <yanok@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
2022-08-17 12:29:03 +00:00
Nate Biggs e833510bc5 [dart2js] Enable flag (canary -> shipping) to intern dart type values.
Change-Id: Iebac3a7c57665eccd100146f892b891a4591f554
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255201
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-08-17 02:50:42 +00:00
Nate Biggs f7afab742a [dart2js] Reland deferred-serialization flag
Change-Id: I5774a271b4197945682439de6fe59771895547ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251882
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-07-19 18:02:06 +00:00
Mark Zhou 0ee0fba728 [dart2js] Adding supertype hierarchy to dump info
Note: this info is not added to the proto format

Change-Id: Ic7407405dea7bcd7b9d3328cfe0850609dc007a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250785
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2022-07-19 00:55:53 +00:00
Nate Biggs 386ad2ff46 [dart2js] Unland deferredSerialization flag
Change-Id: Id04cab15d8e81df9661390b1d4cc48d2767abded
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251243
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-07-14 01:00:43 +00:00
Nate Biggs 397c8d26dd [dart2js] Enable deferred-serialization flag by default.
Change-Id: I7f462a6a944abbf9eea4381ff72f9ebdf74fae61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250201
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-07-07 20:38:13 +00:00
Nate Biggs aad436cc53 [dart2js] Migrate first round of dart2js_info to nnbd.
Change-Id: Ifc3f97eb6dad6e785263346f1d41ed5a78705bac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245924
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-05-27 15:31:40 +00:00
Mark Zhou bf5690dd0c [dart2js] Removing size checks from main output unit dump info tests
These were far too sensitive to code size changes and causing unhelpful failures.

Change-Id: I5293c7d281a5db2d36af35f67966f4d47413a78a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243561
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2022-05-03 23:14:04 +00:00
Mark Zhou 9925c72e55 [dart2js] Adding program-level info to dump info tests
Change-Id: I3df11ad508259ac12080bab6595377550124c8a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243023
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-05-02 22:00:52 +00:00
Mark Zhou dfd5109b64 [dart2js] Adding class and classtype dump info tests
Change-Id: Iba41106c2b75a8247123e36b505e0be42ad51fad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242181
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2022-04-24 20:05:20 +00:00
Mark Zhou ee5a62ff4e [dart2js] Adding dump info library tests
Change-Id: I1d9a30838dc08612032051f60344588f84b1d436
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242163
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2022-04-24 19:57:51 +00:00