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

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

Issue 9227007: Version 3.8.6 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 11 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') | src/ia32/assembler-ia32.cc » ('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 2011 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
11 // with the distribution. 11 // with the distribution.
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 HValue* HConstant::Canonicalize() { 781 HValue* HConstant::Canonicalize() {
782 return HasNoUses() && !IsBlockEntry() ? NULL : this; 782 return HasNoUses() && !IsBlockEntry() ? NULL : this;
783 } 783 }
784 784
785 785
786 HValue* HTypeof::Canonicalize() { 786 HValue* HTypeof::Canonicalize() {
787 return HasNoUses() && !IsBlockEntry() ? NULL : this; 787 return HasNoUses() && !IsBlockEntry() ? NULL : this;
788 } 788 }
789 789
790 790
791 HValue* HBitwise::Canonicalize() {
792 if (!representation().IsInteger32()) return this;
793 // If x is an int32, then x & -1 == x, x | 0 == x and x ^ 0 == x.
794 int32_t nop_constant = (op() == Token::BIT_AND) ? -1 : 0;
795 if (left()->IsConstant() &&
796 HConstant::cast(left())->HasInteger32Value() &&
797 HConstant::cast(left())->Integer32Value() == nop_constant) {
798 return right();
799 }
800 if (right()->IsConstant() &&
801 HConstant::cast(right())->HasInteger32Value() &&
802 HConstant::cast(right())->Integer32Value() == nop_constant) {
803 return left();
804 }
805 return this;
806 }
807
808
809 HValue* HChange::Canonicalize() {
810 return (from().Equals(to())) ? value() : this;
811 }
812
813
791 void HTypeof::PrintDataTo(StringStream* stream) { 814 void HTypeof::PrintDataTo(StringStream* stream) {
792 value()->PrintNameTo(stream); 815 value()->PrintNameTo(stream);
793 } 816 }
794 817
795 818
796 void HChange::PrintDataTo(StringStream* stream) { 819 void HChange::PrintDataTo(StringStream* stream) {
797 HUnaryOperation::PrintDataTo(stream); 820 HUnaryOperation::PrintDataTo(stream);
798 stream->Add(" %s to %s", from().Mnemonic(), to().Mnemonic()); 821 stream->Add(" %s to %s", from().Mnemonic(), to().Mnemonic());
799 822
800 if (CanTruncateToInt32()) stream->Add(" truncating-int32"); 823 if (CanTruncateToInt32()) stream->Add(" truncating-int32");
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 2129
2107 2130
2108 void HCheckPrototypeMaps::Verify() { 2131 void HCheckPrototypeMaps::Verify() {
2109 HInstruction::Verify(); 2132 HInstruction::Verify();
2110 ASSERT(HasNoUses()); 2133 ASSERT(HasNoUses());
2111 } 2134 }
2112 2135
2113 #endif 2136 #endif
2114 2137
2115 } } // namespace v8::internal 2138 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698