Commit Graph

362 Commits

Author SHA1 Message Date
Srdjan Mitrovic fcea0077cc Minor cleanup in preparation for removal of allocation in new space, and removal of an 'optimization'
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1310383002 .
2015-08-24 13:40:32 -07:00
Daniel Andersson bc149bf2f5 Migrate most uses of StackZone(Isolate*) to Thread*.
Also migrate some HANDLESCOPE uses.
This prepares for concurrent compilation.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1285293004 .
2015-08-13 13:11:30 -07:00
Matthias Hausner fc55f38aaf Fix ??= AST modification.
BUG=23988
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1273033007 .
2015-08-11 13:13:56 -07:00
Daniel Andersson ecccff2566 Refactor VMTagScope to Thread* rather than Isolate*.
Prepares for per-thread vm tags, but only changes the interface for now.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1284713003 .
2015-08-10 10:43:30 -07:00
Matthias Hausner 4ebab25d8f Implement constructor closures
One detail that isn't implemented yet is canonicalization of constructor tear-offs. At the moment, two tear-offs of the same constructor result in closures that are not equal.

BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1255063005 .
2015-08-03 15:50:46 -07:00
Matthias Hausner f1da09741d Implement tear-off closure operator #
BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org//1234883005 .
2015-07-22 12:50:36 -07:00
Daniel Andersson 700bd54362 Remove more uses of Isolate::current_zone.
The most substantial change is in Parser and ParsedFunction, which now cache their calling thread. (A similar change was tried unsuccessfully in the past, but can now be safely implemented thanks to the ThreadRegistry state saving.)

Only remaining users are the Object::Handle(Isolate*, [...]) methods. Then, this deprecated interface will be removed.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1242343002 .
2015-07-21 09:37:23 -07:00
Srdjan Mitrovic d503d2f0ed Added full deferred loading semantic to precompiled/--noopt/eager-loading code (some corner cases, e.g., compile-time errors for constants, still missing)
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1211273011 .
2015-07-09 10:56:55 -07:00
Matthias Hausner 0535e37619 Implement ?? ??= and ?. operators
BUG=23455
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1180903002.
2015-06-18 11:05:16 -07:00
Regis Crelier 601da25b92 Fix issue 23500
BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1146993003
2015-05-29 13:31:16 -07:00
hausner@google.com 9db5059098 Fix CompilerStats info
Move the counters and timers into the isolate. Statically allocated data
does not work anymore now that we always have multiple isolates.

Remove unused counters, add some counters to measure size of compiled code
and meta info.

R=asiva@google.com

Review URL: https://codereview.chromium.org//1127383008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45751 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-12 23:03:48 +00:00
hausner@google.com 1890e567fe Simplification in resolving classes
The helper functions in Parser to resolve classes in the library
and prefix scope created an unnecessary handlescope. With libraries
caching previous lookups, and with namespaces now using dictionaries,
there are just a handful (so to speak) of handles allocated for the
lookup. That does not warrant a handlescope. Removed the helper
functions.

R=asiva@google.com

Review URL: https://codereview.chromium.org//1087463005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45399 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-24 15:45:54 +00:00
hausner@google.com 21ca62f8bc Properly resolve top-level setters
Fixes issue 4386.

When converting a getter to a setter (converting a right-hand
side expression to a left-hand side, assignable entity),
we need to know where to look for the setter function.
Top-level setters need to be resolved in the library or prefix
scope in which the getter was found.

R=regis@google.com

Review URL: https://codereview.chromium.org//1090373006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45316 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-21 17:36:34 +00:00
regis@google.com 8b73c2a3e5 Simplify restoring of saved try contexts in async code by passing around the
relevant variables instead of scopes and try indices.

R=hausner@google.com

Review URL: https://codereview.chromium.org//1079233002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45081 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-10 22:15:00 +00:00
hausner@google.com aa75044ff7 Fix spurious resume when awaiting future in async* code
Fixes issue reported in bug 23116.

The equivalent fix for dart2js contains a test case for this.

R=iposva@google.com

Review URL: https://codereview.chromium.org//1073623002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44985 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-08 22:09:20 +00:00
hausner@google.com 0b99d6dc95 Better error messages when matching parens and braces
Tell user where the mismatched closing paren or brace
opens.

Fix for 22820 and improvement for (previously closed) 2936

R=srdjan@google.com

Review URL: https://codereview.chromium.org//1054893003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44882 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-03 17:07:25 +00:00
koda@google.com 549c74a3da Avoid caching thread in parser.
R=asiva@google.com

Review URL: https://codereview.chromium.org//1051713005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44854 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-02 01:14:31 +00:00
hausner@google.com f5339aaabb Add the implicit return in the correct sequence node
Make sure we add the implicit return node into the sequence
node that contains the function’s code. Previously, we added
the implicit return in the outermost sequence. If the outermost
sequence is at a different context level than the sequence that
contains the function’s code, the debugger cannot access the
captured variables when stopped at the return statement.

