Index: src/hydrogen-mark-deoptimize.cc |
diff --git a/src/hydrogen-mark-deoptimize.cc b/src/hydrogen-mark-deoptimize.cc |
index 111fcd2ce9ba30e7923ca4cdd7af952746499573..c0236e91cbb303765df43fa2c8eeb719d3cb2ea3 100644 |
--- a/src/hydrogen-mark-deoptimize.cc |
+++ b/src/hydrogen-mark-deoptimize.cc |
@@ -34,14 +34,9 @@ void HMarkDeoptimizeOnUndefinedPhase::Run() { |
const ZoneList<HPhi*>* phi_list = graph()->phi_list(); |
for (int i = 0; i < phi_list->length(); i++) { |
HPhi* phi = phi_list->at(i); |
- if (phi->CheckFlag(HValue::kAllowUndefinedAsNaN)) { |
- for (HUseIterator it(phi->uses()); !it.Done(); it.Advance()) { |
- HValue* use_value = it.value(); |
- if (!use_value->CheckFlag(HValue::kAllowUndefinedAsNaN)) { |
- ProcessPhi(phi); |
- break; |
- } |
- } |
+ if (phi->CheckFlag(HValue::kAllowUndefinedAsNaN) && |
+ !phi->CheckUsesForFlag(HValue::kAllowUndefinedAsNaN)) { |
+ ProcessPhi(phi); |
} |
} |
} |
@@ -68,4 +63,22 @@ void HMarkDeoptimizeOnUndefinedPhase::ProcessPhi(HPhi* phi) { |
} |
} |
+ |
+void HComputeChangeUndefinedToNaN::Run() { |
+ const ZoneList<HBasicBlock*>* blocks(graph()->blocks()); |
+ for (int i = 0; i < blocks->length(); ++i) { |
+ const HBasicBlock* block(blocks->at(i)); |
+ for (HInstruction* current = block->first(); current != NULL; ) { |
+ HInstruction* next = current->next(); |
+ if (current->IsChange()) { |
+ if (HChange::cast(current)->can_convert_undefined_to_nan()) { |
+ current->SetFlag(HValue::kAllowUndefinedAsNaN); |
+ } |
+ } |
+ current = next; |
+ } |
+ } |
+} |
+ |
+ |
} } // namespace v8::internal |