| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 5362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5373 for (int i = 0; i < blocks()->length(); ++i) { | 5373 for (int i = 0; i < blocks()->length(); ++i) { |
| 5374 for (HInstruction* instr = blocks()->at(i)->first(); | 5374 for (HInstruction* instr = blocks()->at(i)->first(); |
| 5375 instr != NULL; | 5375 instr != NULL; |
| 5376 instr = instr->next()) { | 5376 instr = instr->next()) { |
| 5377 if (instr->IsDead()) worklist.Add(instr, zone()); | 5377 if (instr->IsDead()) worklist.Add(instr, zone()); |
| 5378 } | 5378 } |
| 5379 } | 5379 } |
| 5380 | 5380 |
| 5381 while (!worklist.is_empty()) { | 5381 while (!worklist.is_empty()) { |
| 5382 HInstruction* instr = worklist.RemoveLast(); | 5382 HInstruction* instr = worklist.RemoveLast(); |
| 5383 // This happens when an instruction is used multiple times as operand. That |
| 5384 // in turn could happen through GVN. |
| 5385 if (!instr->IsLinked()) continue; |
| 5383 if (FLAG_trace_dead_code_elimination) { | 5386 if (FLAG_trace_dead_code_elimination) { |
| 5384 HeapStringAllocator allocator; | 5387 HeapStringAllocator allocator; |
| 5385 StringStream stream(&allocator); | 5388 StringStream stream(&allocator); |
| 5386 instr->PrintNameTo(&stream); | 5389 instr->PrintNameTo(&stream); |
| 5387 stream.Add(" = "); | 5390 stream.Add(" = "); |
| 5388 instr->PrintTo(&stream); | 5391 instr->PrintTo(&stream); |
| 5389 PrintF("[removing dead instruction %s]\n", *stream.ToCString()); | 5392 PrintF("[removing dead instruction %s]\n", *stream.ToCString()); |
| 5390 } | 5393 } |
| 5391 instr->DeleteAndReplaceWith(NULL); | 5394 instr->DeleteAndReplaceWith(NULL); |
| 5392 for (int i = 0; i < instr->OperandCount(); ++i) { | 5395 for (int i = 0; i < instr->OperandCount(); ++i) { |
| (...skipping 6825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12218 } | 12221 } |
| 12219 } | 12222 } |
| 12220 | 12223 |
| 12221 #ifdef DEBUG | 12224 #ifdef DEBUG |
| 12222 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 12225 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 12223 if (allocator_ != NULL) allocator_->Verify(); | 12226 if (allocator_ != NULL) allocator_->Verify(); |
| 12224 #endif | 12227 #endif |
| 12225 } | 12228 } |
| 12226 | 12229 |
| 12227 } } // namespace v8::internal | 12230 } } // namespace v8::internal |
| OLD | NEW |