Commit Graph

233 Commits

Author SHA1 Message Date
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
mlippautz@google.com bfbc0c1118 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.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39775 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-02 20:25:35 +00:00
mlippautz@google.com c65636490f Fix conditionally parsing await as keyword.
BUG=
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39602 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-27 16:22:52 +00:00
mlippautz@google.com d7943b4029 Revert "Fix scope/context behavior in await transformer."
This reverts commit fb220928acc36cc9078f905bb185b4c32b9a5608.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39573 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-27 00:10:45 +00:00
mlippautz@google.com 3a46e60f17 Fix scope/context behavior in await transformer.
We are not allowed to reuse LocalScope in different SequenceNode_s. The problem is that if a context needs to be created for that scope the FlowGraphbuilder will insert context creation code at all SequenNoce_s that use this scope. This results in scopes and contexts being out of sync and writing garbage. The fix is to just chain a new scope that is on the same function- and loop-level.

Also fix recognizing of "await" in async functions. A follow up CL will enable await in loops, if, return, ...

BUG=
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39571 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-26 23:01:58 +00:00
hausner@google.com 6e637eb27f Initializing a final instance is a runtime error
If a final instance variable is initialized at the point of declaration, it
is a runtime error if it is initialized again in a constructor’s initializer
list or by an initializing formal.

If any instance field is initialized more than once in the initializer list of
a constructor, or by an initializing formal parameter, it is a compile time
error.

Adding a new test to cover the expected runtime error.

Fixes issue 13335.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39562 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-26 19:37:36 +00:00
mlippautz@google.com 7c7919f8ef Await it!
Add support for awaiting futures. This leaves us with a non-structural CFG.

TODOs:
* Forwarding exceptions through futures in async functions and rethrowing them using await.
* Known bug with nested contexts (will be fixed in following CL)
* await is not recognized at all expressions specified (yet)

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39559 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-26 17:35:56 +00:00
hausner@google.com 0bbf6c5b16 Runtime support for evaluation of static field initializer expressions
Eliminates the generation of field initializer functions by the parser.
Adds a runtime call that creates a one-shot function to evaluate the
initializer of a static field. The runtime function gets called from
the implicit static getter function for the field.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39387 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-19 21:53:44 +00:00
mlippautz@google.com 5f02ceed86 Introduce await.
This CL adds basic infrastructure needed for awaitable expressions. Implementation of continuations is not part of this CL.

Expressions containing ``await'' are transformed into a series of operations on intermediates, effectively getting rid
of the temporary expression stack. Currently only expressions evaluating to an actual value (read: non-future) are supported.

Also, not all kinds of statements support awaitable expressions yet.

Missing:
 * Capturing all (needed) variables
 * Continuations (connecting a preamble with await statements; re-adding the closure to the run queue)

BUG=
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39345 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-18 18:41:12 +00:00
srdjan@google.com 5d27559bd4 Fix issue 20476: creating multiple LocalVariables with same name (finally_ret_val35), confuses the compiler. token_pos is not enough to guarantee unique name for inlined finally-s. Instead of uniques names per inlined return node, use one function level local.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39206 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-13 17:03:49 +00:00
mlippautz@google.com 47c8f8b3e2 Reland transformation of async functions.
Reland https://codereview.chromium.org/362153002/

Additions:
 * Fixes for parsing async "keyword".
 * Further tests.

BUG=
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38715 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-29 23:50:33 +00:00
mlippautz@google.com be3e426f27 Revert async changes.
Revert "Transform functions marked as async"
This reverts commit 79cbaaf60143babcb29bb0ed74a0da87fd998c39.

Revert "Fix snapshot test"
This reverts commit ee892aa105daccc74c734eb18934814b76a415bb.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38690 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-29 18:42:53 +00:00
mlippautz@google.com dfc33496a4 Transform functions marked as async
In a nutshell:

  foo(params) async { <body> return result; }

transforms to

  foo(params) async {
    var c = new Completer();
    var async_body = () { <body> completer.complete(result); }
    new Future(async_body);
    return c.future;
  }

