Commit graph

1947 commits

Author SHA1 Message Date
Régis Crelier f2806ab624 [Corelib, VM runtime] Fix handling of zero operand in Bigint operations (fixes #32465).
Fix VM, dart2js, and dcc Bigint implementations.
Add shift tests.
Re-enable Bigint intrinsics on VM.

Change-Id: Iec19eac8069cf17783a5346289ea2745ffcc7c26
Reviewed-on: https://dart-review.googlesource.com/46570
Reviewed-by: Florian Loitsch <floitsch@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-21 21:44:10 +00:00
Lasse Reichstein Holst Nielsen a81bc639b5 Fix bug in BigInt.from with certain double values.
Add test.

Change-Id: I385f7237e1b3d004b4401e18a82919b15d097181
Reviewed-on: https://dart-review.googlesource.com/46460
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Florian Loitsch <floitsch@google.com>
2018-03-19 17:46:35 +00:00
Ben Konyi b28c4664c0 Revert "[VM] Move runtime/lib/{developer,profiler,timeline}.dart -> ..._patch.dart, fix owner of constructors"
This reverts commit 60a2cfa219.

Change-Id: I6d83653c72d5e8576952a631d23be5be5d9c71f6
Reviewed-on: https://dart-review.googlesource.com/46384
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-03-13 22:24:19 +00:00
Lasse R.H. Nielsen 00dae36b47 Add of constructors to collections.
Change-Id: Ic9a180cbb758cf8fe51369d904fa4b51fd1b8e27
Reviewed-on: https://dart-review.googlesource.com/44480
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-03-13 12:57:49 +00:00
Martin Kustermann 60a2cfa219 [VM] Move runtime/lib/{developer,profiler,timeline}.dart -> ..._patch.dart, fix owner of constructors
This makes sure we can distinguish e.g. 2 different timeline.dart files
(from runtime/lib/timeline.dart and sdk/lib/developer/timeline.dart)

This CL also fixes the owner of constructors to be patch classes, if
the constructors come from a patch.

This CL also adds a service/valid_source_locations_test, which loops
over libraries/classes/fields/functions and obtains source locations for
them, including line numbers.  This ensures that if there is a source
location attached to a member, we can use it's token position to get to
the line number.

This CL also changes package:kernel's [Cloner] to clone fileOffsets (and
not just fileEndOffsets). This is important for mixin resolution, where
we copy members into mixin application classes.

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

Change-Id: I4fea5cd646d81f47e1c4ede1e86d477ba6de3e82
Reviewed-on: https://dart-review.googlesource.com/46141
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-13 10:27:26 +00:00
Leaf Petersen 4c881188b2 Disable the .whereType method until generic methods are turned on.
The whereType method silently does the wrong thing without methods,
so make it throw until we turn them on everywhere.

Change-Id: Id934c8bdb4f682dbc3560d78fbca580e37297e2d
Reviewed-on: https://dart-review.googlesource.com/45744
Reviewed-by: Nate Bosch <nbosch@google.com>
2018-03-08 23:14:22 +00:00
Lasse Reichstein Holst Nielsen b3c12d4e3a Dart 2 Libraries Wave 3
Add `typeArguments` to Invocation.
Add constructors to Invocation, making it less necessary for users to create their own implementations.
Add tests.
Add Symbol.unaryMinus and Symbol.empty constants.