R=regis@google.com

Review URL: https://codereview.chromium.org//1037183003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44826 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-31 22:11:06 +00:00
fschneider@google.com 76f5627abd Compile implicit closures as dispatchers instead of duplicating the original method's code.
This saves space in unoptimized code for implicit closures. In optimized code the
original method's code will often be inlined into the implicit closure dispatcher so that
there won't be a performance impact.

The static case just calls the original method. For implicit instance closures, the
this-parameter is loaded from the context and passed to the original method.


The coverage test is affected since the dispatcher has the original method's token position
associated with it. This means that the line with the method declaration is considered to
have executable code. Setting the token position to 0 (Scanner::kNoSourcePos) does not work
because it coincides with the first line (and first token) in the script.

R=hausner@google.com

Review URL: https://codereview.chromium.org//1024563004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44655 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-24 09:33:36 +00:00
hausner@google.com b88c3ee1b8 Fix await/async/yield keyword recognition
Fixes issue 22870.

The VM parser didn’t distinguish between await and “await”.

Added some additional symbol recognition cleanup which should speed up parsing.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//1016833002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44540 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-17 17:26:58 +00:00
rmacnak@google.com e1bbc90322 Display call site data for functions.
- Requested with coverage data, only in function view for now.
 - Adjust token position associated with ICData to correspond to the identifier instead of the open paren.
 - Fix JSONifying ICs for static/constructor calls.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//977283002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44476 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-13 20:44:41 +00:00
regis@google.com c502cb8371 Fix more async machinery (issue 22579 and possibly more to be triaged).
Add regression test.

R=hausner@google.com

Review URL: https://codereview.chromium.org//977243002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44250 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-05 00:42:17 +00:00
fschneider@google.com d0ca8036a2 Fix VM bug with super-constructor invocation and mixins.
When using mixins, the constructor of a super-class was incorrectly
invoked twice if the super() call was not at the end of the initializer
list.

When generating the super constructor call in an implicit constructor, pass
along the phase parameter that comes in instead of invoking all phases.

BUG=dartbug.com/22604
TEST=tests/language/constructor_with_mixin_test.dart
R=hausner@google.com

Review URL: https://codereview.chromium.org//973843005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44242 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-04 18:02:40 +00:00
regis@google.com 17f01a0489 Fix more async machinery (capture return value when necessary, issue 22620).
Review URL: https://codereview.chromium.org//981433002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44216 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-04 02:08:52 +00:00
regis@google.com 5cb782b7fb Fix async machinery for finally clauses (issues 22445, 22300).
R=hausner@google.com

Review URL: https://codereview.chromium.org//974073002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44210 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 23:55:18 +00:00
regis@google.com 8618df1864 One more fix to async machinery (rethrow in finally, issue 22595).
R=hausner@google.com

Review URL: https://codereview.chromium.org//973103002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44189 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 18:34:01 +00:00
hausner@google.com 9a6ed9a718 Implement async* functions in VM
R=iposva@google.com

Review URL: https://codereview.chromium.org//944893005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44185 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 17:49:53 +00:00
regis@google.com 0036014d8a Fix async machinery (issue 22445 and possibly others to be triaged later).
R=hausner@google.com, iposva@google.com

Review URL: https://codereview.chromium.org//958243003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44107 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-27 22:19:47 +00:00
regis@google.com afd4864b0e Save exception and stack trace variables in async catch clauses and use them
in rethrow statements (fix issue 22523).

R=hausner@google.com

Review URL: https://codereview.chromium.org//956583003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44001 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-24 22:05:35 +00:00
regis@google.com 3caf1669dc Fix indentation of parser trace (several threads may compile at once).
R=hausner@google.com

Review URL: https://codereview.chromium.org//944463002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43885 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-19 18:54:24 +00:00
hausner@google.com 2487c76886 Add support for sync* and yield and yield*
R=srdjan@google.com

Review URL: https://codereview.chromium.org//888463004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43516 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-05 18:36:40 +00:00
koda@google.com 99127744c6 Add Zone-based handle allocation interface and reduce use of Isolate-based interfaces.
Remove deprecated Isolate-based BitVector constructor.

R=asiva@google.com

Review URL: https://codereview.chromium.org//868913002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43136 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-26 14:54:02 +00:00
johnmccutchan@google.com f216834af8 Expose set_source service command for functions
- Can change signatures
- Currently only works for unexecuted functions.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org//751183003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42124 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-04 23:35:24 +00:00
srdjan@google.com bad6a61899 Cleanups.
R=vegorov@google.com

Review URL: https://codereview.chromium.org//774763002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42069 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-02 18:48:12 +00:00
zerny@google.com 8e807c8550 Integrate the Irregexp Regular Expression Engine.
BUG=http://dartbug.com/19090
R=fschneider@google.com

Committed: https://code.google.com/p/dart/source/detail?r=41949

