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 5418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5429 for (int i = 0; i < blocks()->length(); ++i) { | 5429 for (int i = 0; i < blocks()->length(); ++i) { |
5430 for (HInstruction* instr = blocks()->at(i)->first(); | 5430 for (HInstruction* instr = blocks()->at(i)->first(); |
5431 instr != NULL; | 5431 instr != NULL; |
5432 instr = instr->next()) { | 5432 instr = instr->next()) { |
5433 if (instr->IsDead()) worklist.Add(instr, zone()); | 5433 if (instr->IsDead()) worklist.Add(instr, zone()); |
5434 } | 5434 } |
5435 } | 5435 } |
5436 | 5436 |
5437 while (!worklist.is_empty()) { | 5437 while (!worklist.is_empty()) { |
5438 HInstruction* instr = worklist.RemoveLast(); | 5438 HInstruction* instr = worklist.RemoveLast(); |
| 5439 // This happens when an instruction is used multiple times as operand. That |
| 5440 // in turn could happen through GVN. |
| 5441 if (!instr->IsLinked()) continue; |
5439 if (FLAG_trace_dead_code_elimination) { | 5442 if (FLAG_trace_dead_code_elimination) { |
5440 HeapStringAllocator allocator; | 5443 HeapStringAllocator allocator; |
5441 StringStream stream(&allocator); | 5444 StringStream stream(&allocator); |
5442 instr->PrintNameTo(&stream); | 5445 instr->PrintNameTo(&stream); |
5443 stream.Add(" = "); | 5446 stream.Add(" = "); |
5444 instr->PrintTo(&stream); | 5447 instr->PrintTo(&stream); |
5445 PrintF("[removing dead instruction %s]\n", *stream.ToCString()); | 5448 PrintF("[removing dead instruction %s]\n", *stream.ToCString()); |
5446 } | 5449 } |
5447 instr->DeleteAndReplaceWith(NULL); | 5450 instr->DeleteAndReplaceWith(NULL); |
5448 for (int i = 0; i < instr->OperandCount(); ++i) { | 5451 for (int i = 0; i < instr->OperandCount(); ++i) { |
(...skipping 6821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12270 } | 12273 } |
12271 } | 12274 } |
12272 | 12275 |
12273 #ifdef DEBUG | 12276 #ifdef DEBUG |
12274 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 12277 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
12275 if (allocator_ != NULL) allocator_->Verify(); | 12278 if (allocator_ != NULL) allocator_->Verify(); |
12276 #endif | 12279 #endif |
12277 } | 12280 } |
12278 | 12281 |
12279 } } // namespace v8::internal | 12282 } } // namespace v8::internal |
OLD | NEW |