Dart API changes:
* Loading units are a list and is an object now.
* Instance constants have a reference to their class definition.
JSON changes:
* loading units are a pool now.
* loading units are objects rather than only a string now.
* definitions are a pool now (so that const instances can refer to
them).
TEST=pkg/compiler/test/record_use/record_use_test.dart
TEST=pkg/dart2wasm/test/record_use_test.dart
TEST=pkg/vm/test/transformations/record_use_test.dart
Change-Id: I5fed1796d9cb08d6f0ade862ba2b4c3b5fea4ebd
Cq-Include-Trybots: luci.dart.try:dart2wasm-asserts-linux-chrome-try,dart2wasm-asserts-minified-linux-d8-try,dart2wasm-linux-chrome-try,dart2wasm-linux-d8-try,dart2wasm-linux-firefox-try,dart2wasm-linux-jscm-chrome-try,dart2wasm-linux-optimized-jsc-try,pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try,dart2js-canary-linux-try,dart2js-hostasserts-linux-d8-try,dart2js-linux-chrome-try,dart2js-linux-firefox-try,dart2js-mac-chrome-try,dart2js-mac-safari-try,dart2js-minified-csp-linux-chrome-try,dart2js-minified-linux-d8-try,dart2js-unit-linux-x64-release-try,dart2js-win-chrome-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481860
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Removed from `benchmarks/`, `runtime/`, `sdk/`, `tools/` and `utils/`.
(Leaving `tests/`, `pkg/` and `third_party/`.)
CoreLibraryReviewExempt: No real change.
Tested: No test changes for no real code changes.
Change-Id: Ieb42441457ca3d0ea4443dd153ee902ea33b28de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480241
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
This ensures that `_Enum.index` is always available for switch strength
reduction optimizations. Most real programs use the index of at least one `enum`, so the field is not usually elided. This change makes small tests and benchmarks behave more like real programs where these optimizations happen.
Bug: #51657
CoreLibraryReviewExempt: dart2js specific annotation
Change-Id: If98e483d7cce265e823fd574565089e328215cca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446481
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
benchmark_harness's `measureFor` returns in microseconds, but we
currently show the numbers with the unit "ns".
Convert the microseconds reported by benchmark_harness to nanoseconds
when reporting.
We could also report in microseconds, but the numbers would be very
small, with a few zeros before fractional digits. So keep reporting in
nanoseconds.
Change-Id: I189190b2139c8e2d39b8bef84159585ab0967980
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436904
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
The name has always been annoying because it did not add strong typing. And now there aren't variants of the VM platform to distinguish.
Leave a copy at the old name to not immediately break illegal uses.
TEST=ci
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,flutter-frontend-try,flutter-linux-try
Change-Id: Ie76fa7f16940aa1ba8d582eb5197f0ae55dc8938
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429828
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Fix violations of lints that I expect have no influence on the
performance characteristics of this benchmark:
* annotate_overrides
* avoid_shadowing_type_parameters
* curly_braces_in_flow_control_structures
* prefer_single_quotes
* use_function_type_syntax_for_parameters
Change-Id: I360fca77c9290d1ced5563409f1bfb6a12009fc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433270
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Fix violations of lints that I expect have no influence on the
performance characteristics of this benchmark:
* directives_ordering
Change-Id: I3aa77c9351507a54dfb1b5e3a8295cea3fc66540
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433269
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Fix violations of lints that I expect have no influence on the
performance characteristics of this benchmark:
* avoid_init_to_null
* directives_ordering
* prefer_single_quotes
Change-Id: I50b507405abf9eb75c2fba688a9588a2fa84bab7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433268
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Fix violations of lints that I expect have no influence on the
performance characteristics of this benchmark:
* annotate_overrides
* directives_ordering
Change-Id: I49f33347aea5cfdcbac5c9195a18427bdb7c667e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433266
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Don't convert Dart `double`s to `externref`s when calling JS interop
functions, pass them as `double`.
We pass other unboxed values (`int`s and `bool`s) as `externref`s, as
before:
- `int`s are most efficiently passed as `externref`s, as small integers
can be converted to `i31ref` and externalized without allocation.
- `bool`s passed as `i32` mostly work because JS treats 0 as false and
everything else as true, but the values can still be observed as
numbers rather than bools, which causes some test failures.
Changes:
- Make raw interop procedures take `double` as argument, when the Dart
type for the interop function argument is non-nullable `double`.
- Pass static type of the value and expected type (by the interop
function) to `jsifyValue`.
- `jsifyValue` then takes the static type and expected type into account
to avoid conversions when both are `double`s.
- `jsifyValue` is refactored to avoid the type conversion mapping
allocation on every call.
New benchmark result before the changes:
WasmJSInterop.call.void.1ArgsDouble(RunTimeRaw): 0.018275229357798167 ns.
After:
WasmJSInterop.call.void.1ArgsDouble(RunTimeRaw): 0.014034965034965034 ns.
Issue: https://github.com/dart-lang/sdk/issues/60357
Change-Id: Ia70671f9a8e14f359f1119beda123e94aacdd2cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422480
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
In V8, the only way to pass a Wasm integer or float to JS without
allocation is by passing it as a 31-bit integer.
This can be done by:
1. Passing as `i32`. If the integer fits into 31 bits it's passed
without allocation.
2. Passing as externalized `i31ref`.
(1) requires importing the JS function with different signatures: for
each `int` argument we would need a signature with the `i32` as the Wasm
argument type, and another with `externref` (or `f64` if we want to pass
large integers as `f64`).
This is not feasible as with a JS function with N `int` arguments we
would need `2^N` imports. So we implement (2): we import each interop
function with one signature, passing `externref` as the argument, as
before. When the number fits into 31 bits we convert it to an `i31ref`
and externalize it. Otherwise we convert the number to `externref` as
before, by calling the JS function `(o) => o` imported with type `[f64]
-> [externref]`.
New benchmark checks `int` passing for small (31 bit) and large (larger
than 31 bit) integers. Results before:
WasmJSInterop.call.void.1ArgsSmi(RunTimeRaw): 0.020 ns.
WasmJSInterop.call.void.1ArgsInt(RunTimeRaw): 0.018 ns.
After:
WasmJSInterop.call.void.1ArgsSmi(RunTimeRaw): 0.014 ns.
WasmJSInterop.call.void.1ArgsInt(RunTimeRaw): 0.018 ns.
Issue: https://github.com/dart-lang/sdk/issues/60357
Change-Id: I749001e0e7e9784114415439298c2f3e0fb974b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419880
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
The "new" rti library has been standard for years now and no one should
be passing `--experiment-new-rti` or `--use-old-rti`. We can now clean
up any references to different versions of rtis.
Change-Id: I4421b8943fe5034ed4d259477e8112b25ba0c763
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416326
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
This reverts commit 74c5aa3a7a.
Reason for revert: Fix golem breakage by not changing the script dart_precompiled_runtime2
TEST=ci
Original change's description:
> Revert ""[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory""
>
> This reverts commit f81a402aa1.
>
> Reason for revert: golem benchmarks are failing to run
>
> TEST=ci
>
> Original change's description:
> > "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
> >
> > Fixed golem breakage by temporarily copying dartaotruntime to dart_precompiled_runtime
> >
> > This reverts commit 75e6a748f7.
> >
> > TEST=ci
> >
Change-Id: I9efe40643c59bc617f6fb484b89b038deaffbb93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393941
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
This reverts commit f81a402aa1.
Reason for revert: golem benchmarks are failing to run
TEST=ci
Original change's description:
> "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
>
> Fixed golem breakage by temporarily copying dartaotruntime to dart_precompiled_runtime
>
> This reverts commit 75e6a748f7.
>
> TEST=ci
>
> Original change's description:
> > Revert "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
> >
> > This reverts commit 1b331d05c2.
> >
> > Reason for revert: golem builds are failing
> >
> > Original change's description:
> > > [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
> > >
> > > TEST=ci
> > >
>
> Change-Id: Id0f383eabb496c06c0acebc639c8e3b056ba82d0
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393781
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
Change-Id: Iec494940412aa31dbefdc5280e35ae99e8cecb26
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393764
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Fixed golem breakage by temporarily copying dartaotruntime to dart_precompiled_runtime
This reverts commit 75e6a748f7.
TEST=ci
Original change's description:
> Revert "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
>
> This reverts commit 1b331d05c2.
>
> Reason for revert: golem builds are failing
>
> Original change's description:
> > [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
> >
> > TEST=ci
> >
Change-Id: Id0f383eabb496c06c0acebc639c8e3b056ba82d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393781
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
The dynamic invocations `sink1.codeUnits` and `sink2.isEven` can be slow
on dart2wasm.
They are done once in a few iterations, but the noise can still be
eliminated with a `if (runtimeFalse)` guard around the code that makes
sure the benchmarked code won't be optimized away.
Change-Id: Id85013fa4be1912d1c710cd119e9f6f1e77bcff4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373040
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Golem config expects RunTimeRaw metric (as we want to see not runs per
second but a more meaningful benchmark, i.e. how much transferring 1KB
of data takes)
=> Golem cannot just display it in different form, we have to make the
benchmark report it also as RunTimeRaw.
=> This CL should fix the golem benchmarks.
Change-Id: I91301930941986771eb0725fd0d85424bb07dc3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372640
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Adds a benchmark to test converting Dart functions to and
from JS as well as calling them.
Specifically, tests some combinations of the following:
- Converting vs calling functions
- JS vs Dart functions
- Calling instance methods vs static methods vs closure vs
closures stored in fields
Change-Id: I8f5b63781201042c4068437fe84c3043d6dfb446
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368064
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
This relands "Add copy of ObjectHash benchmark that uses hardware performance counters"
It lands a roll of benchmark_harness to a new version without
the breaking change in the previous, reverted, roll.
It adds a copy of a benchmark that uses
the new features in benchmark_harness.
Reason for reland: The breaking change is removed from benchmark harness.
Original change's description:
> Revert "Add copy of ObjectHash benchmark that uses hardware performance counters"
>
> This reverts commit faee649175.
>
> Reason for revert: The new version of benchmark_harness breaks cbuild.
>
> Original change's description:
> > Add copy of ObjectHash benchmark that uses hardware performance counters
> >
> > Bug: b/320440992
> > Change-Id: Ia504a59861b2de32c0b82d6bb38491600a37e9ff
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363703
> > Reviewed-by: Jonas Termansen <sortie@google.com>
>
> Bug: b/320440992
> Change-Id: I19bd814c1641243ab0b75f45bc55cdfe27d4bff3
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363740
> Auto-Submit: Alexander Thomas <athom@google.com>
> Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
> Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
> Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Bug: b/320440992
Change-Id: I101a7ca756a5da5ddf934818325177501c370f23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364180
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: William Hesse <whesse@google.com>
The benchmarks were using a range of antipatterns that did not do what
the authors thought they did. It seems that the authors thought the
warmup method has to run for a while and do the full warmup, but the
truth is that the harness will do that for you by running the warmup
function in a timed loop. Instead these patterns just wasted time by
making the warmup more expensive and complex than needed.
This change just removes the warmup overrides since none of them do
anything positive. This change prepares us for future improvements to
the benchmark harness.
Fixes: b/324874055
Change-Id: Ib7c282123a2151614bc95a105a30e67221f11315
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352022
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
We want dart2wasm be comparable to dart2js / dart2aot, the ladder two
are much more conservative with inlining compared to current dart2wasm.
The -O3 is described in the binaryen sources as agressive for
performance and therefore willing to compromise code size.
The -Os is more nuanced: It will perform many optimizations that are
done in -O3 (and e.g. not in -O2) but it will make inlining less
agressive.
This reduces flute compile-time by 10% and code size by 10%
This benchmark results are mixed (some things get faster, some things
slower). Naturally there'll be specialized micro benchmarks that
get hit hard by this.
Where performance matters we should rather make dart2wasm use better
inlining heuristics and annotate code with
`@pragma('wasm:prefer-inline')`
Change-Id: Idf7e75e4e385629c9cec66359efe0afe50db3e72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352523
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>