Commit Graph

285 Commits

Author SHA1 Message Date
fschneider@chromium.org
012db51660 Reuse backing store of two zone lists by using Rewind(0) instead of Clear().
Review URL: http://codereview.chromium.org/6647019

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7108 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-09 15:50:24 +00:00
kmillikin@chromium.org
a05a492254 Remove class HSubgraph.
Review URL: http://codereview.chromium.org/6647018

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7100 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-09 12:37:56 +00:00
kmillikin@chromium.org
d31594feae Refactor construction of switch statements to avoid subgraphs.
Refactor construction of switch statements so it doesn't use class
HSubgraph.

There are also a few improvements.  We do not use an auxiliary list of
comparisons because they're embedded as a linked list in the graph
under construction.  We share a common break block for all breaks from
the same switch.  We do not insert empty blocks unless necessary to
maintain edge-split form.

There is also a bug fix.  The entry to a clause body is a potential
join and must have a join ID set, otherwise deoptimization within the
body can go to an unpredictable place in the unoptimized code.

Review URL: http://codereview.chromium.org/6650021

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7099 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-09 12:06:54 +00:00
fschneider@chromium.org
4d2c3ee82d Avoid allocation of temporary zone lists when inserting representation changes.
Instead of allocating fresh temporary lists for every instruction, reuse
the same instance and reset it between instructions.

This reduces the amount of zone memory used for inserting the HChange
instructions roughly by half.

Review URL: http://codereview.chromium.org/6628079

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7094 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-08 15:08:36 +00:00
fschneider@chromium.org
12ba2dd435 Improve dead phi elimination.
This change splits the existing phi elimination into two phases:
1. Remove redundant phis
2. Remove dead phis with a fixed point iteration.

The new approach allows us to remove dead phis that are connected
in a cycle.

Review URL: http://codereview.chromium.org/6624061

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7085 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-08 10:04:23 +00:00
kmillikin@chromium.org
2662624988 Refactor inlined functions to avoid using subgraphs.
Function inlining no longer uses subgraphs.  We detect inlining in an
effect context and avoid materializing a return value earlier than we
did before.

Review URL: http://codereview.chromium.org/6635012

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7080 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-07 15:42:23 +00:00
kmillikin@chromium.org
c3172a6b7e Refactor polymorphic load and inline function graph construction.
Change the way we construct the graph for polymorphic loads to match that of
polymorphic stores.

Introduce a stack-allocated helper for saving and restoring all the
function-specific graph builder state that needs to change when we begin
translating an inlined function.  Make this class authoritative by moving
redundant state out of the builder and deferring to the current function's
state.

Ensure that we always print a tracing message when abandoning an inlining
attempt.

Review URL: http://codereview.chromium.org/6628012

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7074 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-07 11:52:36 +00:00
fschneider@chromium.org
db9e6dcd86 Mark HChange that convert to int32 with truncation with the appropiate flag.
Before we would compute the flag by iterating over all uses. The truncating 
flag is always determined at construction time since we already computed
the flag for all other instructions before inserting HChange instructions.

 
Review URL: http://codereview.chromium.org/6615012

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7047 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-03 13:50:16 +00:00
kmillikin@chromium.org
d6a041b8f9 Remove some more uses of subgraphs and more cleanup of the graph builder.
Do not use subgraphs to implement the translation of simple branching
control flow, for the function body entry, or for labeled blocks.

Combine all the loop construction functions into a single one.

Resolve a possible problem with duplicate AST IDs used both for joined loop
break blocks, the normal loop exit, and for their common successor, by never
introducing the extra (successor) block and instead making the normal loop
exit a predecessor of the break join block.  There is a similar issue with
joined continue blocks.

Remove a (never needed) two-element zone list per each time we replace one
hydrogen value with another.

Review URL: http://codereview.chromium.org/6604002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7027 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-02 14:09:59 +00:00
kmillikin@chromium.org
043a876e93 Translate loops without using subgraphs.
Build all loop graphs without using class HSubgraph.  This also eliminates a
silly goto for the update expression of a for loop.

Support for peeling loops is removed because it's currently untested.

Review URL: http://codereview.chromium.org/6602031

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7017 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-03-02 11:09:25 +00:00
kmillikin@chromium.org
ee2659d4e6 Remove all functionality from class HSubgraph.
Move the member functions of HSubgraph to HGraphBuilder.

