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 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 // A change from an integer32 can be replaced by the integer32 value. | 1561 // A change from an integer32 can be replaced by the integer32 value. |
1562 if (dividend->IsChange() && | 1562 if (dividend->IsChange() && |
1563 HChange::cast(dividend)->from().IsInteger32()) { | 1563 HChange::cast(dividend)->from().IsInteger32()) { |
1564 return HChange::cast(dividend)->value(); | 1564 return HChange::cast(dividend)->value(); |
1565 } | 1565 } |
1566 return NULL; | 1566 return NULL; |
1567 } | 1567 } |
1568 | 1568 |
1569 | 1569 |
1570 HValue* HUnaryMathOperation::Canonicalize() { | 1570 HValue* HUnaryMathOperation::Canonicalize() { |
| 1571 if (op() == kMathRound) { |
| 1572 HValue* val = value(); |
| 1573 if (val->IsChange()) val = HChange::cast(val)->value(); |
| 1574 |
| 1575 // If the input is integer32 then we replace the round instruction |
| 1576 // with its input. |
| 1577 if (val->representation().IsSmiOrInteger32()) return val; |
| 1578 } |
| 1579 |
1571 if (op() == kMathFloor) { | 1580 if (op() == kMathFloor) { |
1572 HValue* val = value(); | 1581 HValue* val = value(); |
1573 if (val->IsChange()) val = HChange::cast(val)->value(); | 1582 if (val->IsChange()) val = HChange::cast(val)->value(); |
1574 | 1583 |
1575 // If the input is integer32 then we replace the floor instruction | 1584 // If the input is integer32 then we replace the floor instruction |
1576 // with its input. | 1585 // with its input. |
1577 if (val->representation().IsSmiOrInteger32()) return val; | 1586 if (val->representation().IsSmiOrInteger32()) return val; |
1578 | 1587 |
1579 if (val->IsDiv() && (val->UseCount() == 1)) { | 1588 if (val->IsDiv() && (val->UseCount() == 1)) { |
1580 HDiv* hdiv = HDiv::cast(val); | 1589 HDiv* hdiv = HDiv::cast(val); |
(...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3650 if (from().IsDouble() && to().IsTagged()) return HType::HeapNumber(); | 3659 if (from().IsDouble() && to().IsTagged()) return HType::HeapNumber(); |
3651 return type(); | 3660 return type(); |
3652 } | 3661 } |
3653 | 3662 |
3654 | 3663 |
3655 Representation HUnaryMathOperation::RepresentationFromInputs() { | 3664 Representation HUnaryMathOperation::RepresentationFromInputs() { |
3656 Representation rep = representation(); | 3665 Representation rep = representation(); |
3657 // If any of the actual input representation is more general than what we | 3666 // If any of the actual input representation is more general than what we |
3658 // have so far but not Tagged, use that representation instead. | 3667 // have so far but not Tagged, use that representation instead. |
3659 Representation input_rep = value()->representation(); | 3668 Representation input_rep = value()->representation(); |
3660 if (!input_rep.IsTagged()) rep = rep.generalize(input_rep); | 3669 if (!input_rep.IsTagged()) { |
| 3670 rep = rep.generalize(input_rep); |
| 3671 } else if (flexible_int()) { |
| 3672 rep = Representation::Integer32(); |
| 3673 } |
3661 return rep; | 3674 return rep; |
3662 } | 3675 } |
3663 | 3676 |
3664 | 3677 |
3665 void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, | 3678 void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, |
3666 HValue* dominator) { | 3679 HValue* dominator) { |
3667 ASSERT(side_effect == kChangesNewSpacePromotion); | 3680 ASSERT(side_effect == kChangesNewSpacePromotion); |
3668 if (!FLAG_use_allocation_folding) return; | 3681 if (!FLAG_use_allocation_folding) return; |
3669 | 3682 |
3670 // Try to fold allocations together with their dominating allocations. | 3683 // Try to fold allocations together with their dominating allocations. |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4479 break; | 4492 break; |
4480 case kExternalMemory: | 4493 case kExternalMemory: |
4481 stream->Add("[external-memory]"); | 4494 stream->Add("[external-memory]"); |
4482 break; | 4495 break; |
4483 } | 4496 } |
4484 | 4497 |
4485 stream->Add("@%d", offset()); | 4498 stream->Add("@%d", offset()); |
4486 } | 4499 } |
4487 | 4500 |
4488 } } // namespace v8::internal | 4501 } } // namespace v8::internal |
OLD | NEW |