Change-Id: I70cb3265f9413617cf57fce1297e393a29eeb26a
Reviewed-on: https://dart-review.googlesource.com/40741
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-03-08 16:36:07 +00:00
Régis Crelier 383517d292 [VM runtime] Fix type canonicalization (fixes #32425).
A reused type argument vector that is longer than necessary needs to be
shortened to the correct length upon type canonicalization.
The runtime call comparing two instance runtime types also needs to consider
reused vectors.
Add regression test.

Change-Id: Ib3b9620409b9cff313f270c4f3fb7051fecbb604
Reviewed-on: https://dart-review.googlesource.com/45340
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-03-08 09:55:35 +00:00
Lasse R.H. Nielsen d22ac9f071 Faster first/last on VM implementation of (Linked)HashSet.
See issue #31470

The performance numbers from the example in that issue improved as follows:

Before:
Set.first  2669 ms
Set.last  15509 ms
HashSet.first  2845 ms
HashSet.last  22053 ms

After:
Set.first  1244 ms
Set.last  1422 ms
HashSet.first  1075 ms
HashSet.last  4552 ms

Bug: http://dartbug.com/31470
Change-Id: I8afc91ad8835ac18bcc37737570c7f4be0bb6e8a
Reviewed-on: https://dart-review.googlesource.com/44782
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Corry <erikcorry@google.com>
2018-03-06 12:50:21 +00:00
Lasse R.H. Nielsen 3a769b9dbe Add missing methods to make classes Dart 2 valid.
Change-Id: I9a2e07de692127069d8098e3a0ea45846a3f45ae
Reviewed-on: https://dart-review.googlesource.com/43672
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2018-03-02 14:01:49 +00:00
Martin Kustermann acf86bfb22 [VM] Type _CompactIterator/_CompactIterable._table
With the [_table] field being `dynamic` we were unable to eliminate
checks for the [_isModifiedSince] method, since there is a dynamic call
site.

This CL adds a type to [_table] so [_isModifiedSince] does not need to
perform any checks (via package:vm/transf.../no_dynamic_invocations_annotator.dart)

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

Change-Id: If773c4b63fab62d1ccdd2e783aa16c19f780000a
Reviewed-on: https://dart-review.googlesource.com/43423
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-01 14:03:28 +00:00
Lasse R.H. Nielsen 9ee735b659 Add missing methods to List and Map implementations.
Optimize FollowedBy when the operands have efficient length.

Change-Id: I0af59240d70b929358c06b8d57a85df2deee6aaf
Reviewed-on: https://dart-review.googlesource.com/43665
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-02-28 12:26:53 +00:00
Régis Crelier b766ec170c [VM runtime] Optimize new Bigint implementation for digit pair processing on 64-bit platforms.
Added Montgomery reduction in new Bigint implementation to support faster crypto (modPow).

Change-Id: Ic6872c9809485db27d0175c1d1f348232250b682
Reviewed-on: https://dart-review.googlesource.com/43300
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-02-28 00:52:57 +00:00
Régis Crelier b761571bf3 [VM runtime] Remove reference to old Bigint class from intrinsics (that will be
reused to support new Bigint implementation) by introducing a global constant.
Add asserts and comments in old Bigint implementation.

Change-Id: Id647ffb6ae6557457ccf52fde4f0e6eb3d06c0b5
Reviewed-on: https://dart-review.googlesource.com/43280
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-02-23 01:23:33 +00:00
Paul Berry b119f7a4cd Only allow implicit use of .call if it refers to a method.
Change-Id: I4c332b64eb7338ceaf63544c3dd0317f8c7d4538
Reviewed-on: https://dart-review.googlesource.com/42020
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-02-21 14:12:14 +00:00
Régis Crelier ba75b6939d [VM] Increase BigInt digit size from 16 to 32 bits.
Change-Id: I60e7e34559d11d80fde7955dec98b21b7029e199
Reviewed-on: https://dart-review.googlesource.com/40962
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-02-14 00:41:01 +00:00
Ryan Macnak 3f40488ec4 [vm, isolate] Refactor isolate message snapshotting to centralize construction of the Message.
Remove unused special case in ApiMessageWriter for lists of int.

This is in preparation for ensuring we always free any external data that ends up in an isolate message.

Bug: https://github.com/dart-lang/sdk/issues/31959
Change-Id: I999656fc11d2aee9aebe70852be5bb075f234b4d
Reviewed-on: https://dart-review.googlesource.com/41020
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-02-14 00:28:01 +00:00
Dmitry Stefantsov 47fbe76d03 Avoid patching with redirecting factories in vm-related patches
Change-Id: Id45696a38b281b1b75a9a0e26d89216388a4ec19
Reviewed-on: https://dart-review.googlesource.com/39942
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-02-08 14:11:50 +00:00
Lasse R.H. Nielsen bdc6e9c862 Add ticks counter to Timer.
Change-Id: Ie5ed28fa8b7ef9c6aea97331267cf3c717b17099
Reviewed-on: https://dart-review.googlesource.com/21342
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-02-08 10:16:00 +00:00
Ryan Macnak 1451cfd741 [vm] Add Dart_NewListOfType to the embedding API.
Change-Id: I4729d9b39b0902ad5b77de2acd9f1e867134a619
Reviewed-on: https://dart-review.googlesource.com/39840
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-02-07 22:05:30 +00:00
Lasse R.H. Nielsen 6f78471687 New methods on Iterable, List, Set, Queue, Map.
Changes signature of Iterable.singleWhere.
Makes LinkedHashMap no longer be a HashMap.

Change-Id: I7a12fea533d42b0fc8357086649df38ad01f3cdd
Reviewed-on: https://dart-review.googlesource.com/39140
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-02-07 06:12:53 +00:00
William Hesse 9c35cff5cd Revert "New methods on Iterable, List, Set, Queue, Map."
This reverts commit 0b59f24f97.

Reason for revert: Creates crashes in dart2js with kernel, see
https://luci-milo.appspot.com/buildbot/client.dart/dart2js-linux-d8-minified-1-5-be/9751

Original change's description:
> New methods on Iterable, List, Set, Queue, Map.
> Changes signature of Iterable.singleWhere.
> Makes LinkedHashMap no longer be a HashMap.
> 
> Change-Id: Ibd7e56e1ac03cb9fb10d19d1328d452fcd06d89f
> Reviewed-on: https://dart-review.googlesource.com/32541
> Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
> Reviewed-by: Leaf Petersen <leafp@google.com>

TBR=lrn@google.com,leafp@google.com

Change-Id: Iab904f5885a5213ae2e16ef496eed0b6843185f3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/39060
Reviewed-by: William Hesse <whesse@google.com>
2018-02-06 13:32:19 +00:00
Lasse R.H. Nielsen 0b59f24f97 New methods on Iterable, List, Set, Queue, Map.
Changes signature of Iterable.singleWhere.
Makes LinkedHashMap no longer be a HashMap.

Change-Id: Ibd7e56e1ac03cb9fb10d19d1328d452fcd06d89f
Reviewed-on: https://dart-review.googlesource.com/32541
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-02-06 11:17:46 +00:00
Peter von der Ahé 861550a28c Read patch files in strong mode
Closes https://github.com/dart-lang/sdk/issues/28822

Change-Id: I05e1d9885a39efca131d78d06cfd8a0e84276bb9
Reviewed-on: https://dart-review.googlesource.com/36641
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-02-05 14:35:36 +00:00
Florian Loitsch 3b8e4d41a7 Reapply "Run async functions immediately."
Which was reverted in commit 032be73dbe.
Originally commited in commit 67bac0bce6.
Original review URL: https://dart-review.googlesource.com/5263

Change-Id: Ic7333c29e502a3924dc6aade8ffa46fc8aa5b04a
Reviewed-on: https://dart-review.googlesource.com/38120
Commit-Queue: Florian Loitsch <floitsch@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2018-02-02 15:50:16 +00:00
Florian Loitsch 032be73dbe Revert "Run async functions immediately."
This reverts commit 67bac0bce6.

Reason for revert: broke the bot.

Original change's description:
> Run async functions immediately.
> 
> Migrated from https://codereview.chromium.org/2478703003/
> 
> Change-Id: I1d678c01ba5876490b12c676c500171328361d31
> Reviewed-on: https://dart-review.googlesource.com/5263
> Commit-Queue: Florian Loitsch <floitsch@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Reviewed-by: Vijay Menon <vsm@google.com>
> Reviewed-by: William Hesse <whesse@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>

TBR=whesse@google.com,rnystrom@google.com,vegorov@google.com,kustermann@google.com,zra@google.com,floitsch@google.com,jmesserly@google.com,vsm@google.com,regis@google.com,sigmund@google.com

Change-Id: I20c948057423c3fa5aa8c72843f8f2a17e086ad5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/37981
Reviewed-by: Florian Loitsch <floitsch@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2018-02-01 15:01:21 +00:00
Florian Loitsch 67bac0bce6 Run async functions immediately.
Migrated from https://codereview.chromium.org/2478703003/

Change-Id: I1d678c01ba5876490b12c676c500171328361d31
Reviewed-on: https://dart-review.googlesource.com/5263
Commit-Queue: Florian Loitsch <floitsch@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-02-01 14:08:57 +00:00
Lasse Reichstein Holst Nielsen 0c18b643c6 Add RegExp.escape methods.
Fixes 4706

Bug: http://dartbug.com/4706
Change-Id: If635cb0eb7c20405ab0127a443fe51176191b5ad
Reviewed-on: https://dart-review.googlesource.com/35641
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2018-02-01 09:56:47 +00:00
Jens Johansen e4238bea4c Fix wrong assert in InvocationMirror_unpackTypeArguments (take 2)
It was pointed out that the previous fix
(5c74e0e16f) wasn't strong mode safe
because the returned array when length = 0 was not properly typed.
This fixes the issue by removing the old fix and simply removing the
assert.

Bug: 31381
Change-Id: I6d63d3329da2711067f632adbb9be998a4d468d9
Reviewed-on: https://dart-review.googlesource.com/37741
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-02-01 07:09:38 +00:00
Jens Johansen 5c74e0e16f Fix wrong assert in InvocationMirror_unpackTypeArguments
There's an assert in InvocationMirror_unpackTypeArguments checking that
the length of the incomming TypeArguments is positive (len > 0).
That's not a valid assert.
When creating TypeArguments it will be TypeArguments::null() if it is
empty or contains only dynamic.
TypeArguments::null() will answer 0 as length which is thus perfectly
valid.

This CL fixes the wrong assert (technically it returns before the assert,
but still).

Fixes #31381.

Change-Id: I7a253418b69751b13e98fcf2def2b23b32f96142
Reviewed-on: https://dart-review.googlesource.com/37480
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-01-30 12:25:49 +00:00
Régis Crelier 25d7d355db Provide distinct BigInt implementation classes in VM, dart2js, and dartdevc.
The classes are still identical, but will diverge as the VM will provide an
optimized version.

Change-Id: I8397fd927b89fa745ac7aa4b8d98e562140f731b
Reviewed-on: https://dart-review.googlesource.com/35521
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
2018-01-29 18:12:34 +00:00
Alexander Markov fc27a2c9d4 [vm/corelib] Fix int/double comparisons in num.compareTo
* double.compareTo(int) is fixed to handle integers which are not
  precisely representable as doubles.

* int.compareTo(double) is fixed to properly handle doubles which
  are clamped when converted to integers (with Dart 2.0 fixed-size
  integers).

* Test for num.compareTo is updated for fixed-size integers; more corner
  cases added.

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

Change-Id: I8e98c3627f032082ab6a397713dece436585afd1
Reviewed-on: https://dart-review.googlesource.com/35004
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-01-22 18:22:28 +00:00
Zachary Anderson 9c40a7e662 Reland: [dart:cli] Adds waitFor(Future)
This is a reland of https://dart-review.googlesource.com/#/c/sdk/+/28920/
with the following changes:
- It creates a new library dart:cli
- waitFor(Future) goes in dart:cli instead of dart:io
- Removes a flaky test, and adds a missing precompiler entrypoint
- Adds waitFor(Future)
- Improves doc comments

fixes #31102

Change-Id: I04d2c46fd0afac049dd4fd1353905dc20da18f90
Reviewed-on: https://dart-review.googlesource.com/29449
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Natalie Weizenbaum <nweiz@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-01-18 16:38:54 +00:00
Erik Corry c8ae9bf77b [VM] Stop treating 0x180e as whitespace
This aligns us with JS engines and Unicode 6.3

R=lrn@google.com

Bug: 29060
Change-Id: I0b6356f0e652f7c9841bcf6485aa591a3d835061
Reviewed-on: https://dart-review.googlesource.com/35560
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Corry <erikcorry@google.com>
2018-01-18 10:37:15 +00:00
Alexander Markov 2e5264ddea [vm/corelib] Fix int.toRadixString() for MIN_INT64
Closes https://github.com/dart-lang/sdk/issues/31346

Change-Id: Ib925bdacf6503262a3bfb39be032a9607c0420da
Reviewed-on: https://dart-review.googlesource.com/35063
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-01-17 21:50:08 +00:00
Régis Crelier 0c2793b3db [VM runtime] Implement support for _extractTypeArguments in the VM (fixes #31805).
Update status files.

This cl includes implementing these two features on all platforms:
1) Support calling generic functions via DartEntry::InvokeFunction().
2) Support native generic functions. These are currently allowed, but type
   arguments are ignored, and therefore not accessible from the C++ side.

