Commit Graph

71 Commits

Author SHA1 Message Date
fschneider@google.com 855e718f5b Make Value not a subclass of Computation.
Instead I introduce one new computation to materialize constants.

sizeof(UseVal) drops from 64 to 32.
sizeof(ConstantVal) drops from 48 to 16.
Review URL: https://chromiumcodereview.appspot.com//10829451

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11041 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-21 13:36:36 +00:00
fschneider@google.com e07438b906 Reland "Record the arguments for CreateArrayComp correctly as arguments.".
This time on the correct branch.

The elements are not real uses and are therefore not maintained accordingly.

BUG=dart:4563

TBR=vegorov@google.com
Review URL: https://chromiumcodereview.appspot.com//10860007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10884 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-17 11:46:28 +00:00
srdjan@google.com 564e747c2b Propagate class ids using existing type propagation framework.
Review URL: https://chromiumcodereview.appspot.com//10830339

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10849 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-16 17:39:37 +00:00
regis@google.com 4bc16ae3f7 Cleanup handling of NullType in type propagation.
Remove AssertAssignable type checks from graph (when possible), rather than just
marking them as eliminated.
Review URL: https://chromiumcodereview.appspot.com//10828319

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10782 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-15 23:49:12 +00:00
fschneider@google.com c9e6717757 Split ToDouble into two IL instruction to make it work with SSA.
This CL removes the bailout from SSA on smi-to-double conversions.

The smi-to-double conversion is implemented as a call and requires
its operand pushed, the double-to-double conversion has normal input
operands.
Review URL: https://chromiumcodereview.appspot.com//10834311

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10710 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-15 11:31:51 +00:00
iposva@google.com 99d563982c - Support for patching of class methods and fields.
Review URL: https://chromiumcodereview.appspot.com//10827288

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10616 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-14 00:38:01 +00:00
regis@google.com 4000bbad60 Eliminate condition type check when possible.
Review URL: https://chromiumcodereview.appspot.com//10832277

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10610 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-13 22:31:07 +00:00
srdjan@google.com 6456518776 Use type propagation for removing Smi checks in binary operations and comparisons. Regis will adapt type propagation to collect/propagate class ids and merge them into sets (arrays).
Added printing for propagated types and parameter instructions.
Review URL: https://chromiumcodereview.appspot.com//10823278

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10545 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-11 00:09:12 +00:00
vegorov@google.com 1cf5cc74aa Put PushArgument into the environment instead of raw values.
This allows to shorten live ranges and avoid spilling when PushArgument is the last real use of the value.

BUG=

Review URL: https://chromiumcodereview.appspot.com//10825282

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10508 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 14:28:02 +00:00
regis@google.com f1bdaf504a Retrying r10475 (now with null check):
Continue work on type propagation in optimizing compiler (still WIP).
Propagated types are cached in ssa definition nodes.
Type propagation iterates until fix point is reached.
Type checks are marked as eliminated when possible.
Review URL: https://chromiumcodereview.appspot.com//10854084

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10478 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 01:26:13 +00:00
regis@google.com 7e27be6b90 Revert r10475.
Review URL: https://chromiumcodereview.appspot.com//10831252

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10476 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 00:39:42 +00:00
regis@google.com 28bd435419 Continue work on type propagation in optimizing compiler (still WIP).
Propagated types are cached in ssa definition nodes.
Type propagation iterates until fix point is reached.
Type checks are marked as eliminated when possible.
Review URL: https://chromiumcodereview.appspot.com//10829270

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10475 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 00:07:21 +00:00
vegorov@google.com 3a121cc677 Align AllocateObjectComp and AllocateObjectWithBoundsCheckComp with ssa allocator.
AllocateObjectComp becomes a call computation with all arguments pushed via PushArgument.

AllocateObjectWithBoundsCheckComp pushes inputs internally.

R=fschneider@google.com
BUG=

