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
A separate object type for the code cache have been added. This object has two different code caches. The first one (default_cache) is a fixed array organized in the same way as the as the code cache was before. The second cache (global_access_cache) is for code stubs to access the global object. This cache is organized as a hash table taking the property name and code flags as the key.
The reason for separating the global access stubs into a hash table representation is that the number of these is not bounded in the same was as the other types.
This is a remake of r3952 (http://codereview.chromium.org/652119) which have the additional ability to look for the index of code stubs for access to the global object.
BUG=http://code.google.com/p/v8/issues/detail?id=613
Review URL: http://codereview.chromium.org/717001
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4066 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
Remove messages.h from v8.h and include it explicitly in only the few places
it is needed. Many files relied on getting handles-inl.h implicitly from
messages.h through v8.h, so include handles-inl.h explicitly in v8.h
instead.
Remove zone-inl.h from header files where it is not needed, can be replaced
by a forward declaration, or can be replaced by zone.h (specifically,
factory.h and heap.h). Include zone.h or zone-inl.h in header files where
it was implicitly included via heap.h or factory.h. Prefer zone.h over
zone-inl.h in header files where possible by including zone-inl.h in .cc
files.
Review URL: http://codereview.chromium.org/668248
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4058 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
A variable usage analysis pass was run on toplevel and lazily-compiled
code but never used. Remove this pass and the data structures it
builds.
The representation of variable usage for Variables has been changed
from a struct containing a (weighted) count of reads and writes to a
simple flag. VariableProxies are always used, as before. The unused
"object uses" is removed.
Review URL: http://codereview.chromium.org/669270
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4052 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
When Array(0) or new Array(0) is handled by the generated code it is handled
by the same code as Array() and new Array(). For this to work the stack is
tweaked to remove the argument of value 0. However the argc was still passed
as 1 if a call to the runtime system was made.
When the stack is tweaked argc is also changed to 0.
BUG=634
TEST=test/mjsunittest/mjsunit/regress/regress-634.js
Review URL: http://codereview.chromium.org/668155
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4038 ce2b1a6d-e550-0410-aec6-3dcde31c8c00