Change-Id: Id39e8ca46c2ba1ba3d46946c16712a8572ff64ea
Reviewed-on: https://dart-review.googlesource.com/34023
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-01-12 21:32:20 +00:00
Ryan Macnak a4f3b53fe8 Reapply "Partial static mode changes for vm-service and tests (part 3)."
Remove use of castTo, which is not yet available in the prebuilt SDK used to build Observatory.

Bug: https://github.com/dart-lang/sdk/issues/31587
Change-Id: Ia118710a2c4dca1851935d284e1a78a9c6517256
Reviewed-on: https://dart-review.googlesource.com/34022
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-01-11 01:31:17 +00:00
Jens Johansen 37c28f8661 Revert "Reapply "Partial static mode changes for vm-service and tests (part 3).""
This reverts commit c9f6e8695d.

Reason for revert: Change brakes Observatory:

```
$ out/ReleaseX64/dart --observe hello.dart
Observatory listening on http://127.0.0.1:8181/
Hello, world!
vm-service: isolate(348927110)  'hello.dart:main()' has no debugger attached and is paused at exit.  Connect to Observatory at http://127.0.0.1:8181/ to debug.
```

Going to the website I get
```
Unexpected exception:

NoSuchMethodError: method not found: 'castTo'
Receiver: ""
Arguments: [Instance of 'it']

StackTrace:

main.dart.js 2017:3     Object.f
main.dart.js 2203:30    Object.qn
main.dart.js 21316:11   b3.aQ
main.dart.js 20634:6    b3.c2
main.dart.js 20643:8    TZ.$1
main.dart.js 36992:29   UB.$0
main.dart.js 36982:9    Ux.nq
main.dart.js 36990:30   UC.$1
main.dart.js 36992:29   UB.$0
main.dart.js 36982:9    Ux.nq
===== asynchronous gap ===========================
main.dart.js 4840:12    Zh.e4
main.dart.js 3930:17    L.lK
main.dart.js 3932:28    L.ad
main.dart.js 20621:12   b3.dart.ba.lE
main.dart.js 20621:112  b3.dart.ba.lE
main.dart.js 20603:22   b3.cD
===== asynchronous gap ===========================
main.dart.js 4840:12    Zh.e4
main.dart.js 3930:17    L.lK
main.dart.js 3932:28    L.ad
main.dart.js 20621:12   ms.dart.ba.lE
main.dart.js 20621:112  ms.dart.ba.lE
main.dart.js 15829:10   Y4.bs
```

