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

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 1820703003: [turbofan] Representation inference: fail on operators with untested truncation mode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 9 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "src/compiler/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return UseInfo(MachineRepresentation::kTagged, Truncation::Any()); 97 return UseInfo(MachineRepresentation::kTagged, Truncation::Any());
98 } 98 }
99 99
100 // Undetermined representation. 100 // Undetermined representation.
101 static UseInfo Any() { 101 static UseInfo Any() {
102 return UseInfo(MachineRepresentation::kNone, Truncation::Any()); 102 return UseInfo(MachineRepresentation::kNone, Truncation::Any());
103 } 103 }
104 static UseInfo None() { 104 static UseInfo None() {
105 return UseInfo(MachineRepresentation::kNone, Truncation::None()); 105 return UseInfo(MachineRepresentation::kNone, Truncation::None());
106 } 106 }
107
108 // Truncation to a representation that is smaller than the preferred
109 // one.
110 static UseInfo Float64TruncatingToWord32() {
111 return UseInfo(MachineRepresentation::kFloat64, Truncation::Word32());
112 }
113 static UseInfo Word64TruncatingToWord32() {
114 return UseInfo(MachineRepresentation::kWord64, Truncation::Word32());
115 }
116 static UseInfo AnyTruncatingToBool() { 107 static UseInfo AnyTruncatingToBool() {
117 return UseInfo(MachineRepresentation::kNone, Truncation::Bool()); 108 return UseInfo(MachineRepresentation::kNone, Truncation::Bool());
118 } 109 }
119 110
120 MachineRepresentation preferred() const { return preferred_; } 111 MachineRepresentation preferred() const { return preferred_; }
121 Truncation truncation() const { return truncation_; } 112 Truncation truncation() const { return truncation_; }
122 113
123 private: 114 private:
124 MachineRepresentation preferred_; 115 MachineRepresentation preferred_;
125 Truncation truncation_; 116 Truncation truncation_;
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 MachineRepresentation::kWord64); 1289 MachineRepresentation::kWord64);
1299 case IrOpcode::kChangeUint32ToUint64: 1290 case IrOpcode::kChangeUint32ToUint64:
1300 return VisitUnop(node, UseInfo::TruncatingWord32(), 1291 return VisitUnop(node, UseInfo::TruncatingWord32(),
1301 MachineRepresentation::kWord64); 1292 MachineRepresentation::kWord64);
1302 case IrOpcode::kTruncateFloat64ToFloat32: 1293 case IrOpcode::kTruncateFloat64ToFloat32:
1303 return VisitUnop(node, UseInfo::Float64(), 1294 return VisitUnop(node, UseInfo::Float64(),
1304 MachineRepresentation::kFloat32); 1295 MachineRepresentation::kFloat32);
1305 case IrOpcode::kTruncateFloat64ToInt32: 1296 case IrOpcode::kTruncateFloat64ToInt32:
1306 return VisitUnop(node, UseInfo::Float64(), 1297 return VisitUnop(node, UseInfo::Float64(),
1307 MachineRepresentation::kWord32); 1298 MachineRepresentation::kWord32);
1308 case IrOpcode::kTruncateInt64ToInt32:
1309 // TODO(titzer): Is kTypeInt32 correct here?
1310 return VisitUnop(node, UseInfo::Word64TruncatingToWord32(),
1311 MachineRepresentation::kWord32);
1312 1299
1313 case IrOpcode::kChangeFloat32ToFloat64: 1300 case IrOpcode::kChangeFloat32ToFloat64:
1314 return VisitUnop(node, UseInfo::Float32(), 1301 return VisitUnop(node, UseInfo::Float32(),
1315 MachineRepresentation::kFloat64); 1302 MachineRepresentation::kFloat64);
1316 case IrOpcode::kChangeInt32ToFloat64: 1303 case IrOpcode::kChangeInt32ToFloat64:
1317 return VisitUnop(node, UseInfo::TruncatingWord32(), 1304 return VisitUnop(node, UseInfo::TruncatingWord32(),
1318 MachineRepresentation::kFloat64); 1305 MachineRepresentation::kFloat64);
1319 case IrOpcode::kChangeUint32ToFloat64: 1306 case IrOpcode::kChangeUint32ToFloat64:
1320 return VisitUnop(node, UseInfo::TruncatingWord32(), 1307 return VisitUnop(node, UseInfo::TruncatingWord32(),
1321 MachineRepresentation::kFloat64); 1308 MachineRepresentation::kFloat64);
1322 case IrOpcode::kChangeFloat64ToInt32:
1323 return VisitUnop(node, UseInfo::Float64TruncatingToWord32(),
1324 MachineRepresentation::kWord32);
1325 case IrOpcode::kChangeFloat64ToUint32:
1326 return VisitUnop(node, UseInfo::Float64TruncatingToWord32(),
1327 MachineRepresentation::kWord32);
1328
1329 case IrOpcode::kFloat64Add: 1309 case IrOpcode::kFloat64Add:
1330 case IrOpcode::kFloat64Sub: 1310 case IrOpcode::kFloat64Sub:
1331 case IrOpcode::kFloat64Mul: 1311 case IrOpcode::kFloat64Mul:
1332 case IrOpcode::kFloat64Div: 1312 case IrOpcode::kFloat64Div:
1333 case IrOpcode::kFloat64Mod: 1313 case IrOpcode::kFloat64Mod:
1334 case IrOpcode::kFloat64Min: 1314 case IrOpcode::kFloat64Min:
1335 return VisitFloat64Binop(node); 1315 return VisitFloat64Binop(node);
1336 case IrOpcode::kFloat64Abs: 1316 case IrOpcode::kFloat64Abs:
1337 case IrOpcode::kFloat64Sqrt: 1317 case IrOpcode::kFloat64Sqrt:
1338 case IrOpcode::kFloat64RoundDown: 1318 case IrOpcode::kFloat64RoundDown:
(...skipping 14 matching lines...) Expand all
1353 case IrOpcode::kFloat64InsertHighWord32: 1333 case IrOpcode::kFloat64InsertHighWord32:
1354 return VisitBinop(node, UseInfo::Float64(), UseInfo::TruncatingWord32(), 1334 return VisitBinop(node, UseInfo::Float64(), UseInfo::TruncatingWord32(),
1355 MachineRepresentation::kFloat64); 1335 MachineRepresentation::kFloat64);
1356 case IrOpcode::kLoadStackPointer: 1336 case IrOpcode::kLoadStackPointer:
1357 case IrOpcode::kLoadFramePointer: 1337 case IrOpcode::kLoadFramePointer:
1358 case IrOpcode::kLoadParentFramePointer: 1338 case IrOpcode::kLoadParentFramePointer:
1359 return VisitLeaf(node, MachineType::PointerRepresentation()); 1339 return VisitLeaf(node, MachineType::PointerRepresentation());
1360 case IrOpcode::kStateValues: 1340 case IrOpcode::kStateValues:
1361 VisitStateValues(node); 1341 VisitStateValues(node);
1362 break; 1342 break;
1343
1344 // The following opcodes are not produced before representation
1345 // inference runs, so we do not have any real test coverage.
1346 // Simply fail here.
1347 case IrOpcode::kChangeFloat64ToInt32:
1348 case IrOpcode::kChangeFloat64ToUint32:
1349 case IrOpcode::kTruncateInt64ToInt32:
1350 FATAL("Representation inference: unsupported opcodes.");
1351
1363 default: 1352 default:
1364 VisitInputs(node); 1353 VisitInputs(node);
1365 // Assume the output is tagged. 1354 // Assume the output is tagged.
1366 SetOutput(node, MachineRepresentation::kTagged); 1355 SetOutput(node, MachineRepresentation::kTagged);
1367 break; 1356 break;
1368 } 1357 }
1369 } 1358 }
1370 1359
1371 void DeferReplacement(Node* node, Node* replacement) { 1360 void DeferReplacement(Node* node, Node* replacement) {
1372 TRACE("defer replacement #%d:%s with #%d:%s\n", node->id(), 1361 TRACE("defer replacement #%d:%s with #%d:%s\n", node->id(),
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1788 if (!rhs_type->Is(type_cache_.kZeroToThirtyOne)) { 1777 if (!rhs_type->Is(type_cache_.kZeroToThirtyOne)) {
1789 node->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rhs, 1778 node->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rhs,
1790 jsgraph()->Int32Constant(0x1f))); 1779 jsgraph()->Int32Constant(0x1f)));
1791 } 1780 }
1792 NodeProperties::ChangeOp(node, op); 1781 NodeProperties::ChangeOp(node, op);
1793 } 1782 }
1794 1783
1795 } // namespace compiler 1784 } // namespace compiler
1796 } // namespace internal 1785 } // namespace internal
1797 } // namespace v8 1786 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698