Commit graph

1384 commits

Author SHA1 Message Date
Stephen Adams 12dae45e5a [corelib] Properly check radix in BigInt.toRadixString.
Change-Id: Ieb1b541db3c35984f4a75b618f9df1c82f4d37da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221201
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-11-25 22:53:53 +00:00
Lasse R.H. Nielsen 62f4712523 Don't assume that a stack overflow is an Error.
A new test captures a stack overflow error and rethrows it.
It assumed that it would be a Dart `Error`, but on dartdevk it's not.
Now just catches whatever it is and checks that it's the same
object again.

Bug: http://dartbug.com/47664
Change-Id: I2355ab1b43adf82806b0b76fc26aa5879ddb0d87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219788
Auto-Submit: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-11-10 21:36:13 +00:00
Lasse R.H. Nielsen 20e9582106 Add Error.throwWithStackTrace function which throws an error and stack.
Allows throwing an error with an existing stack trace, instead of always
creating a new stack traces.

Fixes #30741

Bug: https://github.com/dart-lang/sdk/issues/30741
TEST=corelib/error_throw_with_stacktrace_test.dart
Change-Id: Iea77b4a8eb5e0cab4cd0d75432d033256c9f79fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219522
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-11-08 15:51:32 +00:00
Lasse R.H. Nielsen 2c36db9b0a Deprecate IntegerDivisionByZeroException.
Deprecates the class and makes it implement `Error` (more specifically
`UnsupportedError`).
Code throwing `IntegerDivisionByZeroException` should be migrated to
throwing `unsupportedError` directly, code catching the exception class
should start catching `UnsupportedError` immediately (or reconsider why
they are catching at all).

Integer division by zero also covers other ways that a double division
can give a non-number result (any infinity or NaN result of the division prior to calling `truncate()` on the result, will cause `~/` to throw).

Fixes #46776

Bug: https://github.com/dart-lang/sdk/issues/46776
Change-Id: Idf2657153dd16542e72c6ba921f587dd9fc9032a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208643
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-10-19 16:07:52 +00:00
Lasse R.H. Nielsen 2dcc064916 Add range-check to DateTime.fromMillisecondsSinceEpoch on VM.
The current constructor allowed large numbers which overflows
when multiplied by 1000 to get microseconds, which then hid the
fact that the original value was out of range.

Now checks directly in the `fromMillisecondsSinceEpoch` constructor,
before multiplying by 1000.

Fixes #46966

BUG= http://dartbug.com/46966
TEST= Regression test added to date_time_test.dart

Change-Id: I4c6448666a49d51c285bd538e05e51a141b3b0b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214641
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-10-11 14:31:37 +00:00
Robert Nystrom 0ea8347576 Remove references to dartfmt in various comments and docs.
Change-Id: I02112ce2920d71f84ce4808c13a62e1a1765d83f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215181
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-10-01 00:56:14 +00:00
Lasse R.H. Nielsen 64f06ac544 Fix bug in Duration.toString().
The `toString` called `(-this).toString()` recursively
for negative durations.
If instantiated with the minimal integer on native,
that call would recurse infinitely.

The code has been wrong since we removed arbitrary precision integers.

TEST= Add test for regression case, otherwise covered by existing tests.

Change-Id: Ifb58bbc5aee38ef760f9352aede1694b79bae931
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212300
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-09-10 14:58:47 +00:00
Lasse R.H. Nielsen ed3824a220 Tweaks, refactoring and updates on DoubleLinkedQueue.
It's a badly designed class, but this change makes it slightly better.
(We should consider moving it to package:collection and removing it from
the platform libraries. Eventually.)

The changes decouples the public `DoubleLinkedQueueEntry` class from
the actual queue implementation classes, avoiding the latter having
to share a generic `_Link<DoubleLinkedQueueEntry>` interface
which would force them to do otherwise unnecessary casts.

The public class should have been abstract, but isn't.
It's mainly used as the API of the entries exposed by DoubleLinkedQueue,
but it can also be used by itself to build double-linked lists that are
not part of a Queue, and the class can be extended.
If anyone does either, it should keep working, so it needs to be a concrete,
self-contained class with a generative constructor.

