If an error happens during the compilation of a function body, an Error is thrown which can be intercepted, and ensures that finally blocks are executed before the isolate is terminated.
The language spec is vague about compilation errors. A doc describing the intentions behind this CL is at
https://docs.google.com/document/d/1_MWOgwJadLCQSBps0zD6Rj5dG4iP1UBuiDvTMH-WMzI/edit#
Example:
1 void bad() {
2 return 5
3 }
4
5 void main(args) {
6 bad();
7 }
Before this CL:
$ dart ~/tmp/e.dart
'file:///Users/hausner/tmp/e.dart': error: line 2 pos 11: semicolon expected
return 5
^
$
After this change:
$ dart ~/tmp/e.dart
Unhandled exception:
'file:///Users/hausner/tmp/e.dart': error: line 2 pos 11: semicolon expected
return 5
^
#0 main (file:///Users/hausner/tmp/e.dart:6:3)
#1 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:259)
#2 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)
$
Notice that the stack trace points to the call site of bad(), not the text location of the syntax error. That's not a bug. The location of the syntax error is given in the error message.
BUG= https://github.com/dart-lang/sdk/issues/23684R=asiva@google.com, lrn@google.com
Review URL: https://codereview.chromium.org/2044753002 .
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 .
table, this ensures that we do not linearly walk through
a large type list in the class calling the expensive
'Type::Equals' method (some applications have close to
1304 generic types in them)
- Use the stand hash table implementation for TypeArguments
canonicalization instead of a custom hash table
R=johnmccutchan@google.com, regis@google.com, rmacnak@google.com
Review URL: https://codereview.chromium.org/1965493004 .
- 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 .
They were used as the class of closure instances and as the type class of
function types.
All closure instances now have class _Closure and function types are represented
by a new class FunctionType extending AbstractType.
Fix issue 24567 and add regression test.
R=asiva@google.com, rmacnak@google.com
Review URL: https://codereview.chromium.org/1584223006 .
Instead of collecting closures functions in each class object, maintain one list per isolate. This is a step towards getting rid of top-level classes.
I'd appreciate if John could take a look at the service isolate and coverage related change.
I'd appreciate if Ryan could take a look at the precompilation related change.
When compiling all of corelib, the list of closures in the isolate is about 600 entries long. If this linear list should become a bottleneck, I'll deal with it later. (Sadly, some code relies on the fact that a closure can be identified with a list index, so making it a hash table instead of an array does not work.)
BUG=
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/1436243005 .
Instead of one array for literal and identifier tokens for each TokenStream, share one array among all TokenStreams in an isolate.
The shared array and the token-to-index map is stored in the object store until the embedder is done loading. Then the map is thrown away (and the array remains shared, referred to by the TokenStreams).
When new files get loaded, a new shared array is created. For temporary scripts, e.g. when evaluating one-shot functions, the token arrays are not shared.
This eliminates many duplicate LiteralToken and identifier tokens. Looking at the core libraries:
Before: 30877 identifiers and 9618 literal tokens
After: 12899 identifiers and 6371 literal tokens
BUG=
R=asiva@google.com
Review URL: https://codereview.chromium.org/1420103006 .
Prevent megamorphic miss function from losing its code:
- Only include megamorphic function in precompiled snapshots.
- Also put the megamorphic miss code in the object store.
R=asiva@google.com
Review URL: https://codereview.chromium.org//1339363002 .
Compile-time constant values are maintained in a cache, keyed
by script and token position. When the same code is compiled
again later, e.g. by the optimizing compiler, the value is
found in the cache and does not need to be computed again.
In this version, the key is a string concatenated from the
script url and the token position. That’s probably more overhead
than we want.
Added two compiler stat counters for number of cached constants
and number of cache hits. Running dart2js to compile a hello world
program results in about 1400 cached values and 85 cache hits.
BUG=
R=srdjan@google.com
Review URL: https://codereview.chromium.org//1308073005 .
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
- Each isolate starts off with a 'Default' UserTag set.
- A null tag cannot be set.
- Calls to clearCurrentTag() should be replaced with a call to UserTag.defaultTag.makeCurrent().
- makeCurrent returns the previously current tag.
This allows for the following pattern to work:
callee() {
var old = calleeTag.makeCurrent();
...
old.makeCurrent();
}
caller() {
var old = callerTag.makeCurrent();
...
callee();
assert(getCurrentTag() == callerTag);
...
old.makeCurrent();
}
R=iposva@google.com, zra@google.com
Review URL: https://codereview.chromium.org//266913010
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35810 260f80e4-7a28-3924-810f-c04153c831b5