Commit Graph

1053 Commits

Author SHA1 Message Date
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
Matthias Hausner 42f5c25fa5 Type parameter and class name must not conflict
Implement missing name conflict check.

BUG=14513
R=regis@google.com

Review URL: https://codereview.chromium.org/2063223003 .
2016-06-15 13:27:59 -07:00
Lasse R.H. Nielsen c56411d576 Make VM accept function values in assert statements.
Fix for issue #18454.

BUG= http://dartbug.com/18454

Review URL: https://codereview.chromium.org/2064663002 .
2016-06-15 10:08:39 +02:00
Matthias Hausner 3e9b9615c0 Always capture instantiator in async functions
Simplifies the VM code a bit.

BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org/2063933002 .
2016-06-14 11:03:49 -07:00
Regis Crelier f4029bf3ee Capture instantiator in async function when required to check result type.
Add regression test (fixes #26668).

Review URL: https://codereview.chromium.org/2057903003 .
2016-06-09 19:14:14 -07:00
Florian Schneider 82fac9b30b Fix incorrect new-space allocations in the parser during background compilation
Thess place were forgotten when changing all allocations in the background
compiler to old-space. New-space allocation is not allowed in the background
compiler thread.

I added assert to places that should only be reachable during unoptimized compilation.

BUG=#26669
R=asiva@google.com

Review URL: https://codereview.chromium.org/2056813002 .
2016-06-09 13:53:42 -07:00
Matthias Hausner 1859ce46c3 Fix finally clause inlining for forward jumps
In switch statements, ‘continue L’ jumps can refer to a label
that the compiler hasn’t seen yet. The label is tentatively
to be in the innermost switch statement, but may later
be moved to an outer switch statement. The compiler must
make sure that the correct finally blocks are inlined in front
of these jumps.

BUG=26577, 25310
R=regis@google.com

Review URL: https://codereview.chromium.org/2030763002 .
2016-06-02 09:03:49 -07:00
Matthias Hausner 7daa2a8915 Fix capturing variables in optimized compilations
Fourth(!) attempt. This CL fixes another instance where parsing a nested function modifies the parser state of the function that is being compiled.

When a local function gets compiled the second time, constant
expressions may not be parsed again, since the constant value
is found in the cache. If the expression refers to an outer
variable, it does not get captured correctly.

Fix: instead of parsing a local function repeatedly to capture
outer variables, use the local function’s context scope to mark
outer variables as captured. This fixes the bug, and makes the
compiler more efficient as well.

BUG= 26453
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2010283004 .
2016-05-27 11:27:10 -07:00
Vyacheslav Egorov 0ce50b865f Fix x64 debug precompiled runtime build.
R=fschneider@google.com
BUG=

Review URL: https://codereview.chromium.org/2006313006 .
2016-05-25 14:00:10 +02:00
Florian Schneider 80d6af1e0c Revert "Fix capturing variables in optimized compilations"
This reverts commit 4dca5d0e01.

It seems to cause at least one additional test failure:

Repro:
    python tools/test.py -mrelease -asimarm64 --write-debug-log --write-test-outcome-log --copy-coredumps -cprecompiler -rdart_precompiled --exclude-suite pkg -t480 language/async_star_regression_fisk_test

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2004373004 .
2016-05-25 13:30:24 +02:00
Matthias Hausner 4dca5d0e01 Fix capturing variables in optimized compilations
Third attempt. A latent bug in finally block inlining
caused the previous crashes in optimized functions.
Fix is in https://codereview.chromium.org/2004883004/.

When a local function gets compiled the second time, constant
expressions may not be parsed again, since the constant value
is found in the cache. If the expression refers to an outer
variable, it does not get captured correctly.

Fix: instead of parsing a local function repeatedly to capture
outer variables, use the local function’s context scope to mark
outer variables as captured. This fixes the bug, and makes the
compiler more efficient as well.

BUG=26453
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2008043002 .
2016-05-24 14:40:52 -07:00