| 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 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1567 } | 1567 } |
| 1568 | 1568 |
| 1569 | 1569 |
| 1570 HValue* HUnaryMathOperation::Canonicalize() { | 1570 HValue* HUnaryMathOperation::Canonicalize() { |
| 1571 if (op() == kMathRound) { | 1571 if (op() == kMathRound) { |
| 1572 HValue* val = value(); | 1572 HValue* val = value(); |
| 1573 if (val->IsChange()) val = HChange::cast(val)->value(); | 1573 if (val->IsChange()) val = HChange::cast(val)->value(); |
| 1574 | 1574 |
| 1575 // If the input is integer32 then we replace the round instruction | 1575 // If the input is integer32 then we replace the round instruction |
| 1576 // with its input. | 1576 // with its input. |
| 1577 if (val->representation().IsSmiOrInteger32()) return val; | 1577 if (val->representation().IsSmiOrInteger32()) { |
| 1578 if (!val->representation().Equals(representation())) { |
| 1579 HChange* result = new(block()->zone()) HChange( |
| 1580 val, representation(), false, false, false); |
| 1581 result->InsertBefore(this); |
| 1582 return result; |
| 1583 } |
| 1584 return val; |
| 1585 } |
| 1578 } | 1586 } |
| 1579 | 1587 |
| 1580 if (op() == kMathFloor) { | 1588 if (op() == kMathFloor) { |
| 1581 HValue* val = value(); | 1589 HValue* val = value(); |
| 1582 if (val->IsChange()) val = HChange::cast(val)->value(); | 1590 if (val->IsChange()) val = HChange::cast(val)->value(); |
| 1583 | 1591 |
| 1584 // If the input is integer32 then we replace the floor instruction | 1592 // If the input is integer32 then we replace the floor instruction |
| 1585 // with its input. | 1593 // with its input. |
| 1586 if (val->representation().IsSmiOrInteger32()) return val; | 1594 if (val->representation().IsSmiOrInteger32()) { |
| 1595 if (!val->representation().Equals(representation())) { |
| 1596 HChange* result = new(block()->zone()) HChange( |
| 1597 val, representation(), false, false, false); |
| 1598 result->InsertBefore(this); |
| 1599 return result; |
| 1600 } |
| 1601 return val; |
| 1602 } |
| 1587 | 1603 |
| 1588 if (val->IsDiv() && (val->UseCount() == 1)) { | 1604 if (val->IsDiv() && (val->UseCount() == 1)) { |
| 1589 HDiv* hdiv = HDiv::cast(val); | 1605 HDiv* hdiv = HDiv::cast(val); |
| 1590 HValue* left = hdiv->left(); | 1606 HValue* left = hdiv->left(); |
| 1591 HValue* right = hdiv->right(); | 1607 HValue* right = hdiv->right(); |
| 1592 // Try to simplify left and right values of the division. | 1608 // Try to simplify left and right values of the division. |
| 1593 HValue* new_left = SimplifiedDividendForMathFloorOfDiv(left); | 1609 HValue* new_left = SimplifiedDividendForMathFloorOfDiv(left); |
| 1594 if (new_left == NULL && | 1610 if (new_left == NULL && |
| 1595 hdiv->observed_input_representation(1).IsSmiOrInteger32()) { | 1611 hdiv->observed_input_representation(1).IsSmiOrInteger32()) { |
| 1596 new_left = new(block()->zone()) HChange( | 1612 new_left = new(block()->zone()) HChange( |
| (...skipping 2895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4492 break; | 4508 break; |
| 4493 case kExternalMemory: | 4509 case kExternalMemory: |
| 4494 stream->Add("[external-memory]"); | 4510 stream->Add("[external-memory]"); |
| 4495 break; | 4511 break; |
| 4496 } | 4512 } |
| 4497 | 4513 |
| 4498 stream->Add("@%d", offset()); | 4514 stream->Add("@%d", offset()); |
| 4499 } | 4515 } |
| 4500 | 4516 |
| 4501 } } // namespace v8::internal | 4517 } } // namespace v8::internal |
| OLD | NEW |