| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 void HDeadCodeEliminationPhase::PrintLive(HValue* ref, HValue* instr) { | 57 void HDeadCodeEliminationPhase::PrintLive(HValue* ref, HValue* instr) { |
| 58 HeapStringAllocator allocator; | 58 HeapStringAllocator allocator; |
| 59 StringStream stream(&allocator); | 59 StringStream stream(&allocator); |
| 60 if (ref != NULL) { | 60 if (ref != NULL) { |
| 61 ref->PrintTo(&stream); | 61 ref->PrintTo(&stream); |
| 62 } else { | 62 } else { |
| 63 stream.Add("root "); | 63 stream.Add("root "); |
| 64 } | 64 } |
| 65 stream.Add(" -> "); | 65 stream.Add(" -> "); |
| 66 instr->PrintTo(&stream); | 66 instr->PrintTo(&stream); |
| 67 PrintF("[MarkLive %s]\n", *stream.ToCString()); | 67 PrintF("[MarkLive %s]\n", stream.ToCString().get()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 | 70 |
| 71 void HDeadCodeEliminationPhase::MarkLiveInstructions() { | 71 void HDeadCodeEliminationPhase::MarkLiveInstructions() { |
| 72 ZoneList<HValue*> worklist(10, zone()); | 72 ZoneList<HValue*> worklist(10, zone()); |
| 73 | 73 |
| 74 // Transitively mark all live instructions, starting from roots. | 74 // Transitively mark all live instructions, starting from roots. |
| 75 for (int i = 0; i < graph()->blocks()->length(); ++i) { | 75 for (int i = 0; i < graph()->blocks()->length(); ++i) { |
| 76 HBasicBlock* block = graph()->blocks()->at(i); | 76 HBasicBlock* block = graph()->blocks()->at(i); |
| 77 for (HInstructionIterator it(block); !it.Done(); it.Advance()) { | 77 for (HInstructionIterator it(block); !it.Done(); it.Advance()) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 HPhi* phi = worklist.RemoveLast(); | 120 HPhi* phi = worklist.RemoveLast(); |
| 121 HBasicBlock* block = phi->block(); | 121 HBasicBlock* block = phi->block(); |
| 122 phi->DeleteAndReplaceWith(NULL); | 122 phi->DeleteAndReplaceWith(NULL); |
| 123 if (phi->HasMergedIndex()) { | 123 if (phi->HasMergedIndex()) { |
| 124 block->RecordDeletedPhi(phi->merged_index()); | 124 block->RecordDeletedPhi(phi->merged_index()); |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 } } // namespace v8::internal | 129 } } // namespace v8::internal |
| OLD | NEW |