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 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1429 } | 1429 } |
1430 | 1430 |
1431 | 1431 |
1432 HValue* HSub::Canonicalize() { | 1432 HValue* HSub::Canonicalize() { |
1433 if (!representation().IsInteger32()) return this; | 1433 if (!representation().IsInteger32()) return this; |
1434 if (CheckUsesForFlag(kTruncatingToInt32)) ClearFlag(kCanOverflow); | 1434 if (CheckUsesForFlag(kTruncatingToInt32)) ClearFlag(kCanOverflow); |
1435 return this; | 1435 return this; |
1436 } | 1436 } |
1437 | 1437 |
1438 | 1438 |
1439 // TODO(svenpanne) Use this in other Canonicalize() functions. | |
1440 static bool IsIdentityOperation(HValue* arg1, HValue* arg2, int32_t identity) { | |
1441 return arg1->representation().IsSpecialization() && | |
1442 arg2->IsInteger32Constant() && | |
1443 arg2->GetInteger32Constant() == identity; | |
1444 } | |
1445 | |
Jakob Kummerow
2013/04/17 12:36:07
nit: two newlines between top-level blocks
| |
1446 HValue* HMul::Canonicalize() { | |
1447 if (IsIdentityOperation(left(), right(), 1)) return left(); | |
1448 if (IsIdentityOperation(right(), left(), 1)) return right(); | |
1449 return this; | |
1450 } | |
1451 | |
1452 | |
1439 HValue* HChange::Canonicalize() { | 1453 HValue* HChange::Canonicalize() { |
1440 return (from().Equals(to())) ? value() : this; | 1454 return (from().Equals(to())) ? value() : this; |
1441 } | 1455 } |
1442 | 1456 |
1443 | 1457 |
1444 HValue* HWrapReceiver::Canonicalize() { | 1458 HValue* HWrapReceiver::Canonicalize() { |
1445 if (HasNoUses()) return NULL; | 1459 if (HasNoUses()) return NULL; |
1446 if (receiver()->type().IsJSObject()) { | 1460 if (receiver()->type().IsJSObject()) { |
1447 return receiver(); | 1461 return receiver(); |
1448 } | 1462 } |
(...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3570 | 3584 |
3571 | 3585 |
3572 void HCheckFunction::Verify() { | 3586 void HCheckFunction::Verify() { |
3573 HInstruction::Verify(); | 3587 HInstruction::Verify(); |
3574 ASSERT(HasNoUses()); | 3588 ASSERT(HasNoUses()); |
3575 } | 3589 } |
3576 | 3590 |
3577 #endif | 3591 #endif |
3578 | 3592 |
3579 } } // namespace v8::internal | 3593 } } // namespace v8::internal |
OLD | NEW |