| 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 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1755 return result; | 1755 return result; |
| 1756 } | 1756 } |
| 1757 | 1757 |
| 1758 | 1758 |
| 1759 LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) { | 1759 LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) { |
| 1760 ASSERT(instr->representation().IsInteger32()); | 1760 ASSERT(instr->representation().IsInteger32()); |
| 1761 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1761 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1762 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1762 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1763 LOperand* dividend = UseRegister(instr->left()); | 1763 LOperand* dividend = UseRegister(instr->left()); |
| 1764 int32_t divisor = instr->right()->GetInteger32Constant(); | 1764 int32_t divisor = instr->right()->GetInteger32Constant(); |
| 1765 LInstruction* result = | 1765 LOperand* temp = |
| 1766 DefineAsRegister(new(zone()) LFlooringDivByConstI(dividend, divisor)); | 1766 ((divisor > 0 && !instr->CheckFlag(HValue::kLeftCanBeNegative)) || |
| 1767 bool can_deopt = | 1767 (divisor < 0 && !instr->CheckFlag(HValue::kLeftCanBePositive))) ? |
| 1768 divisor == 0 || | 1768 NULL : TempRegister(); |
| 1769 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0); | 1769 LInstruction* result = DefineAsRegister( |
| 1770 return can_deopt ? AssignEnvironment(result) : result; | 1770 new(zone()) LFlooringDivByConstI(dividend, divisor, temp)); |
| 1771 if (divisor == 0 || |
| 1772 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) { |
| 1773 result = AssignEnvironment(result); |
| 1774 } |
| 1775 return result; |
| 1771 } | 1776 } |
| 1772 | 1777 |
| 1773 | 1778 |
| 1774 LInstruction* LChunkBuilder::DoFlooringDivI(HMathFloorOfDiv* instr) { | 1779 LInstruction* LChunkBuilder::DoFlooringDivI(HMathFloorOfDiv* instr) { |
| 1775 LOperand* dividend = UseRegister(instr->left()); | 1780 LOperand* dividend = UseRegister(instr->left()); |
| 1776 LOperand* divisor = UseRegister(instr->right()); | 1781 LOperand* divisor = UseRegister(instr->right()); |
| 1777 LOperand* remainder = TempRegister(); | 1782 LOperand* remainder = TempRegister(); |
| 1778 LInstruction* result = | 1783 LInstruction* result = |
| 1779 DefineAsRegister(new(zone()) LFlooringDivI(dividend, divisor, remainder)); | 1784 DefineAsRegister(new(zone()) LFlooringDivI(dividend, divisor, remainder)); |
| 1780 return AssignEnvironment(result); | 1785 return AssignEnvironment(result); |
| 1781 } | 1786 } |
| 1782 | 1787 |
| 1783 | 1788 |
| 1784 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { | 1789 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { |
| 1785 if (instr->RightIsPowerOf2()) { | 1790 if (instr->RightIsPowerOf2()) { |
| 1786 return DoFlooringDivByPowerOf2I(instr); | 1791 return DoFlooringDivByPowerOf2I(instr); |
| 1787 } else if (false && instr->right()->IsConstant()) { | 1792 } else if (instr->right()->IsConstant()) { |
| 1788 return DoFlooringDivByConstI(instr); // TODO(svenpanne) Fix and re-enable. | 1793 return DoFlooringDivByConstI(instr); |
| 1789 } else { | 1794 } else { |
| 1790 return DoFlooringDivI(instr); | 1795 return DoFlooringDivI(instr); |
| 1791 } | 1796 } |
| 1792 } | 1797 } |
| 1793 | 1798 |
| 1794 | 1799 |
| 1795 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { | 1800 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { |
| 1796 LOperand* left = NULL; | 1801 LOperand* left = NULL; |
| 1797 LOperand* right = NULL; | 1802 LOperand* right = NULL; |
| 1798 if (instr->representation().IsSmiOrInteger32()) { | 1803 if (instr->representation().IsSmiOrInteger32()) { |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2556 | 2561 |
| 2557 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2562 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
| 2558 LOperand* receiver = UseRegister(instr->receiver()); | 2563 LOperand* receiver = UseRegister(instr->receiver()); |
| 2559 LOperand* function = UseRegister(instr->function()); | 2564 LOperand* function = UseRegister(instr->function()); |
| 2560 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 2565 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
| 2561 return AssignEnvironment(DefineAsRegister(result)); | 2566 return AssignEnvironment(DefineAsRegister(result)); |
| 2562 } | 2567 } |
| 2563 | 2568 |
| 2564 | 2569 |
| 2565 } } // namespace v8::internal | 2570 } } // namespace v8::internal |
| OLD | NEW |