| 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 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1677 return MarkAsCall(result, instr); | 1677 return MarkAsCall(result, instr); |
| 1678 } | 1678 } |
| 1679 | 1679 |
| 1680 | 1680 |
| 1681 LInstruction* LChunkBuilder::DoMapEnumLength(HMapEnumLength* instr) { | 1681 LInstruction* LChunkBuilder::DoMapEnumLength(HMapEnumLength* instr) { |
| 1682 LOperand* map = UseRegisterAtStart(instr->value()); | 1682 LOperand* map = UseRegisterAtStart(instr->value()); |
| 1683 return DefineAsRegister(new(zone()) LMapEnumLength(map)); | 1683 return DefineAsRegister(new(zone()) LMapEnumLength(map)); |
| 1684 } | 1684 } |
| 1685 | 1685 |
| 1686 | 1686 |
| 1687 HValue* LChunkBuilder::SimplifiedDividendForMathFloorOfDiv(HValue* dividend) { |
| 1688 // A value with an integer representation does not need to be transformed. |
| 1689 if (dividend->representation().IsInteger32()) { |
| 1690 return dividend; |
| 1691 // A change from an integer32 can be replaced by the integer32 value. |
| 1692 } else if (dividend->IsChange() && |
| 1693 HChange::cast(dividend)->from().IsInteger32()) { |
| 1694 return HChange::cast(dividend)->value(); |
| 1695 } |
| 1696 return NULL; |
| 1697 } |
| 1698 |
| 1699 |
| 1700 HValue* LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(HValue* divisor) { |
| 1701 // A value with an integer representation does not need to be transformed. |
| 1702 if (divisor->representation().IsInteger32()) { |
| 1703 return divisor; |
| 1704 // A change from an integer32 can be replaced by the integer32 value. |
| 1705 } else if (divisor->IsChange() && |
| 1706 HChange::cast(divisor)->from().IsInteger32()) { |
| 1707 return HChange::cast(divisor)->value(); |
| 1708 } |
| 1709 |
| 1710 if (divisor->IsConstant() && HConstant::cast(divisor)->HasInteger32Value()) { |
| 1711 HConstant* constant_val = HConstant::cast(divisor); |
| 1712 return constant_val->CopyToRepresentation(Representation::Integer32(), |
| 1713 divisor->block()->zone()); |
| 1714 } |
| 1715 |
| 1716 return NULL; |
| 1717 } |
| 1718 |
| 1719 |
| 1687 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { | 1720 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { |
| 1688 UNIMPLEMENTED_INSTRUCTION(); | 1721 HValue* right = instr->right(); |
| 1722 LOperand* dividend = UseRegister(instr->left()); |
| 1723 LOperand* divisor = UseRegister(right); |
| 1724 LOperand* remainder = TempRegister(); |
| 1725 return AssignEnvironment(DefineAsRegister( |
| 1726 new(zone()) LMathFloorOfDiv(dividend, divisor, remainder))); |
| 1689 } | 1727 } |
| 1690 | 1728 |
| 1691 | 1729 |
| 1692 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { | 1730 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { |
| 1693 LOperand* left = NULL; | 1731 LOperand* left = NULL; |
| 1694 LOperand* right = NULL; | 1732 LOperand* right = NULL; |
| 1695 if (instr->representation().IsInteger32()) { | 1733 if (instr->representation().IsInteger32()) { |
| 1696 ASSERT(instr->left()->representation().IsInteger32()); | 1734 ASSERT(instr->left()->representation().IsInteger32()); |
| 1697 ASSERT(instr->right()->representation().IsInteger32()); | 1735 ASSERT(instr->right()->representation().IsInteger32()); |
| 1698 left = UseRegisterAtStart(instr->BetterLeftOperand()); | 1736 left = UseRegisterAtStart(instr->BetterLeftOperand()); |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2387 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2425 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
| 2388 LOperand* receiver = UseRegister(instr->receiver()); | 2426 LOperand* receiver = UseRegister(instr->receiver()); |
| 2389 LOperand* function = UseRegisterAtStart(instr->function()); | 2427 LOperand* function = UseRegisterAtStart(instr->function()); |
| 2390 LOperand* temp = TempRegister(); | 2428 LOperand* temp = TempRegister(); |
| 2391 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function, temp); | 2429 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function, temp); |
| 2392 return AssignEnvironment(DefineAsRegister(result)); | 2430 return AssignEnvironment(DefineAsRegister(result)); |
| 2393 } | 2431 } |
| 2394 | 2432 |
| 2395 | 2433 |
| 2396 } } // namespace v8::internal | 2434 } } // namespace v8::internal |
| OLD | NEW |