Review URL: http://codereview.chromium.org/6573006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6958 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-28 08:52:00 +00:00
kmillikin@chromium.org
791c9e2c21 Remove most uses of HSubgraph as an argument.
In a lot of cases where we were passing a subgraph (a pair of basic blocks),
we actually only needed a basic block.

Review URL: http://codereview.chromium.org/6570006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6913 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-23 11:59:18 +00:00
fschneider@chromium.org
288b4fb8f4 HIR refactoring.
Review URL: http://codereview.chromium.org/6538080

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6910 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-23 11:19:50 +00:00
kmillikin@chromium.org
3c02d036a8 Partial refactoring of subgraphs.
Change the interface to the Hydrogen graph builder to appear like it
directly holds a current basic block and a current environment.
Remove some direct accesses to the current subgraph, and remove
subgraph accessors that simply forwarded to the exit block.

Review URL: http://codereview.chromium.org/6532088

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6887 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-22 10:32:16 +00:00
kmillikin@chromium.org
14e185b31b Change the translation of break/continue into Hydrogen.
Resolve break and continue when we see them, rather then deferring
them until later.

Review URL: http://codereview.chromium.org/6541060

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6878 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-22 08:40:10 +00:00
kmillikin@chromium.org
c1386c3381 Shorten live ranges for arguments to runtime calls.
Before, the live ranges of the arguments extended to the call itself, and
they were pushed immediately before the call.  Now, they are spilled eagerly
as soon as their value is available and they are spilled to the right place.

The inlined runtime calls in the optimized backend are changed to work as in
all the other backends: they get their arguments untranslated and can choose
their own custom evaluation order.

Review URL: http://codereview.chromium.org/6526047

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6876 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-22 06:25:01 +00:00
kmillikin@chromium.org
82cdd48b2f Fix a bug in deoptimization after logical expressions in an effect context.
When deoptimizing to after an expression of the form (expr0 || expr1)
or (expr0 && expr1) in an effect context, the unoptimized code could
incorrectly see the value of the expression.

Handle the short-circuit binary operators specially in effect contexts.
This fixes the issue and will generate better code when the left
subexpression is boolean-valued.

BUG=v8:1166

Review URL: http://codereview.chromium.org/6519046

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6831 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-17 11:06:50 +00:00
danno@chromium.org
12b4e0efe7 Implement crankshaft support for pixel array stores.
Review URL: http://codereview.chromium.org/6528013

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6817 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-16 13:31:12 +00:00
kmillikin@chromium.org
f2e38c6276 Refactor construction of polymorphic loads, stores, and calls.
Rather than passing in a pair of unequal-length lists, pass the default
subgraph separately.  Construct the typecase from the top down rather than
the bottom up, so it doesn't need an intermediate zone list.

Also, change a basic block's 'last' instruction field to really be its last
instruction by correctly updating it when inserting and removing
instructions.

Review URL: http://codereview.chromium.org/6516016

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6783 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-15 07:58:04 +00:00
fschneider@chromium.org
9bbb257b02 Small cleanup of unused code in hydrogen IR.
Review URL: http://codereview.chromium.org/6513008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6763 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-14 09:23:26 +00:00
kmillikin@chromium.org
3ef7ca6c28 Remove the uses of the arguments from all calls.
Before, Hydrogen call instructions had uses of the PushArgument instructions
for their arguments.  These operands were unneeded, bloated the IR, and
caused calls to be the only Hydrogen instructions with an unpredictable
number of operands.

Now, PushArgument is a pure side-effecting instruction that has no uses.

Review URL: http://codereview.chromium.org/6480030

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6749 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-11 13:20:06 +00:00
danno@chromium.org
1bd9f602be Implement crankshaft support for pixel array loads.
Review URL: http://codereview.chromium.org/6410112

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6725 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-10 12:02:36 +00:00
kmillikin@chromium.org
97ccdd1e99 Introduce a hydrogen value for contexts, support context slot assignment.
Each context in the context chain has a corresponding hydrogen value.
The context values are used for global object lookup and context slot
lookup.  Add simple (non-compound) assignment to context slots.

