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
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
0b7efcd0b0
Private names are not exported, not even if the library imports itself
...
Prevent access to a private name if it’s imported through a self-import.
Adding a test case.
Fixes issue 20162
R=srdjan@google.com
Review URL: https://codereview.chromium.org//489993004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39459 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-21 17:07:25 +00:00
iposva@google.com
4835041da9
- Account for number of pending tasks in old-space collections.
...
- Protect access to the free lists.
- MutexLocker/MonitorLocker do not need to be StackResources.
R=koda@google.com
Review URL: https://codereview.chromium.org//474913004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39396 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-20 03:54:14 +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
648dca65ba
This CL deals with handling of return statements in functions modified as
...
async. These functions contain a so-called async closure (with the actual body)
that should not just return when encountering a return statement, but rather call
the completer first and then return (null).
Previously the last return node has been replaced with a completer.complete call.
This does not work for return statements in nested blocks or try-catch-finally
blocks.
Instead of replacing return statements we now call the completer after
resolving all steps necessary for return nodes, i.e., right after inlining all
finally blocks.
We also need "continuation" returns later on that do not complete the
completer. We differentiate by whether a return node has its scope set or not.
BUG=
R=hausner@google.com , srdjan@google.com
Review URL: https://codereview.chromium.org//460763002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39167 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-12 21:50:37 +00:00
hausner@google.com
68aecc232b
Report compile time error if const class has non-const initializer
...
A recent language change requires classes with a const constructor
to have compile-time constant field initializer expressions. This
CL adds the check, and removes code to handle const instance fields,
which do not exist in Dart.
Fixes issue 18779.
R=regis@google.com
Review URL: https://codereview.chromium.org//444793002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38910 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-05 21:50:03 +00:00
mlippautz@google.com
6dd6e6343b
Fix usage of empty array while parsing array literals.
...
BUG=
R=srdjan@google.com
Review URL: https://codereview.chromium.org//430873002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38738 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-30 17:19:57 +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
asiva@google.com
a323a9c9db
The dart version of typeddata library has changed to be compatible with the dart2js implementation
...
(typeddata does not implement ByteBuffer anymore).
Added new Dart API functions to account for this change.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//392043003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38351 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-17 22:08:07 +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
fschneider@google.com
28039cb7cc
Fix crash bug with noSuchMethod invocation and argument count mismatch.
...
When trying to invoke noSuchMethod on an object and it does not implement
noSuchMethod(i) -- with one argument, but with a mismatching number of arguments,
throw a NoSuchMethodError.
BUG=dartbug.com/12561
TEST=tests/language/regress_12561_test.dart
R=iposva@google.com
Review URL: https://codereview.chromium.org//390003002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38183 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-14 10:06:42 +00:00
asiva@google.com
00a7fd87c2
Use Object::null_object() instead of Object::ZoneHandle() when a null object
...
handle is desired. This is more efficient as it does not result in allocation
of a ZoneHandle and access to Isolate::Current().
R=srdjan@google.com , zra@google.com
Review URL: https://codereview.chromium.org//363093004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38044 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-07 22:15:20 +00:00
rmacnak@google.com
14fcffb2b6
Hide synthetic metadata field exposed in r35926.
...
Also remove Object::CreateInternalMetaData.
BUG=http://dartbug.com/19731
R=iposva@google.com , regis@google.com
Review URL: https://codereview.chromium.org//363473004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37900 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-01 20:09:09 +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
iposva@google.com
5864eb56c6
- Use I instead of isolate() where possible.
...
R=srdjan@google.com
Review URL: https://codereview.chromium.org//338953003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37375 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-16 20:50:05 +00:00
hausner@google.com
4eac05607f
Lazy loading of deferred libraries
...
Defer reading of source code of deferred libraries until the
Dart code executes the loadLibrary() call.
R=iposva@google.com
Review URL: https://codereview.chromium.org//328923002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37334 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-13 22:43:31 +00:00
fschneider@google.com
b0904c1409
Record field initializer with simple literals stores at compile-time.
...
This helps to rule out fields from being unboxing candidates earlier and
avoids generating extra code to track the type at runtime.
Also, align the location summary computation for instance field stores to
use the same condition as the code generation function.
R=vegorov@google.com
Review URL: https://codereview.chromium.org//330243003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37310 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-13 11:49:34 +00:00
regis@google.com
1186078de6
Add support to trace warnings in TraceBuffer.
...
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//328663008
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37298 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-13 00:47:15 +00:00
rmacnak@google.com
da3b61d764
Add missing demangling to the VM's NoSuchMethodError. Ensure the VM's NoSuchMethorErrors for reflective invocation match those for non-reflective invocation.
...
Fix bug in VM demangling of setters.
Fix bug where test was not covering invocation on classes as intended.
BUG=http://dartbug.com/18042
R=asiva@google.com
Review URL: https://codereview.chromium.org//326263002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37294 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-12 22:53:00 +00:00
iposva@google.com
ab18821876
- Fix the external_test.dart as it was relying on outdated
...
functionality and broken syntax. So some tests were passing
for the wrong reason.
- Fix the VM parser to properly report the compilation errors.
- Fix the generation of pretty names of private identifiers.
R=brianwilkerson@google.com
Review URL: https://codereview.chromium.org//269253007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37208 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-10 22:19:33 +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
regis@google.com
fa70e35e60
Improve error message and suggest workaround for mixin limitation.
...
Related to issues 15101, 17610, and 19226.
R=hausner@google.com
Review URL: https://codereview.chromium.org//319833002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37057 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-05 23:19:45 +00:00
regis@google.com
139187ae5f
Add javascript compatibility warnings for strings that are not identical, but
...
equal. The vm does not canonicalize all strings as javascript does.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//312693008
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37013 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-04 20:47:54 +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
vegorov@google.com
4e286b316f
Split GuardField into GuardFieldType and GuardFieldLength instructions.
...
Record expected length offset that matches guarded_cid.
This greatly simplifies code generation and control flow inside these guards.
Fixes the bug that was causing unoptimized code to call into runtime even when guard did not fail.
Add --trace-field-guards flags to trace updates to the state of guarded fields' properties.
BUG=http://dartbug.com/19003
R=fschneider@google.com , johnmccutchan@google.com , zra@google.com
Review URL: https://codereview.chromium.org//304703002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36872 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-02 13:53:53 +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
hausner@google.com
7eb65dc57e
Cache the current token in some functions in the parser
...
Avoid some calls to CurrentToken(). Compiling all of dart2js, this saves
about 10% of calls to CurrentToken(). There is no measurable performance
difference (using wall-clock time).
R=iposva@google.com , srdjan@google.com
Review URL: https://codereview.chromium.org//305653002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36763 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-28 20:21: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
fschneider@google.com
9eb97cb338
Don't require eliminating certain type checks in unoptimized compilation.
...
The compiler relied on the graph builder to eliminate certain type
checks so that running without type check elimination required a
hack in the code generator to deal with the transition sentinel.
This CL makes type checks explicit in the AST and avoid inserting
them where they're not necessary (e.g. assigning null, sentinal values).
R=regis@google.com , srdjan@google.com
Review URL: https://codereview.chromium.org//300763002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36734 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-28 10:16:05 +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
iposva@google.com
13d2f0f237
- Fix build: Move definition of I local to the files using it.
...
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//298003007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36687 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-27 14:53:20 +00:00
iposva@google.com
bd91ac03d4
- Add isolate to ZoneHandle allocation in parser.
...
- Add I macro which gets the local isolate().
R=johnmccutchan@google.com , srdjan@google.com
Review URL: https://codereview.chromium.org//302703005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36686 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-27 14:30:30 +00:00
iposva@google.com
d36cd610cb
- Use isolate where it is appropriate.
...
- Do not emit an name for ExternalLabel.
R=johnmccutchan@google.com , srdjan@google.com
Review URL: https://codereview.chromium.org//306483005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36662 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-27 10:15:50 +00:00
srdjan@google.com
45692c1248
More reduction of accessing TLS by caching/passing isolate value.
...
R=regis@google.com
Review URL: https://codereview.chromium.org//299263005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36598 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-23 23:26:48 +00:00