Commit Graph

182 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 33efb39372 Fix a bug in Equals for UseVal and ConstantVal.
TEST=vm/intermediate_language_test.cc
Review URL: https://chromiumcodereview.appspot.com//10828414

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11037 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-21 13:07:40 +00:00
fschneider@google.com 253c3f8499 Implement class id checks as a separate instruction and add a local CSE optimization pass.
This CL contains:
A new CheckClassComp instruction. Currently it is used only for instance loads:
(LoadInstanceFieldComp)

A pass LocalCSE that performs block-local common subexpression elimination. To identify
redundant expressions I use a hash map per basic block. Computations that do not have
side effects can participate in CSE. For now, I only enabled it for CheckClass.
Any computation that participates in CSE must implement the AttributesEqual function.


Other smaller fixes:

Places where we can pass the correct initial size for GrowableArrays
that have a known size. We should consider having a FixedLengthArray for this purpose.

Made the accessors ic_data() and set_ic_data() use a const ICData*.
Review URL: https://chromiumcodereview.appspot.com//10824349

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10948 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-20 12:40:14 +00:00
zerny@google.com 798b5652a8 Replaced Value by Definition in the renaming environment.
Needed so the SSA renaming environment does not contribute uses in the use list.

R=kmillikin@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10894 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-17 13:06:08 +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 b6d1804071 Reenable elimination of strict equals when right side is true.
Reenable some Smi check eliminations. Soon Florian will factor out class checks into own instruction where the elimination will be moved.
Implement more ResultCid()-s, removed TODO to make it asbtract because almost all computations return kDynamicCid.
Review URL: https://chromiumcodereview.appspot.com//10827387

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10865 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-16 22:22:57 +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 df23e58a2f Change indexed load and store IL instructions to fit with SSA backend.
Generic indexed operations are implemented as normal instance calls. Specialized
operations are inserted by the flow-graph optimizer. This also avoid a lot of duplicated code
in the code generator.
Review URL: https://chromiumcodereview.appspot.com//10836239

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10727 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-15 13:54:38 +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
srdjan@google.com 8299db1ff0 Optimize equality for case when all targets are Object.equals.
Also fixes a couple of issues with https://chromiumcodereview.appspot.com/10830275/
Review URL: https://chromiumcodereview.appspot.com//10826285

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10615 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-13 23:44:07 +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
fschneider@google.com 94fa6055ab Optimize expressions of the form (expr === true) when expr has boolean type.
This allows us to generate better code for many short-circuit
expressions like a || b, a && b if we can statically determine the type
of the subexpressions.

Also: Avoid disassembling optimized functions twice with --disassemble --disassemble-optimized.
Review URL: https://chromiumcodereview.appspot.com//10830275

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10568 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-13 13:10:00 +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
zerny@google.com 24771817a2 Added def-use chain to the intermediate language.
R=fschneider@google.com,kmillikin@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10497 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 12:35:59 +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
vegorov@google.com b9aa74f3a2 Eliminate phis that do not reach any non-environment uses.
This takes care of phis for temporary variables like :expr_temp, lia, lix, igr, casc, alloc, sca that currently create unnecessary pressure on the back-edge of loops.

R=srdjan@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10377 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-08 12:38:21 +00:00
kmillikin@google.com 4a24120c8d Move all register allocator environment initialization into class Environment.
Move the register constraints and initial live ranges of environment values
out of the register allocator and into the environment class.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10342 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-07 15:53:02 +00:00
fschneider@google.com 99e28aacb6 Refactor Instruction classes to use a template base class.
This change makes instructions and computations more uniform.

Also make CreateArrayComp take a register input operand. This
is done by changing the convenience DECLARE_COMPUTATION macro accordingly and use
TemplateComputation as base class for call-instructions.
Review URL: https://chromiumcodereview.appspot.com//10831178

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10330 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-07 10:34:39 +00:00
srdjan@google.com 10b1928a3d Add deopt info to code object and print it. Still missing is the code to 'execute' the deopt instructions and thus deoptimize.
Review URL: https://chromiumcodereview.appspot.com//10823131

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10308 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-06 21:15:26 +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 e2c7f2449d Make CreateArrayComp a call by using explicit push-argument instructions.
This enables SSA compilation of functions containing CreateArray. Currently,
we don't support call-instructions that have pushed arguments and also take
input operands in registers. This will be done in a separate CL.
Review URL: https://chromiumcodereview.appspot.com//10831176

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10284 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-06 11:38:45 +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 04fa2e3547 Refactor our IL instruction for static setters.
We do not need a separate IL instruction anymore. Instead I generate
a normal static call and save the result in a temporary local if it
is needed.
Review URL: https://chromiumcodereview.appspot.com//10825176

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10222 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-03 11:14:07 +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
fschneider@google.com 8eee3f1899 Eliminate unnecessary deoptimization environments.
This CL adds a CanOptimize predicate to every instruction. Before register
allocation there is a simple pass over the IR to remove environments from
instruction that never deoptmize. This reduces the number of uses and shortens
live ranges of values resulting in better code.
Review URL: https://chromiumcodereview.appspot.com//10829098

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10115 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-01 12:09:10 +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
regis@google.com 8fe3e69e37 Improve static type propagation.
Review URL: https://chromiumcodereview.appspot.com//10823022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9943 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-26 16:04:36 +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
vegorov@google.com c9e8d9594e Add support for fixed parameters in the register allocator.
This remove bailout for functions with non-zero number of non-fixed parameters and increases our coverage.

SpillSlot location was renamed into StackSlot location and now allows to address spill slots (positive stack index) and incoming parameters (negative stack index).

Environment was reordered to match order of values on the stack (previously it was inversed).

Correctly reserve spill slots in the prologue of the code. Previously register allocator was allocating spill slots, but generated code did not reserve any space for them on the stack so they might have been overwritten by calls.

Fix off by one in DeoptimizationStub::GenerateCode - we were reserving one slot too many.

Change --optimization-filter flag to use substring search instead of prefix comparison, this is much more useful when VM prefixes function name with a path to the file.

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9934 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-26 13:21:39 +00:00
kmillikin@google.com 30936fefa2 Implement deoptimization in the SSA compiler as a parallel move.
R=srdjan@google.com,vegorov@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9931 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-26 10:40:09 +00:00
fschneider@google.com ac0dd6c295 Add a backward instruction iterator and use it in the liveness analysis.
This avoids the complication when collecting the initial live_in sets while iterating forward.

Also simplify the ForwardInstructionIterator class because we have Goto instructions now and
the last instruction of each block does not use the next-link to
indicate a fall-through anymore.
Review URL: https://chromiumcodereview.appspot.com//10796108

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9875 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-25 08:31:50 +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 16e25206d1 New linear scan allocator.
Review URL: https://chromiumcodereview.appspot.com//10800037

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9851 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-24 16:01:54 +00:00
srdjan@google.com 9df3e4deaa Add higher-level accesses to Environment. Print flow graph after register allocation. Most interesting with --print-flags --print-environments
Review URL: https://chromiumcodereview.appspot.com//10800080

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9826 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-23 20:29:51 +00:00
srdjan@google.com c490158706 Cleanups.
Review URL: https://chromiumcodereview.appspot.com//10809047

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9795 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-20 23:42:23 +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