BUG=
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38681 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-29 17:16:00 +00:00
srdjan@google.com 9c8a395f6f More PcDescriptor cleanups, compress recors if no try index is needed (frequent).
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38242 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-15 17:07:03 +00:00
hausner@google.com f58745f751 Fix parsing and resolving of prefixed names
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37631 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-23 23:26:26 +00:00
regis@google.com 32f3e11d99 Cleanup of error and warning reporting.
R=hausner@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37468 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-18 22:30:34 +00:00
srdjan@google.com 3480ac4a0e Fix deferred library code disabling for inlined functions.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37107 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-06 22:14:40 +00:00
rmacnak@google.com fc3ce06a95 VM: Use a fake parsed function when parsing metadata.
BUG=http://dartbug.com/18976
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36903 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-02 22:06:28 +00:00
regis@google.com b7c5f90bf0 Address TODOs and remove obsolete ones.
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36813 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-29 23:06:02 +00:00
srdjan@google.com ce2d52f111 Pass isolates explicitly.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36740 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-28 14:24:53 +00:00
srdjan@google.com 2b06c73841 Remove unused code, improve speed of Parser::CurrentToken (improvement seen in measurements and profile).
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36710 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-27 21:12:24 +00:00
fschneider@google.com b9c3553964 Eliminate some unnecessary handle allocations in the compiler.
Eliminate duplicate code from PushArgumentInstr by using TemplateDefinition.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36626 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-26 09:53:42 +00:00
regis@google.com dec11d8b7b Add support for javascript incompatibility warnings (work in progress).
For now, warnings are only issued when applicable for type tests, type casts,
and toString.
Fix newly reported lint errors.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36001 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-09 22:42:10 +00:00
fschneider@google.com dfa5c809f5 Simplify flow graph building for instantiator.
The instantiator is always loaded from a local variable which
is determined in the parser. There is no need to create an AST a fresh
ValueGraphVisitor for it since the flow graph builder can just emit a
load-local.

This also makes it clear that the instantiator is not an arbitrary expresssion.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35699 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-02 17:58:01 +00:00
rmacnak@google.com 7ba8ca5753 Reapply "Mark private functions in dart:* that are native or constructors as not visible (omitted from stack traces and ineligible for reflective enumeration or invocation)."
With fix for uninitialized is_dart_scheme_ when read from snapshot.

BUG=http://dartbug.com/15274
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35289 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-23 00:05:08 +00:00
rmacnak@google.com 7840906011 Revert "Mark private functions in dart:* that are native or constructors as not visible (omitted from stack traces and ineligible for reflective enumeration or invocation)."
Review URL: https://codereview.chromium.org//246173002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35238 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-22 00:08:52 +00:00
rmacnak@google.com 69d82c334b Mark private functions in dart:* that are native or constructors as not visible (omitted from stack traces and ineligible for reflective enumeration or invocation).
Ensure invocation_fuzz_test doesn't exit prematurely.

Also visit instance methods defined in superclasses.

Complete blacklist so invocation_fuzz_test passes on the VM.

B=http://dartbug.com/15274
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35234 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-21 23:24:17 +00:00
fschneider@google.com 79a5307d5b VM: Implement closure calls as instance calls.
Conceptually f() becomes f.call() where the .call method performs the actual
closure call. The closure call itself is implemented without a stub.

The check if the object called is a closure becomes a class-id check
which can be hoisted out of loops.

R=iposva@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34917 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-10 10:56:00 +00:00
hausner@google.com 2b4e3c7c99 Implement deferred constant support
Compile time constants lose their const-ness if they are referred
to through a deferred prefix. This CL adds a flag to some ast node
types that remembers whether a field or closure was referred to
via a deferred prefix. If so, the compile-time const analysis flags
the value as non-const.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34785 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-07 17:31:32 +00:00
rmacnak@google.com f0626388f5 VM: Evaluate metadata on a class in the scope of its library not the scope of the class.
BUG=http://dartbug.com/17795
R=gbracha@google.com, hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34537 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-28 22:38:32 +00:00