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 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 } | 751 } |
752 } | 752 } |
753 | 753 |
754 | 754 |
755 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, | 755 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, |
756 HArithmeticBinaryOperation* instr) { | 756 HArithmeticBinaryOperation* instr) { |
757 ASSERT(instr->representation().IsDouble()); | 757 ASSERT(instr->representation().IsDouble()); |
758 ASSERT(instr->left()->representation().IsDouble()); | 758 ASSERT(instr->left()->representation().IsDouble()); |
759 ASSERT(instr->right()->representation().IsDouble()); | 759 ASSERT(instr->right()->representation().IsDouble()); |
760 if (op == Token::MOD) { | 760 if (op == Token::MOD) { |
761 LOperand* left = UseFixedDouble(instr->left(), d1); | 761 LOperand* left = UseFixedDouble(instr->left(), d0); |
762 LOperand* right = UseFixedDouble(instr->right(), d2); | 762 LOperand* right = UseFixedDouble(instr->right(), d1); |
763 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right); | 763 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right); |
764 // We call a C function for double modulo. It can't trigger a GC. We need | 764 return MarkAsCall(DefineFixedDouble(result, d0), instr); |
765 // to use fixed result register for the call. | |
766 // TODO(fschneider): Allow any register as input registers. | |
767 return MarkAsCall(DefineFixedDouble(result, d1), instr); | |
768 } else { | 765 } else { |
769 LOperand* left = UseRegisterAtStart(instr->left()); | 766 LOperand* left = UseRegisterAtStart(instr->left()); |
770 LOperand* right = UseRegisterAtStart(instr->right()); | 767 LOperand* right = UseRegisterAtStart(instr->right()); |
771 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right); | 768 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right); |
772 return DefineAsRegister(result); | 769 return DefineAsRegister(result); |
773 } | 770 } |
774 } | 771 } |
775 | 772 |
776 | 773 |
777 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, | 774 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 LOperand* input = UseRegister(instr->value()); | 1259 LOperand* input = UseRegister(instr->value()); |
1263 LOperand* temp1 = TempRegister(); | 1260 LOperand* temp1 = TempRegister(); |
1264 LOperand* temp2 = TempRegister(); | 1261 LOperand* temp2 = TempRegister(); |
1265 LOperand* double_temp = FixedTemp(d3); // Chosen by fair dice roll. | 1262 LOperand* double_temp = FixedTemp(d3); // Chosen by fair dice roll. |
1266 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); | 1263 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); |
1267 return DefineAsRegister(result); | 1264 return DefineAsRegister(result); |
1268 } | 1265 } |
1269 | 1266 |
1270 | 1267 |
1271 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) { | 1268 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) { |
1272 LOperand* input = UseRegister(instr->value()); | 1269 LOperand* input = UseRegisterAtStart(instr->value()); |
1273 LMathSqrt* result = new(zone()) LMathSqrt(input); | 1270 LMathSqrt* result = new(zone()) LMathSqrt(input); |
1274 return DefineAsRegister(result); | 1271 return DefineAsRegister(result); |
1275 } | 1272 } |
1276 | 1273 |
1277 | 1274 |
1278 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { | 1275 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { |
1279 LOperand* input = UseFixedDouble(instr->value(), d2); | 1276 LOperand* input = UseRegisterAtStart(instr->value()); |
1280 LOperand* temp = FixedTemp(d3); | 1277 LMathPowHalf* result = new(zone()) LMathPowHalf(input); |
1281 LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp); | 1278 return DefineAsRegister(result); |
1282 return DefineFixedDouble(result, d2); | |
1283 } | 1279 } |
1284 | 1280 |
1285 | 1281 |
1286 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | 1282 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
1287 ASSERT(instr->key()->representation().IsTagged()); | 1283 ASSERT(instr->key()->representation().IsTagged()); |
1288 LOperand* context = UseFixed(instr->context(), cp); | 1284 LOperand* context = UseFixed(instr->context(), cp); |
1289 LOperand* key = UseFixed(instr->key(), r2); | 1285 LOperand* key = UseFixed(instr->key(), r2); |
1290 return MarkAsCall( | 1286 return MarkAsCall( |
1291 DefineFixed(new(zone()) LCallKeyed(context, key), r0), instr); | 1287 DefineFixed(new(zone()) LCallKeyed(context, key), r0), instr); |
1292 } | 1288 } |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1711 return DefineAsRegister(new(zone()) LMathMinMax(left, right)); | 1707 return DefineAsRegister(new(zone()) LMathMinMax(left, right)); |
1712 } | 1708 } |
1713 | 1709 |
1714 | 1710 |
1715 LInstruction* LChunkBuilder::DoPower(HPower* instr) { | 1711 LInstruction* LChunkBuilder::DoPower(HPower* instr) { |
1716 ASSERT(instr->representation().IsDouble()); | 1712 ASSERT(instr->representation().IsDouble()); |
1717 // We call a C function for double power. It can't trigger a GC. | 1713 // We call a C function for double power. It can't trigger a GC. |
1718 // We need to use fixed result register for the call. | 1714 // We need to use fixed result register for the call. |
1719 Representation exponent_type = instr->right()->representation(); | 1715 Representation exponent_type = instr->right()->representation(); |
1720 ASSERT(instr->left()->representation().IsDouble()); | 1716 ASSERT(instr->left()->representation().IsDouble()); |
1721 LOperand* left = UseFixedDouble(instr->left(), d1); | 1717 LOperand* left = UseFixedDouble(instr->left(), d0); |
1722 LOperand* right = exponent_type.IsDouble() ? | 1718 LOperand* right = exponent_type.IsDouble() ? |
1723 UseFixedDouble(instr->right(), d2) : | 1719 UseFixedDouble(instr->right(), d1) : |
1724 UseFixed(instr->right(), r2); | 1720 UseFixed(instr->right(), r2); |
1725 LPower* result = new(zone()) LPower(left, right); | 1721 LPower* result = new(zone()) LPower(left, right); |
1726 return MarkAsCall(DefineFixedDouble(result, d3), | 1722 return MarkAsCall(DefineFixedDouble(result, d2), |
1727 instr, | 1723 instr, |
1728 CAN_DEOPTIMIZE_EAGERLY); | 1724 CAN_DEOPTIMIZE_EAGERLY); |
1729 } | 1725 } |
1730 | 1726 |
1731 | 1727 |
1732 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1728 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
1733 ASSERT(instr->left()->representation().IsTagged()); | 1729 ASSERT(instr->left()->representation().IsTagged()); |
1734 ASSERT(instr->right()->representation().IsTagged()); | 1730 ASSERT(instr->right()->representation().IsTagged()); |
1735 LOperand* context = UseFixed(instr->context(), cp); | 1731 LOperand* context = UseFixed(instr->context(), cp); |
1736 LOperand* left = UseFixed(instr->left(), r1); | 1732 LOperand* left = UseFixed(instr->left(), r1); |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2675 | 2671 |
2676 | 2672 |
2677 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2673 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2678 LOperand* object = UseRegister(instr->object()); | 2674 LOperand* object = UseRegister(instr->object()); |
2679 LOperand* index = UseRegister(instr->index()); | 2675 LOperand* index = UseRegister(instr->index()); |
2680 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2676 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2681 } | 2677 } |
2682 | 2678 |
2683 | 2679 |
2684 } } // namespace v8::internal | 2680 } } // namespace v8::internal |
OLD | NEW |