Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: src/hydrogen-instructions.cc

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
Patch Set: Rename CanBeEliminated -> CannotBeEliminated, implement IsDeletable() for HPhi. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.h ('k') | test/mjsunit/compiler/dead-code.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1892 HValue* value = OperandAt(i); 1891 HValue* value = OperandAt(i);
1893 stream->Add(" "); 1892 stream->Add(" ");
1894 value->PrintNameTo(stream); 1893 value->PrintNameTo(stream);
1895 stream->Add(" "); 1894 stream->Add(" ");
1896 } 1895 }
1897 stream->Add(" uses%d_%di_%dd_%dt", 1896 stream->Add(" uses%d_%di_%dd_%dt",
1898 UseCount(), 1897 UseCount(),
1899 int32_non_phi_uses() + int32_indirect_uses(), 1898 int32_non_phi_uses() + int32_indirect_uses(),
1900 double_non_phi_uses() + double_indirect_uses(), 1899 double_non_phi_uses() + double_indirect_uses(),
1901 tagged_non_phi_uses() + tagged_indirect_uses()); 1900 tagged_non_phi_uses() + tagged_indirect_uses());
1902 stream->Add("%s%s]", 1901 stream->Add("%s]", IsConvertibleToInteger() ? "" : "_ncti");
1903 is_live() ? "_live" : "",
1904 IsConvertibleToInteger() ? "" : "_ncti");
1905 } 1902 }
1906 1903
1907 1904
1908 void HPhi::AddInput(HValue* value) { 1905 void HPhi::AddInput(HValue* value) {
1909 inputs_.Add(NULL, value->block()->zone()); 1906 inputs_.Add(NULL, value->block()->zone());
1910 SetOperandAt(OperandCount() - 1, value); 1907 SetOperandAt(OperandCount() - 1, value);
1911 // 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.
1912 if (!CheckFlag(kIsArguments) && value->CheckFlag(kIsArguments)) { 1909 if (!CheckFlag(kIsArguments) && value->CheckFlag(kIsArguments)) {
1913 SetFlag(kIsArguments); 1910 SetFlag(kIsArguments);
1914 } 1911 }
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after
3621 3618
3622 3619
3623 void HCheckFunction::Verify() { 3620 void HCheckFunction::Verify() {
3624 HInstruction::Verify(); 3621 HInstruction::Verify();
3625 ASSERT(HasNoUses()); 3622 ASSERT(HasNoUses());
3626 } 3623 }
3627 3624
3628 #endif 3625 #endif
3629 3626
3630 } } // namespace v8::internal 3627 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | test/mjsunit/compiler/dead-code.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698