and Observatory is completely broken.

From https://github.com/dart-lang/sdk/issues/31397 it seems that Observatory uses an "old" sdk, i.e. we cannot use new stuff as castTo.

Original change's description:
> Reapply "Partial static mode changes for vm-service and tests (part 3)."
>
> Fix dynamic mode static warnings.
>
> Bug: https://github.com/dart-lang/sdk/issues/31587
> Change-Id: I966349f5409f911efacd11f08ffd469373bcd434
> Reviewed-on: https://dart-review.googlesource.com/33540
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=rmacnak@google.com,asiva@google.com

Change-Id: I775544cb5ab212cc836bc63181bdce31d19380b8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/31587
Reviewed-on: https://dart-review.googlesource.com/33800
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-01-10 12:21:53 +00:00
Ryan Macnak c9f6e8695d Reapply "Partial static mode changes for vm-service and tests (part 3)."
Fix dynamic mode static warnings.

Bug: https://github.com/dart-lang/sdk/issues/31587
Change-Id: I966349f5409f911efacd11f08ffd469373bcd434
Reviewed-on: https://dart-review.googlesource.com/33540
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-01-10 01:28:39 +00:00
Ryan Macnak e8d9d945f3 Revert "Partial static mode changes for vm-service and tests (part 3)."
This reverts commit 6ccd7b8ac2.

