Commit Graph

579 Commits

Author SHA1 Message Date
John McCutchan bda2b3d2ff Source position tests for switch and try catch finally
- Give AwaitMarkerNode a token position.
- Make it possible to provide a token position for SaveContext, RestoreContext, StoreContext, and CurrentContext.
- Pass in a token position to internally generated StoreLocal and LoadLocal instructions for try-catch-finally.
- Introduce a Context ClassifyingTokenPosition to be used when we can't attribute a context related instruction to a source position.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1575953005 .
2016-01-12 15:02:35 -08:00
John McCutchan 3ca0a08117 More source position improvements and tests
- Provide source positions for some ConstantInstrs.
- Classify all other ConstantInstrs.
- Use the token position of ++ rather than x in the expr: "x++;" for the add, constant 1, and final load operations.
- More tests
- Improvements to the test helpers.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1576583003 .
2016-01-11 10:19:08 -08:00
Matthias Hausner 4ffdcb76df Eliminate phase parameter in constructors
Super initializer calls get implicitly moved to the end of the initializer list, so we don't need the two-phase constructor protocol anymore.

Ryan, can you please look at the mirror changes and check wether I've missed something?

BUG=
R=asiva@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/1569213003 .
2016-01-08 15:41:51 -08:00
John McCutchan 789ed02b39 Don't test directly against Scanner::kNoSourcePos instead use >= 0.
A follow up CL will introduce new sentinel token positions that are < Scanner::kNoSourcePos (-1)

Gazoo

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1568353002 .
2016-01-08 12:20:24 -08:00
Vyacheslav Egorov 2306f29cc4 Remove unreachable exits from the list collected by InlineExitCollector.
Otherwise we might crash if we try to inherit a deoptimization target
from an unreachable exit as it was not visited by SSA construction and
has no environments attached to it.

R=fschneider@google.com
BUG=http://dartbug.com/25364

