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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 return DoArithmeticT(op, instr); | 749 return DoArithmeticT(op, instr); |
750 } | 750 } |
751 } | 751 } |
752 | 752 |
753 | 753 |
754 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, | 754 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, |
755 HArithmeticBinaryOperation* instr) { | 755 HArithmeticBinaryOperation* instr) { |
756 ASSERT(instr->representation().IsDouble()); | 756 ASSERT(instr->representation().IsDouble()); |
757 ASSERT(instr->left()->representation().IsDouble()); | 757 ASSERT(instr->left()->representation().IsDouble()); |
758 ASSERT(instr->right()->representation().IsDouble()); | 758 ASSERT(instr->right()->representation().IsDouble()); |
759 LOperand* left = NULL; | |
760 LOperand* right = NULL; | |
761 if (op == Token::MOD) { | 759 if (op == Token::MOD) { |
762 left = UseFixedDouble(instr->left(), d1); | 760 LOperand* left = UseFixedDouble(instr->left(), d1); |
763 right = UseFixedDouble(instr->right(), d2); | 761 LOperand* right = UseFixedDouble(instr->right(), d2); |
764 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right); | 762 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right); |
765 // We call a C function for double modulo. It can't trigger a GC. We need | 763 // We call a C function for double modulo. It can't trigger a GC. We need |
766 // to use fixed result register for the call. | 764 // to use fixed result register for the call. |
767 // TODO(fschneider): Allow any register as input registers. | 765 // TODO(fschneider): Allow any register as input registers. |
768 return MarkAsCall(DefineFixedDouble(result, d1), instr); | 766 return MarkAsCall(DefineFixedDouble(result, d1), instr); |
| 767 } else { |
| 768 LOperand* left = UseRegisterAtStart(instr->left()); |
| 769 LOperand* right = UseRegisterAtStart(instr->right()); |
| 770 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right); |
| 771 return DefineAsRegister(result); |
769 } | 772 } |
770 left = UseRegisterAtStart(instr->left()); | |
771 right = UseRegisterAtStart(instr->right()); | |
772 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right); | |
773 return DefineAsRegister(result); | |
774 } | 773 } |
775 | 774 |
776 | 775 |
777 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, | 776 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, |
778 HBinaryOperation* instr) { | 777 HBinaryOperation* instr) { |
779 HValue* left = instr->left(); | 778 HValue* left = instr->left(); |
780 HValue* right = instr->right(); | 779 HValue* right = instr->right(); |
781 ASSERT(left->representation().IsTagged()); | 780 ASSERT(left->representation().IsTagged()); |
782 ASSERT(right->representation().IsTagged()); | 781 ASSERT(right->representation().IsTagged()); |
783 LOperand* left_operand = UseFixed(left, r1); | 782 LOperand* left_operand = UseFixed(left, r1); |
(...skipping 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2605 | 2604 |
2606 | 2605 |
2607 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2606 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2608 LOperand* object = UseRegister(instr->object()); | 2607 LOperand* object = UseRegister(instr->object()); |
2609 LOperand* index = UseRegister(instr->index()); | 2608 LOperand* index = UseRegister(instr->index()); |
2610 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2609 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2611 } | 2610 } |
2612 | 2611 |
2613 | 2612 |
2614 } } // namespace v8::internal | 2613 } } // namespace v8::internal |
OLD | NEW |