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

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

Issue 2171703002: [turbofan] Sanitize the Truncation query method names. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@TurboFan_SimplifiedLowering_TruncationNone
Patch Set: Created 4 years, 5 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 | « src/compiler/representation-change.cc ('k') | 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/address-map.h" 9 #include "src/address-map.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 } 858 }
859 859
860 // Infer representation for phi-like nodes. 860 // Infer representation for phi-like nodes.
861 MachineRepresentation GetOutputInfoForPhi(Node* node, Truncation use) { 861 MachineRepresentation GetOutputInfoForPhi(Node* node, Truncation use) {
862 // Compute the representation. 862 // Compute the representation.
863 Type* type = TypeOf(node); 863 Type* type = TypeOf(node);
864 if (type->Is(Type::None())) { 864 if (type->Is(Type::None())) {
865 return MachineRepresentation::kNone; 865 return MachineRepresentation::kNone;
866 } else if (type->Is(Type::Signed32()) || type->Is(Type::Unsigned32())) { 866 } else if (type->Is(Type::Signed32()) || type->Is(Type::Unsigned32())) {
867 return MachineRepresentation::kWord32; 867 return MachineRepresentation::kWord32;
868 } else if (use.TruncatesToWord32()) { 868 } else if (use.IsUsedAsWord32()) {
869 return MachineRepresentation::kWord32; 869 return MachineRepresentation::kWord32;
870 } else if (type->Is(Type::Boolean())) { 870 } else if (type->Is(Type::Boolean())) {
871 return MachineRepresentation::kBit; 871 return MachineRepresentation::kBit;
872 } else if (type->Is(Type::Number())) { 872 } else if (type->Is(Type::Number())) {
873 return MachineRepresentation::kFloat64; 873 return MachineRepresentation::kFloat64;
874 } else if (use.TruncatesToFloat64()) { 874 } else if (use.IsUsedAsFloat64()) {
875 return MachineRepresentation::kFloat64; 875 return MachineRepresentation::kFloat64;
876 } else if (type->Is(Type::Internal())) { 876 } else if (type->Is(Type::Internal())) {
877 // We mark (u)int64 as Type::Internal. 877 // We mark (u)int64 as Type::Internal.
878 // TODO(jarin) This is a workaround for our lack of (u)int64 878 // TODO(jarin) This is a workaround for our lack of (u)int64
879 // types. This can be removed once we can represent (u)int64 879 // types. This can be removed once we can represent (u)int64
880 // unambiguously. (At the moment internal objects, such as the hole, 880 // unambiguously. (At the moment internal objects, such as the hole,
881 // are also Type::Internal()). 881 // are also Type::Internal()).
882 bool is_word64 = GetInfo(node->InputAt(0))->representation() == 882 bool is_word64 = GetInfo(node->InputAt(0))->representation() ==
883 MachineRepresentation::kWord64; 883 MachineRepresentation::kWord64;
884 #ifdef DEBUG 884 #ifdef DEBUG
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 CommonOperatorBuilder* common() const { return jsgraph_->common(); } 1094 CommonOperatorBuilder* common() const { return jsgraph_->common(); }
1095 SimplifiedOperatorBuilder* simplified() const { 1095 SimplifiedOperatorBuilder* simplified() const {
1096 return jsgraph_->simplified(); 1096 return jsgraph_->simplified();
1097 } 1097 }
1098 1098
1099 void LowerToCheckedInt32Mul(Node* node, Truncation truncation, 1099 void LowerToCheckedInt32Mul(Node* node, Truncation truncation,
1100 Type* input0_type, Type* input1_type) { 1100 Type* input0_type, Type* input1_type) {
1101 // If one of the inputs is positive and/or truncation is being applied, 1101 // If one of the inputs is positive and/or truncation is being applied,
1102 // there is no need to return -0. 1102 // there is no need to return -0.
1103 CheckForMinusZeroMode mz_mode = 1103 CheckForMinusZeroMode mz_mode =
1104 truncation.TruncatesToWord32() || 1104 truncation.IsUsedAsWord32() ||
1105 (input0_type->Is(Type::OrderedNumber()) && 1105 (input0_type->Is(Type::OrderedNumber()) &&
1106 input0_type->Min() > 0) || 1106 input0_type->Min() > 0) ||
1107 (input1_type->Is(Type::OrderedNumber()) && 1107 (input1_type->Is(Type::OrderedNumber()) &&
1108 input1_type->Min() > 0) 1108 input1_type->Min() > 0)
1109 ? CheckForMinusZeroMode::kDontCheckForMinusZero 1109 ? CheckForMinusZeroMode::kDontCheckForMinusZero
1110 : CheckForMinusZeroMode::kCheckForMinusZero; 1110 : CheckForMinusZeroMode::kCheckForMinusZero;
1111 1111
1112 NodeProperties::ChangeOp(node, simplified()->CheckedInt32Mul(mz_mode)); 1112 NodeProperties::ChangeOp(node, simplified()->CheckedInt32Mul(mz_mode));
1113 } 1113 }
1114 1114
(...skipping 11 matching lines...) Expand all
1126 if (BothInputsAre(node, type_cache_.kSigned32OrMinusZero) && 1126 if (BothInputsAre(node, type_cache_.kSigned32OrMinusZero) &&
1127 NodeProperties::GetType(node)->Is(Type::Signed32())) { 1127 NodeProperties::GetType(node)->Is(Type::Signed32())) {
1128 // int32 + int32 = int32 ==> signed Int32Add/Sub 1128 // int32 + int32 = int32 ==> signed Int32Add/Sub
1129 VisitInt32Binop(node); 1129 VisitInt32Binop(node);
1130 if (lower()) ChangeToPureOp(node, Int32Op(node)); 1130 if (lower()) ChangeToPureOp(node, Int32Op(node));
1131 return; 1131 return;
1132 } 1132 }
1133 1133
1134 // Use truncation if available. 1134 // Use truncation if available.
1135 if (BothInputsAre(node, type_cache_.kAdditiveSafeIntegerOrMinusZero) && 1135 if (BothInputsAre(node, type_cache_.kAdditiveSafeIntegerOrMinusZero) &&
1136 truncation.TruncatesToWord32()) { 1136 truncation.IsUsedAsWord32()) {
1137 // safe-int + safe-int = x (truncated to int32) 1137 // safe-int + safe-int = x (truncated to int32)
1138 // => signed Int32Add/Sub (truncated) 1138 // => signed Int32Add/Sub (truncated)
1139 VisitWord32TruncatingBinop(node); 1139 VisitWord32TruncatingBinop(node);
1140 if (lower()) ChangeToPureOp(node, Int32Op(node)); 1140 if (lower()) ChangeToPureOp(node, Int32Op(node));
1141 return; 1141 return;
1142 } 1142 }
1143 1143
1144 // Try to use type feedback. 1144 // Try to use type feedback.
1145 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op()); 1145 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op());
1146 1146
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 return VisitPhi(node, truncation, lowering); 1235 return VisitPhi(node, truncation, lowering);
1236 case IrOpcode::kCall: 1236 case IrOpcode::kCall:
1237 return VisitCall(node, lowering); 1237 return VisitCall(node, lowering);
1238 1238
1239 //------------------------------------------------------------------ 1239 //------------------------------------------------------------------
1240 // JavaScript operators. 1240 // JavaScript operators.
1241 //------------------------------------------------------------------ 1241 //------------------------------------------------------------------
1242 case IrOpcode::kJSToNumber: { 1242 case IrOpcode::kJSToNumber: {
1243 VisitInputs(node); 1243 VisitInputs(node);
1244 // TODO(bmeurer): Optimize somewhat based on input type? 1244 // TODO(bmeurer): Optimize somewhat based on input type?
1245 if (truncation.TruncatesToWord32()) { 1245 if (truncation.IsUsedAsWord32()) {
1246 SetOutput(node, MachineRepresentation::kWord32); 1246 SetOutput(node, MachineRepresentation::kWord32);
1247 if (lower()) lowering->DoJSToNumberTruncatesToWord32(node, this); 1247 if (lower()) lowering->DoJSToNumberTruncatesToWord32(node, this);
1248 } else if (truncation.TruncatesToFloat64()) { 1248 } else if (truncation.IsUsedAsFloat64()) {
1249 SetOutput(node, MachineRepresentation::kFloat64); 1249 SetOutput(node, MachineRepresentation::kFloat64);
1250 if (lower()) lowering->DoJSToNumberTruncatesToFloat64(node, this); 1250 if (lower()) lowering->DoJSToNumberTruncatesToFloat64(node, this);
1251 } else { 1251 } else {
1252 SetOutput(node, MachineRepresentation::kTagged); 1252 SetOutput(node, MachineRepresentation::kTagged);
1253 } 1253 }
1254 return; 1254 return;
1255 } 1255 }
1256 1256
1257 //------------------------------------------------------------------ 1257 //------------------------------------------------------------------
1258 // Simplified operators. 1258 // Simplified operators.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 case IrOpcode::kNumberAdd: 1340 case IrOpcode::kNumberAdd:
1341 case IrOpcode::kNumberSubtract: { 1341 case IrOpcode::kNumberSubtract: {
1342 if (BothInputsAre(node, Type::Signed32()) && 1342 if (BothInputsAre(node, Type::Signed32()) &&
1343 NodeProperties::GetType(node)->Is(Type::Signed32())) { 1343 NodeProperties::GetType(node)->Is(Type::Signed32())) {
1344 // int32 + int32 = int32 1344 // int32 + int32 = int32
1345 // => signed Int32Add/Sub 1345 // => signed Int32Add/Sub
1346 VisitInt32Binop(node); 1346 VisitInt32Binop(node);
1347 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); 1347 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node));
1348 } else if (BothInputsAre(node, 1348 } else if (BothInputsAre(node,
1349 type_cache_.kAdditiveSafeIntegerOrMinusZero) && 1349 type_cache_.kAdditiveSafeIntegerOrMinusZero) &&
1350 truncation.TruncatesToWord32()) { 1350 truncation.IsUsedAsWord32()) {
1351 // safe-int + safe-int = x (truncated to int32) 1351 // safe-int + safe-int = x (truncated to int32)
1352 // => signed Int32Add/Sub (truncated) 1352 // => signed Int32Add/Sub (truncated)
1353 VisitWord32TruncatingBinop(node); 1353 VisitWord32TruncatingBinop(node);
1354 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); 1354 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node));
1355 } else { 1355 } else {
1356 // => Float64Add/Sub 1356 // => Float64Add/Sub
1357 VisitFloat64Binop(node); 1357 VisitFloat64Binop(node);
1358 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); 1358 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
1359 } 1359 }
1360 return; 1360 return;
1361 } 1361 }
1362 case IrOpcode::kSpeculativeNumberMultiply: { 1362 case IrOpcode::kSpeculativeNumberMultiply: {
1363 if (truncation.IsUnused()) return VisitUnused(node); 1363 if (truncation.IsUnused()) return VisitUnused(node);
1364 if (BothInputsAre(node, Type::Integral32()) && 1364 if (BothInputsAre(node, Type::Integral32()) &&
1365 (NodeProperties::GetType(node)->Is(Type::Signed32()) || 1365 (NodeProperties::GetType(node)->Is(Type::Signed32()) ||
1366 NodeProperties::GetType(node)->Is(Type::Unsigned32()) || 1366 NodeProperties::GetType(node)->Is(Type::Unsigned32()) ||
1367 (truncation.TruncatesToWord32() && 1367 (truncation.IsUsedAsWord32() &&
1368 NodeProperties::GetType(node)->Is( 1368 NodeProperties::GetType(node)->Is(
1369 type_cache_.kSafeIntegerOrMinusZero)))) { 1369 type_cache_.kSafeIntegerOrMinusZero)))) {
1370 // Multiply reduces to Int32Mul if the inputs are integers, and 1370 // Multiply reduces to Int32Mul if the inputs are integers, and
1371 // (a) the output is either known to be Signed32, or 1371 // (a) the output is either known to be Signed32, or
1372 // (b) the output is known to be Unsigned32, or 1372 // (b) the output is known to be Unsigned32, or
1373 // (c) the uses are truncating and the result is in the safe 1373 // (c) the uses are truncating and the result is in the safe
1374 // integer range. 1374 // integer range.
1375 VisitWord32TruncatingBinop(node); 1375 VisitWord32TruncatingBinop(node);
1376 if (lower()) ChangeToPureOp(node, Int32Op(node)); 1376 if (lower()) ChangeToPureOp(node, Int32Op(node));
1377 return; 1377 return;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 // Checked float64 x float64 => float64 1410 // Checked float64 x float64 => float64
1411 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(), 1411 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(),
1412 MachineRepresentation::kFloat64, Type::Number()); 1412 MachineRepresentation::kFloat64, Type::Number());
1413 if (lower()) ChangeToPureOp(node, Float64Op(node)); 1413 if (lower()) ChangeToPureOp(node, Float64Op(node));
1414 return; 1414 return;
1415 } 1415 }
1416 case IrOpcode::kNumberMultiply: { 1416 case IrOpcode::kNumberMultiply: {
1417 if (BothInputsAre(node, Type::Integral32()) && 1417 if (BothInputsAre(node, Type::Integral32()) &&
1418 (NodeProperties::GetType(node)->Is(Type::Signed32()) || 1418 (NodeProperties::GetType(node)->Is(Type::Signed32()) ||
1419 NodeProperties::GetType(node)->Is(Type::Unsigned32()) || 1419 NodeProperties::GetType(node)->Is(Type::Unsigned32()) ||
1420 (truncation.TruncatesToWord32() && 1420 (truncation.IsUsedAsWord32() &&
1421 NodeProperties::GetType(node)->Is( 1421 NodeProperties::GetType(node)->Is(
1422 type_cache_.kSafeIntegerOrMinusZero)))) { 1422 type_cache_.kSafeIntegerOrMinusZero)))) {
1423 // Multiply reduces to Int32Mul if the inputs are integers, and 1423 // Multiply reduces to Int32Mul if the inputs are integers, and
1424 // (a) the output is either known to be Signed32, or 1424 // (a) the output is either known to be Signed32, or
1425 // (b) the output is known to be Unsigned32, or 1425 // (b) the output is known to be Unsigned32, or
1426 // (c) the uses are truncating and the result is in the safe 1426 // (c) the uses are truncating and the result is in the safe
1427 // integer range. 1427 // integer range.
1428 VisitWord32TruncatingBinop(node); 1428 VisitWord32TruncatingBinop(node);
1429 if (lower()) ChangeToPureOp(node, Int32Op(node)); 1429 if (lower()) ChangeToPureOp(node, Int32Op(node));
1430 return; 1430 return;
1431 } 1431 }
1432 // Number x Number => Float64Mul 1432 // Number x Number => Float64Mul
1433 VisitFloat64Binop(node); 1433 VisitFloat64Binop(node);
1434 if (lower()) ChangeToPureOp(node, Float64Op(node)); 1434 if (lower()) ChangeToPureOp(node, Float64Op(node));
1435 return; 1435 return;
1436 } 1436 }
1437 case IrOpcode::kSpeculativeNumberDivide: { 1437 case IrOpcode::kSpeculativeNumberDivide: {
1438 if (truncation.IsUnused()) return VisitUnused(node); 1438 if (truncation.IsUnused()) return VisitUnused(node);
1439 if (BothInputsAreUnsigned32(node) && truncation.TruncatesToWord32()) { 1439 if (BothInputsAreUnsigned32(node) && truncation.IsUsedAsWord32()) {
1440 // => unsigned Uint32Div 1440 // => unsigned Uint32Div
1441 VisitWord32TruncatingBinop(node); 1441 VisitWord32TruncatingBinop(node);
1442 if (lower()) DeferReplacement(node, lowering->Uint32Div(node)); 1442 if (lower()) DeferReplacement(node, lowering->Uint32Div(node));
1443 return; 1443 return;
1444 } 1444 }
1445 if (BothInputsAreSigned32(node)) { 1445 if (BothInputsAreSigned32(node)) {
1446 if (NodeProperties::GetType(node)->Is(Type::Signed32())) { 1446 if (NodeProperties::GetType(node)->Is(Type::Signed32())) {
1447 // => signed Int32Div 1447 // => signed Int32Div
1448 VisitInt32Binop(node); 1448 VisitInt32Binop(node);
1449 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); 1449 if (lower()) DeferReplacement(node, lowering->Int32Div(node));
1450 return; 1450 return;
1451 } 1451 }
1452 if (truncation.TruncatesToWord32()) { 1452 if (truncation.IsUsedAsWord32()) {
1453 // => signed Int32Div 1453 // => signed Int32Div
1454 VisitWord32TruncatingBinop(node); 1454 VisitWord32TruncatingBinop(node);
1455 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); 1455 if (lower()) DeferReplacement(node, lowering->Int32Div(node));
1456 return; 1456 return;
1457 } 1457 }
1458 } 1458 }
1459 1459
1460 // Try to use type feedback. 1460 // Try to use type feedback.
1461 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op()); 1461 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op());
1462 1462
(...skipping 18 matching lines...) Expand all
1481 VisitBinop(node, UseInfo::TruncatingWord32(), 1481 VisitBinop(node, UseInfo::TruncatingWord32(),
1482 MachineRepresentation::kWord32, Type::Signed32()); 1482 MachineRepresentation::kWord32, Type::Signed32());
1483 if (lower()) ChangeToInt32OverflowOp(node); 1483 if (lower()) ChangeToInt32OverflowOp(node);
1484 return; 1484 return;
1485 } 1485 }
1486 } 1486 }
1487 1487
1488 if (hint == BinaryOperationHints::kSignedSmall || 1488 if (hint == BinaryOperationHints::kSignedSmall ||
1489 hint == BinaryOperationHints::kSigned32) { 1489 hint == BinaryOperationHints::kSigned32) {
1490 // If the result is truncated, we only need to check the inputs. 1490 // If the result is truncated, we only need to check the inputs.
1491 if (truncation.TruncatesToWord32()) { 1491 if (truncation.IsUsedAsWord32()) {
1492 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(), 1492 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(),
1493 MachineRepresentation::kWord32); 1493 MachineRepresentation::kWord32);
1494 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); 1494 if (lower()) DeferReplacement(node, lowering->Int32Div(node));
1495 } else { 1495 } else {
1496 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(), 1496 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(),
1497 MachineRepresentation::kWord32, Type::Signed32()); 1497 MachineRepresentation::kWord32, Type::Signed32());
1498 if (lower()) ChangeToInt32OverflowOp(node); 1498 if (lower()) ChangeToInt32OverflowOp(node);
1499 } 1499 }
1500 return; 1500 return;
1501 } 1501 }
1502 1502
1503 // default case => Float64Div 1503 // default case => Float64Div
1504 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(), 1504 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(),
1505 MachineRepresentation::kFloat64, Type::Number()); 1505 MachineRepresentation::kFloat64, Type::Number());
1506 if (lower()) ChangeToPureOp(node, Float64Op(node)); 1506 if (lower()) ChangeToPureOp(node, Float64Op(node));
1507 return; 1507 return;
1508 } 1508 }
1509 case IrOpcode::kNumberDivide: { 1509 case IrOpcode::kNumberDivide: {
1510 if (BothInputsAreUnsigned32(node) && truncation.TruncatesToWord32()) { 1510 if (BothInputsAreUnsigned32(node) && truncation.IsUsedAsWord32()) {
1511 // => unsigned Uint32Div 1511 // => unsigned Uint32Div
1512 VisitWord32TruncatingBinop(node); 1512 VisitWord32TruncatingBinop(node);
1513 if (lower()) DeferReplacement(node, lowering->Uint32Div(node)); 1513 if (lower()) DeferReplacement(node, lowering->Uint32Div(node));
1514 return; 1514 return;
1515 } 1515 }
1516 if (BothInputsAreSigned32(node)) { 1516 if (BothInputsAreSigned32(node)) {
1517 if (NodeProperties::GetType(node)->Is(Type::Signed32())) { 1517 if (NodeProperties::GetType(node)->Is(Type::Signed32())) {
1518 // => signed Int32Div 1518 // => signed Int32Div
1519 VisitInt32Binop(node); 1519 VisitInt32Binop(node);
1520 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); 1520 if (lower()) DeferReplacement(node, lowering->Int32Div(node));
1521 return; 1521 return;
1522 } 1522 }
1523 if (truncation.TruncatesToWord32()) { 1523 if (truncation.IsUsedAsWord32()) {
1524 // => signed Int32Div 1524 // => signed Int32Div
1525 VisitWord32TruncatingBinop(node); 1525 VisitWord32TruncatingBinop(node);
1526 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); 1526 if (lower()) DeferReplacement(node, lowering->Int32Div(node));
1527 return; 1527 return;
1528 } 1528 }
1529 } 1529 }
1530 // Number x Number => Float64Div 1530 // Number x Number => Float64Div
1531 if (BothInputsAre(node, Type::NumberOrUndefined())) { 1531 if (BothInputsAre(node, Type::NumberOrUndefined())) {
1532 VisitFloat64Binop(node); 1532 VisitFloat64Binop(node);
1533 if (lower()) ChangeToPureOp(node, Float64Op(node)); 1533 if (lower()) ChangeToPureOp(node, Float64Op(node));
1534 return; 1534 return;
1535 } 1535 }
1536 // Checked float64 x float64 => float64 1536 // Checked float64 x float64 => float64
1537 DCHECK_EQ(IrOpcode::kSpeculativeNumberDivide, node->opcode()); 1537 DCHECK_EQ(IrOpcode::kSpeculativeNumberDivide, node->opcode());
1538 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(), 1538 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(),
1539 MachineRepresentation::kFloat64, Type::Number()); 1539 MachineRepresentation::kFloat64, Type::Number());
1540 if (lower()) ChangeToPureOp(node, Float64Op(node)); 1540 if (lower()) ChangeToPureOp(node, Float64Op(node));
1541 return; 1541 return;
1542 } 1542 }
1543 case IrOpcode::kSpeculativeNumberModulus: { 1543 case IrOpcode::kSpeculativeNumberModulus: {
1544 if (truncation.IsUnused()) return VisitUnused(node); 1544 if (truncation.IsUnused()) return VisitUnused(node);
1545 if (BothInputsAreUnsigned32(node) && truncation.TruncatesToWord32()) { 1545 if (BothInputsAreUnsigned32(node) && truncation.IsUsedAsWord32()) {
1546 // => unsigned Uint32Mod 1546 // => unsigned Uint32Mod
1547 VisitWord32TruncatingBinop(node); 1547 VisitWord32TruncatingBinop(node);
1548 if (lower()) DeferReplacement(node, lowering->Uint32Mod(node)); 1548 if (lower()) DeferReplacement(node, lowering->Uint32Mod(node));
1549 return; 1549 return;
1550 } 1550 }
1551 if (BothInputsAreSigned32(node)) { 1551 if (BothInputsAreSigned32(node)) {
1552 if (NodeProperties::GetType(node)->Is(Type::Signed32())) { 1552 if (NodeProperties::GetType(node)->Is(Type::Signed32())) {
1553 // => signed Int32Mod 1553 // => signed Int32Mod
1554 VisitInt32Binop(node); 1554 VisitInt32Binop(node);
1555 if (lower()) DeferReplacement(node, lowering->Int32Mod(node)); 1555 if (lower()) DeferReplacement(node, lowering->Int32Mod(node));
1556 return; 1556 return;
1557 } 1557 }
1558 if (truncation.TruncatesToWord32()) { 1558 if (truncation.IsUsedAsWord32()) {
1559 // => signed Int32Mod 1559 // => signed Int32Mod
1560 VisitWord32TruncatingBinop(node); 1560 VisitWord32TruncatingBinop(node);
1561 if (lower()) DeferReplacement(node, lowering->Int32Mod(node)); 1561 if (lower()) DeferReplacement(node, lowering->Int32Mod(node));
1562 return; 1562 return;
1563 } 1563 }
1564 } 1564 }
1565 1565
1566 // Try to use type feedback. 1566 // Try to use type feedback.
1567 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op()); 1567 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op());
1568 1568
(...skipping 18 matching lines...) Expand all
1587 VisitBinop(node, UseInfo::TruncatingWord32(), 1587 VisitBinop(node, UseInfo::TruncatingWord32(),
1588 MachineRepresentation::kWord32, Type::Signed32()); 1588 MachineRepresentation::kWord32, Type::Signed32());
1589 if (lower()) ChangeToInt32OverflowOp(node); 1589 if (lower()) ChangeToInt32OverflowOp(node);
1590 return; 1590 return;
1591 } 1591 }
1592 } 1592 }
1593 1593
1594 if (hint == BinaryOperationHints::kSignedSmall || 1594 if (hint == BinaryOperationHints::kSignedSmall ||
1595 hint == BinaryOperationHints::kSigned32) { 1595 hint == BinaryOperationHints::kSigned32) {
1596 // If the result is truncated, we only need to check the inputs. 1596 // If the result is truncated, we only need to check the inputs.
1597 if (truncation.TruncatesToWord32()) { 1597 if (truncation.IsUsedAsWord32()) {
1598 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(), 1598 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(),
1599 MachineRepresentation::kWord32); 1599 MachineRepresentation::kWord32);
1600 if (lower()) DeferReplacement(node, lowering->Int32Mod(node)); 1600 if (lower()) DeferReplacement(node, lowering->Int32Mod(node));
1601 } else { 1601 } else {
1602 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(), 1602 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(),
1603 MachineRepresentation::kWord32, Type::Signed32()); 1603 MachineRepresentation::kWord32, Type::Signed32());
1604 if (lower()) ChangeToInt32OverflowOp(node); 1604 if (lower()) ChangeToInt32OverflowOp(node);
1605 } 1605 }
1606 return; 1606 return;
1607 } 1607 }
1608 1608
1609 // default case => Float64Mod 1609 // default case => Float64Mod
1610 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(), 1610 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(),
1611 MachineRepresentation::kFloat64, Type::Number()); 1611 MachineRepresentation::kFloat64, Type::Number());
1612 if (lower()) ChangeToPureOp(node, Float64Op(node)); 1612 if (lower()) ChangeToPureOp(node, Float64Op(node));
1613 return; 1613 return;
1614 } 1614 }
1615 case IrOpcode::kNumberModulus: { 1615 case IrOpcode::kNumberModulus: {
1616 if (BothInputsAreUnsigned32(node) && truncation.TruncatesToWord32()) { 1616 if (BothInputsAreUnsigned32(node) && truncation.IsUsedAsWord32()) {
1617 // => unsigned Uint32Mod 1617 // => unsigned Uint32Mod
1618 VisitWord32TruncatingBinop(node); 1618 VisitWord32TruncatingBinop(node);
1619 if (lower()) DeferReplacement(node, lowering->Uint32Mod(node)); 1619 if (lower()) DeferReplacement(node, lowering->Uint32Mod(node));
1620 return; 1620 return;
1621 } 1621 }
1622 if (BothInputsAreSigned32(node)) { 1622 if (BothInputsAreSigned32(node)) {
1623 if (NodeProperties::GetType(node)->Is(Type::Signed32())) { 1623 if (NodeProperties::GetType(node)->Is(Type::Signed32())) {
1624 // => signed Int32Mod 1624 // => signed Int32Mod
1625 VisitInt32Binop(node); 1625 VisitInt32Binop(node);
1626 if (lower()) DeferReplacement(node, lowering->Int32Mod(node)); 1626 if (lower()) DeferReplacement(node, lowering->Int32Mod(node));
1627 return; 1627 return;
1628 } 1628 }
1629 if (truncation.TruncatesToWord32()) { 1629 if (truncation.IsUsedAsWord32()) {
1630 // => signed Int32Mod 1630 // => signed Int32Mod
1631 VisitWord32TruncatingBinop(node); 1631 VisitWord32TruncatingBinop(node);
1632 if (lower()) DeferReplacement(node, lowering->Int32Mod(node)); 1632 if (lower()) DeferReplacement(node, lowering->Int32Mod(node));
1633 return; 1633 return;
1634 } 1634 }
1635 } 1635 }
1636 // => Float64Mod 1636 // => Float64Mod
1637 VisitFloat64Binop(node); 1637 VisitFloat64Binop(node);
1638 if (lower()) ChangeToPureOp(node, Float64Op(node)); 1638 if (lower()) ChangeToPureOp(node, Float64Op(node));
1639 return; 1639 return;
(...skipping 23 matching lines...) Expand all
1663 MachineRepresentation::kWord32); 1663 MachineRepresentation::kWord32);
1664 if (lower()) { 1664 if (lower()) {
1665 lowering->DoShift(node, lowering->machine()->Word32Shl(), rhs_type); 1665 lowering->DoShift(node, lowering->machine()->Word32Shl(), rhs_type);
1666 } 1666 }
1667 return; 1667 return;
1668 } 1668 }
1669 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op()); 1669 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op());
1670 if (hint == BinaryOperationHints::kSignedSmall || 1670 if (hint == BinaryOperationHints::kSignedSmall ||
1671 hint == BinaryOperationHints::kSigned32) { 1671 hint == BinaryOperationHints::kSigned32) {
1672 Type* rhs_type = GetUpperBound(node->InputAt(1)); 1672 Type* rhs_type = GetUpperBound(node->InputAt(1));
1673 if (truncation.TruncatesToWord32()) { 1673 if (truncation.IsUsedAsWord32()) {
1674 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(), 1674 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(),
1675 MachineRepresentation::kWord32); 1675 MachineRepresentation::kWord32);
1676 if (lower()) { 1676 if (lower()) {
1677 lowering->DoShift(node, lowering->machine()->Word32Shl(), 1677 lowering->DoShift(node, lowering->machine()->Word32Shl(),
1678 rhs_type); 1678 rhs_type);
1679 } 1679 }
1680 } else { 1680 } else {
1681 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(), 1681 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(),
1682 MachineRepresentation::kWord32, Type::Signed32()); 1682 MachineRepresentation::kWord32, Type::Signed32());
1683 if (lower()) { 1683 if (lower()) {
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 return; 1915 return;
1916 } 1916 }
1917 case IrOpcode::kCheckIf: { 1917 case IrOpcode::kCheckIf: {
1918 ProcessInput(node, 0, UseInfo::Bool()); 1918 ProcessInput(node, 0, UseInfo::Bool());
1919 ProcessRemainingInputs(node, 1); 1919 ProcessRemainingInputs(node, 1);
1920 SetOutput(node, MachineRepresentation::kNone); 1920 SetOutput(node, MachineRepresentation::kNone);
1921 return; 1921 return;
1922 } 1922 }
1923 case IrOpcode::kCheckNumber: { 1923 case IrOpcode::kCheckNumber: {
1924 if (InputIs(node, Type::Number())) { 1924 if (InputIs(node, Type::Number())) {
1925 if (truncation.TruncatesToWord32()) { 1925 if (truncation.IsUsedAsWord32()) {
1926 VisitUnop(node, UseInfo::TruncatingWord32(), 1926 VisitUnop(node, UseInfo::TruncatingWord32(),
1927 MachineRepresentation::kWord32); 1927 MachineRepresentation::kWord32);
1928 } else { 1928 } else {
1929 // TODO(jarin,bmeurer): We need to go to Tagged here, because 1929 // TODO(jarin,bmeurer): We need to go to Tagged here, because
1930 // otherwise we cannot distinguish the hole NaN (which might need to 1930 // otherwise we cannot distinguish the hole NaN (which might need to
1931 // be treated as undefined). We should have a dedicated Type for 1931 // be treated as undefined). We should have a dedicated Type for
1932 // that at some point, and maybe even a dedicated truncation. 1932 // that at some point, and maybe even a dedicated truncation.
1933 VisitUnop(node, UseInfo::AnyTagged(), 1933 VisitUnop(node, UseInfo::AnyTagged(),
1934 MachineRepresentation::kTagged); 1934 MachineRepresentation::kTagged);
1935 } 1935 }
1936 if (lower()) DeferReplacement(node, node->InputAt(0)); 1936 if (lower()) DeferReplacement(node, node->InputAt(0));
1937 } else { 1937 } else {
1938 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); 1938 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
1939 } 1939 }
1940 return; 1940 return;
1941 } 1941 }
1942 case IrOpcode::kCheckTaggedPointer: { 1942 case IrOpcode::kCheckTaggedPointer: {
1943 if (InputCannotBe(node, Type::SignedSmall())) { 1943 if (InputCannotBe(node, Type::SignedSmall())) {
1944 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); 1944 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
1945 if (lower()) DeferReplacement(node, node->InputAt(0)); 1945 if (lower()) DeferReplacement(node, node->InputAt(0));
1946 } else { 1946 } else {
1947 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); 1947 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
1948 } 1948 }
1949 return; 1949 return;
1950 } 1950 }
1951 case IrOpcode::kCheckTaggedSigned: { 1951 case IrOpcode::kCheckTaggedSigned: {
1952 if (SmiValuesAre32Bits() && truncation.TruncatesToWord32()) { 1952 if (SmiValuesAre32Bits() && truncation.IsUsedAsWord32()) {
1953 // TODO(jarin,bmeurer): Add CheckedSignedSmallAsWord32? 1953 // TODO(jarin,bmeurer): Add CheckedSignedSmallAsWord32?
1954 VisitUnop(node, UseInfo::CheckedSigned32AsWord32(), 1954 VisitUnop(node, UseInfo::CheckedSigned32AsWord32(),
1955 MachineRepresentation::kWord32); 1955 MachineRepresentation::kWord32);
1956 if (lower()) DeferReplacement(node, node->InputAt(0)); 1956 if (lower()) DeferReplacement(node, node->InputAt(0));
1957 } else { 1957 } else {
1958 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); 1958 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
1959 } 1959 }
1960 return; 1960 return;
1961 } 1961 }
1962 1962
1963 case IrOpcode::kAllocate: { 1963 case IrOpcode::kAllocate: {
1964 ProcessInput(node, 0, UseInfo::TruncatingWord32()); 1964 ProcessInput(node, 0, UseInfo::TruncatingWord32());
1965 ProcessRemainingInputs(node, 1); 1965 ProcessRemainingInputs(node, 1);
1966 SetOutput(node, MachineRepresentation::kTagged); 1966 SetOutput(node, MachineRepresentation::kTagged);
1967 return; 1967 return;
1968 } 1968 }
1969 case IrOpcode::kLoadField: { 1969 case IrOpcode::kLoadField: {
1970 if (truncation.IsUnused()) return VisitUnused(node); 1970 if (truncation.IsUnused()) return VisitUnused(node);
1971 FieldAccess access = FieldAccessOf(node->op()); 1971 FieldAccess access = FieldAccessOf(node->op());
1972 MachineRepresentation const representation = 1972 MachineRepresentation const representation =
1973 access.machine_type.representation(); 1973 access.machine_type.representation();
1974 // If we are loading from a Smi field and truncate the result to Word32, 1974 // If we are loading from a Smi field and truncate the result to Word32,
1975 // we can instead just load the high word on 64-bit architectures, which 1975 // we can instead just load the high word on 64-bit architectures, which
1976 // is exactly the Word32 we are looking for, and therefore avoid a nasty 1976 // is exactly the Word32 we are looking for, and therefore avoid a nasty
1977 // right shift afterwards. 1977 // right shift afterwards.
1978 // TODO(bmeurer): Introduce an appropriate tagged-signed machine rep. 1978 // TODO(bmeurer): Introduce an appropriate tagged-signed machine rep.
1979 if (truncation.TruncatesToWord32() && 1979 if (truncation.IsUsedAsWord32() &&
1980 representation == MachineRepresentation::kTagged && 1980 representation == MachineRepresentation::kTagged &&
1981 access.type->Is(Type::TaggedSigned()) && SmiValuesAre32Bits()) { 1981 access.type->Is(Type::TaggedSigned()) && SmiValuesAre32Bits()) {
1982 VisitUnop(node, UseInfoForBasePointer(access), 1982 VisitUnop(node, UseInfoForBasePointer(access),
1983 MachineRepresentation::kWord32); 1983 MachineRepresentation::kWord32);
1984 if (lower()) { 1984 if (lower()) {
1985 // Morph this Smi load field into an int32 load field. 1985 // Morph this Smi load field into an int32 load field.
1986 access.machine_type = MachineType::Int32(); 1986 access.machine_type = MachineType::Int32();
1987 access.type = type_cache_.kInt32; 1987 access.type = type_cache_.kInt32;
1988 #if V8_TARGET_LITTLE_ENDIAN 1988 #if V8_TARGET_LITTLE_ENDIAN
1989 access.offset += kPointerSize / 2; 1989 access.offset += kPointerSize / 2;
(...skipping 27 matching lines...) Expand all
2017 } 2017 }
2018 case IrOpcode::kLoadBuffer: { 2018 case IrOpcode::kLoadBuffer: {
2019 if (truncation.IsUnused()) return VisitUnused(node); 2019 if (truncation.IsUnused()) return VisitUnused(node);
2020 BufferAccess access = BufferAccessOf(node->op()); 2020 BufferAccess access = BufferAccessOf(node->op());
2021 ProcessInput(node, 0, UseInfo::PointerInt()); // buffer 2021 ProcessInput(node, 0, UseInfo::PointerInt()); // buffer
2022 ProcessInput(node, 1, UseInfo::TruncatingWord32()); // offset 2022 ProcessInput(node, 1, UseInfo::TruncatingWord32()); // offset
2023 ProcessInput(node, 2, UseInfo::TruncatingWord32()); // length 2023 ProcessInput(node, 2, UseInfo::TruncatingWord32()); // length
2024 ProcessRemainingInputs(node, 3); 2024 ProcessRemainingInputs(node, 3);
2025 2025
2026 MachineRepresentation output; 2026 MachineRepresentation output;
2027 if (truncation.TruncatesUndefinedToZeroOrNaN()) { 2027 if (truncation.IdentifiesUndefinedAndNaNAndZero()) {
2028 if (truncation.TruncatesNaNToZero()) { 2028 if (truncation.IdentifiesNaNAndZero()) {
2029 // If undefined is truncated to a non-NaN number, we can use 2029 // If undefined is truncated to a non-NaN number, we can use
2030 // the load's representation. 2030 // the load's representation.
2031 output = access.machine_type().representation(); 2031 output = access.machine_type().representation();
2032 } else { 2032 } else {
2033 // If undefined is truncated to a number, but the use can 2033 // If undefined is truncated to a number, but the use can
2034 // observe NaN, we need to output at least the float32 2034 // observe NaN, we need to output at least the float32
2035 // representation. 2035 // representation.
2036 if (access.machine_type().representation() == 2036 if (access.machine_type().representation() ==
2037 MachineRepresentation::kFloat32) { 2037 MachineRepresentation::kFloat32) {
2038 output = access.machine_type().representation(); 2038 output = access.machine_type().representation();
(...skipping 20 matching lines...) Expand all
2059 access.machine_type().representation())); // value 2059 access.machine_type().representation())); // value
2060 ProcessRemainingInputs(node, 4); 2060 ProcessRemainingInputs(node, 4);
2061 SetOutput(node, MachineRepresentation::kNone); 2061 SetOutput(node, MachineRepresentation::kNone);
2062 if (lower()) lowering->DoStoreBuffer(node); 2062 if (lower()) lowering->DoStoreBuffer(node);
2063 return; 2063 return;
2064 } 2064 }
2065 case IrOpcode::kLoadElement: { 2065 case IrOpcode::kLoadElement: {
2066 if (truncation.IsUnused()) return VisitUnused(node); 2066 if (truncation.IsUnused()) return VisitUnused(node);
2067 ElementAccess access = ElementAccessOf(node->op()); 2067 ElementAccess access = ElementAccessOf(node->op());
2068 VisitBinop(node, UseInfoForBasePointer(access), 2068 VisitBinop(node, UseInfoForBasePointer(access),
2069 UseInfo::TruncatingWord32(), 2069 UseInfo::TruncatingWord32(),
2070 access.machine_type.representation()); 2070 access.machine_type.representation());
2071 return; 2071 return;
2072 } 2072 }
2073 case IrOpcode::kStoreElement: { 2073 case IrOpcode::kStoreElement: {
2074 ElementAccess access = ElementAccessOf(node->op()); 2074 ElementAccess access = ElementAccessOf(node->op());
2075 WriteBarrierKind write_barrier_kind = WriteBarrierKindFor( 2075 WriteBarrierKind write_barrier_kind = WriteBarrierKindFor(
2076 access.base_is_tagged, access.machine_type.representation(), 2076 access.base_is_tagged, access.machine_type.representation(),
2077 access.type, node->InputAt(2)); 2077 access.type, node->InputAt(2));
2078 ProcessInput(node, 0, UseInfoForBasePointer(access)); // base 2078 ProcessInput(node, 0, UseInfoForBasePointer(access)); // base
2079 ProcessInput(node, 1, UseInfo::TruncatingWord32()); // index 2079 ProcessInput(node, 1, UseInfo::TruncatingWord32()); // index
2080 ProcessInput(node, 2, 2080 ProcessInput(node, 2,
(...skipping 10 matching lines...) Expand all
2091 } 2091 }
2092 return; 2092 return;
2093 } 2093 }
2094 case IrOpcode::kPlainPrimitiveToNumber: { 2094 case IrOpcode::kPlainPrimitiveToNumber: {
2095 if (InputIs(node, Type::Boolean())) { 2095 if (InputIs(node, Type::Boolean())) {
2096 VisitUnop(node, UseInfo::Bool(), MachineRepresentation::kWord32); 2096 VisitUnop(node, UseInfo::Bool(), MachineRepresentation::kWord32);
2097 if (lower()) DeferReplacement(node, node->InputAt(0)); 2097 if (lower()) DeferReplacement(node, node->InputAt(0));
2098 } else if (InputIs(node, Type::String())) { 2098 } else if (InputIs(node, Type::String())) {
2099 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); 2099 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
2100 if (lower()) lowering->DoStringToNumber(node); 2100 if (lower()) lowering->DoStringToNumber(node);
2101 } else if (truncation.TruncatesToWord32()) { 2101 } else if (truncation.IsUsedAsWord32()) {
2102 if (InputIs(node, Type::NumberOrOddball())) { 2102 if (InputIs(node, Type::NumberOrOddball())) {
2103 VisitUnop(node, UseInfo::TruncatingWord32(), 2103 VisitUnop(node, UseInfo::TruncatingWord32(),
2104 MachineRepresentation::kWord32); 2104 MachineRepresentation::kWord32);
2105 if (lower()) DeferReplacement(node, node->InputAt(0)); 2105 if (lower()) DeferReplacement(node, node->InputAt(0));
2106 } else { 2106 } else {
2107 VisitUnop(node, UseInfo::AnyTagged(), 2107 VisitUnop(node, UseInfo::AnyTagged(),
2108 MachineRepresentation::kWord32); 2108 MachineRepresentation::kWord32);
2109 if (lower()) { 2109 if (lower()) {
2110 NodeProperties::ChangeOp(node, 2110 NodeProperties::ChangeOp(node,
2111 simplified()->PlainPrimitiveToWord32()); 2111 simplified()->PlainPrimitiveToWord32());
2112 } 2112 }
2113 } 2113 }
2114 } else if (truncation.TruncatesToFloat64()) { 2114 } else if (truncation.IsUsedAsFloat64()) {
2115 if (InputIs(node, Type::NumberOrOddball())) { 2115 if (InputIs(node, Type::NumberOrOddball())) {
2116 VisitUnop(node, UseInfo::TruncatingFloat64(), 2116 VisitUnop(node, UseInfo::TruncatingFloat64(),
2117 MachineRepresentation::kFloat64); 2117 MachineRepresentation::kFloat64);
2118 if (lower()) DeferReplacement(node, node->InputAt(0)); 2118 if (lower()) DeferReplacement(node, node->InputAt(0));
2119 } else { 2119 } else {
2120 VisitUnop(node, UseInfo::AnyTagged(), 2120 VisitUnop(node, UseInfo::AnyTagged(),
2121 MachineRepresentation::kFloat64); 2121 MachineRepresentation::kFloat64);
2122 if (lower()) { 2122 if (lower()) {
2123 NodeProperties::ChangeOp(node, 2123 NodeProperties::ChangeOp(node,
2124 simplified()->PlainPrimitiveToFloat64()); 2124 simplified()->PlainPrimitiveToFloat64());
(...skipping 13 matching lines...) Expand all
2138 ProcessInput(node, 0, UseInfo::AnyTagged()); 2138 ProcessInput(node, 0, UseInfo::AnyTagged());
2139 SetOutput(node, MachineRepresentation::kBit); 2139 SetOutput(node, MachineRepresentation::kBit);
2140 return; 2140 return;
2141 } 2141 }
2142 case IrOpcode::kCheckFloat64Hole: { 2142 case IrOpcode::kCheckFloat64Hole: {
2143 if (truncation.IsUnused()) return VisitUnused(node); 2143 if (truncation.IsUnused()) return VisitUnused(node);
2144 CheckFloat64HoleMode mode = CheckFloat64HoleModeOf(node->op()); 2144 CheckFloat64HoleMode mode = CheckFloat64HoleModeOf(node->op());
2145 ProcessInput(node, 0, UseInfo::TruncatingFloat64()); 2145 ProcessInput(node, 0, UseInfo::TruncatingFloat64());
2146 ProcessRemainingInputs(node, 1); 2146 ProcessRemainingInputs(node, 1);
2147 SetOutput(node, MachineRepresentation::kFloat64); 2147 SetOutput(node, MachineRepresentation::kFloat64);
2148 if (truncation.TruncatesToFloat64() && 2148 if (truncation.IsUsedAsFloat64() &&
2149 mode == CheckFloat64HoleMode::kAllowReturnHole) { 2149 mode == CheckFloat64HoleMode::kAllowReturnHole) {
2150 if (lower()) DeferReplacement(node, node->InputAt(0)); 2150 if (lower()) DeferReplacement(node, node->InputAt(0));
2151 } 2151 }
2152 return; 2152 return;
2153 } 2153 }
2154 case IrOpcode::kCheckTaggedHole: { 2154 case IrOpcode::kCheckTaggedHole: {
2155 CheckTaggedHoleMode mode = CheckTaggedHoleModeOf(node->op()); 2155 CheckTaggedHoleMode mode = CheckTaggedHoleModeOf(node->op());
2156 if (truncation.TruncatesToWord32() && 2156 if (truncation.IsUsedAsWord32() &&
2157 mode == CheckTaggedHoleMode::kConvertHoleToUndefined) { 2157 mode == CheckTaggedHoleMode::kConvertHoleToUndefined) {
2158 ProcessInput(node, 0, UseInfo::CheckedSigned32AsWord32()); 2158 ProcessInput(node, 0, UseInfo::CheckedSigned32AsWord32());
2159 ProcessRemainingInputs(node, 1); 2159 ProcessRemainingInputs(node, 1);
2160 SetOutput(node, MachineRepresentation::kWord32); 2160 SetOutput(node, MachineRepresentation::kWord32);
2161 if (lower()) DeferReplacement(node, node->InputAt(0)); 2161 if (lower()) DeferReplacement(node, node->InputAt(0));
2162 } else { 2162 } else {
2163 ProcessInput(node, 0, UseInfo::AnyTagged()); 2163 ProcessInput(node, 0, UseInfo::AnyTagged());
2164 ProcessRemainingInputs(node, 1); 2164 ProcessRemainingInputs(node, 1);
2165 SetOutput(node, MachineRepresentation::kTagged); 2165 SetOutput(node, MachineRepresentation::kTagged);
2166 } 2166 }
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
3429 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3429 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3430 Operator::kNoProperties); 3430 Operator::kNoProperties);
3431 to_number_operator_.set(common()->Call(desc)); 3431 to_number_operator_.set(common()->Call(desc));
3432 } 3432 }
3433 return to_number_operator_.get(); 3433 return to_number_operator_.get();
3434 } 3434 }
3435 3435
3436 } // namespace compiler 3436 } // namespace compiler
3437 } // namespace internal 3437 } // namespace internal
3438 } // namespace v8 3438 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/representation-change.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698