Reason for revert: analyzer failures

Original change's description:
> Partial static mode changes for vm-service and tests (part 3).
> 
> Bug: https://github.com/dart-lang/sdk/issues/31587
> Change-Id: I812fd4cd8e74875ce7ada9886035137af2fef73a
> Reviewed-on: https://dart-review.googlesource.com/33100
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=rmacnak@google.com,asiva@google.com

Change-Id: Ic368fc23f58e02cafbaf6ae81dbcbffc3dcced13
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/31587
Reviewed-on: https://dart-review.googlesource.com/33240
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-01-09 02:37:56 +00:00
Ryan Macnak 6ccd7b8ac2 Partial static mode changes for vm-service and tests (part 3).
Bug: https://github.com/dart-lang/sdk/issues/31587
Change-Id: I812fd4cd8e74875ce7ada9886035137af2fef73a
Reviewed-on: https://dart-review.googlesource.com/33100
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-01-09 01:40:10 +00:00
Florian Loitsch f3e845cf48 Revert "Reland: [dart:io] Adds waitForEventSync"
This reverts commit 3ea5e13ad7.

Change-Id: Ic9fae69f3b7ef6e41aac3c7ebca3e1d288dbffb1
Reviewed-on: https://dart-review.googlesource.com/29589
Reviewed-by: Florian Loitsch <floitsch@google.com>
2017-12-14 14:10:45 +00:00
Samir Jindel 56ecbbde4b [kernel] Support 64-bit integer literals correctly in Fasta.
Bug:
Change-Id: Idfb037e79d247889fe6a7d9a9b475ca4f8637080
Reviewed-on: https://dart-review.googlesource.com/27800
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-12-13 20:35:19 +00:00
Martin Kustermann cf1de7d46c [VM] Replace hand-written assembly prologues with IR
As part of the prologue changes we get rid of the empty context as well.

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

