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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 Emit(kSSEFloat64ToInt64, output_count, outputs, 1, inputs); | 855 Emit(kSSEFloat64ToInt64, output_count, outputs, 1, inputs); |
856 } | 856 } |
857 | 857 |
858 | 858 |
859 void InstructionSelector::VisitTruncateFloat32ToUint64(Node* node) { | 859 void InstructionSelector::VisitTruncateFloat32ToUint64(Node* node) { |
860 X64OperandGenerator g(this); | 860 X64OperandGenerator g(this); |
861 Emit(kSSEFloat32ToUint64, g.DefineAsRegister(node), g.Use(node->InputAt(0))); | 861 Emit(kSSEFloat32ToUint64, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
862 } | 862 } |
863 | 863 |
864 | 864 |
865 void InstructionSelector::VisitTruncateFloat64ToUint64(Node* node) { | 865 void InstructionSelector::VisitTryTruncateFloat64ToUint64(Node* node) { |
866 X64OperandGenerator g(this); | 866 X64OperandGenerator g(this); |
867 Emit(kSSEFloat64ToUint64, g.DefineAsRegister(node), g.Use(node->InputAt(0))); | 867 InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0))}; |
| 868 InstructionOperand outputs[2]; |
| 869 size_t output_count = 0; |
| 870 outputs[output_count++] = g.DefineAsRegister(node); |
| 871 |
| 872 Node* success_output = NodeProperties::FindProjection(node, 1); |
| 873 if (success_output) { |
| 874 outputs[output_count++] = g.DefineAsRegister(success_output); |
| 875 } |
| 876 |
| 877 Emit(kSSEFloat64ToUint64, output_count, outputs, 1, inputs); |
868 } | 878 } |
869 | 879 |
870 | 880 |
871 void InstructionSelector::VisitChangeInt32ToInt64(Node* node) { | 881 void InstructionSelector::VisitChangeInt32ToInt64(Node* node) { |
872 X64OperandGenerator g(this); | 882 X64OperandGenerator g(this); |
873 Emit(kX64Movsxlq, g.DefineAsRegister(node), g.Use(node->InputAt(0))); | 883 Emit(kX64Movsxlq, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
874 } | 884 } |
875 | 885 |
876 | 886 |
877 void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { | 887 void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { |
(...skipping 579 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 |