Chromium Code Reviews| 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,28 @@ |
| } |
| +void HGraph::ComputeMinusZeroChecks() { |
| + 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()); |
| + BitVector visited(GetMaximumValueID()); |
|
William Hesse
2011/01/31 12:22:54
Is this allocation a problem? Can you reuse one?
fschneider
2011/01/31 12:34:44
Good point. Done.
|
| + PropagateMinusZeroChecks(change->value(), &visited); |
| + } |
| + } |
| + } |
| + } |
| +} |
| + |
| + |
| // Implementation of utility classes to represent an expression's context in |
| // the AST. |
| AstContext::AstContext(HGraphBuilder* owner, Expression::Context kind) |
| @@ -2243,6 +2256,7 @@ |
| graph_->InitializeInferredTypes(); |
| graph_->Canonicalize(); |
| graph_->InsertRepresentationChanges(); |
| + graph_->ComputeMinusZeroChecks(); |
| // Eliminate redundant stack checks on backwards branches. |
| HStackCheckEliminator sce(graph_); |