Change more functions used by the Compiler class to have a uniform
interface: they get passed as argument an input/output pointer to a
CompilationInfo that they mutate if they succeed, and they return a
flag telling whether they succeeded.
Also, remove some unnecessary timers.
Review URL: http://codereview.chromium.org/3561012
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5583 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
For some reason, the scope's arguments and arguments shadow were
variable proxies, which resulted in all references to the arguments
shadow being shared in the AST. This makes it hard to put per-node
state on the AST nodes.
I took the opportunity to remove Variable::AsVariable which has
confused people in the past, and to rename Variable::slot to the more
accurate Variable::AsSlot.
Review URL: http://codereview.chromium.org/3432022
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5517 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
The flow graph has been simplified to remove the special branch, join,
and exit nodes. All nodes are now basic blocks (possibly empty to
preserve edge-split form) with a distinguished entry and exit block.
Most trivial expressions are not added to the flow graph as
instructions. The assigned variable analyzer has been changed to
sometimes work right-to-left so that right subexpressions can be
marked as trivial.
The reaching definitions analysis has been temporarily removed, and
the analyses that depended on it (primitivity analysis, dead code
marking) as well.
Review URL: http://codereview.chromium.org/1530003
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4307 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
As part of aggressive dead code elimination, we initially assume all
flow-graph instructions are not live. We mark those that are critical
and recursively all their children. The children of variable
references (VariableProxies occurring as rvalues) include all their
reaching definitions.
Review URL: http://codereview.chromium.org/1159005
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4246 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This change adds a data-flow pass to statically determine
if a variable contains a primitive type.
It requires building the flow graph and computing reaching
definitions as pre-requisites. The analysis annotates all
VariableProxy nodes with the result.
Review URL: http://codereview.chromium.org/1132005
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4224 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This change adds the option to peel off the first iteration of inner loops.
Loop peeling is off by default and can enabled by a flag. It also requires building a flow graph.
As part of this I added the possibility to clone AST nodes.
Review URL: http://codereview.chromium.org/998001
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4205 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
Use the classical worklist algorithm to compute reaching definitions.
All nodes are initially put on the worklist. Until the worklist is
empty, nodes are removed, their RD_in is recomputed, and if it changes
their successors are added to the worklist.
Review URL: http://codereview.chromium.org/853004
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4113 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
Reaching definitions in (RD_in) is initially empty for all nodes. Gen
and kill sets are computed. AST node numbers are used for nodes to
refer to their definition number.
Also: two small changes to flow graph printing. Children of branch
nodes are visited in right-to-left order when performing depth first
search. Instructions are numbered locally within blocks so as to not
destroy AST node number before printing (it's useful to print the
definition).
Review URL: http://codereview.chromium.org/876001
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4107 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This change adds a pass over the AST that computes the
set of assigned variables for locals and parameters for each expression.
The result of this analysis is used to for two purposes:
1. Recognize variables that are trivial subexpressions. A left sub-expression
of a binary operation is trivial if it is a local variable or a parameter
and it is not assigned in the right sub-expression. In the case of a
trivial left sub-expression we evaluate the right first.
Currently only binary operations and compare operations are considered
when finding trivial left sub-expressions.
2. Recogize certain simple for-loops with a constant trip count where the loop
variable is always within smi range. If the loop count variable is not
assigned in the body of the loop (except in the update expression the
for-loop). This allows omitting smi checks on operation using the loop
count variable.
Review URL: http://codereview.chromium.org/669155
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4087 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
Visitor stack overflow is used to signal an unsupported construct in
the flow graph. Check for it in more places. Make the utility
functions for appending to graphs handle more cases if they can be
handled correctly.
Remove the entry node in favor of a block with a NULL predecessor as
single entry. Represent the empty flow graph as a single empty block.
Add empty blocks lazily where needed to preserve edge-split form.
Review URL: http://codereview.chromium.org/804003
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4086 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
Before computing reaching definitions, the set of all definitions in a
function must be collected and they must be numbered. Have the flow
graph builder collect definitions for stack-allocated variables into a
list, and implicitly number them with their list index.
Review URL: http://codereview.chromium.org/668257
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4064 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
The flow graph is built by walking the AST. Edges are labeled with
instructions (AST nodes). Normal nodes have a single predecessor edge and a
single (labeled) successor edge. Branch nodes are explicit, they have a
single predecessor edge and a pair of (unlabeled) successor edges. Merge
nodes are explicit, they have a pair of predecessor edges and a single
(unlabeled) successor edge.
There is a distinguished (normal) entry node and a distinguished (special)
exit node with arbitrarily many predecessor edges and no successor edges.
The graph is intended to support graph-based analysis and transformation.
Review URL: http://codereview.chromium.org/660449
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4051 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This change add simple local live variable information to
the fast code generator. It supports only AST nodes that
are accepted by the syntax checker.
Each variable use points to a variable definition structure
which contains the last use of the definition.
To determine whether a variable is live after a certain point
we can check whether its last use occurs later in the evaluation
order defined by the AST labeling number.
The new information is currently only printed out together with
the IR and not yet used for code generation.
Review URL: http://codereview.chromium.org/603004
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3839 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
Support a binary operation (bitwise OR) so long as it's not nested in
the left subexpression. This ensures that the expression stack never
has height greater than two and so can be kept fully in registers.
The bounded expression stack height and the absence of any side
effects on the fast path allows us to still bailout out to the very
beginning of the function if any of our fast-path checks fail.
Review URL: http://codereview.chromium.org/594008
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3822 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This is a first step towards loading globals directly from property cells instead
of going through a load IC.
This change supports only properties with the DontDelete attribute since
we are only able to bailout into the generic code generated by the secondary
code generator the beginning of a function. The resulting fast-case code is
specialized for a specific context. When invoked with a different global object,
it will always bailout to the secondary code.
When loading a property that does not exist at compile-time or a property
that is deleteable we still generate the generic load IC.
Review URL: http://codereview.chromium.org/565034
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3808 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This change adds a post-order numbering to AST nodes that
are relevant for the fast code generator. It is only invoked
together with the fast compiler.
Also changed the ast printer to print the numbering for
testing purposes if it is present.
Review URL: http://codereview.chromium.org/553134
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3738 ce2b1a6d-e550-0410-aec6-3dcde31c8c00