OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 30 matching lines...) Expand all Loading... |
41 if (instr->IsArithmeticBinaryOperation()) { | 41 if (instr->IsArithmeticBinaryOperation()) { |
42 if (instr->representation().IsInteger32()) { | 42 if (instr->representation().IsInteger32()) { |
43 if (instr->HasAtLeastOneUseWithFlagAndNoneWithout( | 43 if (instr->HasAtLeastOneUseWithFlagAndNoneWithout( |
44 HInstruction::kTruncatingToInt32)) { | 44 HInstruction::kTruncatingToInt32)) { |
45 instr->SetFlag(HInstruction::kAllUsesTruncatingToInt32); | 45 instr->SetFlag(HInstruction::kAllUsesTruncatingToInt32); |
46 } | 46 } |
47 } else if (instr->representation().IsSmi()) { | 47 } else if (instr->representation().IsSmi()) { |
48 if (instr->HasAtLeastOneUseWithFlagAndNoneWithout( | 48 if (instr->HasAtLeastOneUseWithFlagAndNoneWithout( |
49 HInstruction::kTruncatingToSmi)) { | 49 HInstruction::kTruncatingToSmi)) { |
50 instr->SetFlag(HInstruction::kAllUsesTruncatingToSmi); | 50 instr->SetFlag(HInstruction::kAllUsesTruncatingToSmi); |
| 51 } else if (instr->HasAtLeastOneUseWithFlagAndNoneWithout( |
| 52 HInstruction::kTruncatingToInt32)) { |
| 53 // Avoid redundant minus zero check |
| 54 instr->SetFlag(HInstruction::kAllUsesTruncatingToInt32); |
51 } | 55 } |
52 } | 56 } |
53 } | 57 } |
54 } | 58 } |
55 } | 59 } |
56 // Perform actual Canonicalization pass. | 60 // Perform actual Canonicalization pass. |
57 for (int i = 0; i < blocks->length(); ++i) { | 61 for (int i = 0; i < blocks->length(); ++i) { |
58 for (HInstructionIterator it(blocks->at(i)); !it.Done(); it.Advance()) { | 62 for (HInstructionIterator it(blocks->at(i)); !it.Done(); it.Advance()) { |
59 HInstruction* instr = it.Current(); | 63 HInstruction* instr = it.Current(); |
60 HValue* value = instr->Canonicalize(); | 64 HValue* value = instr->Canonicalize(); |
61 if (value != instr) instr->DeleteAndReplaceWith(value); | 65 if (value != instr) instr->DeleteAndReplaceWith(value); |
62 } | 66 } |
63 } | 67 } |
64 } | 68 } |
65 | 69 |
66 } } // namespace v8::internal | 70 } } // namespace v8::internal |
OLD | NEW |