Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 (op() == Token::BIT_XOR) return this; | |
|
Sven Panne
2012/01/11 09:54:03
I don't think we need this special case, because '
fschneider
2012/01/11 10:00:30
Done.
| |
| 794 // If x is an int32, x & -1 == x and x | 0 == x. | |
| 795 int nop_constant = (op() == Token::BIT_AND) ? -1 : 0; | |
|
Sven Panne
2012/01/11 09:54:03
Use int32_t, not int.
fschneider
2012/01/11 10:00:30
Done.
| |
| 796 if (left()->IsConstant() && | |
| 797 HConstant::cast(left())->HasInteger32Value() && | |
| 798 HConstant::cast(left())->Integer32Value() == nop_constant) { | |
| 799 return right(); | |
| 800 } | |
| 801 if (right()->IsConstant() && | |
| 802 HConstant::cast(right())->HasInteger32Value() && | |
| 803 HConstant::cast(right())->Integer32Value() == nop_constant) { | |
| 804 return left(); | |
| 805 } | |
| 806 return this; | |
| 807 } | |
| 808 | |
| 809 | |
| 791 void HTypeof::PrintDataTo(StringStream* stream) { | 810 void HTypeof::PrintDataTo(StringStream* stream) { |
| 792 value()->PrintNameTo(stream); | 811 value()->PrintNameTo(stream); |
| 793 } | 812 } |
| 794 | 813 |
| 795 | 814 |
| 796 void HChange::PrintDataTo(StringStream* stream) { | 815 void HChange::PrintDataTo(StringStream* stream) { |
| 797 HUnaryOperation::PrintDataTo(stream); | 816 HUnaryOperation::PrintDataTo(stream); |
| 798 stream->Add(" %s to %s", from().Mnemonic(), to().Mnemonic()); | 817 stream->Add(" %s to %s", from().Mnemonic(), to().Mnemonic()); |
| 799 | 818 |
| 800 if (CanTruncateToInt32()) stream->Add(" truncating-int32"); | 819 if (CanTruncateToInt32()) stream->Add(" truncating-int32"); |
| (...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2106 | 2125 |
| 2107 | 2126 |
| 2108 void HCheckPrototypeMaps::Verify() { | 2127 void HCheckPrototypeMaps::Verify() { |
| 2109 HInstruction::Verify(); | 2128 HInstruction::Verify(); |
| 2110 ASSERT(HasNoUses()); | 2129 ASSERT(HasNoUses()); |
| 2111 } | 2130 } |
| 2112 | 2131 |
| 2113 #endif | 2132 #endif |
| 2114 | 2133 |
| 2115 } } // namespace v8::internal | 2134 } } // namespace v8::internal |
| OLD | NEW |