Lines Matching refs:node
16 #include "src/compiler/node-matchers.h"
17 #include "src/compiler/node-properties.h"
47 // During this phase, the usage information for a node determines the best
156 void SetAndCheckInput(Node* node, int index, UseInfo use_info) {
158 input_use_infos_.resize(node->InputCount(), UseInfo::None());
183 // Information for each node tracked during the fixpoint.
186 // Adds new use to the node. Returns true if something has changed
187 // and the node has to be requeued.
258 while (current.input_index < current.node->InputCount()) {
259 Node* input = current.node->InputAt(current.input_index);
272 Node* node = current.node;
274 NodeInfo* info = GetInfo(node);
276 bool updated = UpdateFeedbackType(node);
278 for (Node* const user : node->uses()) {
289 Node* node = queue_.front();
291 NodeInfo* info = GetInfo(node);
293 bool updated = UpdateFeedbackType(node);
295 for (Node* const user : node->uses()) {
312 Type* TypeOf(Node* node) {
313 Type* type = GetInfo(node)->feedback_type();
314 return type == nullptr ? NodeProperties::GetType(node) : type;
317 Type* FeedbackTypeOf(Node* node) {
318 Type* type = GetInfo(node)->feedback_type();
322 Type* TypePhi(Node* node) {
323 int arity = node->op()->ValueInputCount();
324 Type* type = FeedbackTypeOf(node->InputAt(0));
326 type = op_typer_.Merge(type, FeedbackTypeOf(node->InputAt(i)));
331 Type* TypeSelect(Node* node) {
332 return op_typer_.Merge(FeedbackTypeOf(node->InputAt(1)),
333 FeedbackTypeOf(node->InputAt(2)));
353 bool UpdateFeedbackType(Node* node) {
354 if (node->op()->ValueOutputCount() == 0) return false;
356 NodeInfo* info = GetInfo(node);
360 switch (node->opcode()) {
362 Type* lhs = FeedbackTypeOf(node->InputAt(0));
363 Type* rhs = FeedbackTypeOf(node->InputAt(1));
382 Type* lhs = FeedbackTypeOf(node->InputAt(0));
383 Type* rhs = FeedbackTypeOf(node->InputAt(1));
402 Type* lhs = FeedbackTypeOf(node->InputAt(0));
403 Type* rhs = FeedbackTypeOf(node->InputAt(1));
422 Type* lhs = FeedbackTypeOf(node->InputAt(0));
423 Type* rhs = FeedbackTypeOf(node->InputAt(1));
442 Type* lhs = FeedbackTypeOf(node->InputAt(0));
443 Type* rhs = FeedbackTypeOf(node->InputAt(1));
462 new_type = TypePhi(node);
464 new_type = Weaken(node, type, new_type);
468 GetOutputInfoForPhi(node, GetInfo(node)->truncation(), new_type);
469 ResetOutput(node, output);
474 new_type = TypeSelect(node);
477 GetOutputInfoForPhi(node, GetInfo(node)->truncation(), new_type);
478 ResetOutput(node, output);
485 GetInfo(node)->set_feedback_type(NodeProperties::GetType(node));
491 GetInfo(node)->set_feedback_type(new_type);
493 PrintNodeFeedbackType(node);
498 void PrintNodeFeedbackType(Node* n) {
502 for (Node* const i : n->inputs()) {
521 Type* Weaken(Node* node, Type* previous_type, Type* current_type) {
534 // Once we start weakening a node, we should always weaken.
535 if (!GetInfo(node)->weakened()) {
545 GetInfo(node)->set_weakened();
561 Node* node = queue_.front();
562 NodeInfo* info = GetInfo(node);
565 TRACE(" visit #%d: %s\n", node->id(), node->op()->mnemonic());
566 VisitNode(node, info->truncation(), nullptr);
586 Node* node = *i;
587 NodeInfo* info = GetInfo(node);
588 TRACE(" visit #%d: %s\n", node->id(), node->op()->mnemonic());
591 source_positions_, source_positions_->GetSourcePosition(node));
592 VisitNode(node, info->truncation(), lowering);
598 Node* node = *i;
599 Node* replacement = *(++i);
600 node->ReplaceUses(replacement);
601 node->Kill();
602 // We also need to replace the node in the rest of the vector.
605 if (*j == node) *j = replacement;
610 void EnqueueInitial(Node* node) {
611 NodeInfo* info = GetInfo(node);
613 nodes_.push_back(node);
614 queue_.push(node);
618 // for that input node. Add the input to {nodes_} if this is the first time
620 void EnqueueInput(Node* use_node, int index,
622 Node* node = use_node->InputAt(index);
624 NodeInfo* info = GetInfo(node);
631 // First visit of this node.
633 nodes_.push_back(node);
634 queue_.push(node);
643 // New usage information for the node is available.
645 queue_.push(node);
658 void SetOutput(Node* node, MachineRepresentation representation,
660 DCHECK(MachineRepresentationIsSubtype(GetInfo(node)->representation(),
662 ResetOutput(node, representation, type_check);
665 void ResetOutput(Node* node, MachineRepresentation representation,
667 NodeInfo* info = GetInfo(node);
672 Type* GetUpperBound(Node* node) { return NodeProperties::GetType(node); }
674 bool InputIs(Node* node, Type* type) {
675 DCHECK_EQ(1, node->op()->ValueInputCount());
676 return GetUpperBound(node->InputAt(0))->Is(type);
679 bool BothInputsAreSigned32(Node* node) {
680 return BothInputsAre(node, Type::Signed32());
683 bool BothInputsAreUnsigned32(Node* node) {
684 return BothInputsAre(node, Type::Unsigned32());
687 bool BothInputsAre(Node* node, Type* type) {
688 DCHECK_EQ(2, node->op()->ValueInputCount());
689 return GetUpperBound(node->InputAt(0))->Is(type) &&
690 GetUpperBound(node->InputAt(1))->Is(type);
693 void ConvertInput(Node* node, int index, UseInfo use) {
694 Node* input = node->InputAt(index);
704 TRACE(" change: #%d:%s(@%d #%d:%s) ", node->id(), node->op()->mnemonic(),
711 Node* n = changer_->GetRepresentationFor(
712 input, input_info->representation(), TypeOf(input), node, use);
713 node->ReplaceInput(index, n);
717 void ProcessInput(Node* node, int index, UseInfo use) {
719 EnqueueInput(node, index, use);
721 ConvertInput(node, index, use);
725 void ProcessRemainingInputs(Node* node, int index) {
726 DCHECK_GE(index, NodeProperties::PastValueIndex(node));
727 DCHECK_GE(index, NodeProperties::PastContextIndex(node));
728 for (int i = std::max(index, NodeProperties::FirstEffectIndex(node));
729 i < NodeProperties::PastEffectIndex(node); ++i) {
730 EnqueueInput(node, i); // Effect inputs: just visit
732 for (int i = std::max(index, NodeProperties::FirstControlIndex(node));
733 i < NodeProperties::PastControlIndex(node); ++i) {
734 EnqueueInput(node, i); // Control inputs: just visit
738 // The default, most general visitation case. For {node}, process all value,
742 void VisitInputs(Node* node) {
743 int tagged_count = node->op()->ValueInputCount() +
744 OperatorProperties::GetContextInputCount(node->op());
747 ProcessInput(node, i, UseInfo::AnyTagged());
750 for (int i = tagged_count; i < node->InputCount(); i++) {
751 EnqueueInput(node, i);
756 void VisitBinop(Node* node, UseInfo left_use, UseInfo right_use,
759 DCHECK_EQ(2, node->op()->ValueInputCount());
760 ProcessInput(node, 0, left_use);
761 ProcessInput(node, 1, right_use);
762 for (int i = 2; i < node->InputCount(); i++) {
763 EnqueueInput(node, i);
765 SetOutput(node, output, type_check);
769 void VisitBinop(Node* node, UseInfo input_use, MachineRepresentation output,
771 VisitBinop(node, input_use, input_use, output, type_check);
775 void VisitUnop(Node* node, UseInfo input_use, MachineRepresentation output) {
776 DCHECK_EQ(1, node->op()->ValueInputCount());
777 ProcessInput(node, 0, input_use);
778 ProcessRemainingInputs(node, 1);
779 SetOutput(node, output);
783 void VisitLeaf(Node* node, MachineRepresentation output) {
784 DCHECK_EQ(0, node->InputCount());
785 SetOutput(node, output);
789 void VisitFloat64Binop(Node* node) {
790 VisitBinop(node, UseInfo::TruncatingFloat64(),
793 void VisitInt32Binop(Node* node) {
794 VisitBinop(node, UseInfo::TruncatingWord32(),
797 void VisitWord32TruncatingBinop(Node* node) {
798 VisitBinop(node, UseInfo::TruncatingWord32(),
801 void VisitUint32Binop(Node* node) {
802 VisitBinop(node, UseInfo::TruncatingWord32(),
805 void VisitInt64Binop(Node* node) {
806 VisitBinop(node, UseInfo::TruncatingWord64(),
809 void VisitUint64Binop(Node* node) {
810 VisitBinop(node, UseInfo::TruncatingWord64(),
813 void VisitFloat64Cmp(Node* node) {
814 VisitBinop(node, UseInfo::TruncatingFloat64(), MachineRepresentation::kBit);
816 void VisitInt32Cmp(Node* node) {
817 VisitBinop(node, UseInfo::TruncatingWord32(), MachineRepresentation::kBit);
819 void VisitUint32Cmp(Node* node) {
820 VisitBinop(node, UseInfo::TruncatingWord32(), MachineRepresentation::kBit);
822 void VisitInt64Cmp(Node* node) {
823 VisitBinop(node, UseInfo::TruncatingWord64(), MachineRepresentation::kBit);
825 void VisitUint64Cmp(Node* node) {
826 VisitBinop(node, UseInfo::TruncatingWord64(), MachineRepresentation::kBit);
830 MachineRepresentation GetOutputInfoForPhi(Node* node, Truncation use,
834 type = TypeOf(node);
854 bool is_word64 = GetInfo(node->InputAt(0))->representation() ==
858 DCHECK_EQ(IrOpcode::kPhi, node->opcode()); // This only works for phis.
859 for (int i = 1; i < node->op()->ValueInputCount(); i++) {
860 DCHECK_EQ(is_word64, GetInfo(node->InputAt(i))->representation() ==
871 void VisitSelect(Node* node, Truncation truncation,
873 ProcessInput(node, 0, UseInfo::Bool());
875 MachineRepresentation output = GetOutputInfoForPhi(node, truncation);
876 SetOutput(node, output);
880 SelectParameters p = SelectParametersOf(node->op());
882 NodeProperties::ChangeOp(node,
889 ProcessInput(node, 1, input_use);
890 ProcessInput(node, 2, input_use);
894 void VisitPhi(Node* node, Truncation truncation,
896 MachineRepresentation output = GetOutputInfoForPhi(node, truncation);
899 SetOutput(node, output);
901 int values = node->op()->ValueInputCount();
904 if (output != PhiRepresentationOf(node->op())) {
905 NodeProperties::ChangeOp(node, lowering->common()->Phi(output, values));
912 for (int i = 0; i < node->InputCount(); i++) {
913 ProcessInput(node, i, i < values ? input_use : UseInfo::None());
917 void VisitCall(Node* node, SimplifiedLowering* lowering) {
918 const CallDescriptor* desc = CallDescriptorOf(node->op());
922 for (int i = 0; i < node->InputCount(); i++) {
925 ProcessInput(node, i, UseInfo::None());
927 ProcessInput(node, i, TruncatingUseInfoFromRepresentation(
930 ProcessInput(node, i, UseInfo::None());
935 SetOutput(node,
938 SetOutput(node, MachineRepresentation::kTagged);
954 void VisitStateValues(Node* node) {
956 for (int i = 0; i < node->InputCount(); i++) {
957 EnqueueInput(node, i, UseInfo::Any());
963 ZoneVector<MachineType>(node->InputCount(), zone);
964 for (int i = 0; i < node->InputCount(); i++) {
965 Node* input = node->InputAt(i);
975 NodeProperties::ChangeOp(node,
978 SetOutput(node, MachineRepresentation::kTagged);
981 const Operator* Int32Op(Node* node) {
982 return changer_->Int32OperatorFor(node->opcode());
985 const Operator* Int32OverflowOp(Node* node) {
986 return changer_->Int32OverflowOperatorFor(node->opcode());
989 const Operator* Uint32Op(Node* node) {
990 return changer_->Uint32OperatorFor(node->opcode());
993 const Operator* Float64Op(Node* node) {
994 return changer_->Float64OperatorFor(node->opcode());
1000 Node* value) {
1053 Type* field_type, Node* value) {
1068 void ReplaceEffectControlUses(Node* node, Node* effect, Node* control) {
1069 for (Edge edge : node->use_edges()) {
1080 void ChangeToPureOp(Node* node, const Operator* new_op) {
1081 if (node->op()->EffectInputCount() > 0) {
1082 DCHECK_LT(0, node->op()->ControlInputCount());
1083 // Disconnect the node from effect and control chains.
1084 Node* control = NodeProperties::GetControlInput(node);
1085 Node* effect = NodeProperties::GetEffectInput(node);
1086 ReplaceEffectControlUses(node, effect, control);
1087 node->TrimInputCount(new_op->ValueInputCount());
1089 DCHECK_EQ(0, node->op()->ControlInputCount());
1092 NodeProperties::ChangeOp(node, new_op);
1095 void ChangeToInt32OverflowOp(Node* node, const Operator* new_op) {
1096 NodeProperties::ChangeOp(node, new_op);
1099 void VisitSpeculativeAdditiveOp(Node* node, Truncation truncation,
1101 if (BothInputsAre(node, type_cache_.kSigned32OrMinusZero) &&
1102 NodeProperties::GetType(node)->Is(Type::Signed32())) {
1104 VisitInt32Binop(node);
1105 if (lower()) ChangeToPureOp(node, Int32Op(node));
1110 if (BothInputsAre(node, type_cache_.kAdditiveSafeIntegerOrMinusZero) &&
1114 VisitWord32TruncatingBinop(node);
1115 if (lower()) ChangeToPureOp(node, Int32Op(node));
1120 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op());
1124 if (BothInputsAre(node, Type::Signed32()) ||
1125 (BothInputsAre(node, type_cache_.kSigned32OrMinusZero) &&
1126 NodeProperties::GetType(node)->Is(type_cache_.kSafeInteger))) {
1130 VisitBinop(node, UseInfo::TruncatingWord32(),
1133 ChangeToInt32OverflowOp(node, Int32OverflowOp(node));
1141 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(),
1144 ChangeToInt32OverflowOp(node, Int32OverflowOp(node));
1150 VisitBinop(node, UseInfo::CheckedNumberOrUndefinedAsFloat64(),
1153 ChangeToPureOp(node, Float64Op(node));
1158 // Dispatching routine for visiting the node {node} with the usage {use}.
1160 void VisitNode(Node* node, Truncation truncation,
1162 switch (node->opcode()) {
1168 return VisitLeaf(node, MachineRepresentation::kNone);
1171 ProcessInput(node, 0, UseInfo::None());
1172 SetOutput(node, MachineRepresentation::kTagged);
1176 return VisitLeaf(node, MachineRepresentation::kWord32);
1178 return VisitLeaf(node, MachineRepresentation::kWord64);
1180 return VisitLeaf(node, MachineRepresentation::kFloat32);
1182 return VisitLeaf(node, MachineRepresentation::kFloat64);
1184 return VisitLeaf(node, MachineType::PointerRepresentation());
1186 return VisitLeaf(node, MachineRepresentation::kTagged);
1188 return VisitLeaf(node, MachineRepresentation::kTagged);
1192 ProcessInput(node, 0, UseInfo::Bool());
1193 ProcessInput(node, 1, UseInfo::AnyTagged());
1194 ProcessRemainingInputs(node, 2);
1197 ProcessInput(node, 0, UseInfo::Bool());
1198 EnqueueInput(node, NodeProperties::FirstControlIndex(node));
1201 ProcessInput(node, 0, UseInfo::TruncatingWord32());
1202 EnqueueInput(node, NodeProperties::FirstControlIndex(node));
1205 return VisitSelect(node, truncation, lowering);
1207 return VisitPhi(node, truncation, lowering);
1209 return VisitCall(node, lowering);
1215 VisitInputs(node);
1218 SetOutput(node, MachineRepresentation::kWord32);
1219 if (lower()) lowering->DoJSToNumberTruncatesToWord32(node, this);
1221 SetOutput(node, MachineRepresentation::kFloat64);
1222 if (lower()) lowering->DoJSToNumberTruncatesToFloat64(node, this);
1224 SetOutput(node, MachineRepresentation::kTagged);
1234 NodeInfo* input_info = GetInfo(node->InputAt(0));
1237 node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(0));
1238 NodeProperties::ChangeOp(node, lowering->machine()->Word32Equal());
1241 node->AppendInput(jsgraph_->zone(), jsgraph_->FalseConstant());
1242 NodeProperties::ChangeOp(node, lowering->machine()->WordEqual());
1246 ProcessInput(node, 0, UseInfo::AnyTruncatingToBool());
1247 SetOutput(node, MachineRepresentation::kBit);
1253 NodeInfo* input_info = GetInfo(node->InputAt(0));
1256 DeferReplacement(node, node->InputAt(0));
1259 node->AppendInput(jsgraph_->zone(), jsgraph_->TrueConstant());
1260 NodeProperties::ChangeOp(node, lowering->machine()->WordEqual());
1264 ProcessInput(node, 0, UseInfo::AnyTruncatingToBool());
1265 SetOutput(node, MachineRepresentation::kWord32);
1273 if (TypeOf(node->InputAt(0))->Is(Type::Signed32()) &&
1274 TypeOf(node->InputAt(1))->Is(Type::Signed32())) {
1276 VisitInt32Cmp(node);
1277 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node));
1278 } else if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32()) &&
1279 TypeOf(node->InputAt(1))->Is(Type::Unsigned32())) {
1281 VisitUint32Cmp(node);
1282 if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node));
1285 VisitFloat64Cmp(node);
1286 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
1293 return VisitSpeculativeAdditiveOp(node, truncation, lowering);
1299 if (TypeOf(node->InputAt(0))->Is(Type::Signed32()) &&
1300 TypeOf(node->InputAt(1))->Is(Type::Signed32())) {
1302 VisitInt32Cmp(node);
1303 if (lower()) ChangeToPureOp(node, Int32Op(node));
1305 } else if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32()) &&
1306 TypeOf(node->InputAt(1))->Is(Type::Unsigned32())) {
1308 VisitUint32Cmp(node);
1309 if (lower()) ChangeToPureOp(node, Uint32Op(node));
1313 CompareOperationHints::Hint hint = CompareOperationHintOf(node->op());
1316 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(),
1318 if (lower()) ChangeToPureOp(node, Int32Op(node));
1323 VisitBinop(node, UseInfo::CheckedNumberOrUndefinedAsFloat64(),
1325 if (lower()) ChangeToPureOp(node, Float64Op(node));
1331 if (BothInputsAre(node, Type::Signed32()) &&
1332 NodeProperties::GetType(node)->Is(Type::Signed32())) {
1335 VisitInt32Binop(node);
1336 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node));
1337 } else if (BothInputsAre(node,
1342 VisitWord32TruncatingBinop(node);
1343 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node));
1346 VisitFloat64Binop(node);
1347 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
1353 if (BothInputsAreSigned32(node)) {
1354 if (NodeProperties::GetType(node)->Is(Type::Signed32())) {
1357 VisitInt32Binop(node);
1358 if (lower()) ChangeToPureOp(node, Int32Op(node));
1362 NodeProperties::GetType(node)->Is(
1367 VisitWord32TruncatingBinop(node);
1368 if (lower()) ChangeToPureOp(node, Int32Op(node));
1373 if (BothInputsAre(node, Type::NumberOrUndefined())) {
1374 VisitFloat64Binop(node);
1375 if (lower()) ChangeToPureOp(node, Float64Op(node));
1379 DCHECK_EQ(IrOpcode::kSpeculativeNumberMultiply, node->opcode());
1380 VisitBinop(node, UseInfo::CheckedNumberOrUndefinedAsFloat64(),
1382 if (lower()) ChangeToPureOp(node, Float64Op(node));
1387 if (BothInputsAreSigned32(node)) {
1388 if (NodeProperties::GetType(node)->Is(Type::Signed32())) {
1390 VisitInt32Binop(node);
1391 if (lower()) DeferReplacement(node, lowering->Int32Div(node));
1396 VisitWord32TruncatingBinop(node);
1397 if (lower()) DeferReplacement(node, lowering->Int32Div(node));
1401 if (BothInputsAreUnsigned32(node) && truncation.TruncatesToWord32()) {
1403 VisitWord32TruncatingBinop(node);
1404 if (lower()) DeferReplacement(node, lowering->Uint32Div(node));
1408 if (BothInputsAre(node, Type::NumberOrUndefined())) {
1409 VisitFloat64Binop(node);
1410 if (lower()) ChangeToPureOp(node, Float64Op(node));
1414 DCHECK_EQ(IrOpcode::kSpeculativeNumberDivide, node->opcode());
1415 VisitBinop(node, UseInfo::CheckedNumberOrUndefinedAsFloat64(),
1417 if (lower()) ChangeToPureOp(node, Float64Op(node));
1422 if (BothInputsAreSigned32(node)) {
1423 if (NodeProperties::GetType(node)->Is(Type::Signed32())) {
1425 VisitInt32Binop(node);
1426 if (lower()) DeferReplacement(node, lowering->Int32Mod(node));
1431 VisitWord32TruncatingBinop(node);
1432 if (lower()) DeferReplacement(node, lowering->Int32Mod(node));
1436 if (BothInputsAreUnsigned32(node) && truncation.TruncatesToWord32()) {
1438 VisitWord32TruncatingBinop(node);
1439 if (lower()) DeferReplacement(node, lowering->Uint32Mod(node));
1443 if (BothInputsAre(node, Type::NumberOrUndefined())) {
1445 VisitFloat64Binop(node);
1446 if (lower()) ChangeToPureOp(node, Float64Op(node));
1450 DCHECK_EQ(IrOpcode::kSpeculativeNumberModulus, node->opcode());
1451 VisitBinop(node, UseInfo::CheckedNumberOrUndefinedAsFloat64(),
1453 if (lower()) ChangeToPureOp(node, Float64Op(node));
1459 VisitInt32Binop(node);
1460 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node));
1464 Type* rhs_type = GetUpperBound(node->InputAt(1));
1465 VisitBinop(node, UseInfo::TruncatingWord32(),
1468 lowering->DoShift(node, lowering->machine()->Word32Shl(), rhs_type);
1473 Type* rhs_type = GetUpperBound(node->InputAt(1));
1474 VisitBinop(node, UseInfo::TruncatingWord32(),
1477 lowering->DoShift(node, lowering->machine()->Word32Sar(), rhs_type);
1482 Type* rhs_type = GetUpperBound(node->InputAt(1));
1483 VisitBinop(node, UseInfo::TruncatingWord32(),
1486 lowering->DoShift(node, lowering->machine()->Word32Shr(), rhs_type);
1491 if (InputIs(node, Type::Unsigned32())) {
1492 VisitUnop(node, UseInfo::TruncatingWord32(),
1494 if (lower()) DeferReplacement(node, node->InputAt(0));
1495 } else if (InputIs(node, type_cache_.kSafeSigned32)) {
1496 VisitUnop(node, UseInfo::TruncatingWord32(),
1498 if (lower()) DeferReplacement(node, lowering->Int32Abs(node));
1499 } else if (InputIs(node,
1501 VisitUnop(node, UseInfo::TruncatingFloat64(),
1503 if (lower()) DeferReplacement(node, node->InputAt(0));
1505 VisitUnop(node, UseInfo::TruncatingFloat64(),
1507 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
1512 VisitUnop(node, UseInfo::TruncatingWord32(),
1514 if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node));
1518 VisitBinop(node, UseInfo::TruncatingWord32(),
1520 if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node));
1524 VisitUnop(node, UseInfo::TruncatingFloat64(),
1526 if (lower()) DeferReplacement(node, lowering->Float64Ceil(node));
1530 VisitUnop(node, UseInfo::TruncatingFloat64(),
1532 if (lower()) DeferReplacement(node, lowering->Float64Floor(node));
1536 VisitUnop(node, UseInfo::TruncatingFloat64(),
1538 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
1542 VisitBinop(node, UseInfo::TruncatingFloat64(),
1544 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
1559 VisitUnop(node, UseInfo::TruncatingFloat64(),
1561 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
1565 VisitUnop(node, UseInfo::TruncatingFloat64(),
1567 if (lower()) DeferReplacement(node, lowering->Float64Round(node));
1571 VisitUnop(node, UseInfo::TruncatingFloat64(),
1573 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
1577 VisitUnop(node, UseInfo::TruncatingFloat64(),
1579 if (lower()) DeferReplacement(node, lowering->Float64Trunc(node));
1584 VisitUnop(node, UseInfo::TruncatingWord32(),
1586 if (lower()) DeferReplacement(node, node->InputAt(0));
1591 VisitUnop(node, UseInfo::TruncatingWord32(),
1593 if (lower()) DeferReplacement(node, node->InputAt(0));
1597 VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit);
1599 NodeProperties::ChangeOp(node, lowering->machine()->WordEqual());
1604 VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
1614 node->InsertInput(jsgraph_->zone(), 0,
1616 node->AppendInput(jsgraph_->zone(), jsgraph_->NoContextConstant());
1617 node->AppendInput(jsgraph_->zone(), jsgraph_->graph()->start());
1618 NodeProperties::ChangeOp(node, jsgraph_->common()->Call(desc));
1623 VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
1632 node->InsertInput(jsgraph_->zone(), 0,
1634 node->AppendInput(jsgraph_->zone(), jsgraph_->NoContextConstant());
1635 node->AppendInput(jsgraph_->zone(), jsgraph_->graph()->start());
1636 NodeProperties::ChangeOp(node, jsgraph_->common()->Call(desc));
1641 VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
1652 node->InsertInput(jsgraph_->zone(), 0,
1654 node->AppendInput(jsgraph_->zone(), jsgraph_->NoContextConstant());
1655 node->AppendInput(jsgraph_->zone(), jsgraph_->graph()->start());
1656 NodeProperties::ChangeOp(node, jsgraph_->common()->Call(desc));
1661 VisitUnop(node, UseInfo::TruncatingWord32(),
1666 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
1675 node->InsertInput(jsgraph_->zone(), 0,
1677 node->AppendInput(jsgraph_->zone(), jsgraph_->NoContextConstant());
1678 node->AppendInput(jsgraph_->zone(), jsgraph_->graph()->start());
1679 NodeProperties::ChangeOp(node, jsgraph_->common()->Call(desc));
1685 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(),
1690 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
1692 if (InputIs(node, Type::TaggedPointer())) {
1693 DeferReplacement(node, node->InputAt(0));
1701 VisitUnop(node, UseInfo::CheckedSigned32AsWord32(),
1703 if (lower()) DeferReplacement(node, node->InputAt(0));
1705 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
1707 if (InputIs(node, Type::TaggedSigned())) {
1708 DeferReplacement(node, node->InputAt(0));
1716 ProcessInput(node, 0, UseInfo::TruncatingWord32());
1717 ProcessRemainingInputs(node, 1);
1718 SetOutput(node, MachineRepresentation::kTagged);
1722 FieldAccess access = FieldAccessOf(node->op());
1723 ProcessInput(node, 0, UseInfoForBasePointer(access));
1724 ProcessRemainingInputs(node, 1);
1725 SetOutput(node, access.machine_type.representation());
1729 FieldAccess access = FieldAccessOf(node->op());
1730 ProcessInput(node, 0, UseInfoForBasePointer(access));
1731 ProcessInput(node, 1, TruncatingUseInfoFromRepresentation(
1733 ProcessRemainingInputs(node, 2);
1734 SetOutput(node, MachineRepresentation::kNone);
1738 access.offset, access.type, node->InputAt(1));
1742 node, jsgraph_->simplified()->StoreField(access));
1748 BufferAccess access = BufferAccessOf(node->op());
1749 ProcessInput(node, 0, UseInfo::PointerInt()); // buffer
1750 ProcessInput(node, 1, UseInfo::TruncatingWord32()); // offset
1751 ProcessInput(node, 2, UseInfo::TruncatingWord32()); // length
1752 ProcessRemainingInputs(node, 3);
1776 SetOutput(node, output);
1777 if (lower()) lowering->DoLoadBuffer(node, output, changer_);
1781 BufferAccess access = BufferAccessOf(node->op());
1782 ProcessInput(node, 0, UseInfo::PointerInt()); // buffer
1783 ProcessInput(node, 1, UseInfo::TruncatingWord32()); // offset
1784 ProcessInput(node, 2, UseInfo::TruncatingWord32()); // length
1785 ProcessInput(node, 3,
1788 ProcessRemainingInputs(node, 4);
1789 SetOutput(node, MachineRepresentation::kNone);
1790 if (lower()) lowering->DoStoreBuffer(node);
1794 ElementAccess access = ElementAccessOf(node->op());
1795 ProcessInput(node, 0, UseInfoForBasePointer(access)); // base
1796 ProcessInput(node, 1, UseInfo::TruncatingWord32()); // index
1797 ProcessRemainingInputs(node, 2);
1798 SetOutput(node, access.machine_type.representation());
1802 ElementAccess access = ElementAccessOf(node->op());
1803 ProcessInput(node, 0, UseInfoForBasePointer(access)); // base
1804 ProcessInput(node, 1, UseInfo::TruncatingWord32()); // index
1805 ProcessInput(node, 2,
1808 ProcessRemainingInputs(node, 3);
1809 SetOutput(node, MachineRepresentation::kNone);
1813 access.type, node->InputAt(2));
1817 node, jsgraph_->simplified()->StoreElement(access));
1825 if (InputIs(node, Type::NumberOrUndefined())) {
1826 VisitUnop(node, UseInfo::TruncatingWord32(),
1828 if (lower()) DeferReplacement(node, node->InputAt(0));
1830 VisitUnop(node, UseInfo::AnyTagged(),
1833 NodeProperties::ChangeOp(node,
1839 if (InputIs(node, Type::NumberOrUndefined())) {
1840 VisitUnop(node, UseInfo::TruncatingFloat64(),
1842 if (lower()) DeferReplacement(node, node->InputAt(0));
1844 VisitUnop(node, UseInfo::AnyTagged(),
1847 NodeProperties::ChangeOp(node,
1852 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
1861 ProcessInput(node, 0, UseInfo::AnyTagged());
1862 SetOutput(node, MachineRepresentation::kBit);
1866 CheckFloat64HoleMode mode = CheckFloat64HoleModeOf(node->op());
1867 ProcessInput(node, 0, UseInfo::TruncatingFloat64());
1868 ProcessRemainingInputs(node, 1);
1869 SetOutput(node, MachineRepresentation::kFloat64);
1872 if (lower()) DeferReplacement(node, node->InputAt(0));
1877 CheckTaggedHoleMode mode = CheckTaggedHoleModeOf(node->op());
1880 ProcessInput(node, 0, UseInfo::CheckedSigned32AsWord32());
1881 ProcessRemainingInputs(node, 1);
1882 SetOutput(node, MachineRepresentation::kWord32);
1883 if (lower()) DeferReplacement(node, node->InputAt(0));
1885 ProcessInput(node, 0, UseInfo::AnyTagged());
1886 ProcessRemainingInputs(node, 1);
1887 SetOutput(node, MachineRepresentation::kTagged);
1898 LoadRepresentation rep = LoadRepresentationOf(node->op());
1899 ProcessInput(node, 0, UseInfo::AnyTagged()); // tagged pointer
1900 ProcessInput(node, 1, UseInfo::PointerInt()); // index
1901 ProcessRemainingInputs(node, 2);
1902 return SetOutput(node, rep.representation());
1907 StoreRepresentation rep = StoreRepresentationOf(node->op());
1908 ProcessInput(node, 0, UseInfo::AnyTagged()); // tagged pointer
1909 ProcessInput(node, 1, UseInfo::PointerInt()); // index
1910 ProcessInput(node, 2,
1912 ProcessRemainingInputs(node, 3);
1913 return SetOutput(node, MachineRepresentation::kNone);
1917 return VisitBinop(node, UseInfo::TruncatingWord32(),
1927 return VisitBinop(node, UseInfo::TruncatingWord32(),
1930 return VisitBinop(node, UseInfo::TruncatingWord32(),
1934 return VisitUnop(node, UseInfo::TruncatingWord32(),
1943 return VisitInt32Binop(node);
1947 return VisitUint32Binop(node);
1950 return VisitInt32Cmp(node);
1954 return VisitUint32Cmp(node);
1961 return VisitInt64Binop(node);
1964 return VisitInt64Cmp(node);
1967 return VisitUint64Cmp(node);
1971 return VisitUint64Binop(node);
1979 return VisitBinop(node, UseInfo::TruncatingWord64(),
1982 return VisitBinop(node, UseInfo::TruncatingWord64(),
1986 return VisitUnop(node, UseInfo::TruncatingWord32(),
1989 return VisitUnop(node, UseInfo::TruncatingWord32(),
1992 return VisitUnop(node, UseInfo::TruncatingFloat64(),
1995 return VisitUnop(node, UseInfo::TruncatingFloat64(),
1999 return VisitUnop(node, UseInfo::TruncatingWord32(),
2002 return VisitUnop(node, UseInfo::TruncatingWord32(),
2010 return VisitFloat64Binop(node);
2017 return VisitUnop(node, UseInfo::TruncatingFloat64(),
2020 return VisitUnop(node, UseInfo::TruncatingFloat64(),
2025 return VisitFloat64Cmp(node);
2028 return VisitUnop(node, UseInfo::TruncatingFloat64(),
2032 return VisitBinop(node, UseInfo::TruncatingFloat64(),
2036 VisitUnop(node, UseInfo::TruncatingFloat64(),
2038 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
2043 return VisitLeaf(node, MachineType::PointerRepresentation());
2045 return VisitStateValues(node);
2066 VisitInputs(node);
2068 return SetOutput(node, MachineRepresentation::kTagged);
2073 void DeferReplacement(Node* node, Node* replacement) {
2074 TRACE("defer replacement #%d:%s with #%d:%s\n", node->id(),
2075 node->op()->mnemonic(), replacement->id(),
2078 // Disconnect the node from effect and control chains, if necessary.
2079 if (node->op()->EffectInputCount() > 0) {
2080 DCHECK_LT(0, node->op()->ControlInputCount());
2081 // Disconnect the node from effect and control chains.
2082 Node* control = NodeProperties::GetControlInput(node);
2083 Node* effect = NodeProperties::GetEffectInput(node);
2084 ReplaceEffectControlUses(node, effect, control);
2086 DCHECK_EQ(0, node->op()->ControlInputCount());
2090 GetUpperBound(node)->Is(GetUpperBound(replacement)) &&
2091 TypeOf(node)->Is(TypeOf(replacement))) {
2092 // Replace with a previously existing node eagerly only if the type is the
2094 node->ReplaceUses(replacement);
2096 // Otherwise, we are replacing a node with a representation change.
2099 // insertion for uses of the node.
2100 replacements_.push_back(node);
2103 node->NullAllInputs(); // Node is now dead.
2138 ZoneVector<NodeInfo> info_; // node id -> usage information
2147 ZoneQueue<Node*> queue_; // queue for traversing the graph
2150 Node* node;
2163 NodeInfo* GetInfo(Node* node) {
2164 DCHECK(node->id() >= 0);
2165 DCHECK(node->id() < count_);
2166 return &info_[node->id()];
2189 Node* node, RepresentationSelector* selector) {
2190 DCHECK_EQ(IrOpcode::kJSToNumber, node->opcode());
2191 Node* value = node->InputAt(0);
2192 Node* context = node->InputAt(1);
2193 Node* frame_state = node->InputAt(2);
2194 Node* effect = node->InputAt(3);
2195 Node* control = node->InputAt(4);
2196 Node* throwing;
2198 Node* check0 = graph()->NewNode(simplified()->ObjectIsSmi(), value);
2199 Node* branch0 =
2202 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0);
2203 Node* etrue0 = effect;
2204 Node* vtrue0;
2210 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0);
2211 Node* efalse0 = effect;
2212 Node* vfalse0;
2219 Node* check1 = graph()->NewNode(simplified()->ObjectIsSmi(), vfalse0);
2220 Node* branch1 = graph()->NewNode(common()->Branch(), check1, if_false0);
2222 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
2223 Node* etrue1 = efalse0;
2224 Node* vtrue1;
2231 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
2232 Node* efalse1 = efalse0;
2233 Node* vfalse1;
2254 for (Edge edge : node->use_edges()) {
2269 selector->DeferReplacement(node, value);
2273 Node* node, RepresentationSelector* selector) {
2274 DCHECK_EQ(IrOpcode::kJSToNumber, node->opcode());
2275 Node* value = node->InputAt(0);
2276 Node* context = node->InputAt(1);
2277 Node* frame_state = node->InputAt(2);
2278 Node* effect = node->InputAt(3);
2279 Node* control = node->InputAt(4);
2280 Node* throwing;
2282 Node* check0 = graph()->NewNode(simplified()->ObjectIsSmi(), value);
2283 Node* branch0 =
2286 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0);
2287 Node* etrue0 = effect;
2288 Node* vtrue0 =
2291 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0);
2292 Node* efalse0 = effect;
2293 Node* vfalse0;
2300 Node* check1 = graph()->NewNode(simplified()->ObjectIsSmi(), vfalse0);
2301 Node* branch1 = graph()->NewNode(common()->Branch(), check1, if_false0);
2303 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
2304 Node* etrue1 = efalse0;
2305 Node* vtrue1 =
2308 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
2309 Node* efalse1 = efalse0;
2310 Node* vfalse1;
2331 for (Edge edge : node->use_edges()) {
2346 selector->DeferReplacement(node, value);
2349 void SimplifiedLowering::DoLoadBuffer(Node* node,
2352 DCHECK_EQ(IrOpcode::kLoadBuffer, node->opcode());
2354 MachineType const access_type = BufferAccessOf(node->op()).machine_type();
2356 Node* const buffer = node->InputAt(0);
2357 Node* const offset = node->InputAt(1);
2358 Node* const length = node->InputAt(2);
2359 Node* const effect = node->InputAt(3);
2360 Node* const control = node->InputAt(4);
2361 Node* const index =
2366 Node* check = graph()->NewNode(machine()->Uint32LessThan(), offset, length);
2367 Node* branch =
2370 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
2371 Node* etrue = graph()->NewNode(machine()->Load(access_type), buffer, index,
2374 Type::Intersect(NodeProperties::GetType(node), Type::Number(), zone());
2375 Node* vtrue = changer->GetRepresentationFor(
2376 etrue, access_type.representation(), element_type, node,
2379 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
2380 Node* efalse = effect;
2381 Node* vfalse;
2394 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
2395 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge);
2397 // Replace effect uses of {node} with the {ephi}.
2398 NodeProperties::ReplaceUses(node, node, ephi);
2400 // Turn the {node} into a Phi.
2401 node->ReplaceInput(0, vtrue);
2402 node->ReplaceInput(1, vfalse);
2403 node->ReplaceInput(2, merge);
2404 node->TrimInputCount(3);
2405 NodeProperties::ChangeOp(node, common()->Phi(output_rep, 2));
2407 NodeProperties::ChangeOp(node, machine()->CheckedLoad(access_type));
2412 void SimplifiedLowering::DoStoreBuffer(Node* node) {
2413 DCHECK_EQ(IrOpcode::kStoreBuffer, node->opcode());
2415 BufferAccessOf(node->op()).machine_type().representation();
2416 NodeProperties::ChangeOp(node, machine()->CheckedStore(rep));
2419 Node* SimplifiedLowering::Float64Ceil(Node* const node) {
2420 Node* const one = jsgraph()->Float64Constant(1.0);
2421 Node* const zero = jsgraph()->Float64Constant(0.0);
2422 Node* const minus_zero = jsgraph()->Float64Constant(-0.0);
2423 Node* const two_52 = jsgraph()->Float64Constant(4503599627370496.0E0);
2424 Node* const minus_two_52 = jsgraph()->Float64Constant(-4503599627370496.0E0);
2425 Node* const input = node->InputAt(0);
2458 Node* check0 = graph()->NewNode(machine()->Float64LessThan(), zero, input);
2459 Node* branch0 = graph()->NewNode(common()->Branch(BranchHint::kTrue), check0,
2462 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0);
2463 Node* vtrue0;
2465 Node* check1 =
2467 Node* branch1 = graph()->NewNode(common()->Branch(), check1, if_true0);
2469 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
2470 Node* vtrue1 = input;
2472 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
2473 Node* vfalse1;
2475 Node* temp1 = graph()->NewNode(
2489 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0);
2490 Node* vfalse0;
2492 Node* check1 = graph()->NewNode(machine()->Float64Equal(), input, zero);
2493 Node* branch1 = graph()->NewNode(common()->Branch(BranchHint::kFalse),
2496 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
2497 Node* vtrue1 = input;
2499 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
2500 Node* vfalse1;
2502 Node* check2 = graph()->NewNode(machine()->Float64LessThanOrEqual(),
2504 Node* branch2 = graph()->NewNode(common()->Branch(BranchHint::kFalse),
2507 Node* if_true2 = graph()->NewNode(common()->IfTrue(), branch2);
2508 Node* vtrue2 = input;
2510 Node* if_false2 = graph()->NewNode(common()->IfFalse(), branch2);
2511 Node* vfalse2;
2513 Node* temp1 =
2515 Node* temp2 = graph()->NewNode(
2518 Node* temp3 = graph()->NewNode(
2537 Node* merge0 = graph()->NewNode(common()->Merge(2), if_true0, if_false0);
2542 Node* SimplifiedLowering::Float64Floor(Node* const node) {
2543 Node* const one = jsgraph()->Float64Constant(1.0);
2544 Node* const zero = jsgraph()->Float64Constant(0.0);
2545 Node* const minus_one = jsgraph()->Float64Constant(-1.0);
2546 Node* const minus_zero = jsgraph()->Float64Constant(-0.0);
2547 Node* const two_52 = jsgraph()->Float64Constant(4503599627370496.0E0);
2548 Node* const minus_two_52 = jsgraph()->Float64Constant(-4503599627370496.0E0);
2549 Node* const input = node->InputAt(0);
2584 Node* check0 = graph()->NewNode(machine()->Float64LessThan(), zero, input);
2585 Node* branch0 = graph()->NewNode(common()->Branch(BranchHint::kTrue), check0,
2588 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0);
2589 Node* vtrue0;
2591 Node* check1 =
2593 Node* branch1 = graph()->NewNode(common()->Branch(), check1, if_true0);
2595 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
2596 Node* vtrue1 = input;
2598 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
2599 Node* vfalse1;
2601 Node* temp1 = graph()->NewNode(
2615 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0);
2616 Node* vfalse0;
2618 Node* check1 = graph()->NewNode(machine()->Float64Equal(), input, zero);
2619 Node* branch1 = graph()->NewNode(common()->Branch(BranchHint::kFalse),
2622 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
2623 Node* vtrue1 = input;
2625 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
2626 Node* vfalse1;
2628 Node* check2 = graph()->NewNode(machine()->Float64LessThanOrEqual(),
2630 Node* branch2 = graph()->NewNode(common()->Branch(BranchHint::kFalse),
2633 Node* if_true2 = graph()->NewNode(common()->IfTrue(), branch2);
2634 Node* vtrue2 = input;
2636 Node* if_false2 = graph()->NewNode(common()->IfFalse(), branch2);
2637 Node* vfalse2;
2639 Node* temp1 =
2641 Node* temp2 = graph()->NewNode(
2663 Node* merge0 = graph()->NewNode(common()->Merge(2), if_true0, if_false0);
2668 Node* SimplifiedLowering::Float64Round(Node* const node) {
2669 Node* const one = jsgraph()->Float64Constant(1.0);
2670 Node* const one_half = jsgraph()->Float64Constant(0.5);
2671 Node* const input = node->InputAt(0);
2674 Node* result = Float64Ceil(node);
2683 Node* SimplifiedLowering::Float64Trunc(Node* const node) {
2684 Node* const one = jsgraph()->Float64Constant(1.0);
2685 Node* const zero = jsgraph()->Float64Constant(0.0);
2686 Node* const minus_zero = jsgraph()->Float64Constant(-0.0);
2687 Node* const two_52 = jsgraph()->Float64Constant(4503599627370496.0E0);
2688 Node* const minus_two_52 = jsgraph()->Float64Constant(-4503599627370496.0E0);
2689 Node* const input = node->InputAt(0);
2722 Node* check0 = graph()->NewNode(machine()->Float64LessThan(), zero, input);
2723 Node* branch0 = graph()->NewNode(common()->Branch(BranchHint::kTrue), check0,
2726 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0);
2727 Node* vtrue0;
2729 Node* check1 =
2731 Node* branch1 = graph()->NewNode(common()->Branch(), check1, if_true0);
2733 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
2734 Node* vtrue1 = input;
2736 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
2737 Node* vfalse1;
2739 Node* temp1 = graph()->NewNode(
2753 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0);
2754 Node* vfalse0;
2756 Node* check1 = graph()->NewNode(machine()->Float64Equal(), input, zero);
2757 Node* branch1 = graph()->NewNode(common()->Branch(BranchHint::kFalse),
2760 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
2761 Node* vtrue1 = input;
2763 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
2764 Node* vfalse1;
2766 Node* check2 = graph()->NewNode(machine()->Float64LessThanOrEqual(),
2768 Node* branch2 = graph()->NewNode(common()->Branch(BranchHint::kFalse),
2771 Node* if_true2 = graph()->NewNode(common()->IfTrue(), branch2);
2772 Node* vtrue2 = input;
2774 Node* if_false2 = graph()->NewNode(common()->IfFalse(), branch2);
2775 Node* vfalse2;
2777 Node* temp1 =
2779 Node* temp2 = graph()->NewNode(
2782 Node* temp3 = graph()->NewNode(
2801 Node* merge0 = graph()->NewNode(common()->Merge(2), if_true0, if_false0);
2806 Node* SimplifiedLowering::Int32Abs(Node* const node) {
2807 Node* const zero = jsgraph()->Int32Constant(0);
2808 Node* const input = node->InputAt(0);
2817 Node* SimplifiedLowering::Int32Div(Node* const node) {
2818 Int32BinopMatcher m(node);
2819 Node* const zero = jsgraph()->Int32Constant(0);
2820 Node* const minus_one = jsgraph()->Int32Constant(-1);
2821 Node* const lhs = m.left().node();
2822 Node* const rhs = m.right().node();
2850 Node* check0 = graph()->NewNode(machine()->Int32LessThan(), zero, rhs);
2851 Node* branch0 = graph()->NewNode(common()->Branch(BranchHint::kTrue), check0,
2854 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0);
2855 Node* true0 = graph()->NewNode(machine()->Int32Div(), lhs, rhs, if_true0);
2857 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0);
2858 Node* false0;
2860 Node* check1 = graph()->NewNode(machine()->Int32LessThan(), rhs, minus_one);
2861 Node* branch1 = graph()->NewNode(common()->Branch(), check1, if_false0);
2863 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
2864 Node* true1 = graph()->NewNode(machine()->Int32Div(), lhs, rhs, if_true1);
2866 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
2867 Node* false1;
2869 Node* check2 = graph()->NewNode(machine()->Word32Equal(), rhs, zero);
2870 Node* branch2 = graph()->NewNode(common()->Branch(), check2, if_false1);
2872 Node* if_true2 = graph()->NewNode(common()->IfTrue(), branch2);
2873 Node* true2 = zero;
2875 Node* if_false2 = graph()->NewNode(common()->IfFalse(), branch2);
2876 Node* false2 = graph()->NewNode(machine()->Int32Sub(), zero, lhs);
2886 Node* merge0 = graph()->NewNode(merge_op, if_true0, if_false0);
2891 Node* SimplifiedLowering::Int32Mod(Node* const node) {
2892 Int32BinopMatcher m(node);
2893 Node* const zero = jsgraph()->Int32Constant(0);
2894 Node* const minus_one = jsgraph()->Int32Constant(-1);
2895 Node* const lhs = m.left().node();
2896 Node* const rhs = m.right().node();
2928 Node* check0 = graph()->NewNode(machine()->Int32LessThan(), zero, rhs);
2929 Node* branch0 = graph()->NewNode(common()->Branch(BranchHint::kTrue), check0,
2932 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0);
2933 Node* true0;
2935 Node* msk = graph()->NewNode(machine()->Int32Add(), rhs, minus_one);
2937 Node* check1 = graph()->NewNode(machine()->Word32And(), rhs, msk);
2938 Node* branch1 = graph()->NewNode(common()->Branch(), check1, if_true0);
2940 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
2941 Node* true1 = graph()->NewNode(machine()->Int32Mod(), lhs, rhs, if_true1);
2943 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
2944 Node* false1;
2946 Node* check2 = graph()->NewNode(machine()->Int32LessThan(), lhs, zero);
2947 Node* branch2 = graph()->NewNode(common()->Branch(BranchHint::kFalse),
2950 Node* if_true2 = graph()->NewNode(common()->IfTrue(), branch2);
2951 Node* true2 = graph()->NewNode(
2957 Node* if_false2 = graph()->NewNode(common()->IfFalse(), branch2);
2958 Node* false2 = graph()->NewNode(machine()->Word32And(), lhs, msk);
2968 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0);
2969 Node* false0;
2971 Node* check1 = graph()->NewNode(machine()->Int32LessThan(), rhs, minus_one);
2972 Node* branch1 = graph()->NewNode(common()->Branch(BranchHint::kTrue),
2975 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
2976 Node* true1 = graph()->NewNode(machine()->Int32Mod(), lhs, rhs, if_true1);
2978 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
2979 Node* false1 = zero;
2985 Node* merge0 = graph()->NewNode(merge_op, if_true0, if_false0);
2990 Node* SimplifiedLowering::Uint32Div(Node* const node) {
2991 Uint32BinopMatcher m(node);
2992 Node* const zero = jsgraph()->Uint32Constant(0);
2993 Node* const lhs = m.left().node();
2994 Node* const rhs = m.right().node();
3002 Node* check = graph()->NewNode(machine()->Word32Equal(), rhs, zero);
3004 Node* div = graph()->NewNode(machine()->Uint32Div(), lhs, rhs, d.if_false);
3009 Node* SimplifiedLowering::Uint32Mod(Node* const node) {
3010 Uint32BinopMatcher m(node);
3011 Node* const minus_one = jsgraph()->Int32Constant(-1);
3012 Node* const zero = jsgraph()->Uint32Constant(0);
3013 Node* const lhs = m.left().node();
3014 Node* const rhs = m.right().node();
3040 Node* branch0 = graph()->NewNode(common()->Branch(BranchHint::kTrue), rhs,
3043 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0);
3044 Node* true0;
3046 Node* msk = graph()->NewNode(machine()->Int32Add(), rhs, minus_one);
3048 Node* check1 = graph()->NewNode(machine()->Word32And(), rhs, msk);
3049 Node* branch1 = graph()->NewNode(common()->Branch(), check1, if_true0);
3051 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
3052 Node* true1 = graph()->NewNode(machine()->Uint32Mod(), lhs, rhs, if_true1);
3054 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
3055 Node* false1 = graph()->NewNode(machine()->Word32And(), lhs, msk);
3061 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0);
3062 Node* false0 = zero;
3064 Node* merge0 = graph()->NewNode(merge_op, if_true0, if_false0);
3069 void SimplifiedLowering::DoShift(Node* node, Operator const* op,
3071 Node* const rhs = NodeProperties::GetValueInput(node, 1);
3073 node->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rhs,
3076 NodeProperties::ChangeOp(node, op);
3079 Node* SimplifiedLowering::ToNumberCode() {