Commit graph

22661 commits

Author SHA1 Message Date
Nicholas Shahan 3cff63ff26 [ddc] Seal the native Object prototype in test infra
Update tests to avoid getting or setting `.__proto__`.

Change-Id: I2e80dfc32f162de4f5b3fe5ac74a9e6818a7e55e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317845
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-08-10 19:45:59 +00:00
Nicholas Shahan 30869bf7c4 [js] Add Dart Object API tests for interop objects
Change-Id: I806ef3e5ed2468eecd91427a3e28cc0859aa81fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317844
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-08-10 19:44:00 +00:00
Stephen Adams 7f08f8e494 [dart2js] Add interceptors for JavaScript Symbol and BigInt
The interceptors provide a Dart `toString` method that uses the JavaScript `toString` method.

Issue: #53106

Change-Id: I1cf1df9e24fb4fd2d79679f1f014f39f083be7e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319563
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-08-10 14:42:38 +00:00
Mayank Patke 4c1bafa809 Reland "[dart2js] Add runtime type check for await."
This is a reland of commit c81711bdda

Original change's description:
> [dart2js] Add runtime type check for `await`.
>
> See https://github.com/dart-lang/sdk/issues/49396 for details.
>
> Fixes: #50601
> Change-Id: Ie89130cffe642b3e4935d7d02fe2e34f7fc8b12e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316320
> Commit-Queue: Mayank Patke <fishythefish@google.com>
> Reviewed-by: Stephen Adams <sra@google.com>

Change-Id: Ida3258ee3768e8bff0161019511647db8b161473
Bug: #50601
Bug: b/295131730
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319462
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-08-09 23:17:18 +00:00
Oleh Prypin 27ad1a74dd Revert "[dart2js] Add runtime type check for await."
This reverts commit c81711bdda.

Reason for revert: `Internal Error: Runtime type information not available for type_variable_local` - b/295131730

Original change's description:
> [dart2js] Add runtime type check for `await`.
>
> See https://github.com/dart-lang/sdk/issues/49396 for details.
>
> Fixes: #50601
> Change-Id: Ie89130cffe642b3e4935d7d02fe2e34f7fc8b12e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316320
> Commit-Queue: Mayank Patke <fishythefish@google.com>
> Reviewed-by: Stephen Adams <sra@google.com>

Change-Id: I481b119b6569d1bc9cf2ab80d997a3eb6d06f674
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319421
Reviewed-by: Alexander Thomas <athom@google.com>
Auto-Submit: Oleh Prypin <oprypin@google.com>
Commit-Queue: Oleh Prypin <oprypin@google.com>
2023-08-09 11:23:19 +00:00
Kallen Tu 1f88336597 [analyzer] Move all constructor error reporting to _InstanceCreationEvaluator.evaluate
Pull the error handling outwards to _InstanceCreationEvaluator.evaluate. All errors in const constructors should point to the location of the actual exception and provide more context.

Change-Id: Iafcf46182fab698f5546c63780de6dd9a605a51b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318802
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-08-08 21:55:34 +00:00
Mayank Patke c81711bdda [dart2js] Add runtime type check for await.
See https://github.com/dart-lang/sdk/issues/49396 for details.

Fixes: #50601
Change-Id: Ie89130cffe642b3e4935d7d02fe2e34f7fc8b12e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316320
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-08-08 20:18:04 +00:00
Srujan Gaddam 86eb49ac19 [dart:js_interop] Disallow user @staticInterop classes from subtyping most dart:_js_types types
Since user @staticInterop types are erased to JavaScriptObject, they
should only be able to subtype other types that are :> JavaScriptObject,
which are just JSObject and JSAny. Eventually all the other JS types
will move to extension types and we can remove this check.

Change-Id: If56b6770e141238b583937880ca87496780c8fac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316865
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-08-08 19:17:25 +00:00
Srujan Gaddam a56642e9a1 [dart:js_util] Handle type parameters in export/mocks.
Several changes are made:

- createDartExport now does not export methods that define type parameters.
- createStaticInteropMock adds conformance checks to make sure implementing
members can handle all possible values of a type parameter in an interop
member. An error is added to reduce confusion around this.
- Export creator now uses dart:js_interop_unsafe for a lot of its lowering
as the dart:js_util equivalents are buggy when it comes to calling exported
functions in JS with JS types.
- Small code changes are added to backends to handle the above changes.