Review URL: http://codereview.chromium.org/6390003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6615 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-02-03 13:10:28 +00:00
fschneider@chromium.org
4e7ddab6dc Fix a bug in the placement of minus-zero checks and in GVN.
1. The placement of checks for negative zero has to be computed after
all conversion instructions have been inserted. I separated the code
into its own phase.

2. GVN need to take instruction flags into account when comparing
instructions for redundancy.

Review URL: http://codereview.chromium.org/6260035

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6534 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-31 12:36:54 +00:00
kmillikin@chromium.org
97f09782fa Disable all code motion on the final optimization attempt.
Before, we disabled code motion for check instructions on the final
optimization attempt.  It is unsafe to prevent movement of check
instructions but to allow movement of instructions that assume the checks
were performed.

Review URL: http://codereview.chromium.org/6378012

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6485 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-26 10:25:43 +00:00
vitalyr@chromium.org
b4ff318e4b Support StringCharCodeAt in hydrogen/lithium.
This patch adds H- and L-variants of StringCharCodeAt and StringLength.

StringCharCodeAt is used to inline a constant function call of
String.prototype.charCodeAt and to implement the corresponding inline
runtime function. It does not yet use the recently introduced extra IC
state. (We can specialize on string encoding and avoid deopts because
of out of bounds accesses.)

StringLength needs more work because the stub version of it also
supports strings wrappers and it matters in some cases. (We have to
separate the string only case.)

Review URL: http://codereview.chromium.org/6243008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6408 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-19 20:05:22 +00:00
vitalyr@chromium.org
c919bb7d4a Disable aggressive optimizations on the last optimization attempt.
Only has effect on the loop invariant code motion and Check instructions
for now.

Review URL: http://codereview.chromium.org/6321007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6363 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-18 13:43:48 +00:00
kmillikin@chromium.org
32254e5324 Change the hydrogen timing data to include zone allocation.
Review URL: http://codereview.chromium.org/6190002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6249 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-10 14:16:47 +00:00
kmillikin@chromium.org
c1fd8bcf60 Fix a bug in deoptimization environments.
The function HEnvironment::SetExpressionStackAt did not update the
environment's history.  This function is used to patch the bailout
environment for count operations and global function calls.

Reorganize class HEnvironment to make it fit V8's style a bit better
and to try to add some sanity to which C++ functions are intended to
be inlined.

Remove the flag --trace-environment which merely duplicated data in
the hydrogen.cfg file except without enough context to be useful.

BUG=1004

Review URL: http://codereview.chromium.org/5992011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6137 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-03 16:57:46 +00:00
fschneider@chromium.org
7cc61e6973 Fix GVN for polymorphic loads.
They must not be hoisted above the compare-map-and-branch.

Review URL: http://codereview.chromium.org/5971003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6082 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-20 13:18:47 +00:00
kmillikin@chromium.org
4a6ef3ee28 Fix issue 977, occasional failure of the DeltaBlue benchmark.
Before, when we deoptimized after a branch we jumped to before the branch
was taken in the unoptimized code with a token value that indicated when
edge to take.  There was a lot of machinery to track this value through the
short-circuit logical operations and logical negation, and to handle it
properly at inline function return sites.  There was also machinery to
prevent incorrectly seeing this environment with the extra value never
actually materialized in the unoptimized code.

Instead, now we deoptimize directly to one of the targets of the branch.
Much but not yet all of the extra machinery has been removed or simplified.
The cost is that branching control structures (the looping statements, if
statements, conditional expressions, and the short-circuit binary logical
operations) need extra AST IDs to identify the branch targets.

Review URL: http://codereview.chromium.org/5908001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6049 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-16 13:13:36 +00:00
kmillikin@chromium.org
a695d0731e Change the HGraphBuilder to dispatch on the context.
Before, expressions didn't take advantage of knowing their context in
the AST.  Now, we use the context to decide what to do with a value at
the end of visiting an expression.

Review URL: http://codereview.chromium.org/5620007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5954 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-09 12:49:53 +00:00
kasperl@chromium.org
90b3370374 Update V8 to version 3.0 (re-land r5920).
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5922 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-07 11:31:57 +00:00
kasperl@chromium.org
51b494d096 Revert r5920. Will re-land shortly.
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5921 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-07 11:01:02 +00:00
kasperl@chromium.org
e5860bd6a8 Update V8 to version 3.0.
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5920 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2010-12-07 09:11:56 +00:00