Lowers these extension methods to some helper functions instead of
allowInterop to improve performance and get consistent semantics.
Specifically:
- Function.toJS no longer gives you the same JSFunction when calling
toJS on the same function multiple times in the JS compilers.
- Adds fast calling syntax for functions with 0-5 args in the JS
compilers.
- Allows additional args to be passed to converted functions that
are omitted in the JS compilers.
- The static type now determines the number of args that can be
passed to the JS function in the JS compilers.
- Fixes an issue in dart2wasm where if too few arguments are
passed, the call may succeed due to conversion of undefined to
null.
- Adds throws when a user tries to wrap a JS function that
returned from Function.toJS in the JS compilers.
Closes https://github.com/dart-lang/sdk/issues/55515
Addresses https://github.com/dart-lang/sdk/issues/48186
CoreLibraryReviewExempt: Changes to docs only in API surface.
Change-Id: I41d864dc5e02b597d9f1c16c88e3c04872f28225
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368065
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This reverts commit 64d4689a78.
Reason for revert: Platform.executable doesn't return a path, just an executable name, which can cause breakages.
TEST=ci
Original change's description:
> [ Service ] Start DDS and serve DevTools when the VM service is started via dart:developer
>
> TEST=pkg/dds/test/control_web_server_starts_dds_test.dart
>
> Change-Id: I2e51783592912e5a719685f2ab5e7537b7a59586
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366560
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Derek Xu <derekx@google.com>
Change-Id: I4ceaee4b5ca8f5557e90cd914ee69fe9aa5f85a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373381
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Closes https://github.com/dart-lang/sdk/issues/55342
Closes https://github.com/dart-lang/sdk/issues/55536
Closes https://github.com/dart-lang/sdk/issues/56015
- Adds a type parameter T that extends Object? to
ExternalDartReference to capture the type of the value
that was externalized.
-- In the JS compilers, the representation type of
ExternalDartReference is now T.
-- In dart2wasm, the representation type is now JSValue?.
- ExternalDartReference no longer implements Object.
- Return type of toDartObject is now T.
- ObjectToExternalDartReference and
ExternalDartReferenceToObject both now are on a T that is
bound to Object?.
- Internal patches for WeakReference and Finalizer are
updated.
Change-Id: Ic2dc834b17ec6a4eb2122cba3c495a6e0a1eae6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370663
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
The previous link no longer lead to a relevant destination. While I can add a client-side redirect on dart.dev, this CL updates the link to a redirect we can better guarantee as up to date in the long term.
TEST=vm/cc/DartAPI_RootLibraryMissingMain
Change-Id: I1e9dbf7a32c1468c308e9cf00d96575ba3c24695
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373322
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
If a `String` is not a `StringBase` it must be a `JSStringImpl`.
Using `unsafeCast` instead of `as` improves generated code as it avoids
calling the "as" function for casting to `JSStringImpl`.
Change-Id: Idba4f44fc44b7715c4433262dd0eab25d062d2d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373244
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This is a reland of commit 1a614b1d86
Bug: b/348315159
This CL removes the native assets fallback from the VM.
TEST=pkg/dartdev/test/native_assets/build_test.dart
TEST=tests/ffi/native_assets/asset_relative_test.dart
Closes: https://github.com/dart-lang/sdk/issues/55523
Closes: https://github.com/dart-lang/sdk/issues/55925
Change-Id: Ib40d3a8c7d4b7c6226b6e4db4b3016cc32591239
Cq-Include-Trybots: dart/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,pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-mac-release-try,pkg-mac-release-arm64-try,pkg-win-release-try,pkg-win-release-arm64-try,vm-aot-asan-linux-release-x64-try,vm-asan-linux-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-msan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372500
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
- the receiver could be a type variable whose _bound_ is Never
Closes#56079
Change-Id: I6871b418ab0b9646d8de79654b84bbb2f4e60dd0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373243
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
This adds an interface for the addProblem method and uses it to remove
dependency on SourceLibraryBuilder from OutlineBuilder.
Change-Id: Ied3ecad46359d437aef133bb2745fd97ba9d175a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373081
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Not ready to announce it (yet)
Change-Id: Icc7fbdaa2564511429a1b5601afcce065a5663f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373162
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Sigurd Meldgaard <sigurdm@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>
Write barriers are not eliminated for large arrays, and deferred marking them is expensive.
TEST=IsolateSendExitLatency
Change-Id: Ifeefb0d86e15d096ae45f8e8ff6aa3d9db4cb9ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373141
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Since these operators can't be written by users, prefer
to keep them as JS types.
Closes https://github.com/dart-lang/sdk/issues/55267
Change-Id: Ifb9b581fb82e057ba14c669a5a3934f9c502d06f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359181
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Let me know if there's any information missing. We can either add it
now or later.
Change-Id: I9b0792e9e614eadc3a570c3ac0155e8b91ba8489
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373101
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Inferred type of a covariant field should not be used as
an argument type of an implicit setter, as setter of a covariant
field performs a type check before assigning value to the field.
Correct such uses of covariant field types in unboxing
and AOT type propagation in order to avoid incorrect removal of
a type check in the implicit setter of a covariant field.
TEST=runtime/tests/vm/dart/regress_56051_test.dart
Fixes https://github.com/dart-lang/sdk/issues/56051
Change-Id: I55bfedfd96e918aac9597706c6eab1b81e1202ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372721
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This fixes an issue with runtime blob that created arguments
array for `main()`: the JS referenced a now (after [0]) no longer
existing `stringToDartString` function.
Instead of having a runtime blob at all for the dealing of `main` we
simply give the JS array to the `invokeMain` function which can use
normal JS interop to transform it to a `List<String>`.
=> This avoids the need to export `$getMain`, `$makeStringList` and the
`buildArgsList` JS function.
[0] https://dart-review.googlesource.com/c/sdk/+/372660
Change-Id: I665e60ab93a4f8ed9de5fc135ed0e68514f2af5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372461
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
- WeakTable rehashing
- worklist in the root set
Apply the pattern from object_graph_copy of maintaining the worklist as a heap object to avoid bloating the root set, and using a hash table that can safepoint in the middle of rehashing by not using address-based hash codes.
TEST=IsolateSendExitLatency
Change-Id: I2a632327102b0cc88ccdcffb024d813aa8e355f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372161
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
In this CL, Debugger::FindCompiledFunctions always just returns
Error::null(), but when eager compilation of functions is implemented
(https://dart-review.googlesource.com/c/sdk/+/338740), it will introduce
the possibility of Debugger::FindCompiledFunctions truly returning
errors. So, this CL adds the error propagation logic in advance to
avoid making the eager function compilation CL too large.
TEST=this is effectively just a refactor, so CI
Change-Id: Ibedbebf19fed306c8b93c98ba71b7cc57b90e174
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369161
Reviewed-by: Alexander Aprelev <aam@google.com>
It is dead code. Breakpoint requests that only have a line number are just handled by passing column_number=-1 to SetBreakpointAtLineCol.
TEST=CI
Change-Id: I44fb9f805c364edb074bf9cdbd3fcbe3888b3bff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369160
Reviewed-by: Alexander Aprelev <aam@google.com>