Change-Id: Ie3b6b157930537267f270b60373b2b17e0a14344
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316141
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-08-04 21:45:29 +00:00
Srujan Gaddam b5fe6be0bd [dart:js_interop] toJSBox should use foreign function for set
Using setProperty triggers assertInterop, which prevents a Dart
Function from being boxed.

Change-Id: Ifa8a068abb7191ccb1c50f2733e6d85df411c945
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317847
Commit-Queue: Joshua Litt <joshualitt@google.com>
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-08-03 15:59:30 +00:00
William Hesse 3024bfdde2 [test] Skip two dartdevc tests that are timing out
Issue is currently open to fix these tests.

Bug: https://github.com/dart-lang/sdk/issues/49622
Change-Id: I22c21437461f7b9bf757e6ed5935b4eeba4f52d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317761
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2023-08-03 11:31:35 +00:00
Paul Berry 1e0e12052c Add language test to reproduce #53089.
Change-Id: Ia77a7336a9f5abd73a7575d7833ce0e3ee3453a8
Bug: https://github.com/dart-lang/sdk/issues/53089
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317441
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-08-02 12:02:38 +00:00
Nate Biggs 2ec35b5761 [dart2js] Fix issue with non-async try/catch nested in catch block of async try/catch.
Fixes: 53082
Change-Id: Iadb11da5d6e71109682fc941f10e7373f70a1430
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317340
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-08-01 19:39:32 +00:00
Johnni Winther 5ea3b88932 [_js_interop] Use #type for interop message
The uses the #type handle to pass the DartType in the message rather
than using the toString() method which doesn't give the desired result.

Change-Id: Iac17507643a9932570d5975a106a3ededc03f58c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316585
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-08-01 11:12:19 +00:00
Johnni Winther a76f4d5c34 [cfe] Rename InlineClass to ExtensionTypeDeclaration
This renames InlineClass to ExtensionTypeDeclaration, and InlineType
to ExtensionType. Members of extension type declarations are called
extension type members instead of extension type declaration members
for "brevity".

TEST=existing

Change-Id: I91ed62533ddd345644492f04dc3310d007460288
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316780
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-08-01 09:04:38 +00:00
Srujan Gaddam 7d6414a6d5 [dart:js_interop] Restrict external members from using type parameters that don't extend static interop types
Since external APIs can only use primitives and JS types in static interop,
we should require that all type parameters on static interop APIs extend
another static interop type. This is the minimum required to ensure all
type parameters can be erased to JSValue. This only affects dart:js_interop
users and replaces the previous type parameter static error check.

Change-Id: Ia546874da73c808aa25deb8d54d581db783987df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316140
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-07-31 17:40:56 +00:00
Liam Appelbe edeac698c2 [vm/ffi] Closure callbacks for async callbacks
This change is almost trivial. The closure is stored on the callback's
RawReceivePort, not in the VM. So we can basically just remove the CFE
check and it pretty much works. The only problem is that we can't set
function.FfiCallbackTarget anymore, so most of the CL is dealing with
that.

A few places were deciding whether an FFI trampoline was a call or a
callback based on whether function.FfiCallbackTarget() was null. But
now the target will be null for async callbacks. So instead I've added
a new value to the FfiCallbackKind enum (and renamed it), and changed
those checks.

Sync callback closures will be a separate CL, because they're more
complicated.

Bug: https://github.com/dart-lang/sdk/issues/52689
Change-Id: I8e5dfb557362e679f66195b735c3c382e6792840
TEST=async_void_function_callbacks_test.dart
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316160
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-07-26 23:23:26 +00:00
Daco Harkes 3915c9cd44 [test/ffi] Fix status file
https://dart-review.googlesource.com/c/sdk/+/302322 didn't match the
behavior and didn't cover aot.

Bug: https://github.com/dart-lang/sdk/issues/39487
Change-Id: Id1bf70ab72d19cd4c1e531362099389eebb46835
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316383
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-07-26 16:50:46 +00:00
Kallen Tu ba005169c5 [analyzer] Initial refactor of _InstanceCreationEvaluator to return Constant value.
evaluateConstructorCall now returns a Constant, which means evaluation may be cut early in some places if there's an error. However, some code generators rely on _InstanceCreationEvaluator to complete, and so there's no _major_ changes to the design right now (and some small additions to avoid breaking many tests).

