OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/hydrogen-mark-deoptimize.h" | 5 #include "src/hydrogen-mark-deoptimize.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 | 9 |
10 void HMarkDeoptimizeOnUndefinedPhase::Run() { | 10 void HMarkDeoptimizeOnUndefinedPhase::Run() { |
11 const ZoneList<HPhi*>* phi_list = graph()->phi_list(); | 11 const ZoneList<HPhi*>* phi_list = graph()->phi_list(); |
12 for (int i = 0; i < phi_list->length(); i++) { | 12 for (int i = 0; i < phi_list->length(); i++) { |
13 HPhi* phi = phi_list->at(i); | 13 HPhi* phi = phi_list->at(i); |
14 if (phi->CheckFlag(HValue::kAllowUndefinedAsNaN) && | 14 if (phi->CheckFlag(HValue::kAllowUndefinedAsNaN) && |
15 !phi->CheckUsesForFlag(HValue::kAllowUndefinedAsNaN)) { | 15 !phi->CheckUsesForFlag(HValue::kAllowUndefinedAsNaN)) { |
16 ProcessPhi(phi); | 16 ProcessPhi(phi); |
17 } | 17 } |
18 } | 18 } |
19 } | 19 } |
20 | 20 |
21 | 21 |
22 void HMarkDeoptimizeOnUndefinedPhase::ProcessPhi(HPhi* phi) { | 22 void HMarkDeoptimizeOnUndefinedPhase::ProcessPhi(HPhi* phi) { |
23 ASSERT(phi->CheckFlag(HValue::kAllowUndefinedAsNaN)); | 23 DCHECK(phi->CheckFlag(HValue::kAllowUndefinedAsNaN)); |
24 ASSERT(worklist_.is_empty()); | 24 DCHECK(worklist_.is_empty()); |
25 | 25 |
26 // Push the phi onto the worklist | 26 // Push the phi onto the worklist |
27 phi->ClearFlag(HValue::kAllowUndefinedAsNaN); | 27 phi->ClearFlag(HValue::kAllowUndefinedAsNaN); |
28 worklist_.Add(phi, zone()); | 28 worklist_.Add(phi, zone()); |
29 | 29 |
30 // Process all phis that can reach this phi | 30 // Process all phis that can reach this phi |
31 while (!worklist_.is_empty()) { | 31 while (!worklist_.is_empty()) { |
32 phi = worklist_.RemoveLast(); | 32 phi = worklist_.RemoveLast(); |
33 for (int i = phi->OperandCount() - 1; i >= 0; --i) { | 33 for (int i = phi->OperandCount() - 1; i >= 0; --i) { |
34 HValue* input = phi->OperandAt(i); | 34 HValue* input = phi->OperandAt(i); |
(...skipping 17 matching lines...) Expand all Loading... |
52 current->SetFlag(HValue::kAllowUndefinedAsNaN); | 52 current->SetFlag(HValue::kAllowUndefinedAsNaN); |
53 } | 53 } |
54 } | 54 } |
55 current = next; | 55 current = next; |
56 } | 56 } |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 | 60 |
61 } } // namespace v8::internal | 61 } } // namespace v8::internal |
OLD | NEW |