Review URL: https://chromiumcodereview.appspot.com//10855053

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10453 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-09 19:34:41 +00:00
asiva@google.com d4d781d636 - Unify class ids and snapshot object ids list so that we don't have disparate
and sometimes confusing values.
- Remove instance_kind_ field from RawClass.
- Rename all class id names to have a Cid suffix.
- Remove code from object.h and object_store.h which dealt with object ids
  of predefined classes for snapshots.
Review URL: https://chromiumcodereview.appspot.com//10827209

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10418 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-08 19:46:23 +00:00
regis@google.com 6f5281c404 Get rid of ast node ids.
Rename cid to deopt_id.
Review URL: https://chromiumcodereview.appspot.com//10832150

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10306 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-06 20:24:03 +00:00
kmillikin@google.com 1093cf4fe5 Allocate the environment's location backing store during register allocation.
The code relies on the addresses of elements in this backing store.  It was
correct but difficult to guarantee when it was a growable array's backing
store.

R=vegorov@google.com
BUG=

Review URL: https://chromiumcodereview.appspot.com//10831179

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10290 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-06 15:13:21 +00:00
fschneider@google.com 442b981575 Replace InstanceSetterComp instruction with a plain instance call.
After my last change to InstanceSetterComp we do not need a separate
IL instruction for it anymore.
Review URL: https://chromiumcodereview.appspot.com//10829164

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10278 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-06 08:55:13 +00:00
fschneider@google.com 3c5c1dc4bd Separate double binary operation into a separate instruction class.
Double operation are currently implemented as calls, so they need
arguments pushed on the stack. Smi and Mint operations are not calls,
so they are handled with the same instruction as before.
Review URL: https://chromiumcodereview.appspot.com//10850014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10178 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-02 16:26:46 +00:00
fschneider@google.com e5bd4af606 Support Throw and ReThrow in SSA-based compiler.
This change makes them call-instructions using explicit push-arguments.
Review URL: https://chromiumcodereview.appspot.com//10829141

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10176 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-02 15:54:42 +00:00
fschneider@google.com 362c202998 Use explicit push-argument for InstanceSetter instruction.
This allows optimizing functions with InstanceSetter.
Review URL: https://chromiumcodereview.appspot.com//10826097

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10157 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-02 10:23:29 +00:00
regis@google.com ba83d02f9e Add type propagation phase in optimizing compiler (work in progress).
Remove unused cid field from Instruction node and add it to nodes subclassing
Instruction that need it: BranchInstr, ReturnInstr, ThrowInstr, ReThrowInstr.
Remove unused icdata field from Instruction node and add it to BranchInstr.
Review URL: https://chromiumcodereview.appspot.com//10830109

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10125 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-01 17:15:55 +00:00
vegorov@google.com 45e3affbb3 Ensure that we never try to split range at its end position.
Move parallel moves corresponding to gotos and block entries into this intructions to separate them from normal parallel moves that are used data flow inside basic blocks.

Block fixed locations only from instruction's start to instruction end (not to the start of the next instruction).

R=fschneider@google.com
BUG=

Review URL: https://chromiumcodereview.appspot.com//10821108

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10065 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-31 16:28:09 +00:00
fschneider@google.com 8203892ada Refactor building arguments for InstanceCall and fix deoptimization environment for pushed arguments.
This CL enables SSA compilation of functions containing InstanceCallComp computations.

It also contains a bug fix to correctly simulate the deoptimization environment for argument
expressions.
Review URL: https://chromiumcodereview.appspot.com//10833068

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10011 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-30 13:26:31 +00:00
fschneider@google.com c87efe45fa Add explicit PushArgument IL instructions to static calls.
This enables compiling static calls with the SSA-based code generator.

Add a helper to the graph builder for adding argument expressions to the graph.
Review URL: https://chromiumcodereview.appspot.com//10824078

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10008 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-30 11:19:42 +00:00
fschneider@google.com e7853aab37 Add an explicit push-argument instruction to the IL.
It is used in ClosureCall and CreateClosure. Refactoring the other call-instruction
will be done in a separate CL.

These instructions do not have their arguments as input operands anymore since they
are really call-arguments passed on the stack.

This allows us to optimize a function with closure calls with SSA. For example:

