Commit Graph

47 Commits

Author SHA1 Message Date
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 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 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 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 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 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 df6881a022 Do not use recursion for depth-first traversal of straight line code.
For straight-line sequences of intermediate instructions, use iteration in
the depth-first search implementation.

R=srdjan@google.com
BUG=
TEST=vm/CodeIndexTable should pass on x64

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5660 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-19 21:57: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 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
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 295d7260b1 Generate code for instance of: copy from CodeGenerator. More code needed for the instantiator "thing"
Review URL: https://chromiumcodereview.appspot.com//9665029

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5329 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-12 16:12:04 +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
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
srdjan@google.com 15d1961630 Implement strict comparison and native calls in flow graph compiler x64.
Review URL: https://chromiumcodereview.appspot.com//9624025

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5179 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 17:15:35 +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 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
srdjan@google.com fcebdcf28a Add Load/Store Static/Instance fields.
Review URL: https://chromiumcodereview.appspot.com//9586024

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4972 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-05 19:07:08 +00:00
kmillikin@google.com 6f1fc66fdd Remove an unneeded temp in instance setters and indexed stores.
R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4938 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-05 10:26:07 +00:00
kmillikin@google.com 0930238061 Support instance getters and setters, indexed loads and stores.
These can be supported as instance calls.  In the case of instance
setters and indexed stores, there is a new computation type because of
the semantics of preserving the value.  For the example program:

void test(e) {
  print(e.forty_two);
  print(e.forty_two = 41);
}

we generate the graph:

 0: [target]
    t0 <-LoadLocal(e)
    t0 <-InstanceCall(get:forty_two, t0)
    StaticCall(print, t0)
    t0 <-#0
    t1 <-LoadLocal(e)
    t2 <-#41
    t0 <-InstanceSetter(t0, t1, t2)
    StaticCall(print, t0)
    return #null

and emit the correct code.

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4861 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-02 09:47:49 +00:00
kmillikin@google.com 9058b2b8f3 Implement StaticCall and InstanceCall in the new code generator.
1. Introduce a value visitor for argument values.

2. Add enough information to StaticCallComp and InstanceCallComp IL
computations so that we can generate code.

3. Enable code generation for them.

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4859 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-02 09:03:45 +00:00
srdjan@google.com efbfa66368 Adding Native Call node : a native function consists of that node, it does call into C runtime. In this case I am not sure if we should copy all fields from AstNode to Computation node or should we store the AstNode and access data indirectly.
Review URL: https://chromiumcodereview.appspot.com//9559012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4809 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-01 17:43:27 +00:00
hausner@google.com eb6fe72a42 Teach the flow graph compiler to play nice with the debugger
Add PC descriptors for return statements. Fixing blood red build bot.
Review URL: https://chromiumcodereview.appspot.com//9523001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4725 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-28 21:53:35 +00:00
kmillikin@google.com b565b15849 Expand the instruction visitor to visit computations and values.
For compilation passes we will want a visitor that can reach computations
and values, rather than virtual functions in the computation/value classes.
Implement the visitor signature and double dispatching.  Use it to remove
the virtual Print functions.

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4664 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-28 08:58:49 +00:00
kmillikin@google.com 862dc2f03c Add enough compiler support to compile empty functions on x64.
Implement a simple compilation visitor for the intermediate language.  Copy
code from the x64 code generator to support compilation of functions with no
arguments, no locals, and that return a literal.

Compiled code is not used, but it can be disassembled and visually checked
against the code from the old code generator.

R=srdjan@google.com
BUG=
TEST=expected to pass all tests on x64

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4601 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-27 08:28:51 +00:00
kmillikin@google.com 3fb8b5985e Ensure that outgoing constant arguments will be materialized.
This keeps the IL simple for the benefit of the optimizing compiler.
It intentionally relies on a particular temporary allocation strategy
for the non-optimizing compiler.

For the dart function

main() {
  var x = 2;
  hukairs(1, x, 3);
}

The flow graph is:

 0: [target]
    StoreLocal(x, #2)
    t0 <-#1
    t1 <-LoadLocal(x)
    t2 <-#3
    StaticCall(hukairs, t0, t1, t2)
    return #null

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4600 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-27 08:04:24 +00:00
kmillikin@google.com 7fd32d779b Incorporate some review comments.
Clean up a couple of style TODOs from an earlier review.

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4599 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-27 07:56:37 +00:00
srdjan@google.com 397f15c454 Added LoadLiteralComp, StrictCompareComp; implement InstanceCallNode.
Review URL: https://chromiumcodereview.appspot.com//9456033

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4580 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-24 22:37:57 +00:00
srdjan@google.com e8114222fe New compiler, intermediate language, type testing and casting changes as agreed with Kevin.
Review URL: https://chromiumcodereview.appspot.com//9454022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4554 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 22:51:18 +00:00
kmillikin@google.com 023b02d54c Implement a simple InstructionVisitor class.
The instruction visitor visits each block and for each block each
instruction.  Rewrite the instruction printing code to use this new
visitor.

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4547 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 18:29:58 +00:00
kmillikin@google.com 164832b3a3 Add type testing and casting support.
Introduce a virtual tag() function to Instruction classes, use it to
implement type testing and casting.  Use type testing and casting to
eliminate some virtual functions on the instruction classes.

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4546 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 18:15:11 +00:00
kmillikin@google.com 392cdd56ef Recognize basic block entries in the flow graph.
Also, instead of keeping a list of all instructions, keep a list of only
block entries.  The printing implementation is changed (for the better) to
use the new representation.  With --use_new_compiler and --print_flow_graph
the function:

main() {
  var f = 1;
  var n = 5;
  while (n > 0) {
    f = f * n;
    n = n - 1;
  }
  print(f);
}

prints as:

 0: [target]
    StoreLocal(f, #1)
    StoreLocal(n, #5) goto 1
 1: [join]
    t0 <-LoadLocal(n)
    t0 <-InstanceCall(>, t0, #0)
    if t0 goto(2, 3)
 2: [target]
    t0 <-LoadLocal(f)
    t1 <-LoadLocal(n)
    t0 <-InstanceCall(*, t0, t1)
    StoreLocal(f, t0)
    t0 <-LoadLocal(n)
    t0 <-InstanceCall(-, t0, #1)
    StoreLocal(n, t0) goto 1
 3: [target]
    t0 <-LoadLocal(f)
    StaticCall(print, t0)
    return #null

R=srdjan@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4515 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 09:09:45 +00:00
kmillikin@google.com 41e77a0a9e Initial implementation of a flow-graph builder for Dart's AST.
Visit the AST and generate an instruction (ie, not basic-block) flow
graph.

The flow graph for the simple function:

main() {
  var f = 1;
  var n = 5;
  while (n > 0) {
    f = f * n;
    n = n - 1;
  }
  print(f);
}

is:

       1: StoreLocal(f, #1)
       2: StoreLocal(n, #5)
       3: [join]
       4: t0 <-LoadLocal(n)
       5: t0 <-InstanceCall(>, t0, #0)
       6: if t0 goto(7, 15)
       7: [target]
       8: t0 <-LoadLocal(f)
       9: t1 <-LoadLocal(n)
      10: t0 <-InstanceCall(*, t0, t1)
      11: StoreLocal(f, t0)
      12: t0 <-LoadLocal(n)
      13: t0 <-InstanceCall(-, t0, #1)
      14: StoreLocal(n, t0) goto 3
      15: [target]
      16: t0 <-LoadLocal(f)
      17: StaticCall(print, t0)
      18: return #null

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4460 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 15:20:13 +00:00