Commit Graph

756 Commits

Author SHA1 Message Date
hausner@google.com 00366dcfa1 Fix Windows build
Review URL: https://codereview.chromium.org//903843002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43522 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-05 21:00:02 +00:00
hausner@google.com a28a13d936 Attempt to fix the Windows build
Review URL: https://codereview.chromium.org//901263002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43518 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-05 19:33:37 +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
fschneider@google.com 2727257bf8 VM: Fix source location in stack trace of async code.
This eliminates an invalid source position and allows async code
to work with the stack_traces package to a get full async stack chain.

Frames with an invalid location (file.dart:1:1) are now printed without
line/column information (file.dart)

BUG=dartbug.com/22009
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43497 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-05 10:26:27 +00:00
zra@google.com 1299ad1485 Allows turning on checked mode on a per-isolate basis
using the embedding API.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43481 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 18:32:48 +00:00
zerny@google.com e449cd0329 Propagate the stack trace of the inner-most throw when using async/await.
This patch does not provide a full async stack trace, it only ensures
that the inner-most stack frame will be the point of the initial throw.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43463 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 11:54:23 +00:00
fschneider@google.com d9be656941 VM: Share closure-call dispatchers.
Instead of caching these in each signature class,
cache them in the common super-class of all closures (_FunctionImpl)

This avoid unecessary polymorphism when invoking.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43336 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-30 13:06:11 +00:00
fschneider@google.com a33e651a42 VM: Simplify dispatcher code for closure calls.
The getter call to ".call" can be avoided for Function objects, since
it just returns the receiver there.

This makes the unoptimized code smaller. Optimized code will
only be affected if the getter call was not inlined before.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43287 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-29 14:50:37 +00:00
srdjan@google.com 12c5e2bbaf Cleanup: use const reference for ParsedFunction where possible.
R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43226 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-28 00:41:09 +00:00
hausner@google.com 7a83c9d449 Eliminate the --enable_async flag
The default value for --enable_async has been true for a couple of weeks now. This
change eliminates the flag altogether, which may be a breaking change unless the
dart executable is invoked with --ignore-unrecognized-flags

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43160 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-26 23:01:38 +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
rmacnak@google.com db79e9cca6 Rename is_visible to is_reflectable; use is_debuggable instead of is_reflectable to decide whether to filter a frame from stack traces.
Merge verbose_stacktrace flag into show_hidden_frames.

Don't mark native functions as non-debuggable (breakpoints don't actually work there now but nothing goes wrong).

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43121 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-23 21:16:40 +00:00
rmacnak@google.com 2fb0bb020b Reapply "Mark all private functions in dart: libraries as invisible (*sniff*). Previously these functions were only marked invisible if they were also native, a constructor, or on a black list."
Broken assumption in Dartium fixed in blink r188698.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43053 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-21 20:44:04 +00:00
rmacnak@google.com ed88ac7f0c Revert "Mark all private functions in dart: libraries as invisible (*sniff*). Previously these functions were only marked invisible if they were also native, a constructor, or on a black list."
Broke Dartium.

TBR=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43026 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-20 20:56:59 +00:00
rmacnak@google.com 045bd762d7 Mark all private functions in dart: libraries as invisible (*sniff*). Previously these functions were only marked invisible if they were also native, a constructor, or on a black list.
An invisible function is hidden from stack traces, will not be enumerated
by mirrors, and cannot be directly invoked by mirrors. Note that private
classes remain accessible.

Fix a few internal dart:io functions that should be private.

Fix bug where mirrors would enumerate top-level invisible functions.

Mark observatory test that was using such private functions through
mirrors as failing.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43019 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-20 18:32:19 +00:00
hausner@google.com bb1ab60dc0 First step in eliminating —enable_async flag
Switch default value of enable-async to true, and remove the flag
from test source code.