Change-Id: I707e23c631bcfbbad6c91c4963d0c10f7a0be625
Reviewed-on: https://dart-review.googlesource.com/25320
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-13 16:04:34 +00:00
Zachary Anderson 3ea5e13ad7 Reland: [dart:io] Adds waitForEventSync
The only fix needed for relanding is adding _ensureScheduleImmediate
to the list of vm entrypoints in //runtime/vm/compiler/aot/precompiler.cc

Original commit message:

Adds a top-level call waitForEventSync to dart:io that blocks the
thread an Isolate is running on until messages are available.
Before the thread blocks, the microtask queue is drained.
Before waitForEventSync returns, all messages are handled.

Lifting this up from a comment:

This is apropos of the request that nweiz@ sent to the mailing list a
couple weeks back. I'm not sure we should land this. We certainly
shouldn't land it without some annotations that will make the analyzer
complain a lot in most configurations, but I don't know what those
annotations are.

fixes #31102

Change-Id: Id96de46cc5f10e1847045cfafb7cfed6a38bce16
Reviewed-on: https://dart-review.googlesource.com/28920
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2017-12-12 23:16:50 +00:00
Zach Anderson 9d8e6453d2 Revert "[dart:io] Adds waitForEventSync"
This reverts commit 2aed87a133.

Reverting for failures on precompiled bots.