foo() {
  bar() { return 42; }
  return bar();
}
Review URL: https://chromiumcodereview.appspot.com//10825035

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9935 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-26 14:10:29 +00:00
srdjan@google.com 67de9f1323 Some cleanups.
Review URL: https://chromiumcodereview.appspot.com//10806099

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9874 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-25 00:25:00 +00:00
srdjan@google.com b7ef0471e3 Add HasSSATemp and an assert to ssa_temp_idnex setter.
Review URL: https://chromiumcodereview.appspot.com//10806089

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9859 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-24 17:39:07 +00:00
vegorov@google.com d83a634324 Add spill slot locations.
Review URL: https://chromiumcodereview.appspot.com//10805053

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9810 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-23 14:05:48 +00:00
srdjan@google.com 66d31c8b23 Fix crash during parallel moves. Made MoveOperands ZoneAlloacted. Non-const ValueObjects a fragile, since it is easy to modify a copy instead of the original. It is also dangereous to use pointers to ValueObjects that contain copy constructors.
Review URL: https://chromiumcodereview.appspot.com//10806047

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9790 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-20 21:16:06 +00:00
srdjan@google.com 26e3afe496 Apply Kevin's suggestions, make branch-compare generation more robust
- remove setting previous link during graph building
- do not replace already inserted nodes
Review URL: https://chromiumcodereview.appspot.com//10808035

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9778 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-20 15:20:11 +00:00
srdjan@google.com 2016081f87 Fuse compare with branch at graph building time.
Review URL: https://chromiumcodereview.appspot.com//10802025

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9762 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-19 15:52:44 +00:00
kmillikin@google.com e440d86cb5 Revert "Revert "Introduce Goto instructions to the flow graph.""
Reapply svn revision 9731 with a bug fix.  The original review is at
http://chromiumcodereview.appspot.com/10735071/

R=vegorov@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10805008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9738 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-18 13:44:12 +00:00
kmillikin@google.com a368233743 Revert "Introduce Goto instructions to the flow graph."
This reverts svn revision 9731 due to test failures.

TBR=vegorov@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10808008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9733 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-18 10:44:54 +00:00
kmillikin@google.com 87d743a3c5 Introduce Goto instructions to the flow graph.
Goto is a control instruction with a single successor.

Before: basic blocks ended with an exit (return, throw, or rethrow), a
branch to a pair of target entries, or else they fell through to the
next block entry.

Now: basic blocks end with an exit, a branch, or an explicit goto to a
join entry.

R=vegorov@google.com,srdjan@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10735071

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9731 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-18 10:28:37 +00:00
srdjan@google.com f5b544c948 Equality compare should record two arguments in IC data. Inline double equality comparison.
Review URL: https://chromiumcodereview.appspot.com//10702195

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9644 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-13 20:17:42 +00:00
vegorov@google.com 1bd5a9b414 Skeleton of a linear scan register allocator.
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10696151

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9563 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-11 18:52:17 +00:00
vegorov@google.com 1ae72fbd8b Change comparison-to-branch fusion to actually remove comparison from the graph.
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10698153

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9556 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-11 17:41:54 +00:00
srdjan@google.com b4e299e2c1 Improve code for checked instance calls (polymorphic calls) and expand printing of PolymorphicInstanceCall to include checked class names.
Review URL: https://chromiumcodereview.appspot.com//10698128

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9520 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-10 18:22:45 +00:00
kmillikin@google.com ac0025ebd3 Use the instruction iterator rather than an explicit loop in more places.
R=vegorov@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10704119

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9467 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-09 12:58:36 +00:00
kmillikin@google.com 6bd463ee85 Rename the successor field of instruction to next.
Renaming only change to use a name parallel to 'previous'.

R=vegorov@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10693122

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9464 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-09 11:38:29 +00:00
fschneider@google.com a411bf5045 Add forward iterator to iterate instructions inside a basic block.
It is currently only used in SSA renaming.
Review URL: https://chromiumcodereview.appspot.com//10692107

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9438 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-06 12:31:37 +00:00
kmillikin@google.com 5f541253ad Eliminate the type distinction between BindInstr and DoInstr.
Represent the distinction between computations whose value is used and
computations whose value is unused with a data member (instead of a
separate type).

