Commit Graph

815 Commits

Author SHA1 Message Date
Nate Bosch aa246f6588 Add return types on all main declarations
Reduces the noise when disallowing implicit dynamic.

Change-Id: I98b03cb675ecd4b9e7f4135efa274fb57eb87832
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104164
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2019-06-11 00:19:00 +00:00
Sigmund Cherem fddecf659c Do not hide problems in kernel_sdk.dart
This addresses the most concerning problem in #37117

Change-Id: I38feb310023b066922a8049c5026a49572c3e399
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105461
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2019-06-07 22:51:49 +00:00
Vijay Menon 3b5a187726 [dartdevc] move ddc internal libraries under sdk
Note, this has the effect of including all DDC Dart sources with the
shipped SDK: we ship everything under sdk/lib.

This should enable https://github.com/dart-lang/build/issues/2262

Change-Id: If66bc7c620034e7f2acf7d2c3e9524a408417681
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104383
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-06-04 13:47:29 +00:00
Nate Bosch 0241e40c15 Track Library URI for classes
Closes #36771

- Add getLibraryUri and setLibraryUri runtime utility.
- When emitting classes add a statement to set the library URI.

Change-Id: I8974c7fdd4d9986f27a35f116d9881af043c0c9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104641
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2019-06-03 21:47:17 +00:00
Vijay Menon 69063ab552 [dartdevc] automatically find d8 in ddb
Also remove stale files

Change-Id: Ie3004a3c7f30148459caa1a4b08d909c08484eca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104420
Commit-Queue: Vijay Menon <vsm@google.com>
Auto-Submit: Vijay Menon <vsm@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2019-06-03 20:02:46 +00:00
Vijay Menon dd5530a73e [dartdevc] make ImmutableSet private
Patch files should not add public members to the underlying library.

Siggi was hitting this when wiring up modular testing for DDC:
https://dart-review.googlesource.com/c/sdk/+/103680/3/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart#544

The ddk builder appears to have be swallowing this error - not yet sure why.

Change-Id: I86098b25a344b2bb8b69fe3dc386d01f6f7cb309
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103740
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2019-05-29 20:04:24 +00:00
Nicholas Shahan 694699c6e4 [dartdevc] Improve NSM errors when making dynamic calls
Add specific error text for the dynamic call failure cases:
* Calling null.
* Calling an object instance with a null `call()` method.
* Passing too few or too many arguments.
* Passing incorrect named arguments.
* Passing too few or too many type arguments.
* Passing type arguments to a non-generic method.

This does not address the issue of a missing name. The errors still just
reference 'call'. Tagging a name could be added in a future change.

Issue: #36165
Change-Id: I21592ef506908559da0bfe9aac5ed5bae7fcb84e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103645
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-05-29 16:57:30 +00:00
Vijay Menon 47e63b0eee [dartdevc] encode part file metadata
Fixes https://github.com/dart-lang/sdk/issues/37074

Hand-tested on flutter gallery.  E.g.,:
> dart.getParts('package:flutter_web_ui/ui.dart')
(15) ["src/ui/canvas.dart", "src/ui/compositing.dart", "src/ui/debug_canvas_reuse_overlay.dart", "src/ui/geometry.dart", "src/ui/hash_codes.dart", "src/ui/initialization.dart", "src/ui/lerp.dart", "src/ui/natives.dart", "src/ui/painting.dart", "src/ui/pointer.dart", "src/ui/semantics.dart", "src/ui/browser_location.dart", "src/ui/text.dart", "src/ui/tile_mode.dart", "src/ui/window.dart"]

Change-Id: Ied734d9f3739886d6679a9a9bbeae854e432bc52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103602
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2019-05-29 14:48:40 +00:00
Vijay Menon 834587a78c [dartdevc] fix import/export declarations for es6 to add extension
d8 assumes a '.js' extension - e.g.,:
```
import { core, dart, dartx } from 'dart_sdk.js';
```

Note: this will enable Siggi's modular compilation framework to run DDC tests on d8.

Change-Id: I1167a36e1454950149fecb8abc793728a16e4591
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103780
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2019-05-28 18:48:55 +00:00
Nicholas Shahan d06592b532 [dartdevc] Add details to failed assertion messages
* Source file location
* Assertion source code