This CL is just the framework for the "return Constant" design and will be the base for reporting better errors in constructor invocations.

These changes already show that we cut some amount of over-reporting in our existing language and unit tests, which is a step in the right direction.

Bug: https://github.com/dart-lang/sdk/issues/47603, https://github.com/dart-lang/sdk/issues/47351, https://github.com/dart-lang/sdk/issues/49389

Change-Id: I5ba7f1282658884c18a32d5e98c7804bbfeac0f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312347
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-07-25 19:23:02 +00:00
asiva 5d872a8737 [VM/Runtime] - Deprecate Dart_UpdateExternalSize and Dart_UpdateFinalizableExternalSize from the Dart C API
https://github.com/dart-lang/sdk/issues/52568

TEST=new test added.

Change-Id: I4f4b6b607fa2e0daa14fc25e3bdf99214f6ccb6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314900
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2023-07-20 17:06:44 +00:00
Mayank Patke b336f3900b [dart2js] Bailout tracing of record fields when record is bailed out
Fixes: #52968
Change-Id: Ie59d4c0f903089622bc260d471bc136fa91eacde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315020
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2023-07-19 23:34:46 +00:00
Brian Quinlan e75cacf2b8 Clean up Platform.lineTerminator test.
Change-Id: I933956de806d9b4597385cf4afa4a98528c2165c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313542
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-07-19 20:23:51 +00:00
Paul Berry e835ab692e Update language tests to prepare for enabling interface-update-2.
The tests `variable_property_not_promoted_test` and
`this_property_not_promoted_test` verify that fields are _not_
promoted. To prevent them from failing when we enable the language
feature `inference-update-2` (which provides field promotion), they
need `@dart=3.0` directives. This ensures that we will continue to
have coverage of the old (non-promoting) behavior after field
promotion is switched on.

Bug: https://github.com/dart-lang/language/issues/2020
Change-Id: I376da01dfe4223f17ae4863e4460b4f1a0708dc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314760
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-07-19 17:31:18 +00:00
Nicholas Shahan c3c98a0446 [ddc] Update reified type calculation
In the new type system, allow native types that have a "peer" on
the Dart side to use that Dart type as their reified type.

This matches the semantics of the old type system for these types.

Change-Id: I62bf6cb1654d33549a6ea2c757e7e65fa81677a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313700
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-07-18 21:01:14 +00:00
Srujan Gaddam 18b7dd771b Reland "[dart:js_interop] Remove Object.toJS and JSNumber.toDart"
This is a reland of commit 16fcfe7eae

Original change's description:
> [dart:js_interop] Remove Object.toJS and JSNumber.toDart
>
> Modifies JSBoxedDartObject reified type on JS backends and also
> modifies JSBoxedDartObject.toDart now that a proper box is introduced.
> Also uses a JS symbol in JSBoxedDartObject.toDart for a property
> check so that different Dart apps don't accidentally share Dart
> objects. It's now an error to call this function on non-boxed objects.
>
> Fixes a type issue where creating a new object literal with the JS
> foreign function was resulting in dart2js thinking toJSBox would
> always throw. Changing the typeDescription to PlainJavaScriptObject
> instead of =Object fixes that issue.
>
> CoreLibraryReviewExempt: Backend-specific library.
> Change-Id: I5cfb1f32ff4328fafdf9831b0d8da806c39391d9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309082
> Reviewed-by: Joshua Litt <joshualitt@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>

CoreLibraryReviewExempt: Reland.
Change-Id: If6b190f12bdf840b0259c5739f50d9bdcd27fd47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313600
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-07-17 21:16:07 +00:00
Paul Berry 5db0c2b546 Test some more corner cases of field promotion.
While rereading the analyzer logic that decides whether to suppress
field promotion due to the presence of a `noSuchMethod` forwarder, I
found a few corner cases that aren't handled correctly:

- The logic for deciding which fields are included in a class's
  implementation currently doesn't understand that an abstract field
  is abstract; it treats it as a concrete field, therefore if a
  concrete subclass implements of `noSuchMethod`, but fails to
  implement the field, the analyzer fails to detect that there will be
  a `noSuchMethod` forwarder (and thus fails to suppress promotion).