That class is moved to dart:_internal to avoid its private
implementation fields from interfering with the queue implementation classes,
which have similar fields, but can now have them at different types.
That's a hack, but it works.

The internal implementation of the DoubleLinkedQueue and its entries
are updated to better follow current programming idioms, and avoids
having fields on classes which don't need them.

Also fixes #27920
(`clear`ing a list now detaches each entry from the list so later `.contains`
won't give the wrong answer).

And moves queue tests from tests/corelib to tests/lib/collection,
since Queue isn't exposed by `dart:core`.

BUG= https://github.com/dart-lang/sdk/issues/27920

Change-Id: Ia3bb340a75886de160cc0e449947e8e7ee587061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211265
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-08-31 12:44:39 +00:00
Daco Harkes b294fe59f9 [vm/gardening] Mark bigint_parse_radix_test/3 as slow
Bug: https://github.com/dart-lang/sdk/issues/47050

Change-Id: Ia0496785c5df6c231269ae4ebbb4376beb3a63d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211904
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-08-31 09:56:50 +00:00
Erik Ernst 166d474257 Adjust symbol tests to new semantics
Cf. https://github.com/dart-lang/sdk/issues/46207, the semantics of
the platform class `Symbol` was changed such that all string argumnts
are accepted (previously, only some strings were accepted).

Change-Id: I1d2b093e4fdbb5dabf17b7a53c70e9787a7a76a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205480
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2021-07-01 18:43:14 +00:00
Lasse R.H. Nielsen 83376bf1ee Add Object.hash and Object.hashAll static helper methods.
Fixes #11617.

Bug: http://dartbug.com/11617
Change-Id: Id06fb5b3914bee24713427edbd3b9b7e86f86449
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/73360
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-06-25 11:40:35 +00:00
Stephen Adams 8fda1d6cf3 [js_runtime] Don't modify inputs to Function.apply
In some cases adding default arguments modified the 'positional'
arguments input List.  Since there are 'accelerated' paths for small
numbers of arguments, this bug did not show in any other tests.

Change-Id: I5075c96ecfdc9645b85b9beeeb38305415153d20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204747
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-06-24 03:29:38 +00:00
Alexander Aprelev c8ffded3ad [vm/regexp] Ensure recently added reg_exp_receive_port_test runs on dartkp.
This is follow-up to db17c490f8 where test was marked as skipped on dart_precompiled runtime.

Normalized corelib.status file so that presubmit reports relevant feedback with changes to it.

TEST=reg_exp_receive_port_test

Change-Id: Ib67d4c139040f27d1bd0b2b65ceb07269bacadd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202981
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-06-09 17:06:51 +00:00
Alexander Aprelev db17c490f8 [vm/regexp] Ensure regex sent in a message can be used by the receiver.
Fixes https://github.com/dart-lang/sdk/issues/46294

TEST=reg_exp_receive_port_test.dart

Change-Id: Ic9ecde42224d44035ecb60347e11aae0bd92cd09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202861
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-06-09 02:50:50 +00:00
Ryan Macnak bc3aa70e20 [vm, compiler] Fix size of sign-extension in x64c BigInt intrinsics.
TEST=ci
Change-Id: I99aa9875705823c22b5474bb1d66c7bc1aaac9fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202309
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-06-03 22:47:56 +00:00
Erik Ernst e4647026a1 Correct symbol_reserved_word_test.dart, splitting it into two tests.
Also add one new test symbol_arbitrary_string_test.dart.

Change-Id: I12b07218a098a37b83d99525d2be3ec356ef1fd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195503
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-06-01 15:55:03 +00:00
Lasse R.H. Nielsen a5e18113f3 Remove references to triple-shift and generic-metadata experiments.
TEST= removed flags from test. No behavior should change.

Change-Id: I401bfb68c082d1bd405a118d5eca6a47a807945f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199241
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2021-05-12 13:35:00 +00:00
Lasse R.H. Nielsen 5b64d1233b Fix null-safety migration error in CastMap.
Make expect use `Never` to signal non-completion instead of depending on `meta`.

Change-Id: Ibb4230e6b0cfbf995ad91a31c6620525cf6a8918
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194244
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-05-10 14:15:07 +00:00
Robert Nystrom 29c850db57 Fix test names in corelib/.
Without "_test", they aren't run by the test runner.

Change-Id: I073ea7b8e127120b306036ff9bf5f25066133679
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198080
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2021-05-05 01:06:12 +00:00
Erik Ernst cf7bfc5d3c Fix corelib/type_tostring_test.dart
Change-Id: I6eb9c6ca54bb4f00bfd1011d10f291ea5f672972
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195508
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-04-16 07:33:57 +00:00
Daco Harkes 4558112105 Rereland "[vm/ffi] Disallow Pointers and structs in finalizers and expandos"
`Dart_NewWeakPersistentHandle` and `Dart_NewFinalizableHandle` in
`dart_api.h` do no longer accept `Pointer`s and subtypes of `Struct`s
as values passed in to the `object` parameter.

Expandos no longer accept `Pointer`s and subtypes of `Struct`s
as values passed in to the `object` parameter.

Cleans up unused object_store->ffi_struct_class.

Reland 1: Allow importing `dart:ffi` from `dart:core` with
          `--enable-ffi=false`.
Reland 2: Allow the new `_Compound` class to extend `NativeType`. (This
          got triggered in this CL on the build because of the import
          from `dart:core`.)

Closes: https://github.com/dart-lang/sdk/issues/45071
Breaking change: https://github.com/dart-lang/sdk/issues/45072

TEST=vm/cc/DartAPI_FinalizableHandleErrors
TEST=vm/cc/DartAPI_WeakPersistentHandleErrors
TEST=tests/ffi(_2)/expando_test.dart

Change-Id: I133278e16bd75cd2bb6234e7ddf042ffa0a54fd6
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,analyzer-analysis-server-linux-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195079
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-04-14 12:07:18 +00:00
Daco Harkes c33dad37e5 Revert "Reland "[vm/ffi] Disallow Pointers and structs in finalizers and expandos""
This reverts commit 3f0ad61daa.

Reason for revert: Conflicts with https://dart-review.googlesource.com/c/sdk/+/194765

Original change's description:
> Reland "[vm/ffi] Disallow `Pointer`s and structs in finalizers and expandos"
>
> `Dart_NewWeakPersistentHandle` and `Dart_NewFinalizableHandle` in
> `dart_api.h` do no longer accept `Pointer`s and subtypes of `Struct`s
> as values passed in to the `object` parameter.
>
> Expandos no longer accept `Pointer`s and subtypes of `Struct`s
> as values passed in to the `object` parameter.
>
> Cleans up unused object_store->ffi_struct_class.
>
> Closes: https://github.com/dart-lang/sdk/issues/45071
> Breaking change: https://github.com/dart-lang/sdk/issues/45072
>
> TEST=vm/cc/DartAPI_FinalizableHandleErrors
> TEST=vm/cc/DartAPI_WeakPersistentHandleErrors
> TEST=tests/ffi(_2)/expando_test.dart
>
> Change-Id: I9af6d0173db60614091068c218391f73756c135f
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195061
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Daco Harkes <dacoharkes@google.com>

TBR=kustermann@google.com,dacoharkes@google.com

Change-Id: I90064b6b73155a43f37388f987c6b29f72ce9770
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195076
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-04-13 15:05:07 +00:00
Daco Harkes 3f0ad61daa Reland "[vm/ffi] Disallow Pointers and structs in finalizers and expandos"
`Dart_NewWeakPersistentHandle` and `Dart_NewFinalizableHandle` in
`dart_api.h` do no longer accept `Pointer`s and subtypes of `Struct`s
as values passed in to the `object` parameter.

Expandos no longer accept `Pointer`s and subtypes of `Struct`s
as values passed in to the `object` parameter.

Cleans up unused object_store->ffi_struct_class.

Closes: https://github.com/dart-lang/sdk/issues/45071
Breaking change: https://github.com/dart-lang/sdk/issues/45072

TEST=vm/cc/DartAPI_FinalizableHandleErrors
TEST=vm/cc/DartAPI_WeakPersistentHandleErrors
TEST=tests/ffi(_2)/expando_test.dart

Change-Id: I9af6d0173db60614091068c218391f73756c135f
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195061
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-04-13 13:52:36 +00:00
Alexander Markov 5129cff930 [vm/aot] Discard Code objects from the heap
While deserializing AOT snapshot, Code objects which do not contain
valuable information besides entry point and stack maps are discarded
and not allocated on the heap (they are replaced with
StubCode::UnknownDartCode()).

PC -> Code/CompressedStackMaps lookup is implemented using a separate
table (InstructionsTable).

Flutter gallery in release-sizeopt mode:
Heap size of snapshot objects: arm -26.89%, arm64 -27.68%

Large Flutter application in release mode with --dwarf-stack-traces:
Heap size of snapshot objects: -24.3%.
Discarded Code objects: 72.5% of all Code objects.

Issue: https://github.com/dart-lang/sdk/issues/44852.

TEST=existing tests; "--dwarf_stack_traces --no-retain_function_objects
--no-retain_code_objects" mode is enabled for a few tests.

Change-Id: I5fe3e283630c8e8f4442319d5dcae38d174dd0d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189560
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-04-13 02:36:16 +00:00
Lasse R.H. Nielsen 6af4987dc6 Change VM DateTime to-local-time computation to not fail for <1h changes.
The DateTime conversion to local time amounts to solving an
equation, finding an offset where the current local time is that offset.

The current approach doesn't actually do that, it just tries to simulate
the JS approach, with a tweak to avoid DST change issues, but that tweak
assumes that all time zone adjustments are one hour changes.

This CL should work correctly for time zone changes of up to one hour,
but might still fail for changes of more than one hour.
It works by trying more offsets, which obviously has a performance cost,
which depends on how efficient the operation system is at providing
the local time zone for a specific milliseconds-since-epoch.

Change-Id: I80dc6e62e0639d9966d3c5a06430787d8acc4ff1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182041
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-04-08 16:51:00 +00:00
Lasse Reichstein Holst Nielsen 7f2b875b4a Add efficient entries and keys.contains to SplayTreeMap.
Update some other methods to be more performant than the default
inherited from `MapMixin`.
Change argument validation to `map.[]=`, `map.putIfAbsent` and `set.add`
checks that the key/element is allowed by the `compare` function.
Previously the map methods just checked `key != null` (which was wrong),
and compare did nothing special, both just relied on the `splay` call
doing a `compare` call. That was not true for an empty map, which means
that you could add a key/element which wasn't a valid comparable,
as long as you did it as the *first* key/element.
That is now caught.


Bug: https://github.com/dart-lang/sdk/issues/45296
Change-Id: I8ba49a7892ed27daa4434f5fb7be3e777ef32bc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190883
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-03-22 13:20:13 +00:00
Stephen Adams c310592643 [corelib] Fix unsigned_shift_test
1. Replace unintended '>>' with '>>>'

2. If infinity is an int, it is a large shift count and not an error.

3. Improve web coverage: Put the dynamic validation tests their own
(multi)parts so that failures of validation are separate to incorrect
results so can't mask incorrect results.

Change-Id: I569135507f1f23a01bde1f85f7ce91dec2bd8df4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189960
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-03-09 17:15:00 +00:00
Ryan Macnak 5a385890b9 [test] Apply simarm64 status file entries to simarm64c.
Remove references to the removed simarmv6 architecture.

TEST=ci
Change-Id: I10e9fc8291c3e5b6b9a4bd71ca05de95e53f22c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187500
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-02-25 21:18:02 +00:00
Stephen Adams 6100737245 [tests] Copy comment from corelib_2/unsigned_shift_test to corelib
Accidentally omitted from https://dart-review.googlesource.com/c/sdk/+/186920

TBR=alexmarkov@google.com

Change-Id: I39d3942f411bc9987f4e817bd05932b460ceca2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187162
Auto-Submit: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-02-25 02:28:55 +00:00
Stephen Adams 6f18bce08d [dart2js] Fix unsigned_shift_test
Original test contains int literals that are illegal on web.

Change-Id: I87ba80ae273792dd5572e9890a339d4d3df34fb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186920
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-02-24 22:01:24 +00:00
Alexander Markov 7f8001218b [vm] Support unsigned shift operator int.>>>
TEST=runtime/tests/vm/dart/unsigned_shift_right_test.dart and other
tests for >>>.

Issue https://github.com/dart-lang/sdk/issues/30892
Issue https://github.com/dart-lang/sdk/issues/44914

Change-Id: I7f0a9e1e486be06576c5d9bff3659b0aa6d68c23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184921
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2021-02-24 00:14:57 +00:00
Ben Konyi 848121e6d4 Reland "[ CLI ] Improved consistency of -D and --define across tools and commands"
- Added support for --define to the VM and dart2js
- Added support for -D and --define for `dart run` and `dart compile js`

Remaining improvements:
- Add support for providing multiple comma separated values for `dart
  run`, `dart`, and `dart2js`

Related issue: https://github.com/dart-lang/sdk/issues/44562

TEST=Updated CLI tests and added new dart2js tests.

This reverts commit e49937769f.

Change-Id: I5f9275b829665eb5e8695403d67f230e752ab0e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183180
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-02-05 23:53:28 +00:00
Lasse R.H. Nielsen 222b894d62 Change resolve for package:URIs to not remove package name.
A "package URI" is defined as one with a `package` scheme,
no authority, a first path segment terminated by `/` which
contains no escapes and is not all `.` characters.
This is the definition of package names accepted by .packages
as well: Valid path characters and not all dots.

Change-Id: I9a161d47732e8bf873d278774315c72a4a928823
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117542
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-02-05 18:31:48 +00:00
Lasse R.H. Nielsen 4a484c88e1 Make ListMixin.take check that the argument is not null.
Fixes #41743, #30155
BUG= http://dartbug.com/41743

Change-Id: I223905a92b7353cdc50498d265a6dfe2f2f614d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160640
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-01-28 17:19:35 +00:00
Ben Konyi e49937769f Revert "[ CLI ] Improved consistency of -D and --define across tools and"
This reverts commit e83e78431f.

Reason for revert: Failing on SIMARM and AOT bots

Original change's description:
> [ CLI ] Improved consistency of -D and --define across tools and
> commands
>
> - Added support for --define to the VM and dart2js
> - Added support for -D and --define for `dart run` and `dart compile js`
>
> Remaining improvements:
> - Add support for providing multiple comma separated values for `dart
>   run`, `dart`, and `dart2js`
>
> Related issue: https://github.com/dart-lang/sdk/issues/44562
>
> TEST=Updated CLI tests and added new dart2js tests.
>
> Change-Id: I9379c7aee1eab377adb3438393d9ad79c4938cc4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178262
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=bkonyi@google.com,asiva@google.com,sigmund@google.com

Change-Id: I1c594ae7db551619cc3191ff7f832c4fc61a4171
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179081
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-01-14 01:05:29 +00:00
Ben Konyi e83e78431f [ CLI ] Improved consistency of -D and --define across tools and
commands

- Added support for --define to the VM and dart2js
- Added support for -D and --define for `dart run` and `dart compile js`

Remaining improvements:
- Add support for providing multiple comma separated values for `dart
  run`, `dart`, and `dart2js`

Related issue: https://github.com/dart-lang/sdk/issues/44562

TEST=Updated CLI tests and added new dart2js tests.

Change-Id: I9379c7aee1eab377adb3438393d9ad79c4938cc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178262
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-01-13 23:33:17 +00:00
Lasse R.H. Nielsen eaf5be7b80 Uri.https and Uri.http constructors queryParams type
Currently `Uri.http` and `Uri.https` factory constructors do not allow for `queryParameters` to be `Map<String, dynamic>`, but only `Map<String, String>`, when in fact the main `Uri` constructor does work with `queryParameters` as `Map<String, dynamic>`.

Closes https://github.com/dart-lang/sdk/pull/42564
https://github.com/dart-lang/sdk/pull/42564

GitOrigin-RevId: 6fa130cc4325ae99d96260e8dc0a222398e7522f
Change-Id: Ia1ee0911ec4d80df75792a365af9ca143a729fa2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163620
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-01-11 15:22:06 +00:00
Stephen Adams 6892f0ddc0 [tests] Don't run corelb{,_2}/integer_arith_vm_test on web
This is a VM optimization test.
Operations are also tested in int_modulo_arith_test.

Change-Id: Icd9c288e23b9561c809a5cf997d68dd151bdbed9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176000
Auto-Submit: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-13 18:37:17 +00:00
Oleksii Khomchenko 64226729c1 [corelib] Add Set.unmodifiable backed by an UnmodifiableSetView
UnmodifiableSetView does not have backend specific implementations
(simillar to UnmodifiableMapView, unlike UnmodifiableListView).

Closes https://github.com/dart-lang/sdk/issues/36901

Change-Id: I041bb6dc95d6a67a395ca75581ffe8e5933acdc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164103
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-12-10 11:00:27 +00:00
Tess Strickland 367761987b [vm/corelib] Fix ConcurrentModificationError for empty addAll.
Since we only add elements if the iterator is non-empty, we
shouldn't get a ConcurrentModificationError if both the iterator
and receiver are the same empty EfficientLengthIterator.

Fixes https://github.com/dart-lang/sdk/issues/42011

TEST=New regression test added that fails without the sdk change.

Fixed: 42011
Change-Id: Ib5259c8f043cc8277d2fea407d1f64a24430c4d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173901
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-11-25 12:01:44 +00:00
Stephen Adams e769817cdc [tests] Split corelib{,_2}/list_concurrent_modify_test
Splitting out a failing test to increase coverage of other tests.

It is not clear that `a.addAll(a)` should throw if `a` is empty.
`a` is not modified by the action.

dart2js/DDC do not detect this case and I'm reluctant to add a check
for the case where `a` is in fact not modified.

The VM test is very specific to an identical argument and cannot
detect the case for `a = Mylist([])`.

Another option to this proposal is to simply delete the `[]` case.

In general, I'd like to move more ConcurrentModificationError tests
into assert statements.

Change-Id: I1f9559bdb43ea1bae0575413748c9d9d0de58b99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170023
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-11-05 19:46:35 +00:00
Erik Ernst 3a7eeb6315 Rename is{Strong,Weak}Mode to has{Sound,Unsound}NullSafety
Change-Id: If3912d75c5f89a741299b2fae4299d01ac928eec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170424
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2020-11-05 14:26:53 +00:00
Alexander Markov e9aa232066 Remove remaining tests for bytecode mode
Change-Id: I9690bd8a9bdcf16963424c64c1b80628e50fa28a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166922
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-09 22:30:19 +00:00
Riley Porter febb1929cd [ddc] Copy JS 2-digit year handling from dart2js.
Fixes https://github.com/dart-lang/sdk/issues/42894

Change-Id: I68a8782d123c299ec34bfd0a31b3108138dac117
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164681
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2020-09-26 01:11:54 +00:00
Nate Bosch 735bcbe10d Allow reading null current with unsound null safety
Fixes #42950

It was previously allowed, though non-sensible, to read `.current`
before advancing the iterator for a `RegExp.allMatches` iterable and get
`null`. Using `as` allows backward compatibility in unsound null safety
mode, while `!` is breaking since it introduces a null check in either
mode.

The new behavior is also the behavior of the migrated code for DDC since
https://dart-review.googlesource.com/c/sdk/+/151121

Change-Id: I9f3654298a3d480ec2f297a40a4145ff6ca9f011
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157880
Auto-Submit: Nate Bosch <nbosch@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2020-09-18 17:43:57 +00:00
Konstantin Shcheglov 8de8a1c226 Move codes from StaticTypeWarningCode into CompileTimeErrorCode.
They are all errors now.

Change-Id: If48d38e38e845fd5b5a950dd5514bf1cbbce03d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-07-27 16:44:15 +00:00
Konstantin Shcheglov ba92b78acd Move errors from StaticWarningCode to CompileTimeErrorCode.
Bug: https://github.com/dart-lang/sdk/issues/42821
Change-Id: I153c48d7a2e4a02026928e6203aacf8f2dc029ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155849
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-07-26 04:19:25 +00:00
Tess Strickland bb24f76c72 [vm] Reland "Remove non-covariant checks from closure bodies (part 1)"
Also relands the followup CLs:
"Perform non-covariant checks when dynamically invoking callables."
"Use AreValidArguments so that names are checked as well."

Original description of first CL:

This change only affects compilation when running in non-precompiled
mode with --no-lazy-dispatchers enabled.

Instead of always compiling in non-covariant checks, even for closures
not called dynamically, remove the non-covariant checks from the closure
and instead do the non-covariant checks for dynamic calls during the
NoSuchMethodForCallStub fallback by calling
Function::DoArgumentTypesMatch.

Adds two overloads for Function::DoArgumentTypesMatch, one which takes a
function type argument vector and one which takes neither an
instantiator type argument vector or a function type argument vector.
For the versions that are not explicitly passed a type argument vector,
an appropriate one is constructed using the arguments. If there is not
enough information in the arguments, then we fall back to assuming the
empty type argument vector for the instantiator case and instantiating
to bounds in the function type argument case.

Fixes Function::DoArgumentTypesMatch to handle generic functions and to
check arguments appropriately according to the active null safety mode.
For generic functions, the provided or resulting function type vector
has non-covariant checks performed against the type parameter bounds.

This change uncovered one test that was incorrectly passing in strong
mode, see https://github.com/dart-lang/sdk/issues/42688 for details.

Original description of second CL:

The VM only does this when the callable function does not expect dynamic
invocations. Otherwise, performing the checks would be redundant, as the
function body already contains the appropriate non-covariant checks.

Third CL had no additional description.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-try,vm-kernel-reload-linux-release-x64-try, vm-kernel-reload-rollback-linux-debug-x64-try
Bug: https://github.com/dart-lang/sdk/issues/40813
Change-Id: I1a3e9c1865103a8d716e1cad814267caffaaadf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154688
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-21 10:00:41 +00:00
Alexander Aprelev d6eb87bbcc Revert "[vm] Remove non-covariant checks from closure bodies (part 1)" as it broke language_2/vm/no_such_args_error_message_vm_test.
This reverts commit 556f0fb5c8 and fixes merge conflict.

Revert "[vm] Perform non-covariant checks when dynamically invoking callables." as a collateral.

This reverts commit 7a6287bb92.

Revert "[vm] Use AreValidArguments so that names are checked as well." as a collateral

This reverts commit 90c683018f.

Change-Id: Iee2c5e91c39d19dca7a1e640c103443c95e6c4f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154705
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-07-16 23:25:54 +00:00
Tess Strickland 556f0fb5c8 [vm] Remove non-covariant checks from closure bodies (part 1)
This change only affects compilation when running in non-precompiled
mode with --no-lazy-dispatchers enabled.

Instead of always compiling in non-covariant checks, even for closures
not called dynamically, remove the non-covariant checks from the closure
and instead do the non-covariant checks for dynamic calls during the
NoSuchMethodForCallStub fallback by calling
Function::DoArgumentTypesMatch.

Adds two overloads for Function::DoArgumentTypesMatch, one which takes a
function type argument vector and one which takes neither an
instantiator type argument vector or a function type argument vector.
For the versions that are not explicitly passed a type argument vector,
an appropriate one is constructed using the arguments. If there is not
enough information in the arguments, then we fall back to assuming the
empty type argument vector for the instantiator case and instantiating
to bounds in the function type argument case.

Fixes Function::DoArgumentTypesMatch to handle generic functions and to
check arguments appropriately according to the active null safety mode.
For generic functions, the provided or resulting function type vector
has non-covariant checks performed against the type parameter bounds.

This change uncovered one test that was incorrectly passing in strong
mode, see https://github.com/dart-lang/sdk/issues/42688 for details.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-dartkb-linux-release-x64-try
Change-Id: I5030a46b356778448b51a243f16406eacf1c04bf
Bug: https://github.com/dart-lang/sdk/issues/40813
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153202
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-16 14:54:04 +00:00