Change-Id: I758bfc72d8f5e67b0e5e12a7367a47f1df9364e2
Reviewed-on: https://dart-review.googlesource.com/28900
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2017-12-12 21:05:01 +00:00
Zachary Anderson 2aed87a133 [dart:io] Adds waitForEventSync
Adds a top-level call waitForEventSync to dart:io that blocks the
thread an Isolate is running on until messages are available.
Before the thread blocks, the microtask queue is drained.
Before waitForEventSync returns, all messages are handled.

Lifting this up from a comment:

This is apropos of the request that nweiz@ sent to the mailing list a
couple weeks back. I'm not sure we should land this. We certainly
shouldn't land it without some annotations that will make the analyzer
complain a lot in most configurations, but I don't know what those
annotations are.

Change-Id: If8286f4525994a162dd4f4563fefccb9d0984f7c
Reviewed-on: https://dart-review.googlesource.com/25281
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-12-12 19:12:58 +00:00
Bob Nystrom 650c9dcc8e Support extractTypeArguments() in 1.0 mode on the VM and dart2js.
Without strong mode, a "good enough" implementation is to simply call
the generic method with "dynamic" for the type arguments, which is what
this does. That should be enough to unblock our internal users.

We also need to not report a compile error when
dart_internal/extract_type_arguments.dart imports the hidden
"dart:_internal" library.

This patch does both of those for the VM and dart2js (using its old
front end).

Note that the test still fails because the test is more particular than
most actual user code would be -- it validates that the instantiated
type arguments are *exactly* correct, and not that the returned object
is merely subtype compatible.

Bug:
Change-Id: I0343beace4991861b29712b3fd7067ec8dc8f8ba
Reviewed-on: https://dart-review.googlesource.com/28020
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-12 19:04:18 +00:00
Paul Berry ba2417fdc0 Fix SDK errors due to inconsistent inheritance of Operator==.
The informal spec for strong mode top level inference
(https://github.com/dart-lang/sdk/pull/28218) says "If there are
multiple overridden/implemented methods, and any two of them have
non-equal types (declared or inferred) for a parameter position which
is being inferred for the overriding method, it is an error."

This CL fixes several SDK errors that arise from this rule.  For
example, the classes _Closure, Function, and Object contained members
declared as follows:

    class _Closure implements Function {
      bool operator ==(other) ...
    }
    class Function {
      bool operator ==(Object other) ...
    }
    class Object {
      bool operator ==(other) ...
    }

The type of Object's operator == was (dynamic) -> bool; the type of
Function's operator == was (Object) -> bool; therefore the type of
_Closure's operator == (which overrides both, since _Closure extends
Object and implements Function) cannot be inferred and must be
specified.

A similar situation exists for _Double and _IntegerImplementation
(both implement num, which declares operator == to have type (Object)
-> bool), and _Uri (which implements Uri, which declares operator ==
to have type (Object) -> bool).

This CL fixes the error by specifying the type explicitly in the
classes _Closure, _Double, _IntegerImplementation, and _Uri.

Change-Id: I91f7ceef8549399d438ba4be8c408493b3f338db
Reviewed-on: https://dart-review.googlesource.com/28100
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-11 13:02:19 +00:00
Bob Nystrom 03c8767f73 Here's a start at exposing an API to address https://github.com/dart-lang/sdk/issues/31371.
There is no actual implementation here yet (that's your job :) ), but there is:

- An external method in dart:_internal, extractTypeArguments().
- Empty patch methods for that for the VM, dart2js, and DDC. These need to have implementations
  filled in.
- A "dart_internal" package to expose a subset of the API. It gives you:

    extractListTypeArgument()
    extractMapTypeArguments()

  We'll bring this into Google, but not publish it externally unless we find we really need to.
- A test for the behavior. It probably has bugs since I can't run it.

See: https://github.com/dart-lang/sdk/issues/31371
Change-Id: I7d9f9a3a36f8e8be106440375c80d584898c83cb
Reviewed-on: https://dart-review.googlesource.com/26467
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2017-12-08 21:57:00 +00:00