Commit Graph

1040 Commits

Author SHA1 Message Date
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
Matthias Hausner b88c777590 Fix latent bug in finally-block inlining
The parser copies blocks of finally clauses to every return
or jump statement that can break out of enclosing try statements.
This change makes sure that only enclosing try statements in the
same function are considered.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2004883004 .
2016-05-24 08:51:52 -07:00
Vyacheslav Egorov 65f2e015ca VM: Fix race between background compiler and guarded cid update.
Rework how we check guarded state consistency in background compiler.

Background compiler was storing original fields inside guarded fields list. This caused a race during inlining when inliner would copy guarded fields one by one from the callee function into the caller, because ParsedFunction::AddToGuardedFields looks at the guarded_cid to filter out those fields that should not be guarded.

As a result if some guarded field transitioned to unguarded (kDynamicCid) after callee graph construction but before list of guarded fields were copied then AddToGuardedFields would simply skip that field because it now has guarded_cid() == kDynamicCid.

We fix this race by always placing copies into the list of guarded fields and unwrapping them only in FinalizeCode.

Placing the copies also allows us to simplify a lot of code that was trying to verify guarded state consistency before committing the generated optimized code - now that we store copies in the list we can just compare their state to the originals and abort if the state is different.

Additionally fix deduplication check that was comparing original fields with copies - resulting in adding the same field into the list multiple times.

Add an assertion that verifies that we are not trying to access guarded_cid of original field from background compiler.

R=fschneider@google.com
BUG=

Review URL: https://codereview.chromium.org/2006793002 .
2016-05-24 14:52:02 +02:00
Vyacheslav Egorov 655bc90489 Enable optimizer pipeline for DBC.
Most of the infrastructure is fixed to work with DBC stack layout:

- register allocator allocates DBC registers with the limitation that we allocate only 20 registers and bail out if anything needs spilling (there is no use implementing spilling on DBC because registers are memory locations themselves). We should be able to bump number of CPU registers on DBC up to 256 but this requires major surgery in some parts - so I postponed this;
- lazy deoptimization is implemented, eager deoptimization is not - because we don't emit any code that actually requires it. it's a minor change to support it once we have a target;
- stack scanning respects stack maps built by registers allocator;

We bailout from all unsupported instructions.

R=zra@google.com

Review URL: https://codereview.chromium.org/1992963002 .
2016-05-24 14:35:50 +02:00
Matthias Hausner b4e6c9d8f0 Revert "Fix capturing variables in optimized compilations"
This reverts commit 117693961f.

BUG=

Review URL: https://codereview.chromium.org/1991533002 .
2016-05-17 16:31:02 -07:00
Matthias Hausner 117693961f Fix capturing variables in optimized compilations
Second attempt, this time also capturing hidden variables
like 'this' in initializer lists. Original CL is
https://codereview.chromium.org/1980193002

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/1986393002 .
2016-05-17 15:59:42 -07:00
John McCutchan 48c8ffa7f3 Initial isolate reload support
This is a cut of the work that Todd and I collaborated on in the reload branch.

In this CL, we've dropped the loader port hacks, in other words, on stack reloading in the standalone embedder does not work yet.

- [x] Support for hot reloading of isolate source code
- [x] Unit test harness and many tests
- [x] Service protocol and Observatory support
- [x] Product build does not include support for hot reloading.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1965823002 .
2016-05-17 12:19:06 -07:00
Ryan Macnak 01e023263e Revert "Fix capturing variables in optimized compilations"
This reverts commit 3968005cc8.

Broke optimization counter and precompilation bots.

TBR=hausner@google.com

Review URL: https://codereview.chromium.org/1985103002 .
2016-05-17 10:05:07 -07:00
Matthias Hausner 3968005cc8 Fix capturing variables in optimized compilations
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.

No wall-time improvement found when running dart2js, though.

BUG=26453
R=regis@google.com

Review URL: https://codereview.chromium.org/1980193002 .
2016-05-16 15:53:00 -07:00
Ryan Macnak 37d08d6ebc Add timeline events for compiling static initializers and writing full snapshots. Remove timeline event for InitCompiler. Fail gracefully for missing flags when writing full snapshots.
Also fix PRODUCT build.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1970363002 .
2016-05-16 09:28:49 -07:00
Harry Terkelsen 1745ba77f5 fix all instances of "the the"
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1980573003 .
2016-05-13 12:38:25 -07:00
Florian Schneider 245197fb9f VM precompiler: Allow optimizing static initializers.
Static initializers were compiled without any optimizations. They are only
executed once, but the optimizer can potentially extract static type information
and may also produce a bit smaller code. (7K size savings when compiling dart2js -- i.e. < 0.1%)

This CL enables optimizations for them. The space savings
 are not great, but I still think it's nicer to only have
 optimized code when precompiling, instead of a mixture of
 unoptimized and optimized.

Also, fix printing disassembly for initializers, and insert additional assertions.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1958913003 .
2016-05-10 09:38:03 +02:00
Regis Crelier 508b876ec8 Report wrong async function result type as type error in checked mode (Fixes #26133).
Add regression test.

R=hausner@google.com

Review URL: https://codereview.chromium.org/1847953002 .
2016-05-09 15:06:45 -07:00
Ivan Posva b2ac279269 - Use a map to lookup libraries by URL.
- Ensure the uniqueness of private keys without having to
  search the existing key space.
- Pass a thread parameter where useful to library methods.

BUG=

Review URL: https://codereview.chromium.org/1947393003 .
2016-05-05 10:42:28 -07:00