R=fschneider@google.com,srdjan@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10700111

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9416 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-05 10:06:28 +00:00
fschneider@google.com 767b5d4439 Add support for fixed parameters in SSA builder and fix a bug in the pre-order graph traversal.
Each fixed parameter is initially defined by a ParameterInstr as definition. This
definition is not in the instruction stream, but just in the initial environment
at the graph entry so that the live range of all parameters start at the same point.

The pre-order spanning tree was computed in the wrong way which caused test failures
when building SSA because renaming relies on the dominator tree which depends on
the preorder spanning tree.

Also change the IL printing functions to be more compatible with the visualizer tool.
Review URL: https://chromiumcodereview.appspot.com//10735002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9391 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-04 10:24:19 +00:00
fschneider@google.com 3dcdc79ffe Add deoptimization environments to instructions.
Each instruction that can deoptimize need to have the values of the
non-optimizing code as uses. The values are stored in an environment
(GrowableArray<Value*>) attached to the instruction when constructing
SSA form.

For now every instructions gets a deoptimization environment. It contains
the values of all locals, parameters and expression stack elements at
the start of the instruction.

The environment is not used yet, but can be printed in the flow graph
with the flag --print-environments.
Review URL: https://chromiumcodereview.appspot.com//10696090

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9345 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-03 12:54:03 +00:00
fschneider@google.com eba7136e7b Make IL instructions a doubly-linked list within basic blocks.
In order to be able to efficiently iterate backwards over instructions
and removing or replacing instructions in the graph we want them to
be a double-linked list inside basic blocks. The list has the following

1. Block entry instructions do not have a previous instruction.
2. The last instruction in a block may or may not have a next instruction:
   - Branches have a NULL-successor.
   - Normal block exits have a block entry instructions as successor.

This CL also makes the accessor for previous and next instruction in this
list non-virtual. This avoidis the current code duplication there.
Review URL: https://chromiumcodereview.appspot.com//10665022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9297 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-02 16:08:58 +00:00
fschneider@google.com da315f478e Revert r9253 because of dartium test failures
TBR=vegorov
Review URL: https://chromiumcodereview.appspot.com//10693048

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9256 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-29 17:27:12 +00:00
fschneider@google.com 6e4bc9fb91 Add a goto instruction to the IL use it to terminate basic blocks.
Having an explicit control instruction at the end of each
basic block allows to easily remove instructions inside
a block because the last_instruction pointer can not change.
Review URL: https://chromiumcodereview.appspot.com//10700034

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9253 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-29 16:31:37 +00:00
fschneider@google.com 63d4ad7d5f Add new files and data structures for the new register allocator.
This CL adds new files to hold the new register allocator and
adds a parallel-move instructions that will be used to insert
moves for register constraints, spills and phi-resolution.

No new functionality added yet.
Review URL: https://chromiumcodereview.appspot.com//10635020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9027 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-22 10:59:06 +00:00
srdjan@google.com 3b0fd96a70 Fuse Comparison->BooleanNegate->Branch.
Review URL: https://chromiumcodereview.appspot.com//10559072

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8914 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-20 16:25:11 +00:00
fschneider@google.com b42a49f107 Fix a bug in SSA renaming.
This CL changes the order of step 2a and 2b in the SSA renaming: Uses of
LoadLocal/StoreLocal must be renamed first so that the environment is correctly
updated for StoreLocal instructions.

A simple example showing the bug:

test_xy() {
  var x = 1;
  var y = 2;
  var z = 3;
  for (var i = 0; i < 5; i++) {
    y = z = x;
    x++;
  }
  return x + y + z;
}

Also in this change:
- changed the printing of SSA operands to v0, v1, .. instead
of t0, t1 to better distinguish them from non-SSA operands.
- make sure that UseVal are always copied when renaming phi 
input operands. 
Review URL: https://chromiumcodereview.appspot.com//10583014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8893 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-20 10:08:01 +00:00