This change embeds the information as strings into the compiled source. In the
future we could reconstruct the source file location at runtime from the stack
trace.

In tests with various large applications this added roughly 1MB (0.1MB
compressed) or less to the compiled file size.

Fixes: #36995
Change-Id: I2634f7eab6e54eec209094b52429987dd62c0828
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103568
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-05-28 18:03:38 +00:00
Régis Crelier 735669190e [corelib BigInt] Fix implementation of BigInt.modInverse (fixes issue #37008).
A negative result was wrongly returned as a positive value.
Since positive values are preferred, the implementation now adds the modulus
enough times to make the result positive.

Change-Id: I87a2ceb359345846740a749ab6b46b1d45e7ba21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103664
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-05-25 22:05:51 +00:00
Robert Nystrom 70bd05e662 Stop ignoring runtime cast failures on function types.
Change-Id: Id3485e04aafea988604663e893818672d98dc8b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103662
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2019-05-24 23:52:08 +00:00
Nate Bosch 2bbb2f3c1f Disallow implicit casts
Explicit casts make it easier to confidently navigate the code base and
apply refactorings which tighten types. This change exposes a number of
places where types can be tightened, but only the most trivial were
applied. For most places I added the explicit cast that would have
happened anyway and so behavior shouldn't be changing.

- Add the configuration which disallows implicit casts in the analyzer.
- Add explicit casts in almost all instances.
- Where the implicit cast was due to a local variable type on the left,
  change it to a `var` so the type is not repeated.
- In a few places add argument types where they were already applied on
  the parent type, and the subclass was unnecessarily loosening argument
  types to dynamic.
- In a few places where a method was defined with an implicit dynamic
  return but had an obvious and consistent return type, annotate the
  method instead of casting after calls to that method.

Change-Id: I90e11b1cc08ce69967ea5705b507d5758a8f668f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103381
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2019-05-22 00:33:39 +00:00
Jacob Richman e2976acd22 Add --track-widget-creation flag to frontend_server.
This is needed to activate the kernel transformer embedded with the kernel package from the flutter engine.

Change-Id: I3253e01723b662eb48b4b3743ac5bcc1b44c7d46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102920
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Jacob Richman <jacobr@google.com>
2019-05-20 22:47:28 +00:00
Nicholas Shahan 2fd1021326 [dartdevc] Turn on lints and cleanup violations
Working towards turning on all lints from package:pedantic. This change includes
the lints that needed cleanup and don't change any behavior.

Applied cleanup:
* Don't explicitly initialize variables to null.
* DO use curly braces for all flow control structures.
* Use `.isEmpty` instead of `.length == 0`.
* Use `.isNotEmpty` instead of `.length > 0` or `! .isEmpty`.
* Use `=` to separate a named parameter from its default value.

The remaining lints from package:pedantic will require cleanup that is less
automatic and will be addressed in later changes.

Change-Id: Ie4c3ba685f8a559209dd14ac037203ecd16252c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103086
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-05-20 20:20:47 +00:00
Nate Bosch 9adc5be551 Dartfmt all of DDC with the latest
Some changes in indentation for adjacent string literals and a case of
formatting inside string interpolation.

Change-Id: I30eb9b9e891a11a54f89351e0f2d4c0172e69066
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103161
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2019-05-20 19:14:37 +00:00
Nate Bosch 04e329b6ed Add override annotations across DDC
Previously 36% of overrides were annotated, including inconsistent
annotations within a single class.

- Add annotations on remaining overridden methods.
- Add linter section to `analysis_options.yaml` so that missing
  annotations are visible while editing.

Change-Id: Ief1a6d5b8da6f4b630a6cfc72a6ed67db346c081
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103140
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2019-05-20 17:31:26 +00:00
Vijay Menon 140822aebd [dartdevc] Allow multiple summaries and experiments in ddb tool
This allows us to test modular compiles from the cli:

> ddb -k foo.dart
> ddb -k -s foo.dill bar.dart

Change-Id: Ib88e7ff1291a7db5ecd1774b9e594121a303f2d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102002
Auto-Submit: Vijay Menon <vsm@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2019-05-11 22:23:57 +00:00
Nate Bosch d2ddf644fa Ignore deprecated analyzer import warnings
Gives a clean analyzer output for this directory.

Change-Id: Ieac655d76e1d3791c808ea809a669c7d86ff613f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102204
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2019-05-10 20:05:48 +00:00
Nicholas Shahan a31594b9af [dartdevc] Cleanup ddb script
* Fix possible race condition when flushing `stdout` and `stderr`.
* Add help option and usage text (saves me from digging into the file when I
  forget a flag).
* Avoid passing `enable-experiment` with an empty string.

Change-Id: Iea288a1fad43f16c494510302efbcc65a2d91502
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101744
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-05-08 17:08:55 +00:00
Nicholas Shahan e0e5c85f48 [dartdevc] Always print errors when running ddb script
This ensures that errors are printed to the console when running in node and the
main method is async. Previously errors were being swallowed because node exits
with exit code zero in this circumstance.

Other minor cleanup to remove unused variables, imports, and flags.

Change-Id: I1dac156bbe7aa204a6034cb56ef8e9353568d400
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101340
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-05-03 22:24:18 +00:00
Vijay Menon 8866165950 [dartdevc] Reify bottom as Null
Fixes https://github.com/dart-lang/sdk/issues/36832

Change-Id: Ie0869ca350d1951e0736a9d6c92da4a7984117ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101180
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2019-05-03 13:39:43 +00:00
Graciliano Monteiro Passos d543d2e812 Check window.MediaSource before call constructor
MediaSource is an experimental technology. Not compatible with iOS Safary, even with current last iOS version (v12 April 2019).

This JS  function (polyfill) crashes web compiled Dart load on iOS.

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

GitOrigin-RevId: c18de2cc60e0c06c566e3f2f552d6543a45011fa
Change-Id: Ic36d2cb257ecccf1b94b026f40a949a74409c371
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99980
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2019-04-30 20:02:02 +00:00
Stevie Strickland 4028fec3b5 Reland "[vm] Finish adding support for ECMAScript 2018 features."
This work pulls in v8 support for these features with
appropriate changes for Dart and closes
https://github.com/dart-lang/sdk/issues/34935.

This adds support for the following features:

* Interpreting patterns as Unicode patterns instead of
  BMP patterns
* the dotAll flag (`/s`) for changing the behavior
  of '.' to also match line terminators
* Escapes for character classes described by Unicode
  property groups (e.g., \p{Greek} to match all Greek
  characters, or \P{Greek} for all non-Greek characters).

The following TC39 proposals describe some of the added features:

* https://github.com/tc39/proposal-regexp-dotall-flag
* https://github.com/tc39/proposal-regexp-unicode-property-escapes

These additional changes are included:

* Extends named capture group names to include the full
  range of identifier characters supported by ECMAScript,
  not just ASCII.
* Changing the RegExp interface to return RegExpMatch
  objects, not Match objects, so that downcasting is
  not necessary to use named capture groups from Dart

**Note**: The changes to the RegExp interface are a
breaking change for implementers of the RegExp interface.
Current users of the RegExp interface (i.e., code using Dart
RegExp objects) will not be affected.

Change-Id: Ie62e6082a0e2fedc1680ef2576ce0c6db80fc19a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100641
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Stevie Strickland <sstrickl@google.com>
2019-04-29 09:11:48 +00:00
Keerti Parthasarathy 9238e25305 Revert "[vm] Finish adding support for ECMAScript 2018 features."
This reverts commit 5ebb640a67.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> [vm] Finish adding support for ECMAScript 2018 features.
> 
> This work pulls in v8 support for these features with
> appropriate changes for Dart and closes
> https://github.com/dart-lang/sdk/issues/34935.
> 
> This adds support for the following features:
> 
> * Interpreting patterns as Unicode patterns instead of
>   BMP patterns
> * the dotAll flag (`/s`) for changing the behavior
>   of '.' to also match line terminators
> * Escapes for character classes described by Unicode
>   property groups (e.g., \p{Greek} to match all Greek
>   characters, or \P{Greek} for all non-Greek characters).
> 
> The following TC39 proposals describe some of the added features:
> 
> * https://github.com/tc39/proposal-regexp-dotall-flag
> * https://github.com/tc39/proposal-regexp-unicode-property-escapes
> 
> These additional changes are included:
> 
> * Extends named capture group names to include the full
>   range of identifier characters supported by ECMAScript,
>   not just ASCII.
> * Changing the RegExp interface to return RegExpMatch
>   objects, not Match objects, so that downcasting is
>   not necessary to use named capture groups from Dart
> 
> **Note**: The changes to the RegExp interface are a
> breaking change for implementers of the RegExp interface.
> Current users of the RegExp interface (i.e., code using Dart
> RegExp objects) will not be affected.
> 
> Change-Id: I0709ed0a8d5db36680e32bbad585594857b9ace4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95651
> Commit-Queue: Stevie Strickland <sstrickl@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=lrn@google.com,kustermann@google.com,jmesserly@google.com,johnniwinther@google.com,sstrickl@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I1eda0fee4fd9e94df095944049833a67b07277e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100560
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2019-04-25 14:29:51 +00:00
Alan Knight f3bd910e10 Only use MapFormatter for SDK maps (HashMap and LinkedHashMap)
For classes that implement Map, using MapFormatter can result in many,
many custom format operations. Also, the presentation is not that
useful. We get e.g. a list of indices that then have a name and value
beside them, so it just duplicates the Object view, but with extra
non-useful data.

Change-Id: I74ed34521778bddae9cdad975339925d7c181bf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100282
Commit-Queue: Alan Knight <alanknight@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
2019-04-24 22:08:45 +00:00
Stevie Strickland 5ebb640a67 [vm] Finish adding support for ECMAScript 2018 features.
This work pulls in v8 support for these features with
appropriate changes for Dart and closes
https://github.com/dart-lang/sdk/issues/34935.

This adds support for the following features:

* Interpreting patterns as Unicode patterns instead of
  BMP patterns
* the dotAll flag (`/s`) for changing the behavior
  of '.' to also match line terminators
* Escapes for character classes described by Unicode
  property groups (e.g., \p{Greek} to match all Greek
  characters, or \P{Greek} for all non-Greek characters).

The following TC39 proposals describe some of the added features:

* https://github.com/tc39/proposal-regexp-dotall-flag
* https://github.com/tc39/proposal-regexp-unicode-property-escapes

These additional changes are included:

* Extends named capture group names to include the full
  range of identifier characters supported by ECMAScript,
  not just ASCII.
* Changing the RegExp interface to return RegExpMatch
  objects, not Match objects, so that downcasting is
  not necessary to use named capture groups from Dart

**Note**: The changes to the RegExp interface are a
breaking change for implementers of the RegExp interface.
Current users of the RegExp interface (i.e., code using Dart
RegExp objects) will not be affected.

Change-Id: I0709ed0a8d5db36680e32bbad585594857b9ace4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95651
Commit-Queue: Stevie Strickland <sstrickl@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-04-24 09:24:16 +00:00
Jenny Messerly 0136d96a96 [dartdevc] fix #36532, adds DDC support for CFE constant flag
This fixes DDC to work when CFE's constants flag is enabled.
The fixes are primarily due to how CFE inlines constants, and how it
handles "unevaluated constants" (these arise from modular compilation
and outline kernel files).

Specifically this CL addresses the following issues:

- private names now work across modules (landed in this CL:
  https://dart-review.googlesource.com/c/sdk/+/98926)
- correctly emit tearoffs regardless of how they're represeted
  (constant or StaticGet)
- correctly recognize the internal SDK and JS interop annotations,
  regardless of how they're represented (constants or expressions)
- change how DDC represents `undefined` in its internal SDK, so
  its detected regardless of constant inlining
- emit numeric constants as integers in JS when possible


Change-Id: I0fbda9d24578075f655ea945ed1b2ceed124af48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99240
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2019-04-12 01:47:57 +00:00
Vijay Menon 8f3608ca25 Enable ddb to run with experiments
Change-Id: I545fd124c212cf3e69c306609c0cff25c7c44216
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98782
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2019-04-08 20:43:29 +00:00
Ben Konyi ac2c934563 Reland "[ VM / dart:isolate ] Added ability to set names for spawned isolates."
This reverts commit 638f13ff3d.

Change-Id: Ib5015539b1c93791c2469be6995789f8f0362806
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97845
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-03-28 16:39:50 +00:00
Jenny Messerly dfae23d205 [dartdevc] fix #36293, call nSM on callable objects if the lookup fails
Given `obj.foo(1, 2, 3)`, if `obj.foo` succeeds but `call()` on the
resulting object fails, DDC should call `noSuchMethod()` on the result
of `obj.foo`, not on `obj`. This CL also adds a few more test cases that
DDC was failing on.

Change-Id: I76c3cc73e4cc81791f961c6b2a55cbfea7a5240b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97701
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2019-03-22 22:55:11 +00:00
Jenny Messerly 65b92e9579 [dartdevc] fix #36253, kernel backend now emits trackLibraries call
Also fixes DDC's Kernel backend to emit source maps. There's also
some refactoring to move shared code to the shared_compiler, to unblock
hot reload implementation work and other fixes (such as exporting
private names from the module).

Change-Id: I872e221d9f266198fcc220900146c1c9c5503acb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97553
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2019-03-22 22:41:01 +00:00
Kevin Moore a447b36280 convert: remove private typedefs
Change-Id: Ie97da6a9347b6c3a96ae5854c8b7d6ba1be0dba8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97354
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
2019-03-22 14:27:25 +00:00
Jenny Messerly cb4b6157a2 fix #36205, static calls in dart:html should directly call the DOM
It looks like this code was implemented in the wrong place. At some
point reading the code (possibly during Kernel backend port), I noticed
this and left a TODO. This CL implements the solution described in it.

Change-Id: Iff837d471c87ec2fdb8f1a9a4afdb025af1a726f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97262
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2019-03-20 23:38:46 +00:00
Stevie Strickland af5fc2d4d2 [VM] Partial support for named regexp captures.
See https://github.com/tc39/proposal-regexp-named-groups
for a high-level description of the feature and examples.  This is one of the
features requested in https://github.com/dart-lang/sdk/issues/34935.

This is a partial implementation because while there is a way to retrieve
groups via Dart by name, it requires casting the returned Match to the
new RegExpMatch interface to avoid changing the RegExp interface.
Changing the RegExp interface will happen in a future update, since there
are other planned changes to the RegExp interface coming soon and that way
we only change it once. See https://github.com/dart-lang/sdk/issues/36171
for more details on the planned changes.

Also, since only BMP regular expressions are supported, not full
Unicode ones (i.e., those with the /u flag in ECMAscript), \k<NAME>
will only be parsed as a named back reference if there are named
captures in the string. Otherwise, the \k will be parsed as the identity
escape for backwards compatibility. The new tests illustrate this
difference.

Change-Id: Ieeb0374813db78924c9aa8ac3e652dfb6d4a5934
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95461
Commit-Queue: Stevie Strickland <sstrickl@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-03-19 10:40:15 +00:00
Stephen Adams 7a90563ee3 [js_runtime] Try to avoid String.prototype.replace with replacement patterns
Change-Id: I4b063fe77592bbb0ad9f6ffb628c3bdd6323b20c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96220
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-03-15 21:51:15 +00:00
Stephen Adams 9b185051a9 Don't use lazy static initializer in Random.secure()
The lazy static initializer returns null after throwing on the first use.

Change-Id: I44fbb6f8af263dc5c813ed5dff2291fb27e48b4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96984
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-03-15 17:45:06 +00:00
Daco Harkes 638f13ff3d Revert "[ VM / dart:isolate ] Added ability to set names for spawned isolates."
This reverts commit 59525264e8.

Reason for revert: causes Flutter test observatory and protocol to deadlock.
Issue: https://github.com/dart-lang/sdk/issues/36232

Original change's description:
> [ VM / dart:isolate ] Added ability to set names for spawned isolates.
> 
> Fixes issue #34059
> 
> Change-Id: I315498b02edc184e9e408c93eddb78aa1a5a8a1d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/90341
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I5f2115a2ac394a8d4c7c175bc97f2b88b65fcb49
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97107
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2019-03-15 14:40:37 +00:00
Ben Konyi 59525264e8 [ VM / dart:isolate ] Added ability to set names for spawned isolates.
Fixes issue #34059

Change-Id: I315498b02edc184e9e408c93eddb78aa1a5a8a1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/90341
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-14 22:23:09 +00:00
Lasse R.H. Nielsen 2e9ff26527 Fix overflow bug in BigInt implementations.
Fixes #36105

Bug: http://dartbug.com/36105
Change-Id: I9adf70d11474f844d2a4fbf5fcc3754562b1cf65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95644
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2019-03-08 16:11:08 +00:00
Jenny Messerly 5a8bdc7f34 [dartdevc] fix #36052, missing key in map should result in null
Change-Id: Ic32fb8689fd2163e162b80ad4682e9b10ba4eaee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94920
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Auto-Submit: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2019-03-05 01:15:30 +00:00
Vijay Menon fa2d32e80a [ddc] Add api to query loaded libs
Change-Id: Ib82292081b1e7c1b08af9b57f8c8a0aef16cd0d8
Reviewed-on: https://dart-review.googlesource.com/c/94990
Auto-Submit: Vijay Menon <vsm@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2019-03-02 00:16:41 +00:00
Jenny Messerly 76d31a251e [dartdevc] fix hot restart static field reset
Fields are not currently getting reset after the 2nd time, unless the
module is reloaded. This moves the tracking to initialized fields,
rather than defined fields, which is more difficult to clear.

Change-Id: Ie25c151d16872fd330798aa3b7fb7ab0d8d14fc1
Reviewed-on: https://dart-review.googlesource.com/c/95060
Auto-Submit: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2019-03-01 23:56:01 +00:00
Régis Crelier c2a48ee065 [VM] Fix bigint left shift that could cause heap corruption when intrinsified.
The size of the result digit array was not computed correctly.
When 64-bit intrinsics are used, one extra digit pair must be allocated.

Change-Id: Id3ca3a16ef24b598e44bf25221d400b9be71248a
Reviewed-on: https://dart-review.googlesource.com/c/94683
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-03-01 18:59:10 +00:00
Alan Knight 19dbd70363 Catch errors in formatting function types
Change-Id: Ifa889ab486da4b86a2738857bf2c6d8a8ed0cfe4
Reviewed-on: https://dart-review.googlesource.com/c/93125
Commit-Queue: Alan Knight <alanknight@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
2019-03-01 00:47:59 +00:00
Lasse R.H. Nielsen 7c70ab1817 Revert change that empirically doesn't improve code for dart2js stopwatch.
Change-Id: Ib7a29c51c9d503c251fb28be4edc0becdc0a68c2
Reviewed-on: https://dart-review.googlesource.com/c/94745
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2019-02-28 14:12:26 +00:00
Vijay Menon 3b8591d13e [ddc] Initial impl for invoking service extension
Change-Id: Ibdd61eb390c2b62641318ca60fb76b43a4a3cb27
Reviewed-on: https://dart-review.googlesource.com/c/94660
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
2019-02-28 00:53:42 +00:00
Lasse R.H. Nielsen 40bab34fbd Fix Stopwatch timers to not overflow on intermediate computations.
With a nanosecond tick counter, the elapsedMicroseconds getter
could overflow if a stopwatch runs for only ~2.5 hours.

Change-Id: I10cb54bba928713a3127a6bfbd19346b01d775b0
Reviewed-on: https://dart-review.googlesource.com/c/94381
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-02-27 09:56:12 +00:00
Mark Zhou 2d58ea3b42 [dartdevc] fix #35554, throw NullThrownError when null is thrown
Change-Id: Ib792b8c30b8ddb91da07a3f16fb4450379139d95
Reviewed-on: https://dart-review.googlesource.com/c/94321
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Auto-Submit: Mark Zhou <markzipan@google.com>
2019-02-26 23:02:25 +00:00
Jenny Messerly 627e96c9c1 [dartdevc] simplify microtask scheduling using JS Promise
All of DDC's supported platforms have Promises, so we can use them
instead of MutationObservers (web) and timers (node.js).

See issue #20055 (same issue, but for dart2js).

Change-Id: Id635a4a9fa104a2ab19dd20824d209f682f831f9
Reviewed-on: https://dart-review.googlesource.com/c/91765
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2019-02-21 20:13:19 +00:00