Review URL: https://codereview.chromium.org/1563703005 .
2016-01-07 15:21:47 +01:00
John McCutchan a0260c8c24 Add token position to StoreStaticFieldInstr
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1568713002 .
2016-01-06 14:38:54 -08:00
John McCutchan 6e4dcdf879 Add a token position to LoadLocal, StoreLocal, and LoadStaticField instructions
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1569613002 .
2016-01-06 13:29:01 -08:00
John McCutchan 89d05debec Improve token position for the entry CheckStackoverflowInstr
- Have it use the same token position as the DebugStepCheckInstr at entry.
- Add a token pos to ConstantInstr (but it's not really used yet).

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1561833006 .
2016-01-06 11:21:00 -08:00
Florian Schneider e9968ca5ff Fix VM bug with try-catch inside of try-finally.
There were two exception handlers with the same index added to the code so that only the one added
last was executed. In case of an exception that means that a re-throw may be omitted, causing invalid
control flow.

Also, add assertion to ensure unique try-index for exception handlers.

BUG=#25333
R=hausner@google.com

Review URL: https://codereview.chromium.org/1569523002 .
2016-01-06 18:50:53 +01:00
John McCutchan cb8b641cc9 Make Scanner::kNoSourcePos be a true sentinel value
- It is possible to write a Dart program with a function token_pos of 0.
- Switch Scanner::kNoSourcePos from 0 to -1.

R=hausner@google.com

Review URL: https://codereview.chromium.org/1564493002 .
2016-01-06 09:06:28 -08:00
Regis Crelier 48bc8bbf33 Remove instantiator argument in generated code for type tests.
R=srdjan@google.com

Review URL: https://codereview.chromium.org/1533383003 .
2015-12-21 13:07:32 -08:00
Florian Schneider 4a037f0ccb VM: Use read-only handle Object::dynamic_type() where possible.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1528873002 .
2015-12-16 11:31:53 +01:00
Matthias Hausner 648e52baa8 Collect closure functions in isolate
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 .
2015-11-17 15:40:27 -08:00
Florian Schneider 598018bd21 VM: Fix bug with ??= expressions using await.
Moving the construction of ?? into the parser using LetNode, so that the await-transformations are properly applied.

a ?? b becomes { temp = a; temp !== null ? temp : b; }

a ??= b becomes { temp = a; temp != null ? temp : a = b; }

BUG=issue #24392
R=hausner@google.com

Review URL: https://codereview.chromium.org/1417733007 .
2015-11-03 21:47:06 +01:00
Florian Schneider 05ad578b77 VM: Don't rely on always running constant propagation in the optimizer
When inlining functions that unconditionally throw (have zero normal returns),
the optimizer inserts a branch with a true condition and relies on
 constant propagation to remove the rest of the caller which becomes unreachable
 after inlining.

 This allows to compilesuch functions without running constant propagation by
 replacing uses of the return value with null.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1419553005 .
2015-10-30 22:48:59 +01:00
Srdjan Mitrovic 772ee329c4 Make ICData changes thread safe (first compute array, then set it). Install code in the main thread instead of in the background compilation thread.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1410363005 .
2015-10-26 15:12:29 -07:00
Srdjan Mitrovic c9a7080f47 nt # Enter a description of the change.
Set invocation counter to INT_MIN once a function is entered into the optimization queue, so that it does not get repeatedly triggered. Mutex on megamorphic cache lookup. Make AttachCode thread safe. Cleanups.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1413233004 .
2015-10-21 11:00:08 -07:00
Ryan Macnak a9fcf0ee8b Trace through const objects instead of spying on flow graph construction to find closure functions. Allows dropping local closure functions the optimizing compiler removes.
Remove a dead local function from Uri.parse.

Don't rely on HasCode to indicate a function's callees have been visited because it misses functions compiled by const evaluation.

Add missing VM entry point.

dart2js ARM
libprecompiled.so -2.7%
precompiled.isolate -3.4%

R=srdjan@google.com

Review URL: https://codereview.chromium.org/1409523003 .
2015-10-14 15:30:42 -07:00
Ryan Macnak 1a5a8fb58a Don't assume at least one closure function is encountered before tree-shaking. Allow for uncompiled closure functions and drop them.
R=srdjan@google.com

Review URL: https://codereview.chromium.org/1400193003 .
2015-10-13 14:56:35 -07:00
Srdjan Mitrovic 6f53350611 Move deopt_id and related helpers/definitions from Isolate to Thread
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1390153004 .
2015-10-13 10:08:14 -07:00
Srdjan Mitrovic 8d618766a8 Remove isolate argument from handle allocation: Part II
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org/1389353004 .
2015-10-12 14:06:50 -07:00
Florian Schneider 8adefa8e79 VM: Support phis with pair representations.
This enables unboxed int64 values in phis on 32-bit platforms (ia32, ARM, MIPS).

On ia32 I measured SHA256 +14%, SHA1 +6%, MD5 +2%.

BUG=
R=johnmccutchan@google.com, regis@google.com

Review URL: https://codereview.chromium.org//1377113004 .
2015-10-08 11:43:55 +02:00
Ryan Macnak 129d7d3cec Ensure the debugger considers parameters to be in scope at the method entry debug step.
Push entry debug step check after parameter capturing and give it the token position of the last parameter.

BUG=http://b/24200673
R=hausner@google.com

Review URL: https://codereview.chromium.org/1393453004 .
2015-10-07 12:33:29 -07:00
Srdjan Mitrovic d867784de5 Cleanups and preemptively pass Heap::kOld whenever subtype testing in compiler
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1377453005 .
2015-09-29 11:05:54 -07:00
Siva Annamalai 79ef28317f Changes to prepare for allowing script snapshots to be taken after running the main application:
- Rename accessors of class Field to make it more apparent as to what is being accessed (static field values or instance field offsets
- Use precompiled initializer state (Used only during precompilation) to also store saved initial value of static fields (Used only during application snapshot   generation)

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

Review URL: https://codereview.chromium.org//1289643005 .
2015-09-04 11:03:46 -07:00
Regis Crelier 1abc4ce8e9 Reduce the number of captured variables in async code, by only capturing local
variables that are in scope at each await location.

R=hausner@google.com

Review URL: https://codereview.chromium.org//1308163006 .
2015-09-02 18:29:32 -07:00
Regis Crelier e6225bee44 Improve async code in VM by not unnecessarily capturing parameters of async and
sync closures, thereby avoiding copy of parameters on entry.
Remove variable aliases in local scopes now that another mechanism detects
use-before-define cases. Keep aliases only for captured variables of outer
functions thereby speeding up scope lookups for all Dart code (not just async).
The next step will be to try to reduce the number of captured variables in
async code.

R=hausner@google.com

Review URL: https://codereview.chromium.org//1317213003 .
2015-08-27 16:49:07 -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
Srdjan Mitrovic 1a1ff00a29 Use zone when allocating handles in FlowGraphCompiler assembling operations. Add profiling VM tags for parse and flow graph builder, active only when --profile_vm. Lazily generate IR constant_value handles.
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1263573010 .
2015-08-03 10:10:24 -07:00
Ryan Macnak 8a3e134502 Non-tree-shaking --precompile.
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1261673004 .
2015-07-30 15:29:19 -07:00
Ryan Macnak c165fee611 Insert debug step check at the beginning of a function.
BUG=http://dartbug.com/23827
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1237203002 .
2015-07-14 15:27:44 -07:00
Srdjan Mitrovic 5711c13f69 Make frequent type checks (instanceof) faster by adding dedicated instanceof methods; improves dart2js startup
There is a possibility of adding intrinsics for all new instanceOf methods; my measurements did not show any benefits, therefore they were removed from this CL.

BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1222863003 .
2015-07-07 10:20:41 -07:00
Srdjan Mitrovic fbc9f6b9d8 Fix (optimizer) crashes in conditional nodes when result is not needed.
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1211593004.
2015-06-24 11:30:50 -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
Ivan Posva f5e3f94019 Fix http://dartbug.com/23578:
- Complete revamp of isolate-specific flags.
- Associate flags with the isolate on creation.
- Dart_CreateIsolate and associate callback do take an
  extra flags argument.
- Make sure to clear IC data array when clearing code.

BUG=23578

Review URL: https://codereview.chromium.org//1162033005
2015-06-07 17:57:34 +02:00
Regis Crelier a5669190ab Fixed breakpoint handling at return statement with inlined finally clauses.
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1170483002
2015-06-03 15:25:42 -07:00
Regis Crelier 4bf6db0c25 Adjust context level when required before executing inlined finally clauses.
Add regression test.

BUG=23537
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1154823003
2015-06-03 10:31:48 -07:00
Florian Schneider 63209c93d3 Fix result cid of CompactLinkedHashMap._index native getter.
This field can be null when a hash map is deserialized from a snapshot where
the index is regenerated.

BUG=
R=iposva@google.com, koda@google.com

Review URL: https://codereview.chromium.org//1159393003
2015-06-03 17:01:31 +02:00
Daniel Andersson ea46192ca3 VM-internalize the default Map implementation.
Make the compact linked hash map, which is the default implementation for Map
(including map literals), a VM-internal class.

This makes it easy to have more efficient serialization of maps (although for
now, the implementation is straight-forward).

Refactor the compact hash class hierarchy to enable the VM-internal class and
the rest (also the Set classes) to share a maximal amount of code, by using
two different bases for implicit/explicit fields.

Remove existing proof-of-concept, C++-based internal VM-class.

BUG=http://dartbug.com/22982
R=asiva@google.com

Review URL: https://codereview.chromium.org//1151523002
2015-05-28 09:32:54 -07:00
Srdjan Mitrovic 91651f8805 Remove value check from ICData checks/house-keeping
BUG=
R=johnmccutchan@google.com, vegorov@google.com

Review URL: https://codereview.chromium.org//1153963002
2015-05-27 13:17:28 -07:00
asiva@google.com c363448f55 Fix build bot failures.
Review URL: https://codereview.chromium.org//1128333005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45743 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-12 18:55:43 +00:00
asiva@google.com 579fc0fd2e Some more cleanup of the finger print checking code.
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45742 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-12 18:14:18 +00:00
srdjan@google.com 3ac643115f Remove unneeded flag declaratiosn (enable_type_checks, enable_asserts).
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45647 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 16:48:43 +00:00
srdjan@google.com 4cce388543 Add flag --support_debugger, controls emitting single stepping checks. Disable in --noopt, 6% gain.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45641 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 10:33:12 +00:00
koda@google.com b5ea484105 Share code for building recognized native getters.
Internalizing the maps will add a few more of these, so let's avoid duplication.

R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45547 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-06 02:49:56 +00:00
fschneider@google.com 8b806c67b9 Revert parts of r45502 and always generate guard field instructions.
R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45506 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-04 20:32:41 +00:00
fschneider@google.com e2afe6429c VM: Improve unoptimized code size by avoid emitting field guards.
Avoid emitting field guard code for fields that have dynamic cid and/or
no fixed length. To keep unoptimized and optimized flow-graphs in sync, the
deopt-id counter has to be advanced accordingly if the guard instructions are
not emitted.

If optimizations are disabled via --noopt, do not emit any field guards and
edge counters.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45502 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-04 18:46:39 +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 9a2468736a Add support for debug break in Dart source.
The new flag --enable-debug-break turns the otherwise illegal Dart statement
  break "message";
into a break instruction preceded with a debug message, the equivalent of
emitting an Assembler::Stop("message").
Add a language test expecting a syntax error without the flag.
Change expected break instruction in arm64 simulator.
Remove constants related to now deleted simulator tracing on mips and arm64.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45218 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-16 19:32:48 +00:00
fschneider@google.com d2513e7841 Add assertion for variable index of reused potentially reused AST nodes.
The flow graph inliner reuses the callee ASTs, therefore nodes may already
have an index assigned. Make sure it matches.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44995 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-09 09:08:06 +00:00