Commit Graph

1263 Commits

Author SHA1 Message Date
Regis Crelier 3342380ff8 Avoid parsing formal type parameters a second time from inside an async body,
as default values may not be resolved correctly and may conflict with already
parsed formal parameters (fixes #27659).
Added regression test.

R=hausner@google.com

Review URL: https://codereview.chromium.org/2452623002 .
2016-10-25 08:11:37 -07:00
Matthias Hausner f73ea62c99 Add check for constness in constructor redirection
Const constructor can only redirect to another const constructor.

BUG=#27617
R=regis@google.com

Review URL: https://codereview.chromium.org/2439593003 .
2016-10-19 15:15:02 -07:00
John McCutchan 8061bd5a8a Add local variable declaration token position to service protocol
- [x] Add three public fields to the "BoundVariable" service type: declarationTokenPos, visibleStartTokenPos, and visibleEndTokenPos. (naming suggestions welcome!)
- [x] Extend LocalVarDescriptors to hold the declaration token position (it already had the scope visibility boundaries).
- [x] Extend ContextScope to hold the declaration token position.
- [x] Add a unit test which verifies this works for local variables, function parameters, and closure captured variables.

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

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2419013004 .
2016-10-17 11:18:24 -07:00
Vyacheslav Egorov f67ce21068 VM support for running Kernel binaries.
BUG=
R=asiva@google.com, fschneider@google.com

Review URL: https://codereview.chromium.org/2411823003 .
2016-10-15 22:48:46 +02:00
Florian Schneider a0380ffaf6 Fix assertion failure with deferred prefixes.
When running with --load-deferred-eagerly, we don't need to collect
functions for invalidation, but instead insert runtime checks  if
the prefix if loadLibrary was called loaded or not.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2415743004 .
2016-10-14 10:20:46 -07:00
Lasse R.H. Nielsen efb9a12811 Add = as default-value separator for named parameters.
Fixes issue #27559.

BUG= http://dartbug.com/27559
R=asiva@google.com, eernst@google.com, floitsch@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org/2411633002 .
2016-10-14 11:25:25 +02:00
Jacob Richman 72503ff98d Extend ignore_patch_signature_mismatch used by dartium to ignore type parameters with different bounds
BUG=https://github.com/dart-lang/sdk/issues/27568
R=asiva@google.com

Review URL: https://codereview.chromium.org/2405193004 .
2016-10-12 17:25:55 -07:00
Florian Schneider d99229026e Fix issues with argument evaluation order and noSuchMethod errors.
Fix tests to conform to spec bahavior.

Update dart2js test status.

BUG=#27572
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2416513003 .
2016-10-12 17:04:55 -07:00
Regis Crelier ba2c6e397c Remove redundant code in parser.
R=zra@google.com

Review URL: https://codereview.chromium.org/2411303003 .
2016-10-12 10:10:21 -07:00
Matthias Hausner 43e338d437 Treat generic method parameters as dynamic in all contexts in the VM (fixes #27460)
Review URL: https://codereview.chromium.org/2383993002 .
2016-10-03 09:11:34 -07:00
Regis Crelier b91d74172a Make sure unresolved function type parameter bounds do not end up in snapshot.
Read and write parent_level field of function type parameters in snapshots.
Update TypeParameter::ToCString() to handle function type parameters.
Address Siva's comments in previous cl.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2359543003 .
2016-09-20 13:18:01 -07:00
Regis Crelier 11562f6874 Support generic method syntax (fixes #25869).
Function type parameters are parsed and resolved, but mapped to malformed types
(i.e. dynamic) until full support is implemented.

R=hausner@google.com

Review URL: https://codereview.chromium.org/2349593003 .
2016-09-19 15:17:33 -07:00
Matthias Hausner 3e60d48842 Fix parsing of generic closure formal parameter
BUG=#27299
R=regis@google.com

Review URL: https://codereview.chromium.org/2341493002 .
2016-09-13 15:11:10 -07:00
Matthias Hausner 3829c00e10 Improve compile time constant evaluation
Eliminate the need to invoke an execute-once function to compute
type literals and implicit closures. This reduces the number of
execute-once invocations from 6000 to 60 when compiling all of
the greentea sources, about 1MB of generated code. Sadly, no
significant runtime gain was observed.

Also simplify the caching of computed compile-time constants.

Reinstate the compiler stat counter for number of constants cached.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2338463003 .
2016-09-12 16:23:00 -07:00
Matthias Hausner c15bac4812 Ensure that constant field initializers are canonicalized
In const constructors, field initializer values that are known
to be compile-time constants should be evaluated and canonicalized
at compile time.

BUG=#27164
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2300113002 .
2016-09-01 13:23:20 -07:00
Matthias Hausner e1e4a950ad Remove legacy patch class syntax in VM
This should now work since the last remaining uses of legacy
patch syntax in Dartium are gone.

This reverts commit 04b8a627d6.

BUG=

Review URL: https://codereview.chromium.org/2292213002 .
2016-08-30 10:54:52 -07:00
Matthias Hausner 04b8a627d6 Backing out change that removed legacy patch syntax
Dartium test html/async_spawnuri_test is failing when legacy
patch class syntax parsing is removed.

Once dartium is fixed, this change can be re-applied.

TBR=terry

Review URL: https://codereview.chromium.org/2274663004 .
2016-08-24 16:48:50 -07:00
Lasse R.H. Nielsen 99439a336a See: https://docs.google.com/document/d/1iEuLbDMgbB657R5aFj9EfnT6B0obzQk93Of7CfWKc00/edit#heading=h.9ixvz54wwawi
Implement assert in initializer list in VM.

R=hausner@google.com

Review URL: https://codereview.chromium.org/2002923002 .
2016-08-24 12:43:26 +02:00
Matthias Hausner 4d4ebafad3 Implement parsing support for generic functions
Take two. (This version adds status file entries for checked
tests.)

Type parameters and arguments are parsed but ignored. Proper
handling of the parameters will be added subsequently.

The feature must be enabled with --generic-method-syntax.

Compiling all of dart2js consumes about 2.2% more tokens with
this change, due to the necessary lookahead to distinguish
generic functions from generic types.

===== with this change =========

Number of tokens:        1056691
Source length:           5850143 characters
Number of source tokens: 936226

Total tokens consumed:   3628934  <<<<<
Classes parsed:          2457
  Tokens consumed:       977999
Functions parsed:        49607
  Tokens consumed:       2430638

===== without this change ======

Number of tokens:        1056691
Source length:           5850143 characters
Number of source tokens: 936226

Total tokens consumed:   3547765 <<<<<
Classes parsed:          2457
  Tokens consumed:       942536
Functions parsed:        49607
  Tokens consumed:       2371357

(This reverts commit a1edb1766fd16b1268f3506feb7c9856b32bedfc.)

BUG= 25869

Review URL: https://codereview.chromium.org/2269693002 .
2016-08-22 10:58:55 -07:00
Matthias Hausner a1edb1766f Revert "Implement parsing support for generic functions"
This reverts commit 19af852471.

Checked tests failed. Will work on this on Monday.

TBR=asiva

Review URL: https://codereview.chromium.org/2267473002 .
2016-08-19 16:40:03 -07:00
Matthias Hausner 19af852471 Implement parsing support for generic functions
Type parameters and arguments are parsed but ignored. Proper
handling of the parameters will be added subsequently.

The feature must be enabled with --generic-method-syntax.

Compiling all of dart2js consumes about 2.2% more tokens with
this change, due to the necessary lookahead to distinguish
generic functions from generic types.

===== with this change =========

Number of tokens:        1056691
Source length:           5850143 characters
Number of source tokens: 936226

Total tokens consumed:   3628934  <<<<<
Classes parsed:          2457
  Tokens consumed:       977999
Functions parsed:        49607
  Tokens consumed:       2430638

===== without this change ======

Number of tokens:        1056691
Source length:           5850143 characters
Number of source tokens: 936226

Total tokens consumed:   3547765 <<<<<
Classes parsed:          2457
  Tokens consumed:       942536
Functions parsed:        49607
  Tokens consumed:       2371357

BUG=25869
R=asiva@google.com

Review URL: https://codereview.chromium.org/2260693002 .
2016-08-19 16:21:00 -07:00
Matthias Hausner 3f93791991 Class fields cannot be declared to be of type void
Add a test case and detect void fields.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2248943002 .
2016-08-15 17:14:58 -07:00
Matthias Hausner cf6a6e6e63 Remove legacy patch class syntax in VM
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2247073002 .
2016-08-15 15:23:49 -07:00
Ryan Macnak e09f2f940e Reload: Don't crash when a tearoff adds arguments and is called with too few.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2241603004 .
2016-08-12 13:06:35 -07:00
Matthias Hausner 1a6d1eca32 Implement @patch annotation for patch class members
Allow members of patch classes to be annotated with @patch. The VM
ignores the annotation. I simply replaces the original method
if the name matches, or reports an error if field names match.

Adding a bit is_patched to members to do more checking remains a
TODO. There are currently no unused bits available, and I don’t want
to increase the size of Function objects for this.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2230383003 .
2016-08-10 12:54:57 -07:00
Matthias Hausner f56654e882 Put patch syntax warning behind a flag
Fixes Dartium tests, which choke on the additional output introduced
by the warning.

TBR=vegorov

Review URL: https://codereview.chromium.org/2233493002 .
2016-08-09 13:01:12 -07:00
Matthias Hausner e11ca24053 Use metadata annotation @patch for patch classes
Annotate patch classes and top-level patch functions with @patch
instead of the pseudo-keyword patch. This allows the analyzer
to read patch files, and matches the syntax that dart2js uses.

The deprecated syntax is still supported, but a warning is printed when detected.

BUG=

Review URL: https://codereview.chromium.org/2220883004 .
2016-08-09 09:48:03 -07:00
Matthias Hausner 643fdb9dc8 Implement the language change that makes initializing formal parameters visible in the initializer list, but not in the constructor's body.
The feature is enabled with the flag --initializing-formal-access.

BUG=26655, 26656
R=regis@google.com

Review URL: https://codereview.chromium.org/2051213005 .
2016-08-04 11:24:25 -07:00
Ryan Macnak 5f4a685cd7 Reload: Have dangling extracted properties raise NoSuchMethod.
Closes #26995

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2204593011 .
2016-08-04 09:54:40 -07:00
Matthias Hausner 478e0db389 Eliminate remaining case of ambiguous context level info
When generating the scopes in an await-for loop, make sure the scope
of the loop block is a proper sub-range of the block surrounding
the loop.

This eliminates the last case where the compiler generated context
info of the same range, but with contradicting context level info.

BUG=26941
R=regis@google.com

Review URL: https://codereview.chromium.org/2201203002 .
2016-08-02 14:44:29 -07:00
Regis Crelier f3ad2b77cc Set correct token position range for statement block containing moveNext call of
for-in loops (second attempt at fixing #26941).

R=hausner@google.com

Review URL: https://codereview.chromium.org/2193113002 .
2016-07-29 13:29:09 -07:00
Vyacheslav Egorov 239bb524d2 Remove unnecessary capturing code from the Parser::CreateImplicitClosureNode.
BUG=
R=hausner@google.com, regis@google.com

Review URL: https://codereview.chromium.org/2164323002 .
2016-07-29 13:31:28 +02:00
Regis Crelier 48060a653f Reverting bad fix of issue #26941.
Review URL: https://codereview.chromium.org/2179903009 .
2016-07-28 12:39:49 -07:00
Regis Crelier 47cf4c1877 Set correct token position in moveNext call of for-in loops (fixes #26941).
R=hausner@google.com

Review URL: https://codereview.chromium.org/2188763003 .
2016-07-27 18:15:20 -07:00
Ryan Macnak d37ea681f5 RELOAD: Check if an implicit closure needs rebinding at compile time and adjust closure equality.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2187433006 .
2016-07-27 16:51:11 -07:00
Regis Crelier 11d340c51d Force local context allocation in finally clauses (fixes #26948).
Add regression test.

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

Review URL: https://codereview.chromium.org/2188863002 .
2016-07-27 14:03:25 -07:00
John McCutchan 56d031874f Put a NoOOBMessageScope everywhere we have a NoReloadScope. This is an attempt at fixing the developer_extension_test flake.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2158563002 .
2016-07-15 13:41:53 -07:00
John McCutchan c692a64e5a Rework how enums are implemented and reloaded
- Enum instances now hold their index and their label. Before the labels were held in a static array to the side and the index was used to look up the label.

- Before and after reload enum instances are now paired (by label) and put into the 'become' table.

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

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2153143002 .
2016-07-15 10:52:20 -07:00
Regis Crelier 1d50171a9b Remove now redundant check after an earlier cl added a tighter check.
R=asiva@google.com

Review URL: https://codereview.chromium.org/2153453002 .
2016-07-14 10:57:32 -07:00
Ryan Macnak ee942bd8d6 Remove per-isolate compile-time constants cache.
There are no scripts in the VM isolate as of 83da4db9f9.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2147493005 .
2016-07-12 17:35:54 -07:00
Regis Crelier 455110c6ee Tighten check disallowing use of initializing formals (fixes #26855).
Add regression test.
Add exception for analyzer (filed an issue).

R=asiva@google.com

Review URL: https://codereview.chromium.org/2139003002 .
2016-07-11 15:30:24 -07:00
Todd Turnidge 62ccff992f Cache compile-time constants on the script object, sometimes.
When a script is not in the vm heap, we now cache compile time
constants on the script object itself.  During isolate reload we may
have both an old and a new version of a script being compiled at the
same time and they need to cache their constants separately.  This
also means that compile time constants from old scripts can be
collected when the script is collected, which is good.

When a script is in the vm heap, we continue to use the old system of
employing a shared per-isolate cache stored in the object store.

Closes #26833

BUG=
R=fschneider@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2126393003 .
2016-07-11 14:15:37 -07:00
John McCutchan 4ef89ec4e9 Do not reload when we are evaluating a constants during compilation
- [x] Add a NoReloadScope to `Parser::RunStaticFieldInitializer`
- [x] Add a NoReloadScope to `Parser::EvaluateConstConstructorCall`
- [x] Add a NoReloadScope to `Parser::Interpolate`
- [x] Add a NoReloadScope to `Parser::EvaluateConstExpr`

Fixes #26837

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2135683002 .
2016-07-08 10:05:20 -07:00
Lasse R.H. Nielsen 6a4af257cc Allow trailing comma in parameter and argument lists.
R=hausner@google.com

Review URL: https://codereview.chromium.org/1991043004 .
2016-07-04 12:51:07 +02:00
Florian Schneider 7f0273f83e Remove invalid assertion in the optimizer.
We can have stores inlined in the optimizer that are not initializing stores.

Mark initializing stores in the parser instead to distinguish
initializing- and non-initializing stores more precisely.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2112973002 .
2016-07-01 09:55:35 -07:00
Matthias Hausner 26593c7688 Parse field initializer expressions in the correct scope class
When parsing a field initializer expression or mixin fields,
the current_class must be the mixin application class, not the
mixin class. This is necessary so that type arguments are
resolved in the correct scope class.

Dart2js fails the new regression test language/regress_18713.
Filed issue #26743.

BUG=18713
R=regis@google.com

Review URL: https://codereview.chromium.org/2085003002 .
2016-06-21 12:32:36 -07:00
Matthias Hausner 11d14177e1 Instantiating a const instance of an abstract class is a compile-time error
BUG=22007
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2077293003 .
2016-06-20 11:19:01 -07:00
Matthias Hausner 0a3bf27663 Improve error message for illegal part of declarations
BUG=23082
R=regis@google.com

Review URL: https://codereview.chromium.org/2073223002 .
2016-06-17 14:13:52 -07:00
Matthias Hausner 7a88b69d79 Allow rethrow in nested try statements
Fixes bug where rethrow was rejected when the enclosing catch clause
was not part of the innermost try statement.

BUG=26530
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2075813003 .
2016-06-16 16:04:53 -07:00
Matthias Hausner 98033d4132 Simplify generated code for assert()
Move the assert condition check and throwing the error into
the Dart library. This eliminates one call to library code.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2073623002 .
2016-06-16 10:44:30 -07:00