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
e801021a27
Cleanups.
...
Review URL: https://chromiumcodereview.appspot.com//10765007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9482 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-09 20:31:25 +00:00
regis@google.com
5919998308
Fix static type analysis of closure calls (issue 3959).
...
Add test.
Review URL: https://chromiumcodereview.appspot.com//10762003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9473 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-09 18:02:40 +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
0b1f1323cd
Remove the instruction pointer from computations.
...
Remove the back pointers from computations to instructions in favor of
passing the instruction explicitly when needed.
R=fschneider@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//10700123
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9435 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-06 11:10:53 +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
bece5d05c8
Fix a bug in SSA renaming introduced when using the RemoveFromGraph helper for removing instructions.
...
The helper function RemoveFromGraph resets previous and next instruction pointers to NULL
when deleting an instruction.
I changed it to return the successor of the removed instruction so that the function is
more convenient to use while iterating over the list of instructions.
Review URL: https://chromiumcodereview.appspot.com//10692072
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9332 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-03 08:35:00 +00:00
regis@google.com
d95cbc8d7f
Use VM type cast and save handles.
...
Review URL: https://chromiumcodereview.appspot.com//10693071
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9317 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-02 21:42:53 +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
regis@google.com
8997078334
Remove old code generator.
...
Review URL: https://chromiumcodereview.appspot.com//10665038
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9122 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-26 17:43:44 +00:00
asiva@google.com
5cbd276939
Make the parser agnostic to the TokenStream implementation. This is the first step towards compacting the token stream.
...
Pull the data stream writer/reader code out of snapshot into a generic file so that it can be reused into the token stream compaction implementation.
Review URL: https://chromiumcodereview.appspot.com//10632009
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9043 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-22 20:37:01 +00:00
srdjan@google.com
8ee92c41d6
Fixed a typo, one more reason to get rid of StrictCompare vs StrictCompareComp distinction.
...
Review URL: https://chromiumcodereview.appspot.com//10634032
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9039 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-22 18:28:16 +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
srdjan@google.com
60fa0b27ca
More ICData cleanups: try to use ICData instead of converting it to another intermediate representation. This sets the stage for more & simpler optimizations based on collected type feedback.
...
Review URL: https://chromiumcodereview.appspot.com//10594002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8877 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-19 21:49:11 +00:00
fschneider@google.com
123bfe4e08
Second step for computing SSA: renaming.
...
This CL adds the renaming step to the SSA construction. The renaming pass
initializes a start environment with the initial values of all locals (#null)
and parameters and removes LoadLocal and StoreLocal instructions from the
graph.
Right now the renaming does not support functions with parameters yet.
I added a TODO for this. The SSA form for a simple function with an if-statement:
function foo() {
var v = 0;
var x;
if (v == 0) {
x = 42;
}
return x;
}
looks as follows:
0: [graph]
#null
#null
1: [target]
t0 <- #0
t1 <- #null
t2 <- #0
t3 <- EqualityCompare(t0 == t2)
Branch if t3 goto (2, 3)
2: [target]
t5 <- #42 goto 4
3: [target] goto 4
4: [join]
t4 <- phi(t1,t5)
Return t4
Review URL: https://chromiumcodereview.appspot.com//10544206
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8839 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-19 11:39:02 +00:00
regis@google.com
1207cc2010
Fix bad assert in static type propagation.
...
Review URL: https://chromiumcodereview.appspot.com//10578004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8828 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-18 22:42:39 +00:00
vegorov@google.com
959cf98b00
Implement a simple register allocator that tries to keep instruction results in registers.
...
Add --optimization-filter flag that allows to disbable optimizations for all function which do not match prefix. This allows to quickly localize problems with code generation.
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//10559035
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8811 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-18 18:04:22 +00:00
vegorov@google.com
26fb4ca09a
Fix definition of CreateArrayComp::InputAt.
...
R=fschneider@google.com
Review URL: https://chromiumcodereview.appspot.com//10566025
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8780 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-18 11:39:04 +00:00
regis@google.com
7527d97cf5
Inline Math.sqrt in new compilers.
...
Review URL: https://chromiumcodereview.appspot.com//10542167
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8702 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-15 00:56:25 +00:00
srdjan@google.com
0d74d13f2b
Implement polymorphic instance calls.
...
Review URL: https://chromiumcodereview.appspot.com//10539145
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8678 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-14 18:07:43 +00:00
srdjan@google.com
681165b68b
Some cleanups, started implementing checked instance calls, better equality operation.
...
Review URL: https://chromiumcodereview.appspot.com//10541135
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8626 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-13 18:48:46 +00:00
vegorov@google.com
fadac390f3
Fuse comparisons that are used by branches together.
...
This allows us to eliminate materialization of boolean value.
Fix a bug in ToDoubleComp::LocationSummary on ia32.
R=srdjan@google.com
Review URL: https://chromiumcodereview.appspot.com//10536145
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8617 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-13 16:23:14 +00:00
fschneider@google.com
ee4a0fd042
First step to SSA construction: Phi insertion.
...
This CL contains the phi insertion step of the SSA construction algorithmus: The phi instructions inserted are not functional yet. Renaming is not included yet.
I based it on Kevin's CL (http://codereview.chromium.org/10388161/ ), rebased and fixed a bug (added missing iterator.Advance()) there.
It also reintroduces the Definition IL class because Phi-instructions are also
definitions that are referenced by UseVal.
I also added the set of immediately dominated blocks to each basic block.
This will be needed for pre-order dominator-tree traversal in the renaming pass.
Review URL: https://chromiumcodereview.appspot.com//10539108
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8604 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-13 13:36:04 +00:00
vegorov@google.com
bd19464867
Implement kDoubleToDouble and kIntegerToDouble on ia32 and x64.
...
Fix bug in assembling of cvtsi2sd on x64.
R=srdjan@google.com
Review URL: https://chromiumcodereview.appspot.com//10534116
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8593 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-13 08:29:40 +00:00
srdjan@google.com
5ad91ae250
Add stack check in loops so that loops can be stopped. Optimize relational operations.
...
Use class-ids to describe type of operation. Should we adapt BinaryOp to use class ids as well?
Review URL: https://chromiumcodereview.appspot.com//10536086
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8507 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-11 17:02:39 +00:00
vegorov@google.com
20549ee20d
Implement inlined LoadIndexed operation for arrays on x64.
...
R=srdjan@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//10538064
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8462 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-08 19:36:26 +00:00
srdjan@google.com
bd0bda32f0
Inline setters, getters, various cleanups & restructuring.
...
TODO: cid, token_index and try_index are often passsed around. We should pack them in a data structure.
Review URL: https://chromiumcodereview.appspot.com//10540040
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8406 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-07 19:49:50 +00:00
srdjan@google.com
0912e4ded7
More code for ia32, more shared code.
...
CreateArrayComp, EqualityCompareComp, StoreStaticField, LoadStaticField, StoreIndexedComp, StoreInstanceFieldComp, Throw, Rethrow, AssertBooleanComp.
Made more code shared, which has the disadvantage od splitting MakeLocationSummary from EmitNativeCode. Discuss.
Review URL: https://chromiumcodereview.appspot.com//10543013
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8343 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-06 15:42:07 +00:00
fschneider@google.com
84027c4457
Add flow graph printing into a .cfg file with flag --print-flow-graph-file.
...
This CL adds a flag --print-flow-graph-file which produces one
.cfg-file per isolate when enabled. Currently it prints the final
flow graph before code generation.
I also added SuccessorAt and SuccessorCount to allow easy iteration
over the successors of a basic block.
Review URL: https://chromiumcodereview.appspot.com//10446116
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8322 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-06 11:09:02 +00:00
srdjan@google.com
755790f46f
Adding unary op optimizations, missing assembly operations.
...
Review URL: https://chromiumcodereview.appspot.com//10440099
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8174 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-31 20:38:55 +00:00
regis@google.com
e0d223b30b
Address review comments in commited cl (issue 10460002).
...
Review URL: https://chromiumcodereview.appspot.com//10448079
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8144 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-31 08:31:30 +00:00
srdjan@google.com
d8f4aa2fd0
Use temporary variable for StoreIndexed that returns a value.
...
Review URL: https://chromiumcodereview.appspot.com//10448059
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8109 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-30 15:55:46 +00:00
regis@google.com
841467f0c7
Move CreateArray and CreateClosure to new location template.
...
Review URL: https://chromiumcodereview.appspot.com//10460002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8104 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-30 13:47:24 +00:00
srdjan@google.com
f624ef7821
Moved InstantiateTypeArgumentsComp and InstanceOfComp.
...
Review URL: https://chromiumcodereview.appspot.com//10440053
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8010 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-25 18:54:12 +00:00
srdjan@google.com
1a2bb17304
- Port AssertBool and AssertAssigneable to new location template.
...
- Change AssertAssigneable to always have instantiator and instantiator-type-arguments (if only as a null literal).
Review URL: https://chromiumcodereview.appspot.com//10446019
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7962 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-24 20:25:37 +00:00
srdjan@google.com
eeda4b5810
First step toward an optimizing compiler:
...
- Fix ic-data instrumentation
- Optimize '+' for Smi-s only, by replacing the instance call with inlined operations.
- Add deoptimization stub
- Add deoptimzation support.
Review URL: https://chromiumcodereview.appspot.com//10431006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7952 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-24 16:50:57 +00:00
iposva@google.com
63941a8d3a
- Rename NativeLoadField/NativeStoreField to LoadVMField/StoreVMField.
...
- Implement code patterns for LoadVMField/StoreVMField.
- Fix order of inputs in StoreVMField.
Review URL: https://chromiumcodereview.appspot.com//10451006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7936 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-24 01:13:04 +00:00
fschneider@google.com
13c3beec30
Make saving and restoring of the context around closure calls explicit.
...
This is a first step to refactor the codegen-templates to be reused
between optimizing and non-optimizing backend.
The context is now explicitly saved in a temporary local variable and
not passed as an argument to the ClosureCall instruction anymore.
Review URL: https://chromiumcodereview.appspot.com//10409043
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7811 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-21 17:59:02 +00:00
srdjan@google.com
d016f51e9c
Start porting fast typechecks to x64.
...
Review URL: https://chromiumcodereview.appspot.com//10407018
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7760 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-18 20:10:29 +00:00
fschneider@google.com
055ba590a4
Add IR printing into a supplied buffer and formatted comments on x64.
...
This change refactors printing function for instructions
so that they can be used for different purposes like
printing to stdout (what FlowGraphPrinter currently does),
creating code comments for the disassembler, or in the future
dumping the IR into a file.
I added an abstract interface to iterate over the inputs
of an computation: InputCount and InputAt. This is only
an intermediate step likely to change in the future. For
that I had to bring back the [] operator for zero-operand
instructions.
Review URL: https://chromiumcodereview.appspot.com//10407031
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7731 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-18 01:04:56 +00:00
regis@google.com
1f233e677e
Address a few TODOs related to type propagation.
...
Review URL: https://chromiumcodereview.appspot.com//10407026
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7716 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-17 18:47:45 +00:00
regis@google.com
f3aca487fe
First shot at static type propagation and type test elimination.
...
Review URL: https://chromiumcodereview.appspot.com//10399051
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7708 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-16 23:21:24 +00:00
kmillikin@google.com
e4030da968
Compute assigned variables and dominance frontiers.
...
During basic block discovery, compute assigned variables in each
block. After computing immediate dominators, compute dominance
frontiers. Both of these will be used for SSA construction.
R=fschneider@google.com ,srdjan@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//10377104
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7685 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-16 13:28:02 +00:00
kmillikin@google.com
75e43da991
Add a global graph entry.
...
Ensure all blocks including exception handlers are reachable from the
entry.
R=srdjan@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//10399026
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7681 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-16 12:10:02 +00:00