Delay changing Thread::vm_tag on callback entry and restore the tag early on callback return so that the profiler doesn't see the "running Dart" tag unless it can also see the fake return address marking the entry frame.
TEST=ffi/async_void_function_callbacks, ffi/function_callbacks_subtype, ffi/function_callbacks, ffi/isolate_local_function_callbacks
Bug: https://github.com/dart-lang/sdk/issues/52814
Change-Id: I40d80ec7c44063d078db0e211565e2d127c6b81e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367460
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Equal types should have the same hash, but they are not necessarily
identical.
Update the test to remove the identity check between a constant type and
a type constructed in runtime.
Change-Id: I0d6c6395c587391d3087c26b00fff36d645b33dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368340
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
We have an optimization that will do list lookups at compile time when
the receiver is a constant list and the index is a constant integer.
=> We should only perform this optimization if index is in-bounds.
=> If it's out-of-bounds it should be a [RangeError] thrown at runtime
(if that code is ever executed)
Closes https://github.com/dart-lang/sdk/issues/55817
Change-Id: I3e99cdd96c79e7ff3f490babb2d52131cbd83a88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368302
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
This reverts commit fb057ea4e0.
Reason for revert: b/342552853
Original change's description:
> [js_runtime, js_dev_runtime] Implement `microsecond` field of `DataTime`
>
> - Move DateTime implementation for dart2js and DDC into a shared place to reduce duplication.
>
> - Add a _microsecond field to the web DateTime to track microseconds outside of the JavaScript Date.
>
> - The cute dart2js optimization whereby `DateTime.now().millisecondsSinceEpoch` is compiled to `Date.now()` still works.
>
> - Both implementations report better errors.
>
> - Fixed VM bug with in-range sentinel.
>
>
> Change-Id: I9156255bdb6ecc195500ae9bc88f91fb315b6297
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366963
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Stephen Adams <sra@google.com>
Change-Id: I58572256a7710df4589bb5e41c7afee295c2388b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368103
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Fix follow up comments with an async rethrow test.
Tests that wildcard patterns still work while mixed with wildcard variables.
Bug: https://github.com/dart-lang/sdk/issues/55652
Change-Id: If6ab4de68ff27ad51215427a7183f1aed7229947
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367501
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Knowing whether Dart code is running in a WebAssembly context is useful
to potentially select different code paths exploiting differences in
JavaScript and WASM behavior or simply to report the information to
users (e.g. for crash reports).
Without such a constant, one has to rely on implementation differences
such as `identical(0, 0.0)` or check the available `dart:` libraries.
Both are error-prone, so having a reliable constant as an alternative
makes this easier.
Closes https://github.com/dart-lang/sdk/issues/55694
Change-Id: Ia969641e4b78223c394cbf251805cf77a30cb0fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365822
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
I convert the `noSuchMethod` tests to (imho) simpler tests of what
property access of `e` or `d` or `D` would look like on an int, via
extension getters.
The noSuchMethod test as it was written cannot be executed at runtime,
because (as of Dart 2, I think, maybe earlier), property access on
expressions is a compile-time consideration. And I think as a compile-
time error test, it's hard to see what it's testing.
Change-Id: I5c0ca728e6e812b8f35adb80b288be351c4b076a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367461
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
- Move DateTime implementation for dart2js and DDC into a shared place to reduce duplication.
- Add a _microsecond field to the web DateTime to track microseconds outside of the JavaScript Date.
- The cute dart2js optimization whereby `DateTime.now().millisecondsSinceEpoch` is compiled to `Date.now()` still works.
- Both implementations report better errors.
- Fixed VM bug with in-range sentinel.
Change-Id: I9156255bdb6ecc195500ae9bc88f91fb315b6297
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366963
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Added a little section for late wildcard variables too.
This CL tests mixing top-level wildcard declarations with local wildcard declarations and the non-shadowing, non-binding behaviour.
Bug: https://github.com/dart-lang/sdk/issues/55652
Change-Id: I72e7cfb1b2d80a3934af355579c36252881cf3fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367241
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Making language tests in small batches. These are very basic ones to test that you can have multiple local declarations named `_` in the same namespace without a collision error.
Bug: https://github.com/dart-lang/sdk/issues/55652
Change-Id: I4d00e9072ba745b363d68db72505c599953c41ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366022
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
This gives some more coverage for `dart compile wasm`
Change-Id: I62e7f9c6ecbdf80a1445c35d1733a7f89e6bcf54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366623
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Note that this is not a breaking change, since the CFE already
correctly flags the error condition.
Fixes#55734.
Bug: https://github.com/dart-lang/sdk/issues/55734
Change-Id: I5570e0840ce20c2a761d88f698b9876f7543bd8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This never worked. It was silently accepted, at least if the future had no listeners, then any later attempt to use the future would cause a stack overflow or other impossible results.
Moves some `_Future._complete` call out of try-catch.
The `_complete` shouldn't throw (but before this fix it could).
Moving them out of the `try`/`catch` makes such errors be reported
as unhandled, instead of catching them and trying to complete the same
future again with an error, when it's possibly in an inconsistent state.
Fixes#43662.
Based on https://github.com/dart-lang/sdk/issues/43662#issuecomment-2058870247
CoreLibraryReviewExempt: No response.
Bug: http://dartbug.com/43662
Change-Id: I96a4f01bcd5b6cee93bba267299852569a9b905c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363060
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Currently the type of a static field is only based on the dart type, not
inferred types. This can mean that the type of such field is e.g.
`dynamic`.
Though the return type of the initializer function used the unboxing
information.
=> There was an invariant that if we use `null` to signal uninitialized
in the global, then calling the initializer will also result in a
non-nullable reference type.
=> This was invariant was broken by recent changes to dart2wasm that
take advantage of TFA-inferred unboxing information.
=> We fix this inconsistency by ensuring the wasm global's type is the
same as the initializer function's return type.
Change-Id: I9c27c0b28d2f81f888b4c9afc59dad42af2229ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365825
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
The list factory specialization code can only know constant values
passed to `growable: <xxx>` if the variables are local and not
parameters.
TEST=corelib/list_factory_specialization_regression_test
Change-Id: I2c425108fd266fea6b443a7adee86c5a2b33a4d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365584
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
The expriment is now retired in Dart 3.5, and the flag
stops being valid.
Change-Id: I1ecb087d45b90e98a7f0d3c15a6c8038a1c6982e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365260
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
For example code that uses `Completer` in parameters/fields/...
used to be represented as `Object` in wasm type system, which we
can now represent instead as `_Completer`.
Change-Id: I35b2d8cb45717e58a813756dfa6278804552fbcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365020
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
When analyzing the type test implied by a pattern, flow analysis uses
three variables to control promotion behavior:
- `matchFailsIfWrongType`, which indicates whether flow analysis needs
to account for the possible control flow path resulting from the
type test failing. (This is `false` for cast patterns, because in
the case where a cast pattern fails, an exception is thrown).
- `matchMayFailEvenIfCorrectType`, which indicates whether flow
analysis needs to account for the possible control flow path
resulting from the type test succeeding, but some other check
causing the match to fail. (This is `true` for most list patterns,
because the list pattern will fail to match if the list has the
wrong length).
(Note that `matchMayFailEvenIfCorrectType` doesn't account for the
fact that a pattern match might fail due to failure in a subpattern
match; this is automatically handled by the fact that flow analysis
walks through the complete pattern in the order in which it
executes.)
- `coversMatchedType`, which indicates whether the type test is
guaranteed to succeed due to a subtype relationship between the
matched value type and the type being tested (e.g. a `num x` pattern
is guaranteed to succeed if the matched value type is `int`).
In the case where `matchFailsIfWrongType` is `true`,
`matchMayFailEvenIfCorrectType` is `true`, and `coversMatchedType` is
`false`, flow analysis must account for the fact that there are two
ways that the pattern match might fail: the type test might fail, or
the type test might succeed but then the pattern match might fail for
some other reason.
Before this change, this was done incorrectly, and flow analysis only
accounted for the possibility of the type test failing.
Fixes#55543.
Bug: https://github.com/dart-lang/sdk/issues/55543
Change-Id: I86603ec5f940402313f32177212b7960878db97f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364942
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This fixes issues where structs are accessed dynamically
or simply accessed in a nullable fashion, e.g. with `MyStruct? foo`
dart2wasm does not yet support using structs-by-value as arguments
or return values when calling linear-memory wasm functions.
dart2wasm also doesn't support structs-by-value created in dart
that are backed by WasmGC memory (e.g. arrays).
Change-Id: I9b9c60002d2d32db3f235f1cec25fe3b35fcc17b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365140
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
- Compile tests to kernel and use that instead of source for the Fuchsia test package.
- Skip multitests instead of the running them and approving the failures.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/38752
Change-Id: Idd9bef0f6026c6d882712eb1083e88433bb53b13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333121
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Restore timeout for windows-arm64, which did not get faster.
Change-Id: I9f032c25fc69454929348f0589d35200a4728142
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364625
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
We've roughly doubled bot speeds; half timeouts to provide pressure against this simply getting filled with slower tests.
Change-Id: I812da7adc6c08e6d484732c2558e0d3f63b2694a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364385
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Closes https://github.com/dart-lang/sdk/issues/55549
Closes https://github.com/dart-lang/sdk/issues/55340
Fixes several issues around using ExternalDartReferences:
- Better inlining of interop methods is enabled when this
type is used. This also indirectly improves inlining when
using JSAny.
- Adding some missed inlining for setting properties in
general.
- Allows opaque references of Dart functions to be passed
to JS
- Allows type parameters that extend ExternalDartReference
to be used in interop methods.
- Fixes up parent pointers of nodes in transforms.
Change-Id: I8cbd163ee3c1b98e733c35a61e6e83a0787d334c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364580
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
This reverts commit cd2c566bcf.
Reason for revert: Updating to not remove field used by Flutter engine.
Original change's description:
> Revert "Tweak `expect.dart` library."
>
> This reverts commit ff5f391c0a.
>
> Reason for revert: The expect library is used by Flutter engine, and some of its tests use assertStatementsEnabled. There should be a migration path that doesn't require an atomic change, like adding the replacement api before removing the old one.
>
> Original change's description:
> > Tweak `expect.dart` library.
> >
> > Make API more consistent for a few methods.
> > Reduce the number of language features used in tests:
> > * Never iterating an iterable, always converting it
> > using `.toList()` first and iterating using indices
> > (fx `setEquals`).
> > Also require a `List` in places where an `Iterable`
> > wasn't necessary.
> > * Avoid doing complicated computations that are also
> > used for the error message. Do simple check first,
> > then recompute to get better error messages
> > (fx `allDistinct`).
> >
> > Renamed some rarely used members for consistency
> > (`stringContainsInOrder`->`containsInOrder`,
> > where other string-contains functions just start
> > with `contains`, and `containsOneOf` -> `containsAny`
> > to match `Iterable.any` phrasing, and also it accepts
> > if containing at least one, not precisely one.)
> >
> > Removed a function that wasn't used anywhere.
> >
> > Moved `assertStatementsEnabled` to `variations.dart` as `asserts`.
> > Removed `typeAssertionsEnabled` and `checkedModeEnabled`. The former used in one place, where it was replaced with `checkedImplicitDowncasts` from `variations.dart`, the latter wasn't used anywhere.
> >
> > Deprecates `package:expect/minitest.dart`. It was never intended
> > to be used for new tests, only as a help to convert existing tests
> > written against `package:unit_test`.
> > All existing imports marked as `// ignore: deprecated_member_use`.
> >
> > Change-Id: I07e21d4c0f3ccf11b82ee34af2668fdbb22264d2
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352360
> > Reviewed-by: Slava Egorov <vegorov@google.com>
> > Reviewed-by: Ömer Ağacan <omersa@google.com>
> > Reviewed-by: Nate Bosch <nbosch@google.com>
> > Reviewed-by: Stephen Adams <sra@google.com>
> > Commit-Queue: Lasse Nielsen <lrn@google.com>
>
> Change-Id: I360b4347470a0bb2b63c3108e2b83ee2a771bf3f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362020
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Reviewed-by: Ömer Ağacan <omersa@google.com>
> Reviewed-by: Stephen Adams <sra@google.com>
> Reviewed-by: Leaf Petersen <leafp@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: William Hesse <whesse@google.com>
CoreLibraryReviewExempt: Reland
Change-Id: I53db40edc0733842a008839c3913d51c885e39ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362502
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
The parser didn't support 'new' as identifier in this context.
The CL also adds the reporting of tear-offs as metadata for the CFE.
This was already handled by the analyzer.
Change-Id: I7ab5868fa83e5f216d0e7be7ae9cec4a2c865e80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364480
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Noticed that the same bug that was fixed in [0] also exists in other
places.
=> Remove duplicated code & share in macro assembler.
=> Make use of this in async & sync* generator.
[0] https://dart-review.googlesource.com/c/sdk/+/364321
Change-Id: Id424ab5e8ed8ab70d19977d10cf80fb8b44b3872
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364441
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
During FFI leaf calls, the Dart GC will not run. This means that we
can pass pointers into `TypedData` to FFI calls that take `Pointer`
arguments.
After this CL, we have three types of arguments that can flow into
`Pointer` argument in an FFI call:
* `Pointer`.
* `TypedData`: Any typed data including views.
* `_Compound`: A TypedData/Pointer and an offset in bytes.
The is only possible for `@Native external` functions, `asFunction`
does not support passing in `TypedData`. (See related GitHub issues
for discussion. TLDR: FFIgen should generate bindings without config.)
`.address` expressions on `TypedData` and `Array` elements do _not_
introduce bounds checks, even though `TypedData` and `Array` have
bounds information. E.g. `ffiNative(Uint8List(10)[20].address)` does
not throw.
Implementation details:
The CFE analyzes call-sites to `@Native external` functions. If the
arguments are `.address` expressions, it transforms the call site to
pass the compound or `TypedData`. If an additional offset needs to be
applied, the CFE constructs a new `_Compound` with the correct offset
in bytes.
The CFE then also creates a new `@Native external` function which have
`TypedData`s and `_Compound`s parameters. To avoid name clashes, these
functions are postfixed with `#` and `P`, `T`, or `C` for each Pointer
parameter.
TEST=pkg/vm/testcases/transformations/ffi/address_of_*
In the VM, `TypedData` arguments are passed as tagged values, and the
address is loaded inside the `FfiCallInstr`. `_Compound` arguments
turn into two IL definitions, one for the `TypedDataBase` (tagged),
and one for the offset in bytes (unboxed). The address is then loaded
inside the `FfiCallInstr` and the offset in bytes is applied.
Adding the offset in bytes required an extra temp register for ia32.
Also, it uncovered that the temp register in arm32 was conflicting
with the argument registers. However, TMP should suffice instead.
TEST=tests/ffi/address_of_array_generated_test.dart
TEST=tests/ffi/address_of_struct_generated_test.dart
TEST=tests/ffi/address_of_typeddata_generated_test.dart
Closes: https://github.com/dart-lang/sdk/issues/44589
Closes: https://github.com/dart-lang/sdk/issues/54771
CoreLibraryReviewExempt: VM only, unsupported in dart2wasm
Change-Id: I01fb428cfd6f9096a34689c2819c124a8003cb6b
Cq-Include-Trybots: dart/try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64c-try,vm-aot-win-release-x64-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360882
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
* Extends the frontend server controller to validate/reject compile errors in compiles/recompiles.
* Extends the config to permit an 'expectedError' entry.
* Adds a handful of tests to the suite (adapted from the VM's hot reload tests).
Change-Id: I47d814e375c4c72d0406ebf5bdfee3f1975c64f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363800
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
When entering async functions we read the suspend-state's context and
populate local variables with the context parent chain as well as the
this pointer.
This restoration code assumed that `this` is stored in the outermost
context, which isn't necessarily the case.
In constructors the outermost context can contain the type parameters.
TEST=tests/web/wasm/capture_type_and_this_test.dart
Change-Id: Ie8e3c8732203aea4964d48cb78c97578d0322b2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364321
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Multitests of compile-time errors should be converted to static
error tests, so they don't run on runtime configurations.
Static error tests also test for all the static errors,
their positions, and error message, in a single test run.
This test is currently failing on the common front end,
and on all runtimes, and passing on the analyzer. The
change keeps the failure on common front end by adding
expectations for an error to be reported at the right places.
Bug: https://github.com/dart-lang/sdk/issues/54153
Change-Id: Ic64961f6e0e575ec60626d4f70a0fdc5d71d024e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363085
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
This test incorrectly expects that WeakReference.target should be
cleared for a weakly reachable object. WeakReference specification
doesn't guarantee that:
a9f684e624/sdk/lib/core/weak.dart (L75-L76)
This change fixes the test to give up after certain number of
iterations instead of hanging forever.
Issue: https://github.com/dart-lang/sdk/issues/55518
Change-Id: Ief0ebe1452c83058a35fc1ba87e5a83924d43919
TEST=corelib/weak_reference_test
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363960
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
By initializing `location.href` in the commandline JS runners we allow
programs running in D8 to use `Uri.base` (which depends on
`location.href`).
That in return will allow running some Dart programs in D8 that would
otherwise not run (e.g. code using `package:test/test.dart` - which uses
`Uri.base`)
TEST=tests/web/wasm/location_href_test.dart
Change-Id: Ie219f8d9ece3b92f2442200539557f116d2c84ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363700
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
The recent rewrite of [0] kept the existing semantics of the finalizer
implementation but migrated to the new interop semantics.
Turns out in that existing semantics there's a bug, namely that it
casted the peer object of to a non-nullable [Object] which is incorrect.
This CL
* fixes the cast to non-nullable [Object]
* moves the (currently) web-specific tests for
[Finalizer]/[WeakReference] into `corelib` so it runs on all backends
* expands the finalizer tests to check finalizers get invoked
* expands the weak reference test to ensure weak reference is cleared
[0] https://dart-review.googlesource.com/c/sdk/+/363082/
Issue https://github.com/dart-lang/sdk/issues/55474
Change-Id: Ibd8c186b39100cff9e2f437f1a737034a5364830
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363581
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
When generating `try` block around a CFG block of an async state
machine, generate `catch_all` if the Dart `catch` blocks wrapping the
CFG block can catch JS exceptions.
`catch_all` bodies are identical to the `catch` bodies we already
generate.
The check for whether to generate `catch_all` is reused from the
non-async code generator without changes.
Fixes#55457.
Change-Id: I9d89593599da592106e12efb77c07d68b6cfce5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363000
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
This enables the currently dart2js/ddc-only tests for [WeakReference] /
[Finalizer] on dart2wasm.
As part of that we add a polyfill for the two implementations (just like
dart2js/ddc) do, to make the polyfill test pass.
We also migrate the implementation to use static interop.
Issue https://github.com/dart-lang/sdk/issues/55474
TEST=tests/web/wasm_js_shared/weak_reference_*test.dart
Change-Id: Ic08ae41b6fc78fd9857172ca24695a7f91e06a78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363082
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Non-variadic arguments on the stack on MacOS Arm64 are aligned to
the value size (which can be smaller than word size). However, for
varargs, the arguments on the stack seem to be aligned to the word
size.
This CL introduces an alignment strategy constant for primitives on
the stack in varargs and uses it in the native calling convention
calculation.
TEST=runtime/vm/compiler/ffi/native_calling_convention_test.cc with
runtime/vm/compiler/ffi/unit_tests/variadic_less_than_word/arm64_macos.expect
TEST=tests/ffi/function_varargs_generated_native_leaf_test.dart
Closes: https://github.com/dart-lang/sdk/issues/55471
Change-Id: I51d20c3933a2cea9b110954ddec92fb91b9c3ecd
Cq-Include-Trybots: dart/try:vm-aot-android-release-arm64c-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362762
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Fix trim methods returning a new string (instead of the argument) when
there's nothing to trim.
A second bug fixed in NEL handling in `trim`: the last line should be
`result.substring(...)` instead of `this.substring(...)`. The bug wasn't
caught by any of the tests: NEL needs to be handled specially on the
browser, but mixing NEL with other whitespace wasn't tested in the
existing tests `string_trim_test` and `string_trimlr_test`, so a new
test file added with this case.
Change-Id: Ibf84e185de1b26c9811e3ea58c2ad3f223da8515
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363081
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Also amend SSA type builder to only optimize away casts to *sound* top
types when SNS checks are enabled.
Fixes: b/330884266
Change-Id: Ic619877b7f1e01e1065f4767549880aab2f81106
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363162
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
`clang-format` has decided to format things slightly differently.
To prevent a huge diff on CLs touching
runtime/bin/ffi_test/ffi_test_functions_generated.cc, run a reformat
eagerly.
The generation script now explicitly uses the the clang-format from
the buildtools/ dir. (It was likely using the one on PATH.)
Also, clean up Dart imports to use single quotes, and generate an
ignore to prevent warnings.
TEST=tests/ffi
Change-Id: I54e24d62fe742770fb041bba73110c5285250fb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362763
Reviewed-by: Hossein Yousefi <yousefi@google.com>
Commit-Queue: Hossein Yousefi <yousefi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>