 Chromium Code Reviews
 Chromium Code Reviews Issue 14676011:
  Improve dead code elimination by transitively marking live code and removing all dead code. Replace…  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 14676011:
  Improve dead code elimination by transitively marking live code and removing all dead code. Replace…  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 641 | 641 | 
| 642 void HValue::SetOperandAt(int index, HValue* value) { | 642 void HValue::SetOperandAt(int index, HValue* value) { | 
| 643 RegisterUse(index, value); | 643 RegisterUse(index, value); | 
| 644 InternalSetOperandAt(index, value); | 644 InternalSetOperandAt(index, value); | 
| 645 } | 645 } | 
| 646 | 646 | 
| 647 | 647 | 
| 648 void HValue::DeleteAndReplaceWith(HValue* other) { | 648 void HValue::DeleteAndReplaceWith(HValue* other) { | 
| 649 // We replace all uses first, so Delete can assert that there are none. | 649 // We replace all uses first, so Delete can assert that there are none. | 
| 650 if (other != NULL) ReplaceAllUsesWith(other); | 650 if (other != NULL) ReplaceAllUsesWith(other); | 
| 651 ASSERT(HasNoUses()); | |
| 652 Kill(); | 651 Kill(); | 
| 653 DeleteFromGraph(); | 652 DeleteFromGraph(); | 
| 654 } | 653 } | 
| 655 | 654 | 
| 656 | 655 | 
| 657 void HValue::ReplaceAllUsesWith(HValue* other) { | 656 void HValue::ReplaceAllUsesWith(HValue* other) { | 
| 658 while (use_list_ != NULL) { | 657 while (use_list_ != NULL) { | 
| 659 HUseListNode* list_node = use_list_; | 658 HUseListNode* list_node = use_list_; | 
| 660 HValue* value = list_node->value(); | 659 HValue* value = list_node->value(); | 
| 661 ASSERT(!value->block()->IsStartBlock()); | 660 ASSERT(!value->block()->IsStartBlock()); | 
| (...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1891 HValue* value = OperandAt(i); | 1890 HValue* value = OperandAt(i); | 
| 1892 stream->Add(" "); | 1891 stream->Add(" "); | 
| 1893 value->PrintNameTo(stream); | 1892 value->PrintNameTo(stream); | 
| 1894 stream->Add(" "); | 1893 stream->Add(" "); | 
| 1895 } | 1894 } | 
| 1896 stream->Add(" uses%d_%di_%dd_%dt", | 1895 stream->Add(" uses%d_%di_%dd_%dt", | 
| 1897 UseCount(), | 1896 UseCount(), | 
| 1898 int32_non_phi_uses() + int32_indirect_uses(), | 1897 int32_non_phi_uses() + int32_indirect_uses(), | 
| 1899 double_non_phi_uses() + double_indirect_uses(), | 1898 double_non_phi_uses() + double_indirect_uses(), | 
| 1900 tagged_non_phi_uses() + tagged_indirect_uses()); | 1899 tagged_non_phi_uses() + tagged_indirect_uses()); | 
| 1901 stream->Add("%s%s]", | 1900 stream->Add("%s%s]", | 
| 
Sven Panne
2013/05/07 13:32:10
Do we never print phis marked as dead by DCE? If t
 
titzer
2013/05/13 13:29:38
Done.
 | |
| 1902 is_live() ? "_live" : "", | |
| 1903 IsConvertibleToInteger() ? "" : "_ncti"); | 1901 IsConvertibleToInteger() ? "" : "_ncti"); | 
| 1904 } | 1902 } | 
| 1905 | 1903 | 
| 1906 | 1904 | 
| 1907 void HPhi::AddInput(HValue* value) { | 1905 void HPhi::AddInput(HValue* value) { | 
| 1908 inputs_.Add(NULL, value->block()->zone()); | 1906 inputs_.Add(NULL, value->block()->zone()); | 
| 1909 SetOperandAt(OperandCount() - 1, value); | 1907 SetOperandAt(OperandCount() - 1, value); | 
| 1910 // Mark phis that may have 'arguments' directly or indirectly as an operand. | 1908 // Mark phis that may have 'arguments' directly or indirectly as an operand. | 
| 1911 if (!CheckFlag(kIsArguments) && value->CheckFlag(kIsArguments)) { | 1909 if (!CheckFlag(kIsArguments) && value->CheckFlag(kIsArguments)) { | 
| 1912 SetFlag(kIsArguments); | 1910 SetFlag(kIsArguments); | 
| (...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3622 | 3620 | 
| 3623 | 3621 | 
| 3624 void HCheckFunction::Verify() { | 3622 void HCheckFunction::Verify() { | 
| 3625 HInstruction::Verify(); | 3623 HInstruction::Verify(); | 
| 3626 ASSERT(HasNoUses()); | 3624 ASSERT(HasNoUses()); | 
| 3627 } | 3625 } | 
| 3628 | 3626 | 
| 3629 #endif | 3627 #endif | 
| 3630 | 3628 | 
| 3631 } } // namespace v8::internal | 3629 } } // namespace v8::internal | 
| OLD | NEW |