Commit Graph

1278 Commits

Author SHA1 Message Date
Siva Chandra 3b9cf7351b Allow setting breakpoints in literal function initializers of fields.
Fixes #29581 when the VM parser is used.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2904793002 .
2017-05-26 13:43:34 -07:00
Régis Crelier 9aafded095 Pass type argument vector to generic functions (if --reify-generic-functions is
true, still false per default).
Work in progress, not functional yet (passed vector is still ignored in callee).

R=vegorov@google.com, zra@google.com

Review-Url: https://codereview.chromium.org/2859673002 .
2017-05-18 14:03:47 -07:00
Régis Crelier e4ff8df6e6 Properly handle implicit closure function when a generic function.
The parent function of an implicit closure function is not the enclosing
function, but the function being closurised. This requires special handling in a
few places.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2835363002 .
2017-04-25 13:35:20 -07:00
Régis Crelier 1b68c0d0a1 Process generic function type arguments in more places (function type tests,
function cloning for mixins, signature building, etc...).
Rename --generic-method-semantics flag to --reify-generic-functions (still not
working and disabled by default).

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2835513002 .
2017-04-20 14:20:18 -07:00
Ryan Macnak b15cf1c490 Fix VM crash when encountering an assignment expression in a case expression.
Fixes #29370
Issue #29379

R=regis@google.com

Review-Url: https://codereview.chromium.org/2825843003 .
2017-04-18 13:48:06 -07:00
Régis Crelier fd5089c9e8 Remove parent_level field of function type parameters.
Add function_type_arguments field in closure instances.
Lots of other smaller changes, also related to generic function semantics.
This is still work in progress, with a change of direction in the design:
The type argument vector of a generic function will be prepended with the type
arguments of enclosing generic functions. The re-allocation and concatenation
will be done in nested generic function's prolog. This will greatly simplify
instantiation of types at run time without having to search the context for
parent function's type arguments. However, a closure instance now requires an
additional field. On the other hand, type parameters do not require a
parent_level field anymore.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2818273002 .
2017-04-17 08:58:24 -07:00
Regis Crelier 25dbc9b28a Fix look-ahead parsing code in the VM (fixes #29243).
Add regression test.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2812323002 .
2017-04-12 11:04:21 -07:00
Regis Crelier 659511d518 Fix type parameter invocation in the VM (fixes #19725).
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2814833003 .
2017-04-11 13:31:30 -07:00
Regis Crelier d0a7bad121 Pass a second type argument vector to all type instantiation calls in the VM.
With generic methods, uninstantiated types will require 2 instantiators, one
reflecting the class type arguments (as of today) and one reflecting the
function type arguments (new).
This is work in progress and the second instantiator is always null for now.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2799373002 .
2017-04-10 21:25:33 -07:00
Florian Schneider 5a3f9d9398 Fix a couple of bugs with async stack traces
Related to #29145.

Fixes #29199.

1. Missing source positions in async and async* functions (synthetic code)

2. Added unit tests for issues #28980 and added asyns stack trace testing flags to existing test.

3. Handle uninitialized Completer object when collecting async stack traces.

Still missing is the correct calculation of context levels in ActivationFrame::ContextLevel. This is planned for a separate CL.

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2786503003 .
2017-03-30 11:02:33 -07:00
John McCutchan 07a257573d Debugger support for step-into async and async* functions.
- [x] Support stepping into an async function.
- [x] Support stepping into the async generator in an await for loop.
- [x] Unit test for async function.
- [x] Unit test for async* function.

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

Review-Url: https://codereview.chromium.org/2768103002 .
2017-03-24 07:56:50 -07:00
Regis Crelier 3b33596ab0 Remove outdated special handling of 'void' when parsing class members.
This caused parsing of 'void Function() field;' to fail.
No regression test was added since lots of them are about to land with this cl:
https://codereview.chromium.org/2707033004

R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2774713002 .
2017-03-23 10:49:14 -07:00
Regis Crelier bde22d2dee Cleanup change.
AssertAssignableInstr::Canonicalize was too restrictive: it can instantiate the
type even if the instantiator is null.
Do not allocate empty TypeArguments handles, but use the common one instead.

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2759393005 .
2017-03-21 13:55:39 -07:00
Regis Crelier 9c9a14a29a Add Genericity enum in VM to distinguish how a type is uninstantiated.
Make flow graph builder aware of function type arguments.
This is work in progress toward supporting generic method semantics in the VM.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2761933002 .
2017-03-21 10:20:05 -07:00
Regis Crelier 063dd6d03f Make sure the signature of the call method is finalized before involving it
in bound checkings of its owner class (fixes #29025).
Add regression test and mark as failing for the analyzer (issue filed).
Add missing trail argument in 2 locations (not related to the fixed issue).
Cleanup: Remove ClassFinalizer::kCanonicalizeWellFormed which is not treated
differently than ClassFinalizer::kCanonicalize anymore after earlier changes in
the spec on how to handle malformed types.

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

Review-Url: https://codereview.chromium.org/2755723003 .
2017-03-15 16:44:33 -07:00
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