- The logic for collecting the set of fields (and getters) that are
  included in a class's interface (or implementation) currently stops
  at a library boundary, so it doesn't properly handle the situation
  where there is a library cycle, and two classes in one library are
  related through an intermediate class in some other library.

- The logic for collecting the set of getters that are included in a
  class's interface currently ignores the `on` clauses of mixins.

This CL includes tests for all these corner cases; I will fix them in
a follow-up CL.

Change-Id: I92d73c0643f1ab89144feefab68779418a2c7a35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313840
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-07-17 18:06:16 +00:00
Joshua Litt 53b2f9247b [dart2wasm|js] Fix minor bug with JS typed data's sublist.
Change-Id: I066e40cd5ec515642a828c243c5f6b18c7b4d7f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313620
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-07-17 18:02:05 +00:00
Nate Biggs acd2ad41b6 [dart2js] Union old and new type when refining in type inference.
This change doesn't seem to have a significant impact on most compilation results:
- Golem results show no significant difference in microbenchmarks.
- For a medium and large app tested, while we see a small change in the actual inference results, the generated code is identical before/after this change.
- Timing and memory usage on internal compilations seem comparable before/after this change.

Note: This replaces the need for any notion of "invalid" refines so I will clean up that code in a follow up change.

Change-Id: I2a293eacd944fc17ee2dab97d3d947c042b4038f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313720
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-07-14 20:46:17 +00:00
Joshua Litt 98431c6506 [js|dart2wasm] Add JSArrayImpl subtype of List<JSAny?>.
Change-Id: I1464250b045feb48d1a7882288d6859e9ac87709
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311824
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2023-07-14 17:12:01 +00:00
Sergey G. Grekhov 7f42498d66 [co19] Roll co19 to 7e4ba229fecce1affe8284b166744329182feb3e
2023-07-14 sgrekhov22@gmail.com Fixes dart-lang/co19#2132. Fix roll failures, add issue numbers (dart-lang/co19#2134)
2023-07-13 sgrekhov22@gmail.com Fixes dart-lang/co19#2130. Fix roll failures, add issues numbers (dart-lang/co19#2131)
2023-07-13 sgrekhov22@gmail.com Fixes dart-lang/co19#2125. Add more external functions tests (dart-lang/co19#2128)
2023-07-13 sgrekhov22@gmail.com Fixes dart-lang/co19#2087. Reorder covariance tests to make maintenance easier (dart-lang/co19#2129)
2023-07-12 sgrekhov22@gmail.com dart-lang/co19#2087. Add tests for parameters covariant-by-declaration (dart-lang/co19#2121)
2023-07-12 sgrekhov22@gmail.com Fixes dart-lang/co19#2117. Update assertions, add tests for external members (dart-lang/co19#2126)
2023-07-12 sgrekhov22@gmail.com Fixes dart-lang/co19#2123. Update Superclasses tests. (dart-lang/co19#2124)
2023-07-11 sgrekhov22@gmail.com dart-lang/co19#2117. Update accessible_instance_member_t* tests (dart-lang/co19#2122)
2023-07-10 sgrekhov22@gmail.com Fixes dart-lang/co19#2099. Add subtyping tests for function type with required named arguments (dart-lang/co19#2100)
2023-07-10 sgrekhov22@gmail.com dart-lang/co19#2112. Add missing tests for mixins. Part 2 (dart-lang/co19#2118)
2023-07-07 sgrekhov22@gmail.com dart-lang/co19#2119. Minor wording changes (dart-lang/co19#2120)

Change-Id: I310f2e0a660ac55a242bb9b2ed9a2f1917555d0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313562
Reviewed-by: Alexander Thomas <athom@google.com>
2023-07-14 09:29:50 +00:00
Srujan Gaddam 2767fca6fe Revert "[dart:js_interop] Remove Object.toJS and JSNumber.toDart"
This reverts commit 16fcfe7eae.

Reason for revert: Flutter changes haven't landed to google3 yet.

