Commit Graph

68 Commits

Author SHA1 Message Date
srdjan@google.com 344aba1e75 Assign ids to incoming arguments (to be used in checked mode).
Review URL: https://chromiumcodereview.appspot.com//10115053

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6718 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-19 00:04:47 +00:00
regis@google.com 75de3a8cc2 Move type check elimination from backend to graph builder in new compiler.
Review URL: https://chromiumcodereview.appspot.com//10021070

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6713 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-18 21:58:46 +00:00
srdjan@google.com 953daeaf89 Add more timing information.
Review URL: https://chromiumcodereview.appspot.com//10116012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6697 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-18 15:53:20 +00:00
srdjan@google.com 64226e65ac Share intrinsification framework across architectures, started on instrinsification in the new compiler x64.
Review URL: https://chromiumcodereview.appspot.com//10035006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6661 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-17 22:44:41 +00:00
regis@google.com 9c9652be6f Implement condition type checks in new compiler, thereby removing last bailouts.
Remove svn:eol-style property on various files.
Review URL: https://chromiumcodereview.appspot.com//9969192

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6613 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-17 00:17:33 +00:00
srdjan@google.com 04100d8ced Introduce an equality compare node. Equality will need to be handled specially soon (not just an instance call) and today it needs special code for efficeintly handling null receivers (null-class is never entered into IC data). This fixes a significant performance regression between the old and the new compiler.
Review URL: https://chromiumcodereview.appspot.com//10079018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6544 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-13 22:35:57 +00:00
regis@google.com cb6c1b27f3 Implement checked mode in new compiler.
The only remaining bailout is the boolean type check for conditions.
Review URL: https://chromiumcodereview.appspot.com//10080015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6542 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-13 22:16:59 +00:00
srdjan@google.com 36b456b3b4 Simplify code in code code generator, move checks to flow graph builder. We can assume that any type analysis will occur before the code generator gets called.
Review URL: https://chromiumcodereview.appspot.com//10069042

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6532 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-13 16:49:22 +00:00
srdjan@google.com f122c9e1b7 Add node id for return node.
Review URL: https://chromiumcodereview.appspot.com//10038032

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6484 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-12 21:57:57 +00:00
srdjan@google.com a0a700026f Eliminated last bailout (except for type checked mode) in the new compiler: generate type arguments for instanceof if needed.
Review URL: https://chromiumcodereview.appspot.com//10071016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6467 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-12 17:20:43 +00:00
srdjan@google.com 3bf28e7d3f Implement finally in new compiler.
Review URL: https://chromiumcodereview.appspot.com//9999045

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6419 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-11 17:35:06 +00:00
srdjan@google.com d154a7ffce Try/catch in new compiler. Added try index to appropriate instructions. If any instruction throws an exception, the try index tells us which catch entry the exception belongs to.
Review URL: https://chromiumcodereview.appspot.com//10014006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6389 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-10 23:22:40 +00:00
srdjan@google.com fdc147509e Fix a crash in graoh builder where a throw node is added in an expression tree by the parser: allow throws in expressions by not closing the fragment, instead return null as value.
Review URL: https://chromiumcodereview.appspot.com//10032009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6340 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-09 21:31:15 +00:00
srdjan@google.com 76df5fac83 Implement object allocation/construction as effect (no result), sequence labels and unchaining from context.
Review URL: https://chromiumcodereview.appspot.com//10005010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6226 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-05 16:23:22 +00:00
srdjan@google.com 74e2768550 Implement context cloning in new compiler.
Review URL: https://chromiumcodereview.appspot.com//9961019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6206 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-04 23:10:21 +00:00
srdjan@google.com 4c9fe5b040 Implement closure with type arguments.
Review URL: https://chromiumcodereview.appspot.com//9978014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6196 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-04 20:56:46 +00:00
srdjan@google.com ea5a4fac30 New compiler: implement switch/case in graph builder.
Review URL: https://chromiumcodereview.appspot.com//9959127

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6180 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-04 17:56:53 +00:00
srdjan@google.com 87d8bb5039 Implement StringConcatNode in flow graph builder (it is ised on for "+" on strings, will be soon removed).
Review URL: https://chromiumcodereview.appspot.com//9959134

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6179 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-04 17:25:35 +00:00
regis@google.com ab0a25eb1d Add missing type checks for top level static initializers (issue 1980 and
duplicates 1957, 2070, 2224).
Review URL: https://chromiumcodereview.appspot.com//9958091

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6145 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-03 20:23:30 +00:00
srdjan@google.com f51f25cd28 Implement JumpNode handling (continue, break) in Dowhile and While nodes.
Review URL: https://chromiumcodereview.appspot.com//9958070

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6098 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-02 18:08:35 +00:00
regis@google.com 5282e44fb2 Use null type argument vector instead of vector of Dynamic for a generic raw
type when possible.
Fix type finalization of type parameters (always finalize in the context of the
class being parameterized and not in the enclosing class where the type
parameter is used).
Fix wrong generic optimization and added a test (a generic type instantiated
from a raw instantiator is not always raw).
Added printing of type argument vectors.
Review URL: https://chromiumcodereview.appspot.com//9939003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6068 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-30 22:16:52 +00:00
srdjan@google.com ac580abf42 Implement JumpNode for break/continue in for loops.
Review URL: https://chromiumcodereview.appspot.com//9907001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6050 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-30 17:18:34 +00:00
srdjan@google.com 86472e6dfd Add contexts.
Review URL: https://chromiumcodereview.appspot.com//9726024

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5793 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-23 21:26:34 +00:00
kmillikin@google.com be9bc9c068 Compute immediate dominators using SEMI-NCA.
This is a version of the Lengauer-Tarjan algorithm that is both simpler and
faster.

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5737 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-21 23:45:20 +00:00
regis@google.com 18bd10e96a Implement StaticGetter and StaticSetter in new compiler.
Review URL: https://chromiumcodereview.appspot.com//9726011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5664 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-19 23:09:06 +00:00
kmillikin@google.com 7c43fbb9a3 Make the CFG depth-first traversal do more work for us.
Turn the depth-first traversal into a pass to discover the graph's basic
block structure.  Record basic-block predecessors in the block entry
instructions.  Also record the last instruction in a block in the block
entry instruction (giving constant-time access to the block's successors).

Also, record the depth-first spanning tree of the traversal to be used for
dominator computation.

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5655 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-19 19:39:14 +00:00
srdjan@google.com 1f072a6171 Remove possibility of critical edges.
Review URL: https://chromiumcodereview.appspot.com//9722009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5601 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-16 23:06:39 +00:00
kmillikin@google.com 6653fd66eb Compute preorder as well as postorder basic block orderings.
The Lengauer-Tarjan dominator/dominance frontier algorithm needs to
visit the blocks in reverse preorder (in the first pass) and preorder
(in the second).  Compute that at the same time as postorder (e.g.,
using the same spanning tree).

Take this chance to make the flow graph visitors always operate on a
forward block ordering.

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5598 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-16 22:20:04 +00:00
srdjan@google.com d4dcb9fee0 Clean-up CodeGenState: remove unused loop_level and move context_level to CodeGenerator (and add it to FlowGraphBuilder).
Review URL: https://chromiumcodereview.appspot.com//9706086

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5571 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-16 15:38:43 +00:00
kmillikin@google.com 6e7fa43e58 Simplify translation of conditionals in the flow graph builder.
Allow the builder to assume that, if control flow reaches a conditional
expresion, there is always control flow to two branches.

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5546 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-15 21:52:27 +00:00
srdjan@google.com b9ba050c9c Make Throw and ReThrow instructions instead of computations. That way they can terminate a basic block.
Review URL: https://chromiumcodereview.appspot.com//9699090

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5539 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-15 20:42:01 +00:00
regis@google.com 9827cdc826 Split the computation of uninstantiated type arguments between the factory case
and the constructor case, as suggested in my review of
https://chromiumcodereview.appspot.com/9700003/

Examples of generated IL (first factory, second non-factory).

 foo() { return new List<T>(); }
 moo() { return new A<T>(); }

==== file:///home/regis/test.dart_A_foo
 0: [target]
    t0 <- LoadLocal(this)
    t0 <- NativeLoadField(t0, 16)
    t0 <- ExtractFactoryTypeArguments(t0)
    t0 <- StaticCall(List., t0)
    return t0
==== file:///home/regis/test.dart_A_moo
 0: [target]
    t0 <- #null
    t1 <- LoadLocal(this)
    t1 <- NativeLoadField(t1, 16)
    t2 <- Pick(t1)
    t2 <- ExtractConstructorTypeArguments(t2)
    t0 := t2
    t1 <- ExtractConstructorInstantiator(t1, t2)
    t0 <- AllocateObject(Library:'file:///home/regis/test.dart' Class: A, t0, t1)
    t1 <- Pick(t0)
    t2 <- #3
    StaticCall(A., t1, t2)
    return t0

This change removes the computation that previously returned two values at the
cost of a some small code duplication. We could address this duplication by
exposing the computation recognizing the identity vector at the IL level and
implement a branch.
Review URL: https://chromiumcodereview.appspot.com//9703080

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5537 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-15 20:16:29 +00:00
srdjan@google.com fdb793e189 Add Throw and ReThrow nodes. Rethrow not yet tested (bailout with untested), since it needs the try/catch implementation. Discuss if Throw/ReThrow shoudl be computations or instructions. We have one case in parser where throw is added into the expression tree.
I suggest introducing an EndInstr that has no successor and use it for throw and return. (TODO: Discuss and chnage if necessary). Currently we generate code even after the throw.
Review URL: https://chromiumcodereview.appspot.com//9706032

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5490 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-14 21:47:43 +00:00
srdjan@google.com daa7217127 Implement more of allocation code using type arguments. Type argument extraction for non-factories produces two results, however, instructions can produce only one temporary. Use a stack placeholder so that we have room to push two results. Examples of generated IL (first factory, second non-factory).
foo() { return new List<T>(); }
  moo() { return new A<T>(); }

==== file:///sources/dartall/dart/runtime/Test.dart_A_foo
 0: [target]
    t1 <- LoadLocal(this)
    t1 <- NativeLoadField(t1, 16)
    t1 <- ExtractTypeArguments(t1)
    t0 <- StaticCall(List., t0)
    return t0
==== file:///sources/dartall/dart/runtime/Test.dart_A_moo
 0: [target]
    t0 <- #null
    t1 <- LoadLocal(this)
    t1 <- NativeLoadField(t1, 16)
    t1 <- ExtractTypeArguments(t1)
    t0 <- AllocateObject(Library:'file:///sources/dartall/dart/runtime/Test.dart' Class: A, t0, t1)
    t1 <- Pick(t0)
    t2 <- #3
    StaticCall(A., t1, t2)
    return t0
Review URL: https://chromiumcodereview.appspot.com//9700003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5480 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-14 18:51:47 +00:00
srdjan@google.com aca2d7ffe0 Optional arguments in new compiler.
Includes Issue 9664062: Support allocating and calling closures in the new non-optimizing compiler (with fixes)
Review URL: https://chromiumcodereview.appspot.com//9693020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5419 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 17:35:05 +00:00
kmillikin@google.com b05d117185 Support allocating and calling closures in the new non-optimizing compiler.
As part of this change, variable allocation is split out from the backend
code generator.

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5392 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 12:31:45 +00:00
srdjan@google.com 8d524a5a23 Implement factory call.
Review URL: https://chromiumcodereview.appspot.com//9664023

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5331 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-12 16:22:50 +00:00
srdjan@google.com be77f7a015 Implementing ConstructorCall: part I.
Review URL: https://chromiumcodereview.appspot.com//9646008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5264 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 22:40:37 +00:00
srdjan@google.com c333da7111 Implement logical AND/OR.
Review URL: https://chromiumcodereview.appspot.com//9649012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5253 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 21:34:58 +00:00
kmillikin@google.com 147527a2d0 Implement increment of locals.
R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5228 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 11:41:22 +00:00
kmillikin@google.com 33d36027b1 Implement compilation of conditional expressions.
R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5227 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 11:22:33 +00:00
kmillikin@google.com 0a08aa5c22 Support compilation of ArrayNode.
R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5223 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 09:39:29 +00:00
kmillikin@google.com ecee314841 Support compilation of for loops.
R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5219 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 09:02:20 +00:00
kmillikin@google.com 0aa83907a7 Handle instance field and indexed increment operations.
Handle pre- and post-increment (decrement) in effect and non-effect
contexts.

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5160 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 11:06:02 +00:00
kmillikin@google.com 1c06eed2b6 Implement branching control flow in the non-optimizing graph compiler.
Bind a label on block entry, implement branching.

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5159 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 10:00:26 +00:00
srdjan@google.com 25b3c2feeb Implement '==', '!=' and instanceof (without code generation).
Review URL: https://chromiumcodereview.appspot.com//9615025

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5123 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 21:12:29 +00:00
kmillikin@google.com 01695137f8 Turn CopyTemp and SetTemp into instructions.
These were always used and assumed to be in a stylized form (CopyTemp in
Bind and SetTemp in Do).  Make this required by the IL.  This change allows
eliminating the relative indexing in favor of temporary names, without
restructuring the compiler at all.

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5072 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 10:24:01 +00:00
srdjan@google.com d6abdfb6b8 Eliminate IncrOpStaticFieldNode, replace a set of nodes.
Review URL: https://chromiumcodereview.appspot.com//9592031

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5063 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 00:40:48 +00:00
srdjan@google.com 28aa93c232 Implement DoWhile.
Review URL: https://chromiumcodereview.appspot.com//9553008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5055 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-06 21:02:56 +00:00
kmillikin@google.com 0a9194319d Implement postfix indexed increment.
Chosen because of its wartiness.  A pair of new computations are introduced
to allow the IL to express duplication of temporaries and storing to
temporaries.  These will be translated away by the optimizing compiler, but
allow the instruction stream to represent exactly the deoptimization state
we are intereseted in (with at most one deopt point per instruction).

Translation of:

test(a, i) {
  return a[i]++;
}

is

 0: [target]
    t0 <-#0
    t1 <-LoadLocal(a)
    t2 <-LoadLocal(i)
    t3 <-CopyTemp(-1)
    t4 <-CopyTemp(-1)
    t3 <-InstanceCall([], t3, t4)
    SetTemp(-3)
    t4 <-#1
    t3 <-InstanceCall(+, t3, t4)
    InstanceCall([]=, t1, t2, t3)
    return t0

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5012 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-06 09:49:21 +00:00