| 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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 DefineSameAsFirst(new(zone()) LShiftI(op, left, right, does_deopt)); | 800 DefineSameAsFirst(new(zone()) LShiftI(op, left, right, does_deopt)); |
| 801 return does_deopt ? AssignEnvironment(result) : result; | 801 return does_deopt ? AssignEnvironment(result) : result; |
| 802 } | 802 } |
| 803 | 803 |
| 804 | 804 |
| 805 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, | 805 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, |
| 806 HArithmeticBinaryOperation* instr) { | 806 HArithmeticBinaryOperation* instr) { |
| 807 ASSERT(instr->representation().IsDouble()); | 807 ASSERT(instr->representation().IsDouble()); |
| 808 ASSERT(instr->left()->representation().IsDouble()); | 808 ASSERT(instr->left()->representation().IsDouble()); |
| 809 ASSERT(instr->right()->representation().IsDouble()); | 809 ASSERT(instr->right()->representation().IsDouble()); |
| 810 ASSERT(op != Token::MOD); | |
| 811 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); | 810 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
| 812 LOperand* right = UseRegisterAtStart(instr->BetterRightOperand()); | 811 LOperand* right = UseRegisterAtStart(instr->BetterRightOperand()); |
| 813 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right); | 812 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right); |
| 813 // We call a C function for double modulo. It can't trigger a GC. |
| 814 if (op == Token::MOD) return MarkAsCall(DefineAsRegister(result), instr); |
| 814 return DefineSameAsFirst(result); | 815 return DefineSameAsFirst(result); |
| 815 } | 816 } |
| 816 | 817 |
| 817 | 818 |
| 818 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, | 819 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, |
| 819 HArithmeticBinaryOperation* instr) { | 820 HArithmeticBinaryOperation* instr) { |
| 820 ASSERT(op == Token::ADD || | 821 ASSERT(op == Token::ADD || |
| 821 op == Token::DIV || | 822 op == Token::DIV || |
| 822 op == Token::MOD || | 823 op == Token::MOD || |
| 823 op == Token::MUL || | 824 op == Token::MUL || |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1544 (left->CanBeNegative() && | 1545 (left->CanBeNegative() && |
| 1545 instr->CanBeZero() && | 1546 instr->CanBeZero() && |
| 1546 instr->CheckFlag(HValue::kBailoutOnMinusZero))) | 1547 instr->CheckFlag(HValue::kBailoutOnMinusZero))) |
| 1547 ? AssignEnvironment(result) | 1548 ? AssignEnvironment(result) |
| 1548 : result; | 1549 : result; |
| 1549 } | 1550 } |
| 1550 } else if (instr->representation().IsSmiOrTagged()) { | 1551 } else if (instr->representation().IsSmiOrTagged()) { |
| 1551 return DoArithmeticT(Token::MOD, instr); | 1552 return DoArithmeticT(Token::MOD, instr); |
| 1552 } else { | 1553 } else { |
| 1553 ASSERT(instr->representation().IsDouble()); | 1554 ASSERT(instr->representation().IsDouble()); |
| 1554 // We call a C function for double modulo. It can't trigger a GC. We need | 1555 return DoArithmeticD(Token::MOD, instr); |
| 1555 // to use fixed result register for the call. | |
| 1556 // TODO(fschneider): Allow any register as input registers. | |
| 1557 LArithmeticD* mod = new(zone()) LArithmeticD(Token::MOD, | |
| 1558 UseFixedDouble(left, xmm2), | |
| 1559 UseFixedDouble(right, xmm1)); | |
| 1560 return MarkAsCall(DefineFixedDouble(mod, xmm1), instr); | |
| 1561 } | 1556 } |
| 1562 } | 1557 } |
| 1563 | 1558 |
| 1564 | 1559 |
| 1565 LInstruction* LChunkBuilder::DoMul(HMul* instr) { | 1560 LInstruction* LChunkBuilder::DoMul(HMul* instr) { |
| 1566 if (instr->representation().IsSmiOrInteger32()) { | 1561 if (instr->representation().IsSmiOrInteger32()) { |
| 1567 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1562 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1568 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1563 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1569 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); | 1564 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
| 1570 LOperand* right = UseOrConstant(instr->BetterRightOperand()); | 1565 LOperand* right = UseOrConstant(instr->BetterRightOperand()); |
| (...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2745 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2740 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2746 LOperand* object = UseRegister(instr->object()); | 2741 LOperand* object = UseRegister(instr->object()); |
| 2747 LOperand* index = UseTempRegister(instr->index()); | 2742 LOperand* index = UseTempRegister(instr->index()); |
| 2748 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2743 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2749 } | 2744 } |
| 2750 | 2745 |
| 2751 | 2746 |
| 2752 } } // namespace v8::internal | 2747 } } // namespace v8::internal |
| 2753 | 2748 |
| 2754 #endif // V8_TARGET_ARCH_IA32 | 2749 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |