Index: src/hydrogen.cc |
=================================================================== |
--- src/hydrogen.cc (revision 6529) |
+++ src/hydrogen.cc (working copy) |
@@ -1813,15 +1813,6 @@ |
HValue* use, |
Representation to, |
bool is_truncating) { |
- // Propagate flags for negative zero checks upwards from conversions |
- // int32-to-tagged and int32-to-double. |
- Representation from = value->representation(); |
- if (from.IsInteger32()) { |
- ASSERT(to.IsTagged() || to.IsDouble()); |
- BitVector visited(GetMaximumValueID()); |
- PropagateMinusZeroChecks(value, &visited); |
- } |
- |
// Insert the representation change right before its use. For phi-uses we |
// insert at the end of the corresponding predecessor. |
HBasicBlock* insert_block = use->block(); |
@@ -1984,6 +1975,30 @@ |
} |
+void HGraph::ComputeMinusZeroChecks() { |
+ BitVector visited(GetMaximumValueID()); |
+ for (int i = 0; i < blocks_.length(); ++i) { |
+ for (HInstruction* current = blocks_[i]->first(); |
+ current != NULL; |
+ current = current->next()) { |
+ if (current->IsChange()) { |
+ HChange* change = HChange::cast(current); |
+ // Propagate flags for negative zero checks upwards from conversions |
+ // int32-to-tagged and int32-to-double. |
+ Representation from = change->value()->representation(); |
+ ASSERT(from.Equals(change->from())); |
+ if (from.IsInteger32()) { |
+ ASSERT(change->to().IsTagged() || change->to().IsDouble()); |
+ ASSERT(visited.IsEmpty()); |
+ PropagateMinusZeroChecks(change->value(), &visited); |
+ visited.Clear(); |
+ } |
+ } |
+ } |
+ } |
+} |
+ |
+ |
// Implementation of utility classes to represent an expression's context in |
// the AST. |
AstContext::AstContext(HGraphBuilder* owner, Expression::Context kind) |
@@ -2243,6 +2258,7 @@ |
graph_->InitializeInferredTypes(); |
graph_->Canonicalize(); |
graph_->InsertRepresentationChanges(); |
+ graph_->ComputeMinusZeroChecks(); |
// Eliminate redundant stack checks on backwards branches. |
HStackCheckEliminator sce(graph_); |