Original change's description:
> [dart:js_interop] Remove Object.toJS and JSNumber.toDart
>
> Modifies JSBoxedDartObject reified type on JS backends and also
> modifies JSBoxedDartObject.toDart now that a proper box is introduced.
> Also uses a JS symbol in JSBoxedDartObject.toDart for a property
> check so that different Dart apps don't accidentally share Dart
> objects. It's now an error to call this function on non-boxed objects.
>
> Fixes a type issue where creating a new object literal with the JS
> foreign function was resulting in dart2js thinking toJSBox would
> always throw. Changing the typeDescription to PlainJavaScriptObject
> instead of =Object fixes that issue.
>
> CoreLibraryReviewExempt: Backend-specific library.
> Change-Id: I5cfb1f32ff4328fafdf9831b0d8da806c39391d9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309082
> Reviewed-by: Joshua Litt <joshualitt@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>

Change-Id: I469ad04db7b49ffef47a46ccac97e909e4865719
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313580
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-07-13 21:06:05 +00:00
Srujan Gaddam 16fcfe7eae [dart:js_interop] Remove Object.toJS and JSNumber.toDart
Modifies JSBoxedDartObject reified type on JS backends and also
modifies JSBoxedDartObject.toDart now that a proper box is introduced.
Also uses a JS symbol in JSBoxedDartObject.toDart for a property
check so that different Dart apps don't accidentally share Dart
objects. It's now an error to call this function on non-boxed objects.

Fixes a type issue where creating a new object literal with the JS
foreign function was resulting in dart2js thinking toJSBox would
always throw. Changing the typeDescription to PlainJavaScriptObject
instead of =Object fixes that issue.

CoreLibraryReviewExempt: Backend-specific library.
Change-Id: I5cfb1f32ff4328fafdf9831b0d8da806c39391d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309082
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-07-13 20:38:11 +00:00
Joshua Litt 465d35fac9 [dart2wasm|js] Add support for JS backed subtypes of 64 bit typed data.
Change-Id: I534e946ffdfa6708af0c0ffdecb345adbc9561aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313286
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-07-13 15:29:37 +00:00
Nate Biggs 64fe77f8db [dart2js] Revert invalid refinement change.
A user found another case where this fails (b/290868787).

In this case a ForwardingTypeMask is delegating the subtyping checks to its `forwardTo` mask which ends up saying the masks are equal even though the wrapper around the forwarded masks means they are not equal.

Change-Id: I015f2faf57557ff4189acb6c7144d09cf1ae6bb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313341
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-07-12 15:56:09 +00:00
Daco Harkes 4333288aaa [gardening] Declare resources in test
And give test more time in tsan.

Bug: https://github.com/dart-lang/sdk/issues/52917
Change-Id: I1342612470d63233b265dc9063b0335ec8bef760
Cq-Include-Trybots: luci.dart.try:vm-tsan-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313383
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-07-12 14:02:41 +00:00
Paul Berry 0c9cf2a10b Field promotion: add a test case to repro #52728.
BUG: https://github.com/dart-lang/sdk/issues/52728
Change-Id: I95be48b923ad84b725eac5099db11207d46a74b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313181
Auto-Submit: Paul Berry <paulberry@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-07-11 23:25:43 +00:00
Liam Appelbe eb6baa33ad [vm] Async callback fast path when on target isolate
Skip creating the temporary isolate if the current thread is already
entered into the target isolate. We can marshall the args and send the
message directly from this isolate.

Bug: https://github.com/dart-lang/sdk/issues/52764
Change-Id: I94a1358ad7d2632b53c122cc38cd5675e6f5ecbc
Fixes: https://github.com/dart-lang/sdk/issues/52764
TEST=CI, specifically async_void_function_callbacks_test.dart
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312351
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-07-11 21:26:48 +00:00
Vyacheslav Egorov 4fddaf9486 [sdk] Provide Isolate.resolvePackageUriSync
TEST=augmented few existing tests

Bug: https://github.com/dart-lang/sdk/issues/52121
CoreLibraryReviewExempt: VM-only change, other platforms don't support this API.
Change-Id: I95decae6cf1a5c6ad694747313aa0dbe0a13025d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312981
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-07-11 12:59:33 +00:00
Joshua Litt 50c810e12c [js|dart2wasm] Add JS backed subtypes of Dart typed array classes.
Change-Id: I19a6d47bf857969abe2205e6b505b3a1dead5e3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310480
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2023-07-10 18:11:02 +00:00
Srujan Gaddam e25cd7c182 [dart2wasm] Throw error in JSExportedDartFunction.toDart if not JS function
Currently this throws a Wasm RuntimeError, which is difficult to
recover from.