Next step is to remove the flag altogether

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42670 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-07 19:42:59 +00:00
hausner@google.com ab3af6ec00 Introduce is_debuggable state bit on function objects
Simplify debugger logic. Any function can be marked as
non-debuggable when is is created. The debugger no longer
needs a heuristic which functions are debuggable.
Mostly used for synthetic, generated functions that
have no source code, e.g. async code, implicit getters and
setters, implicit constructors, forwarding constructors,
dispatcher functions.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42570 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-29 22:31:17 +00:00
asiva@google.com b75b67f1e3 Fix error string to include information about class and library when the snapshot writer throws an exception for objects that cannot be serialized.
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42535 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-20 00:41:48 +00:00
hausner@google.com 9a54ccd905 Fix debugging of async code
Make sure the debugger finds the closure function containing the body
of async functions, but not the synthetic function that generates the
future.

Change the way the debugger sets one-time breakpoints. Instead of
compiling the function and instrumenting all safe-points, set a
breakpoint marked as “one-shot” at the beginning of the function
and wait until the function is compiled. Then, once it fires, it
gets automatically deleted.

Finally, be smarter how we resolve breakpoints in compiled code.
The compiler rearranges code in await expressions, which tripped
up the debugger. This change makes sure we select the lowest compiled
code address only within the line containing the requested breakpoint
position.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42368 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-15 18:20:20 +00:00
hausner@google.com 8ece5c1b84 Allow Symbols in switch and maps
Allow Symbol literals (and const Symbol instances) as switch expression
and as key values in const Maps.

This implements the most recent Spec changes.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42230 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-10 00:24:07 +00:00
johnmccutchan@google.com 80d39f91dc Remove overly strict assert around method name token position
BUG=
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42151 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-05 21:51:43 +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
iposva@google.com e8428aa507 - The body of a async function should be executed in a Future.mircotask.
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42064 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-02 13:05:16 +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
koda@google.com 844dca3a21 Make toString visible on enum classes, as required by proposed spec.
R=hausner@google.com, rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41939 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-24 19:19:18 +00:00
hausner@google.com a224480e1a Allow await expressions in arrow-style functions
Recognize await keyword when skipping expressions.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41932 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-24 17:39:04 +00:00
iposva@google.com 96bf02b8f1 - Make array immutable first, then canonicalize it.
- When serializing canonical objects, then inline the referenced
  objects, so that you can canonicalize them when deserializing.
- Reenabled language/enum_const_test.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41881 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-21 07:18:40 +00:00
hausner@google.com bd26915f9e Placate linux C++ compiler
Fixes build error on Linux.

TBR

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41816 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-18 23:29:09 +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
fschneider@google.com c4ff0631f8 Initialize the async jump variable with a smi to avoid polymorphic comparison.
Using the implicit initial null value makes the comparison in the dispatch
prologue of async closures polymorphic (Null|Smi). Initializing to it -1
eliminates the unnecessary class check for null.

Small clean up of scopes and internal variables used for async functions:
Capture them in the parser, so that there is no need to do this later in the
async-transformer.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41123 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-15 11:41:22 +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
hausner@google.com 05398d6e02 Reuse function objects of async closure body
When an async function is compiled, it creates a closure that contains the code of the async function’s body. Before this change, a new function object is created each time the async function is compiled. This change looks up previously created closures and reuses them, similar to what the parser does for local functions.

R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41084 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-13 21:38:12 +00:00
hausner@google.com 752167dec9 throw e is not a compile-time constant expression
Detect illegal compile-time const expression and report error.

Fixes 21146.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40793 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-29 22:47:21 +00:00
hausner@google.com 953e5094d3 Fix context handling in for-in loops
The creation and assignment of a fresh loop variable appeared to be outside
of the loop body. When the assignment fails, e.g. due to a type check, the
stack walking code could thus access the wrong context variables.

This CL fixes code and PC descriptor generation for for-in loops and also
fixes a separate bug that crashed the VM when printing an internal error
message.

Fixes issue 20999.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40552 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-22 17:23:45 +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 8db9d5ceac Parse await as part of an unary expression.
BUG=
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39879 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-04 17:09:44 +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 10011c8b72 - Make Parser::ReceiverType an instance method so that it has access to 'I'
- Minor changes to avoid handle creation.
- Fix snapshot version check error message.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39815 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-03 18:29:12 +00:00
mlippautz@google.com 5faff13d23 Enable await in more statements.
Properly parse await in if, else if, switch, and return.

BUG=
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39813 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-03 17:34:21 +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