Review URL: https://codereview.chromium.org//744853003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41983 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-26 09:32:43 +00:00
hausner@google.com 1b8fa74112 Fix parsing of awaitable expressions with nested functions
“have seen await” flag must be properly saved and restored when
parsing nested function (literals) inside an await expression.

Fixes issue 21536

R=srdjan@google.com

Review URL: https://codereview.chromium.org//755053002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41962 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-25 18:13:49 +00:00
zerny@google.com 84a4135901 Revert "Integrate the Irregexp Regular Expression Engine."
This reverts commit https://code.google.com/p/dart/source/detail?r=41949

TBR=fschneider@google.com
BUG=

Review URL: https://codereview.chromium.org//754383002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41950 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-25 13:36:40 +00:00
zerny@google.com 43ac0c6f33 Integrate the Irregexp Regular Expression Engine.
BUG=http://dartbug.com/19090
R=fschneider@google.com

Review URL: https://codereview.chromium.org//744853003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41949 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-25 13:10:21 +00:00
hausner@google.com 4bf624ebc0 Implement enum types in VM
Fully support enum types as per language spec version 1.6.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//735723003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41815 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-18 23:10:07 +00:00
fschneider@google.com b26ff22adf Allocation sinking for contexts.
Improved aliasing computation in presence of Redefinition and AssertAssignable.

Added possibility for inlining annotations via --enable-inlining-annotations flag.

R=vegorov@google.com

Review URL: https://codereview.chromium.org//184523002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41713 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-13 13:53:58 +00:00
fschneider@google.com 7bec3edaef Remove saving/restoring of the context at function entry.
This is not needed anymore after I changed the current context
to always reside in a local variable.

Further simplifications and cleanup in the debugger.

This also fixes a bad memory retention problem with
non-capturing closures.

BUG=dartbug.com/18886
TEST=tests/language/vm/closure_memory_retention_test.dart
R=hausner@google.com

Review URL: https://codereview.chromium.org//695483003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41433 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-31 07:35:51 +00:00
fschneider@google.com 876193b31a Make CTX allocatable by the register allocator.
This change makes CTX available by not caching the current
context while in Dart code. Instead the current context
is held in a local variable (:saved_current_context_var) and
is passed as argument in CTX at calls.

This also simplifies a lot of code in the debugger: As a result,
Isolate::top_context is not needed anymore since the current context
can always be extracted from a Dart frame.

R=vegorov@google.com

Review URL: https://codereview.chromium.org//678763004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41422 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-30 15:42:38 +00:00
hausner@google.com 95dc65a0e9 Implement await for statement
Implement await for statement to iterate over streams. Uses
the built-in class StreamIterator.

await for (var e in stream_expr) {
  S;
}

Is translated to:

var it = new StreamIterator(stream_expr);
while (await it.moveNext()) {
  var e = it.current;
  S;
}

Review URL: https://codereview.chromium.org//662603003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41328 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-27 18:03:43 +00:00
hausner@google.com 2f49f29c38 Await always waits
The expression ‘await e’ always suspends the enclosing function. If e does not
evaluate to a an object o of type Future, a new Future is created using Future.value(o).

A small change in the backend allows a return instruction to be followed by
other instructions. In async functions, a return can suspend the function and the
continuation point is in the same code block after the return.

Other small changes:
- More user-friendly error message if async/await is not enabled.
- Programs no longer need to import dart:async when using async/await.

R=fschneider@google.com

Review URL: https://codereview.chromium.org//634603002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41105 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-14 19:58:06 +00:00
mlippautz@google.com 800508d980 Bubble up exceptions throw async/await.
This CL addresses bubbling up exceptions through async and await. It adds another parameter to the continuation that can be used to rethrow an error.

BUG=
R=hausner@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//542893004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39926 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-05 19:50:34 +00:00
mlippautz@google.com 8558638543 Enable await in for and for-in loops.
BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org//538803002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39880 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-04 17:42:38 +00:00
mlippautz@google.com 98628f3543 Enable await in while and do-while.
BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org//538703002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39839 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-03 21:51:15 +00:00
asiva@google.com f64b948290 Fix build break (forgot this file in the previous CL).
Review URL: https://codereview.chromium.org//535303002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39818 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-03 18:35:22 +00:00
mlippautz@google.com 56f63abc4f Reland: Fix scoping async functions.
This CL fixes several scoping/context issues:
* Do not reuse scopes in SequenceNode_s as they might introduce a new context
  level. In that case we would trigger context allocationg multiple times
  resulting in scope/contexts being out of sync.
* Properly save and restore saved_try_context in try/catch/finally blocks and
  nesting closures. For this we need to keep track of async closures top scopes.

Updated version of https://codereview.chromium.org/520223002/

BUG=
R=hausner@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//530313002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39810 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-03 16:34:00 +00:00
mlippautz@google.com 165df6920d Revert "Fix scoping async functions."
This reverts commit 7c03f3ef75f546c73d46680206cd7fe61997e1be.

BUG=

Review URL: https://codereview.chromium.org//536543002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39777 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-02 20:54:04 +00:00