Change-Id: I747682d6959b19746d6c98f2ea1b3fefd1ed2d03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312891
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-07-10 17:50:07 +00:00
Ryan Macnak 99ef36064f [infra] Make the sanitizer a first-class status variable.
Makes the TSAN skips apply to
 `test.py -mrelease --sanitizer=tsan`
and not just
 `test.py -n vm-tsan-linux-release-x64`.

Also makes the timeouts agree.

Change-Id: I10315e754a4ebb3020f3c2f6cecfac6b77e77a9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311828
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-07-10 17:46:31 +00:00
Liam Appelbe f4eb5392e5 Refactor vmspecific_static_checks_test
Bug: https://github.com/dart-lang/sdk/issues/52754
Change-Id: I13d729f0caf61fa0ef261ffd1c382177a4115d8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312342
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-07-10 00:07:28 +00:00
asiva f84cf9413f [vm/runtime] - Fix RegExp exception messages (issue 52691)
TEST=new test added

Fixed: 52691
Change-Id: Ibc8865f8e9b1e908be80d4fbe8b8931eda448df8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312348
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2023-07-06 21:10:28 +00:00
Sigmund Cherem 8171191413 [dart2js] Add regression test for #52825
I still haven't found yet the fix for this, but might as well add the regression
test for it.

Change-Id: I84821f6615a26faf95e6f7c498aa3670f5d48a54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312701
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2023-07-06 20:18:24 +00:00
Srujan Gaddam b859e00908 Reland "[dart:html] Throw exception if Window.open opens null window" and
"[dart:html] Move NullWindowException to implementation"

This is a revert of bd3e6fa1a3 and
2b250992f9.

This adds some small code change to avoid a null-assertion being emitted
that would lead to a browser SecurityError.

CoreLibraryReviewExempt: Reland.
Change-Id: Iab52bb728b14fd0b2378b8923b0e1ea8ea930b12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311922
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-07-06 15:50:48 +00:00
Lasse R.H. Nielsen d8fa6fe255 Fix bug in VM _CompactHashIterable.
The iterable is used for the `keys` and `values` of `LinkedHashMap`.
The original code remembered the internal data list and used-count
when the iterable was created, and if the iterable was modified
between creating and iterating, the iterated values would not match
the map.
The solution is to not cache those values, and read them from the
hash table when creting the `Iterator` instead.

Fixes #48282

Tested: Added regression test to corelib/map_test
Bug: https://dartbug.com/48282
Change-Id: I79310615e7090556e6f45b0d7f297755951ef046
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312263
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-07-04 11:00:50 +00:00
Elliott Brooks af8fb2cd73 Support the dart:developer timeline APIs in dart2js and DDC.
Exposes timeline events in the Chrome DevTools performance panel using the  Web APIs performance.mark() and performance.measure(): https://developer.mozilla.org/en-US/docs/Web/API/Performance

CoreLibraryReviewExempt: Only change in sdk/lib is updating a comment.
Bug: https://github.com/flutter/devtools/issues/4652
Change-Id: I4f934bcffeb2920ffaf9b7b3a67fc5fc3b814294
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310974
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Elliott Brooks <elliottbrooks@google.com>
2023-06-30 22:38:11 +00:00
Kallen Tu c86af3c39b [analyzer] Refactor visitMethodInvocation in the const evaluator.
Change-Id: I9ae6c17967c98770ed06dead200c8bd87ae7f2a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309829
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-30 18:32:27 +00:00
Ryan Macnak 8f21c8ed2a [gardening] Don't attempt to measure RSS under sanitizers or with reload.
Bug: https://github.com/dart-lang/sdk/issues/52816
Change-Id: I4e50180a9285727cc2e275dd17dd6855f21a0b6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311926
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-06-29 19:39:05 +00:00
Ryan Macnak ac77af1c07 Group the GC tests into a common directory.
The makes it possible to run just these tests with `test.py vm/gc/`.

Change-Id: Ied4aa0b2fb045c19b1aced68f58a1ef195a5df8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311145
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-06-29 17:27:48 +00:00