Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 | 27 |
| 28 #include "hydrogen-mark-deoptimize.h" | 28 #include "hydrogen-mark-deoptimize.h" |
| 29 | 29 |
| 30 namespace v8 { | 30 namespace v8 { |
| 31 namespace internal { | 31 namespace internal { |
| 32 | 32 |
| 33 void HMarkDeoptimizeOnUndefinedPhase::Run() { | 33 void HMarkDeoptimizeOnUndefinedPhase::Run() { |
| 34 const ZoneList<HPhi*>* phi_list = graph()->phi_list(); | 34 const ZoneList<HPhi*>* phi_list = graph()->phi_list(); |
| 35 for (int i = 0; i < phi_list->length(); i++) { | 35 for (int i = 0; i < phi_list->length(); i++) { |
| 36 HPhi* phi = phi_list->at(i); | 36 HPhi* phi = phi_list->at(i); |
| 37 if (phi->CheckFlag(HValue::kAllowUndefinedAsNaN)) { | 37 if (phi->CheckFlag(HValue::kAllowUndefinedAsNaN) && |
| 38 for (HUseIterator it(phi->uses()); !it.Done(); it.Advance()) { | 38 !phi->CheckUsesForFlag(HValue::kAllowUndefinedAsNaN)) { |
| 39 HValue* use_value = it.value(); | 39 ProcessPhi(phi); |
| 40 if (!use_value->CheckFlag(HValue::kAllowUndefinedAsNaN)) { | |
| 41 ProcessPhi(phi); | |
| 42 break; | |
| 43 } | |
| 44 } | |
| 45 } | 40 } |
| 46 } | 41 } |
| 47 } | 42 } |
| 48 | 43 |
| 49 | 44 |
| 50 void HMarkDeoptimizeOnUndefinedPhase::ProcessPhi(HPhi* phi) { | 45 void HMarkDeoptimizeOnUndefinedPhase::ProcessPhi(HPhi* phi) { |
| 51 ASSERT(phi->CheckFlag(HValue::kAllowUndefinedAsNaN)); | 46 ASSERT(phi->CheckFlag(HValue::kAllowUndefinedAsNaN)); |
| 52 ASSERT(worklist_.is_empty()); | 47 ASSERT(worklist_.is_empty()); |
| 53 | 48 |
| 54 // Push the phi onto the worklist | 49 // Push the phi onto the worklist |
| 55 phi->ClearFlag(HValue::kAllowUndefinedAsNaN); | 50 phi->ClearFlag(HValue::kAllowUndefinedAsNaN); |
| 56 worklist_.Add(phi, zone()); | 51 worklist_.Add(phi, zone()); |
| 57 | 52 |
| 58 // Process all phis that can reach this phi | 53 // Process all phis that can reach this phi |
| 59 while (!worklist_.is_empty()) { | 54 while (!worklist_.is_empty()) { |
| 60 phi = worklist_.RemoveLast(); | 55 phi = worklist_.RemoveLast(); |
| 61 for (int i = phi->OperandCount() - 1; i >= 0; --i) { | 56 for (int i = phi->OperandCount() - 1; i >= 0; --i) { |
| 62 HValue* input = phi->OperandAt(i); | 57 HValue* input = phi->OperandAt(i); |
| 63 if (input->IsPhi() && input->CheckFlag(HValue::kAllowUndefinedAsNaN)) { | 58 if (input->IsPhi() && input->CheckFlag(HValue::kAllowUndefinedAsNaN)) { |
| 64 input->ClearFlag(HValue::kAllowUndefinedAsNaN); | 59 input->ClearFlag(HValue::kAllowUndefinedAsNaN); |
| 65 worklist_.Add(HPhi::cast(input), zone()); | 60 worklist_.Add(HPhi::cast(input), zone()); |
| 66 } | 61 } |
| 67 } | 62 } |
| 68 } | 63 } |
| 69 } | 64 } |
| 70 | 65 |
| 66 | |
| 67 void HComputeChangeUndefinedToNaN::Run() { | |
| 68 const ZoneList<HBasicBlock*>* blocks(graph()->blocks()); | |
| 69 for (int i = 0; i < blocks->length(); ++i) { | |
| 70 const HBasicBlock* block(blocks->at(i)); | |
| 71 for (HInstruction* current = block->first(); current != NULL; ) { | |
| 72 HInstruction* next = current->next(); | |
| 73 if (current->IsChange()) { | |
| 74 if (HChange::cast(current)->convert_undefined_to_nan()) { | |
|
danno
2013/08/13 12:55:03
shouldn't this method be called "can_context_undef
Toon Verwaest
2013/08/13 13:18:56
Done.
| |
| 75 current->SetFlag(HValue::kAllowUndefinedAsNaN); | |
| 76 } | |
| 77 } | |
| 78 current = next; | |
| 79 } | |
| 80 } | |
| 81 } | |
| 82 | |
| 83 | |
| 71 } } // namespace v8::internal | 84 } } // namespace v8::internal |
| OLD | NEW |