Commit Graph

189 Commits

Author SHA1 Message Date
vegorov@google.com 7a6cdd92c7 Remove support for non-ssa optimizing code generation.
This kills FrameRegisterAllocator and related code.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11045 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-21 13:58:57 +00:00
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 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
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
zerny@google.com 5cc78d2a33 Refactored FlowGraphBuilder into a separate FlowGraph representation.
R=kmillikin@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10807 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-16 12:06:17 +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
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 fdfcde6046 In checked mode, make sure the ssa compiler propagates the checked types of
incoming arguments.
Propagate the type of the receiver and of the constructor phase argument.
Review URL: https://chromiumcodereview.appspot.com//10855134

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10605 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-13 21:09:28 +00:00
hausner@google.com 6a1a13901d Support for new operator -
Implement unary operator -. Operator negate is still recognized,
but internally it is represented like unary -. In particular,
operator negate no longer implies an instance method named
negate.

Marked several co19 tests that use "negate" as failing and filed
co19 issue 169 to have these tests updated.
Review URL: https://chromiumcodereview.appspot.com//10830253

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10523 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 18:30:22 +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
hausner@google.com 45b76746b5 Fix super getter/setter
Fix handling of super getters and setters. In particular, parser
now correctly converts super getters into super setters for
compound assignment, and pre- and postfix increment operators.

co 19 tests still fail because super index operator is broken.
Will work on this next.
Review URL: https://chromiumcodereview.appspot.com//10849004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10413 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-08 18:02:51 +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 3bdeb8f453 Add a function's initial stack check to the IL instruction stream.
This stack check needs a GC safepoint.  It is simplest to implement
that by exposing it as an explicit instruction.

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10338 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-07 13:43:46 +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
kmillikin@google.com 9ffbf2ffce Store variable counts in the flow graph builder.
Store the constant counts of copied parameters, non-copied parameters, and
(non-parameter) stack locals in the flow graph builder.  This saves passing
them around to flow graph member functions.

Change usage of "fixed parameter" to "non-copied parameter" because it is
different than what fixed parameter means in other parts of the system.

R=fschneider@google.com,zerny@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10289 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-06 14:33:23 +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
zerny@google.com c1262fbd49 Reapply "Added support for copied parameters to the SSA compiler."
This reapplies svn revision 10172 with a bug fix.

Original Review URL: https://chromiumcodereview.appspot.com//10837076

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10280 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-06 10:07:26 +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
turnidge@google.com 2803d78dfd Change the zone allocation api.
Instead of passing a size in bytes to the allocation function, we now
have a templatized Alloc function:

  zone->Alloc<Type>(len)

This is better for security, as we can check for integer overflow in
the size computation before performing the allocation.  Before, we
often failed to check this.
Review URL: https://chromiumcodereview.appspot.com//10836061

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10254 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-03 21:51:44 +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
regis@google.com 12de02cbab Associate the correct type to method receivers (instead of Dynamic type).
Properly name the first implicit parameter to factories as ':type_arguments'
(instead of 'this', which made it accessible to user code).
Various cleanup.
Review URL: https://chromiumcodereview.appspot.com//10831142

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10203 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-02 23:00:55 +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
kmillikin@google.com 0d699e6c15 Revert "Added support for copied parameters to the SSA compiler."
This reverts svn revision 10172.

TBR=zerny@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10173 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-02 15:10:13 +00:00
zerny@google.com 41f9e67324 Added support for copied parameters to the SSA compiler.
R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10172 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-02 14:53:18 +00:00
vegorov@google.com 71c2638506 Fix structure of WhileDo graph.
Normal entry to the loop should not go through a continue join.

R=kmillikin@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10171 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-02 14:39:49 +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
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
regis@google.com 4968398d2a Nitpicking.
Review URL: https://chromiumcodereview.appspot.com//10807093

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9863 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-24 20:39:21 +00:00
asiva@google.com ec7f44f025 Create frequently used symbols in the vm isolate
- Avoids the need for doing a NewSymbol on these everytime
- saves space as they get shared by isolates
Review URL: https://chromiumcodereview.appspot.com//10783035

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9834 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-24 00:01:50 +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 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
regis@google.com 318edd938c Hide names of internal classes from the user by mapping them to the documented
interfaces they implement.
Review URL: https://chromiumcodereview.appspot.com//10800002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9748 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-18 21:51:27 +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
regis@google.com b86a40f48f Fix type checking of void type.
Fix library and tests accordingly.
Add new test.
Disable new test for dart2js.
Disable some now failing co19 tests (new issue 158 filed).
Hide internal VM String types from user (not complete).
Review URL: https://chromiumcodereview.appspot.com//10787021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9681 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-16 21:34:07 +00:00
regis@google.com dc96874999 Revert fix for type checking of void type, because some top level tests fail.
Review URL: https://chromiumcodereview.appspot.com//10784020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9673 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-16 19:05:38 +00:00
regis@google.com a8ceb243f6 Fix type checking of void type.
Fix library and tests accordingly.
Add new test.
Disable new test for dart2js.
Disable some now failing co19 tests (new issue 158 filed).
Hide internal VM String types from user (not complete).
Review URL: https://chromiumcodereview.appspot.com//10704216

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9672 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-16 18:05:55 +00:00