OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "src/base/adapters.h" | 7 #include "src/base/adapters.h" |
8 #include "src/compiler/instruction-selector-impl.h" | 8 #include "src/compiler/instruction-selector-impl.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 Emit(kSSEFloat64ToInt32, g.DefineAsRegister(node), g.Use(node->InputAt(0))); | 827 Emit(kSSEFloat64ToInt32, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
828 } | 828 } |
829 | 829 |
830 | 830 |
831 void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) { | 831 void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) { |
832 X64OperandGenerator g(this); | 832 X64OperandGenerator g(this); |
833 Emit(kSSEFloat64ToUint32, g.DefineAsRegister(node), g.Use(node->InputAt(0))); | 833 Emit(kSSEFloat64ToUint32, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
834 } | 834 } |
835 | 835 |
836 | 836 |
837 void InstructionSelector::VisitTruncateFloat32ToInt64(Node* node) { | 837 void InstructionSelector::VisitTryTruncateFloat32ToInt64(Node* node) { |
838 X64OperandGenerator g(this); | 838 X64OperandGenerator g(this); |
839 Emit(kSSEFloat32ToInt64, g.DefineAsRegister(node), g.Use(node->InputAt(0))); | 839 InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0))}; |
| 840 InstructionOperand outputs[2]; |
| 841 size_t output_count = 0; |
| 842 outputs[output_count++] = g.DefineAsRegister(node); |
| 843 |
| 844 Node* success_output = NodeProperties::FindProjection(node, 1); |
| 845 if (success_output) { |
| 846 outputs[output_count++] = g.DefineAsRegister(success_output); |
| 847 } |
| 848 |
| 849 Emit(kSSEFloat32ToInt64, output_count, outputs, 1, inputs); |
840 } | 850 } |
841 | 851 |
842 | 852 |
843 void InstructionSelector::VisitTryTruncateFloat64ToInt64(Node* node) { | 853 void InstructionSelector::VisitTryTruncateFloat64ToInt64(Node* node) { |
844 X64OperandGenerator g(this); | 854 X64OperandGenerator g(this); |
845 InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0))}; | 855 InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0))}; |
846 InstructionOperand outputs[2]; | 856 InstructionOperand outputs[2]; |
847 size_t output_count = 0; | 857 size_t output_count = 0; |
848 outputs[output_count++] = g.DefineAsRegister(node); | 858 outputs[output_count++] = g.DefineAsRegister(node); |
849 | 859 |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 Node* const node = value->InputAt(0); | 1467 Node* const node = value->InputAt(0); |
1458 Node* const result = NodeProperties::FindProjection(node, 0); | 1468 Node* const result = NodeProperties::FindProjection(node, 0); |
1459 if (result == NULL || IsDefined(result)) { | 1469 if (result == NULL || IsDefined(result)) { |
1460 switch (node->opcode()) { | 1470 switch (node->opcode()) { |
1461 case IrOpcode::kInt32AddWithOverflow: | 1471 case IrOpcode::kInt32AddWithOverflow: |
1462 cont.OverwriteAndNegateIfEqual(kOverflow); | 1472 cont.OverwriteAndNegateIfEqual(kOverflow); |
1463 return VisitBinop(this, node, kX64Add32, &cont); | 1473 return VisitBinop(this, node, kX64Add32, &cont); |
1464 case IrOpcode::kInt32SubWithOverflow: | 1474 case IrOpcode::kInt32SubWithOverflow: |
1465 cont.OverwriteAndNegateIfEqual(kOverflow); | 1475 cont.OverwriteAndNegateIfEqual(kOverflow); |
1466 return VisitBinop(this, node, kX64Sub32, &cont); | 1476 return VisitBinop(this, node, kX64Sub32, &cont); |
1467 case IrOpcode::kTryTruncateFloat64ToInt64: | |
1468 return VisitTryTruncateFloat64ToInt64(result); | |
1469 default: | 1477 default: |
1470 break; | 1478 break; |
1471 } | 1479 } |
1472 } | 1480 } |
1473 } | 1481 } |
1474 break; | 1482 break; |
1475 case IrOpcode::kInt32Sub: | 1483 case IrOpcode::kInt32Sub: |
1476 return VisitWordCompare(this, value, kX64Cmp32, &cont); | 1484 return VisitWordCompare(this, value, kX64Cmp32, &cont); |
1477 case IrOpcode::kInt64Sub: | 1485 case IrOpcode::kInt64Sub: |
1478 return VisitWord64Compare(this, value, &cont); | 1486 return VisitWord64Compare(this, value, &cont); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 MachineOperatorBuilder::kFloat64RoundTruncate | | 1751 MachineOperatorBuilder::kFloat64RoundTruncate | |
1744 MachineOperatorBuilder::kFloat32RoundTiesEven | | 1752 MachineOperatorBuilder::kFloat32RoundTiesEven | |
1745 MachineOperatorBuilder::kFloat64RoundTiesEven; | 1753 MachineOperatorBuilder::kFloat64RoundTiesEven; |
1746 } | 1754 } |
1747 return flags; | 1755 return flags; |
1748 } | 1756 } |
1749 | 1757 |
1750 } // namespace compiler | 1758 } // namespace compiler |
1751 } // namespace internal | 1759 } // namespace internal |
1752 } // namespace v8 | 1760 } // namespace v8 |
OLD | NEW |