Commit Graph

1263 Commits

Author SHA1 Message Date
Lasse R.H. Nielsen 5ae186153c Make Analyzer, VM and dart2js accept URI strings as part-of library identifier.
R=brianwilkerson@google.com, floitsch@google.com, hausner@google.com, johnniwinther@google.com, sigmund@google.com

Committed: https://github.com/dart-lang/sdk/commit/ef097edad6e5e4e82c3891ad2d8f9cde8fa8cfdc
Review-Url: https://codereview.chromium.org/2640853005 .
2017-03-13 08:31:40 +01:00
Matthias Hausner d8ddd7766b Fix debugger regression in issue 28980
When generating the implicit try-catch of an async function, use the
end token position of the function for the completeError() call. Before
this change, the position was one token past last function token.

CL https://codereview.chromium.org/2646093006/ introduced a regression.
This CL fixes #28980 and implements a different fix for #28443.

BUG=#28980
R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2740783007 .
2017-03-09 16:20:48 -08:00
Regis Crelier 09b5d6f619 Manage and capture class and function instantiators in the parser.
This is work in progress towards supporting generic function semantics.

R=hausner@google.com

Review-Url: https://codereview.chromium.org/2736733005 .
2017-03-08 08:55:30 -08:00
Dmitry Stefantsov 9c340f9eb1 Revert last 4 commits by @lrn
Reverted commits:
* ef097edad6. ("Make Analyzer, VM and
  dart2js accept URI strings as part-of library identifier.")
* e8e1857814. ("Fix bad example of URI
  part-of to be bad, not good.")
* 58f7a92ede. ("Add changelog entry for
  allowing URI in part-of.")
* a4a7d98dce. ("Use FutureOr in
  Completer.complete.")

TBR=lrn@google.com

Review-Url: https://codereview.chromium.org/2724853002 .
2017-03-01 16:44:52 +01:00
Lasse R.H. Nielsen ef097edad6 Make Analyzer, VM and dart2js accept URI strings as part-of library identifier.
R=brianwilkerson@google.com, floitsch@google.com, hausner@google.com, johnniwinther@google.com, sigmund@google.com

Review-Url: https://codereview.chromium.org/2640853005 .
2017-03-01 12:15:11 +01:00
John McCutchan 6cb83f037e Address comments from Matthias on previous CL
original CL: https://codereview.chromium.org/2692803006/

R=hausner@google.com

Review-Url: https://codereview.chromium.org/2720723006 .
2017-02-28 14:02:32 -08:00
Kevin Millikin f31b6d5e2c Reland "Track the 'awaiter return' call stack..."
Original CL: https://codereview.chromium.org/2692803006/

Original commit message:
Tracking the awaiter return call stack:

- [x] Each async function closure now knows who is awaiting on their
return. This is effectively the asynchronous equivalent of the 'frame pointer'.
- [x] Each async* function closure now knows how is listening on their
stream. This is effectively the asynchronous equivalent of the 'frame pointer'.

Detecting uncaught exceptions in async functions:

- [x] Code object keeps a map from :await_jump_var to token position
- [x] Exception Handlers keep track if they are generated (as part of compilation) or directly from user code
- [x] Debugger maps :await_jump_var to a specific try index

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2725623003 .
2017-02-28 16:13:41 +01:00
Kevin Millikin a0965a641f Revert "Track the 'awaiter return' call stack..."
Revert a pair of commits that cause failure of the Kernel continuation
transformer:

  cba7e3e79a
  4fe4f177de

R=kustermann@google.com

Review-Url: https://codereview.chromium.org/2718353002 .
2017-02-28 12:46:31 +01:00
John McCutchan cba7e3e79a Track the 'awaiter return' call stack use it to detect uncaught exceptions in async functions
Tracking the awaiter return call stack:

- [x] Each async function closure now knows who is awaiting on their
return. This is effectively the asynchronous equivalent of the 'frame pointer'.
- [x] Each async* function closure now knows how is listening on their
stream. This is effectively the asynchronous equivalent of the 'frame pointer'.

Detecting uncaught exceptions in async functions:

- [x] Code object keeps a map from :await_jump_var to token position
- [x] Exception Handlers keep track if they are generated (as part of compilation) or directly from user code
- [x] Debugger maps :await_jump_var to a specific try index

Fixes #27242

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2692803006 .
2017-02-27 14:16:15 -08:00
Florian Schneider cf5a62efc5 Print user-friendly name when parsing invalid redirecting constructor.
Addressing comments on https://codereview.chromium.org/2710363002/

R=hausner@google.com

Review-Url: https://codereview.chromium.org/2715243005 .
2017-02-27 12:20:39 -08:00
Regis Crelier 3633c5bd5e Rename Closure instance field type_arguments_ to instantiator_.
Simplify handling of closures as deferred objects.
The name "type_arguments_" is confusing, because class Closure is not generic.
Class Closure was forcefully made (kinda) generic by setting its
type_arguments_field_offset_in_words_ field to a valid value, so that the
type_arguments_ field in closure instances could be accessed similarly as in
generic instances. With generic functions, closures will potentially have more
than one instantiator and the name type_arguments_ becomes nonsensical.

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2719603002 .
2017-02-27 11:14:04 -08:00
Florian Schneider 864166a758 Fix VM crash when parsing a non-existing redirecting constructor
Fixes #28217.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2710363002 .
2017-02-24 10:26:31 -08:00
John McCutchan 97062168e4 Avoid marking functions inlinable when FLAG_causal_async_stacks is false
BUG=

Review-Url: https://codereview.chromium.org/2712003003 .
2017-02-24 06:54:50 -08:00
Regis Crelier 339d16fbc5 Only capture function instantiator when compiling local function (fixes #28757).
Note that this code has no effect yet, because generic functions are not yet
fully supported (no regression test added).

R=hausner@google.com

Review-Url: https://codereview.chromium.org/2690923004 .
2017-02-14 01:54:58 -08:00
Regis Crelier 2037e7e884 Properly resolve upper bounds of generic function's type parameters.
Various minor cleanup related to generic functions.
Add flag in preparation of future work to fully support generic methods.

R=hausner@google.com

Review-Url: https://codereview.chromium.org/2696783002 .
2017-02-14 01:50:02 -08:00
John McCutchan a0ee5b24db Track async causal stack traces
This CL improves the stack traces that accompany exceptions. Whenever an
async function is entered, we remember how we got there. This is similar
in spirit to package:stack_trace but the implementation is more efficient
and memory usage can be more easily reasoned about.

Tracking causal stack traces:

- [x] Upon entry to an async function, capture the synchronous stack trace prefix and store it into the closure.
- [x] Upon entry to an async* function, capture the synchronous stack trace prefix and store it into the closure.
- [x] Before returning from an async function, clear the Thread's asynchronous stack trace.
- [x] After resuming an async function, load the sychronous stack trace prefix into the Thread.
- [x] Filter stack traces to remove async machinery.

Service protocol changes:

- [x] Send causal async stack trace.

Observatory changes:

- [x] Display causal async stack trace below async functions.

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

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

Comparisons: https://docs.google.com/a/google.com/document/d/10r6jEqr8OCiDZ4y9SYU_uOimcHiOGAZMly2ghTErALI/edit?usp=sharing
Review-Url: https://codereview.chromium.org/2646443005 .
2017-02-09 15:39:44 -08:00
Florian Schneider 67a93da99e Handle type literals correctly with deferred loading and await.
When referring to constants via a deferred prefix in an await expression
the transformation must make sure that the generated code before and after
the deferred load agree on the number of captured variables. (i.e. the number
of await-temp variables introduced by the await-transformer is the same)

This CL uses a temporary in the case of compile-time constants, because before
the deferred load, a reference lib.C is translated into a static getter which
also requires a temporary.

Fixes #28678

R=hausner@google.com

Review-Url: https://codereview.chromium.org/2683973002 .
2017-02-08 15:37:39 -08:00
Matthias Hausner a5187ae01d Improve error message when super constructor is invalid
Instead of “unresolved call to super constructor”, adapt error
message if the super class contains a factory constructor with
the same name.

Also add this error message clarification to constructor redirection
clauses.

BUG=#11202
R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2673423003 .
2017-02-06 14:48:16 -08:00
Regis Crelier f3080b8803 Refactor type finalization in VM so that the parser only resolves type
parameters, whereas the class finalizer resolves all other type names and
performs finalization and canonicalization. This allows to remove a lot of
duplicated code between parser and class finalizer.

R=hausner@google.com

Review-Url: https://codereview.chromium.org/2673093003 .
2017-02-03 12:38:31 -08:00
Regis Crelier 1ff4a5a16b Accept instance members and locals named "Function" (fixes #28610).
Add regression test.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2673893002 .
2017-02-03 09:58:37 -08:00
John McCutchan 39729e0d9d Revert "Expand _AssertionError._evaluateAssertion in the frontend"
This reverts commit 9779ff264a.

BUG=

Review-Url: https://codereview.chromium.org/2675803002 .
2017-02-02 10:27:41 -08:00
John McCutchan 9779ff264a Expand _AssertionError._evaluateAssertion in the frontend
The call in _evaluationAssertion becomes megamorphic and this is
showing up on Flutter's profile. Avoid the call becoming megamorphic
by inlining the body at the AST level.

BUG=
R=hausner@google.com

Review-Url: https://codereview.chromium.org/2655803007 .
2017-02-02 07:34:34 -08:00
Florian Schneider 7ac05a4e02 Fix background compiler issue with new-space allocation in the parser.
Field::GetterName would allocate in new-space which is not allowed
during background compilation.

Fixes #26316.

R=hausner@google.com

Review-Url: https://codereview.chromium.org/2665003002 .
2017-01-31 17:21:03 -08:00
Regis Crelier 97f968de1c Implement generic function type syntax in the VM (fixes #27966).
The new function type syntax is allowed everywhere and not just in typedef.

R=hausner@google.com

Review-Url: https://codereview.chromium.org/2643523002 .
2017-01-27 08:45:03 -08:00
Regis Crelier 23d57d28df Set correct type for enum values list (fixes #28341).
Add regression test.
Update status file.

R=hausner@google.com

Review-Url: https://codereview.chromium.org/2651813006 .
2017-01-24 15:07:01 -08:00
Regis Crelier 97c42acc30 Support FutureOr<T> in the VM (fixes #28010).
R=asiva@google.com, rmacnak@google.com

Review-Url: https://codereview.chromium.org/2642443002 .
2017-01-17 10:27:21 -08:00
Matthias Hausner 90b937a4ce Support covariant keyword in the VM parser
For Dart 1.5, the VM ignores the annotation. It is just consumed by the parser, but has otherwise no effect. Errors are reported on illegal covariant declarations.

BUG=#28166
R=regis@google.com

Review-Url: https://codereview.chromium.org/2625823004 .
2017-01-12 14:03:26 -08:00
Ryan Macnak 2ec03cba70 Fix leak of message snapshot buffer when attempting to send an illegal object.
Fix leak with FLAG_enable_debug_break.

R=asiva@google.com, fschneider@google.com

Review-Url: https://codereview.chromium.org/2629533002 .
2017-01-11 16:50:04 -08:00
Florian Schneider 9c82d88d67 VM: Fix bug in deferred loading.
In some cases when loading a deferred library twice, the VM would crash/throw.

Make sure we generate the correct static NoSuchMethod error when referring to
a deferred library that is not loaded yet.

Fixes #28278.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2618823002 .
2017-01-05 18:20:51 -08:00
Siva Annamalai c69cbb586f - report tear offs using the x#y syntax as a compilation error
(fixes issue 27520)
- adjust status files to reflect all tests which have the x#y syntax as
  compile time errors.

BUG=27520
R=regis@google.com

Review-Url: https://codereview.chromium.org/2607173002 .
2016-12-29 13:01:12 -08:00
Regis Crelier 3334c2402a Second try: Fix resolution and canonicalization of typedefs and function types
in preparation of the new typedef syntax.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2606993002 .
2016-12-28 14:53:23 -08:00
Regis Crelier 4980107a96 Revert "Fix resolution and canonicalization of typedefs and function types..."
Review-Url: https://codereview.chromium.org/2600313002 .
2016-12-27 17:54:00 -08:00
Regis Crelier 291ed0c545 Fix resolution and canonicalization of typedefs and function types in
preparation of the new typedef syntax.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2592263004 .
2016-12-27 16:55:21 -08:00
Regis Crelier 889b003952 Introduce a SignatureData class so that signature functions can store both their
parent function and their signature type. This is required to implement the
new function type syntax.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2591823002 .
2016-12-20 18:01:45 -08:00
Matthias Hausner ef40b32e85 Remove --assert-message VM flag
Enable support for messages in assert statements. Remove the
VM flag.

BUG=#28136

Review-Url: https://codereview.chromium.org/2586363003 .
2016-12-19 15:23:12 -08:00
Kevin Millikin f7b6f0cf1c Make the VM's dart:core and dart:async library patches clean.
Clean up the VM's dart:core and dart:async library patches so that
they are clean according to the patching rules implemented in the
analyzer.  Specifically:

  - If a member is patched in a patch file, it must be declared external
    in the SDK.

  - If a member is introduced in a patch file, it must be private.

  - A non-private superclass member cannot be overridden in a patch
    file.

BUG=
R=lrn@google.com, sigmund@google.com

Review-Url: https://codereview.chromium.org/2563633002 .
2016-12-15 10:10:09 +01:00
Matthias Hausner 2c0b605a96 Add optional message argument to assert statements in the VM.
Add flag --assert-message to control the feature.

BUG=#24215
R=regis@google.com

Review-Url: https://codereview.chromium.org/2574003003 .
2016-12-14 11:05:19 -08:00
John McCutchan f125cc7d0b Improve the casing of Stackmap and Stacktrace.
- [x] Stackmap -> StackMap
- [x] Stacktrace -> StackTrace

This makes us consistent with the Dart language (StackTrace) and
corrects the casing of StackMap.

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2572563004 .
2016-12-12 14:51:30 -08:00
Matthias Hausner 156fdef01d Revert "Add optional message argument to assert statements in the VM."
This reverts commit 67e83dd79d.

BUG=

Review-Url: https://codereview.chromium.org/2558993005 .
2016-12-09 09:50:27 -08:00
Matthias Hausner 67e83dd79d Add optional message argument to assert statements in the VM.
Add flag --assert-message to control the feature.

Fixes issue #24215
BUG= http://dartbug.com/24215

This replaces Lasse’s CL  1307363005

patch from issue 1307363005 at patchset 140001 (http://crrev.com/1307363005#ps140001)

R=lrn@google.com

Review-Url: https://codereview.chromium.org/2564623003 .
2016-12-09 09:25:58 -08:00
Regis Crelier 6da1083953 Disallow deprecated typedef syntax for mixin apps in the VM (fixes #14410).
Update status files (will reassign issue #14410 to dart2js, since it still
accepts the syntax).

R=floitsch@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/2556433004 .
2016-12-07 07:34:09 -08:00
Regis Crelier ab6bc6dbfd Fix delayed resolution of function result types (fixes #27760).
Resolution is delayed to properly handle generic results of generic functions.
Resolution has to be done in the library declaring the function and not in the
library declaring a mixin application mixing in the function.

R=hausner@google.com

Review URL: https://codereview.chromium.org/2549443005 .
2016-12-02 15:22:01 -08:00
Matthias Hausner b48435197a Turn on initializing formal access
Change default value of --initializing_formal_access to true.

BUG=27892
R=regis@google.com

Review URL: https://codereview.chromium.org/2540453002 .
2016-11-28 13:15:15 -08:00
Kevin Millikin c0bfda8a08 Remove an unnecessary (empty) scope, streamline the function parsing code.
The scope containing function expressions is always empty.

R=hausner@google.com

Review URL: https://codereview.chromium.org/2013233003 .
2016-11-25 10:24:17 +01:00
Regis Crelier 640b5ca80a Enable syntax-only generic methods in the VM by default.
R=hausner@google.com

Review URL: https://codereview.chromium.org/2486943003 .
2016-11-21 12:33:40 -08:00
Vyacheslav Egorov 23fd1a184b VM: Support bootstrapping core libraries from Kernel binaries instead of source.
BUG=http://dartbug.com/27590
R=asiva@google.com

Review URL: https://codereview.chromium.org/2485993002 .
2016-11-16 13:56:20 +01:00
John McCutchan f0f32a0e29 Map deleted enum values to a sentinel value.
Fixes #27802

BUG=
R=asiva@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/2498863002 .
2016-11-15 14:15:36 -08:00
Siva Annamalai e25cdc78e4 Changes for https://github.com/dart-lang/sdk/issues/27742 mark tear-offs using the x#id syntax as deprecated.
BUG=#27742
R=hausner@google.com

Review URL: https://codereview.chromium.org/2491983003 .
2016-11-11 12:09:01 -08:00
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
Zachary Anderson e29da6037b Small cleanups and linter fixes.
Review URL: https://codereview.chromium.org/2455983002 .
2016-10-27 05:02:20 -07:00