Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: src/compiler/x64/instruction-selector-x64.cc

Issue 1495213003: [turbofan] Changed TruncateFloat64ToInt64 to TryTruncateFloat64ToInt64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::VisitTruncateFloat32ToInt64(Node* node) {
838 X64OperandGenerator g(this); 838 X64OperandGenerator g(this);
839 Emit(kSSEFloat32ToInt64, g.DefineAsRegister(node), g.Use(node->InputAt(0))); 839 Emit(kSSEFloat32ToInt64, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
840 } 840 }
841 841
842 842
843 void InstructionSelector::VisitTruncateFloat64ToInt64(Node* node) { 843 void InstructionSelector::VisitTryTruncateFloat64ToInt64(Node* node) {
844 X64OperandGenerator g(this); 844 X64OperandGenerator g(this);
845 Emit(kSSEFloat64ToInt64, g.DefineAsRegister(node), g.Use(node->InputAt(0))); 845 InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0))};
846 InstructionOperand outputs[2];
847 size_t output_count = 0;
848 outputs[output_count++] = g.DefineAsRegister(node);
849
850 Node* success_output = NodeProperties::FindProjection(node, 1);
851 if (success_output) {
852 outputs[output_count++] = g.DefineAsRegister(success_output);
853 }
854
855 Emit(kSSEFloat64ToInt64, output_count, outputs, 1, inputs);
846 } 856 }
847 857
848 858
849 void InstructionSelector::VisitTruncateFloat32ToUint64(Node* node) { 859 void InstructionSelector::VisitTruncateFloat32ToUint64(Node* node) {
850 X64OperandGenerator g(this); 860 X64OperandGenerator g(this);
851 Emit(kSSEFloat32ToUint64, g.DefineAsRegister(node), g.Use(node->InputAt(0))); 861 Emit(kSSEFloat32ToUint64, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
852 } 862 }
853 863
854 864
855 void InstructionSelector::VisitTruncateFloat64ToUint64(Node* node) { 865 void InstructionSelector::VisitTruncateFloat64ToUint64(Node* node) {
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1447 Node* const node = value->InputAt(0); 1457 Node* const node = value->InputAt(0);
1448 Node* const result = NodeProperties::FindProjection(node, 0); 1458 Node* const result = NodeProperties::FindProjection(node, 0);
1449 if (result == NULL || IsDefined(result)) { 1459 if (result == NULL || IsDefined(result)) {
1450 switch (node->opcode()) { 1460 switch (node->opcode()) {
1451 case IrOpcode::kInt32AddWithOverflow: 1461 case IrOpcode::kInt32AddWithOverflow:
1452 cont.OverwriteAndNegateIfEqual(kOverflow); 1462 cont.OverwriteAndNegateIfEqual(kOverflow);
1453 return VisitBinop(this, node, kX64Add32, &cont); 1463 return VisitBinop(this, node, kX64Add32, &cont);
1454 case IrOpcode::kInt32SubWithOverflow: 1464 case IrOpcode::kInt32SubWithOverflow:
1455 cont.OverwriteAndNegateIfEqual(kOverflow); 1465 cont.OverwriteAndNegateIfEqual(kOverflow);
1456 return VisitBinop(this, node, kX64Sub32, &cont); 1466 return VisitBinop(this, node, kX64Sub32, &cont);
1467 case IrOpcode::kTryTruncateFloat64ToInt64:
1468 return VisitTryTruncateFloat64ToInt64(result);
1457 default: 1469 default:
1458 break; 1470 break;
1459 } 1471 }
1460 } 1472 }
1461 } 1473 }
1462 break; 1474 break;
1463 case IrOpcode::kInt32Sub: 1475 case IrOpcode::kInt32Sub:
1464 return VisitWordCompare(this, value, kX64Cmp32, &cont); 1476 return VisitWordCompare(this, value, kX64Cmp32, &cont);
1465 case IrOpcode::kInt64Sub: 1477 case IrOpcode::kInt64Sub:
1466 return VisitWord64Compare(this, value, &cont); 1478 return VisitWord64Compare(this, value, &cont);
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 MachineOperatorBuilder::kFloat64RoundTruncate | 1743 MachineOperatorBuilder::kFloat64RoundTruncate |
1732 MachineOperatorBuilder::kFloat32RoundTiesEven | 1744 MachineOperatorBuilder::kFloat32RoundTiesEven |
1733 MachineOperatorBuilder::kFloat64RoundTiesEven; 1745 MachineOperatorBuilder::kFloat64RoundTiesEven;
1734 } 1746 }
1735 return flags; 1747 return flags;
1736 } 1748 }
1737 1749
1738 } // namespace compiler 1750 } // namespace compiler
1739 } // namespace internal 1751 } // namespace internal
1740 } // namespace v8 1752 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698