OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 : preferred_(preferred), truncation_(truncation) {} | 77 : preferred_(preferred), truncation_(truncation) {} |
78 static UseInfo TruncatingWord32() { | 78 static UseInfo TruncatingWord32() { |
79 return UseInfo(MachineRepresentation::kWord32, Truncation::Word32()); | 79 return UseInfo(MachineRepresentation::kWord32, Truncation::Word32()); |
80 } | 80 } |
81 static UseInfo TruncatingWord64() { | 81 static UseInfo TruncatingWord64() { |
82 return UseInfo(MachineRepresentation::kWord64, Truncation::Word64()); | 82 return UseInfo(MachineRepresentation::kWord64, Truncation::Word64()); |
83 } | 83 } |
84 static UseInfo Bool() { | 84 static UseInfo Bool() { |
85 return UseInfo(MachineRepresentation::kBit, Truncation::Bool()); | 85 return UseInfo(MachineRepresentation::kBit, Truncation::Bool()); |
86 } | 86 } |
87 static UseInfo Float32() { | 87 static UseInfo TruncatingFloat32() { |
88 return UseInfo(MachineRepresentation::kFloat32, Truncation::Float32()); | 88 return UseInfo(MachineRepresentation::kFloat32, Truncation::Float32()); |
89 } | 89 } |
90 static UseInfo Float64() { | 90 static UseInfo TruncatingFloat64() { |
91 return UseInfo(MachineRepresentation::kFloat64, Truncation::Float64()); | 91 return UseInfo(MachineRepresentation::kFloat64, Truncation::Float64()); |
92 } | 92 } |
93 static UseInfo PointerInt() { | 93 static UseInfo PointerInt() { |
94 return kPointerSize == 4 ? TruncatingWord32() : TruncatingWord64(); | 94 return kPointerSize == 4 ? TruncatingWord32() : TruncatingWord64(); |
95 } | 95 } |
96 static UseInfo AnyTagged() { | 96 static UseInfo AnyTagged() { |
97 return UseInfo(MachineRepresentation::kTagged, Truncation::Any()); | 97 return UseInfo(MachineRepresentation::kTagged, Truncation::Any()); |
98 } | 98 } |
99 | 99 |
100 // Undetermined representation. | 100 // Undetermined representation. |
(...skipping 14 matching lines...) Expand all Loading... |
115 MachineRepresentation preferred_; | 115 MachineRepresentation preferred_; |
116 Truncation truncation_; | 116 Truncation truncation_; |
117 }; | 117 }; |
118 | 118 |
119 | 119 |
120 UseInfo TruncatingUseInfoFromRepresentation(MachineRepresentation rep) { | 120 UseInfo TruncatingUseInfoFromRepresentation(MachineRepresentation rep) { |
121 switch (rep) { | 121 switch (rep) { |
122 case MachineRepresentation::kTagged: | 122 case MachineRepresentation::kTagged: |
123 return UseInfo::AnyTagged(); | 123 return UseInfo::AnyTagged(); |
124 case MachineRepresentation::kFloat64: | 124 case MachineRepresentation::kFloat64: |
125 return UseInfo::Float64(); | 125 return UseInfo::TruncatingFloat64(); |
126 case MachineRepresentation::kFloat32: | 126 case MachineRepresentation::kFloat32: |
127 return UseInfo::Float32(); | 127 return UseInfo::TruncatingFloat32(); |
128 case MachineRepresentation::kWord64: | 128 case MachineRepresentation::kWord64: |
129 return UseInfo::TruncatingWord64(); | 129 return UseInfo::TruncatingWord64(); |
130 case MachineRepresentation::kWord8: | 130 case MachineRepresentation::kWord8: |
131 case MachineRepresentation::kWord16: | 131 case MachineRepresentation::kWord16: |
132 case MachineRepresentation::kWord32: | 132 case MachineRepresentation::kWord32: |
133 return UseInfo::TruncatingWord32(); | 133 return UseInfo::TruncatingWord32(); |
134 case MachineRepresentation::kBit: | 134 case MachineRepresentation::kBit: |
135 return UseInfo::Bool(); | 135 return UseInfo::Bool(); |
136 case MachineRepresentation::kSimd128: // Fall through. | 136 case MachineRepresentation::kSimd128: // Fall through. |
137 case MachineRepresentation::kNone: | 137 case MachineRepresentation::kNone: |
138 break; | 138 break; |
139 } | 139 } |
140 UNREACHABLE(); | 140 UNREACHABLE(); |
141 return UseInfo::None(); | 141 return UseInfo::None(); |
142 } | 142 } |
143 | 143 |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 } | 504 } |
505 | 505 |
506 // Helper for leaf nodes. | 506 // Helper for leaf nodes. |
507 void VisitLeaf(Node* node, MachineRepresentation output) { | 507 void VisitLeaf(Node* node, MachineRepresentation output) { |
508 DCHECK_EQ(0, node->InputCount()); | 508 DCHECK_EQ(0, node->InputCount()); |
509 SetOutput(node, output); | 509 SetOutput(node, output); |
510 } | 510 } |
511 | 511 |
512 // Helpers for specific types of binops. | 512 // Helpers for specific types of binops. |
513 void VisitFloat64Binop(Node* node) { | 513 void VisitFloat64Binop(Node* node) { |
514 VisitBinop(node, UseInfo::Float64(), MachineRepresentation::kFloat64); | 514 VisitBinop(node, UseInfo::TruncatingFloat64(), |
| 515 MachineRepresentation::kFloat64); |
515 } | 516 } |
516 void VisitInt32Binop(Node* node) { | 517 void VisitInt32Binop(Node* node) { |
517 VisitBinop(node, UseInfo::TruncatingWord32(), | 518 VisitBinop(node, UseInfo::TruncatingWord32(), |
518 MachineRepresentation::kWord32); | 519 MachineRepresentation::kWord32); |
519 } | 520 } |
520 void VisitWord32TruncatingBinop(Node* node) { | 521 void VisitWord32TruncatingBinop(Node* node) { |
521 VisitBinop(node, UseInfo::TruncatingWord32(), | 522 VisitBinop(node, UseInfo::TruncatingWord32(), |
522 MachineRepresentation::kWord32); | 523 MachineRepresentation::kWord32); |
523 } | 524 } |
524 void VisitUint32Binop(Node* node) { | 525 void VisitUint32Binop(Node* node) { |
525 VisitBinop(node, UseInfo::TruncatingWord32(), | 526 VisitBinop(node, UseInfo::TruncatingWord32(), |
526 MachineRepresentation::kWord32); | 527 MachineRepresentation::kWord32); |
527 } | 528 } |
528 void VisitInt64Binop(Node* node) { | 529 void VisitInt64Binop(Node* node) { |
529 VisitBinop(node, UseInfo::TruncatingWord64(), | 530 VisitBinop(node, UseInfo::TruncatingWord64(), |
530 MachineRepresentation::kWord64); | 531 MachineRepresentation::kWord64); |
531 } | 532 } |
532 void VisitUint64Binop(Node* node) { | 533 void VisitUint64Binop(Node* node) { |
533 VisitBinop(node, UseInfo::TruncatingWord64(), | 534 VisitBinop(node, UseInfo::TruncatingWord64(), |
534 MachineRepresentation::kWord64); | 535 MachineRepresentation::kWord64); |
535 } | 536 } |
536 void VisitFloat64Cmp(Node* node) { | 537 void VisitFloat64Cmp(Node* node) { |
537 VisitBinop(node, UseInfo::Float64(), MachineRepresentation::kBit); | 538 VisitBinop(node, UseInfo::TruncatingFloat64(), MachineRepresentation::kBit); |
538 } | 539 } |
539 void VisitInt32Cmp(Node* node) { | 540 void VisitInt32Cmp(Node* node) { |
540 VisitBinop(node, UseInfo::TruncatingWord32(), MachineRepresentation::kBit); | 541 VisitBinop(node, UseInfo::TruncatingWord32(), MachineRepresentation::kBit); |
541 } | 542 } |
542 void VisitUint32Cmp(Node* node) { | 543 void VisitUint32Cmp(Node* node) { |
543 VisitBinop(node, UseInfo::TruncatingWord32(), MachineRepresentation::kBit); | 544 VisitBinop(node, UseInfo::TruncatingWord32(), MachineRepresentation::kBit); |
544 } | 545 } |
545 void VisitInt64Cmp(Node* node) { | 546 void VisitInt64Cmp(Node* node) { |
546 VisitBinop(node, UseInfo::TruncatingWord64(), MachineRepresentation::kBit); | 547 VisitBinop(node, UseInfo::TruncatingWord64(), MachineRepresentation::kBit); |
547 } | 548 } |
548 void VisitUint64Cmp(Node* node) { | 549 void VisitUint64Cmp(Node* node) { |
549 VisitBinop(node, UseInfo::TruncatingWord64(), MachineRepresentation::kBit); | 550 VisitBinop(node, UseInfo::TruncatingWord64(), MachineRepresentation::kBit); |
550 } | 551 } |
551 | 552 |
552 // Infer representation for phi-like nodes. | 553 // Infer representation for phi-like nodes. |
553 MachineRepresentation GetOutputInfoForPhi(Node* node, Truncation use) { | 554 MachineRepresentation GetOutputInfoForPhi(Node* node, Truncation use) { |
554 // Compute the representation. | 555 // Compute the representation. |
555 Type* type = GetUpperBound(node); | 556 Type* type = GetUpperBound(node); |
556 if (type->Is(Type::None())) { | 557 if (type->Is(Type::None())) { |
557 return MachineRepresentation::kNone; | 558 return MachineRepresentation::kNone; |
558 } else if (type->Is(Type::Signed32()) || type->Is(Type::Unsigned32())) { | 559 } else if (type->Is(Type::Signed32()) || type->Is(Type::Unsigned32())) { |
559 return MachineRepresentation::kWord32; | 560 return MachineRepresentation::kWord32; |
560 } else if (use.TruncatesToWord32()) { | 561 } else if (use.TruncatesToWord32()) { |
561 return MachineRepresentation::kWord32; | 562 return MachineRepresentation::kWord32; |
562 } else if (type->Is(Type::Boolean())) { | 563 } else if (type->Is(Type::Boolean())) { |
563 return MachineRepresentation::kBit; | 564 return MachineRepresentation::kBit; |
564 } else if (type->Is(Type::Number())) { | 565 } else if (type->Is(Type::Number())) { |
565 return MachineRepresentation::kFloat64; | 566 return MachineRepresentation::kFloat64; |
| 567 } else if (use.TruncatesToFloat64()) { |
| 568 return MachineRepresentation::kFloat64; |
566 } else if (type->Is(Type::Internal())) { | 569 } else if (type->Is(Type::Internal())) { |
567 // We mark (u)int64 as Type::Internal. | 570 // We mark (u)int64 as Type::Internal. |
568 // TODO(jarin) This is a workaround for our lack of (u)int64 | 571 // TODO(jarin) This is a workaround for our lack of (u)int64 |
569 // types. This can be removed once we can represent (u)int64 | 572 // types. This can be removed once we can represent (u)int64 |
570 // unambiguously. (At the moment internal objects, such as the hole, | 573 // unambiguously. (At the moment internal objects, such as the hole, |
571 // are also Type::Internal()). | 574 // are also Type::Internal()). |
572 bool is_word64 = GetInfo(node->InputAt(0))->representation() == | 575 bool is_word64 = GetInfo(node->InputAt(0))->representation() == |
573 MachineRepresentation::kWord64; | 576 MachineRepresentation::kWord64; |
574 #ifdef DEBUG | 577 #ifdef DEBUG |
575 // Check that all the inputs agree on being Word64. | 578 // Check that all the inputs agree on being Word64. |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 } | 965 } |
963 break; | 966 break; |
964 } | 967 } |
965 case IrOpcode::kNumberClz32: { | 968 case IrOpcode::kNumberClz32: { |
966 VisitUnop(node, UseInfo::TruncatingWord32(), | 969 VisitUnop(node, UseInfo::TruncatingWord32(), |
967 MachineRepresentation::kWord32); | 970 MachineRepresentation::kWord32); |
968 if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node)); | 971 if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node)); |
969 break; | 972 break; |
970 } | 973 } |
971 case IrOpcode::kNumberCeil: { | 974 case IrOpcode::kNumberCeil: { |
972 VisitUnop(node, UseInfo::Float64(), MachineRepresentation::kFloat64); | 975 VisitUnop(node, UseInfo::TruncatingFloat64(), |
| 976 MachineRepresentation::kFloat64); |
973 if (lower()) DeferReplacement(node, lowering->Float64Ceil(node)); | 977 if (lower()) DeferReplacement(node, lowering->Float64Ceil(node)); |
974 break; | 978 break; |
975 } | 979 } |
976 case IrOpcode::kNumberFloor: { | 980 case IrOpcode::kNumberFloor: { |
977 VisitUnop(node, UseInfo::Float64(), MachineRepresentation::kFloat64); | 981 VisitUnop(node, UseInfo::TruncatingFloat64(), |
| 982 MachineRepresentation::kFloat64); |
978 if (lower()) DeferReplacement(node, lowering->Float64Floor(node)); | 983 if (lower()) DeferReplacement(node, lowering->Float64Floor(node)); |
979 break; | 984 break; |
980 } | 985 } |
981 case IrOpcode::kNumberRound: { | 986 case IrOpcode::kNumberRound: { |
982 VisitUnop(node, UseInfo::Float64(), MachineRepresentation::kFloat64); | 987 VisitUnop(node, UseInfo::TruncatingFloat64(), |
| 988 MachineRepresentation::kFloat64); |
983 if (lower()) DeferReplacement(node, lowering->Float64Round(node)); | 989 if (lower()) DeferReplacement(node, lowering->Float64Round(node)); |
984 break; | 990 break; |
985 } | 991 } |
986 case IrOpcode::kNumberTrunc: { | 992 case IrOpcode::kNumberTrunc: { |
987 VisitUnop(node, UseInfo::Float64(), MachineRepresentation::kFloat64); | 993 VisitUnop(node, UseInfo::TruncatingFloat64(), |
| 994 MachineRepresentation::kFloat64); |
988 if (lower()) DeferReplacement(node, lowering->Float64Trunc(node)); | 995 if (lower()) DeferReplacement(node, lowering->Float64Trunc(node)); |
989 break; | 996 break; |
990 } | 997 } |
991 case IrOpcode::kNumberToInt32: { | 998 case IrOpcode::kNumberToInt32: { |
992 // Just change representation if necessary. | 999 // Just change representation if necessary. |
993 VisitUnop(node, UseInfo::TruncatingWord32(), | 1000 VisitUnop(node, UseInfo::TruncatingWord32(), |
994 MachineRepresentation::kWord32); | 1001 MachineRepresentation::kWord32); |
995 if (lower()) DeferReplacement(node, node->InputAt(0)); | 1002 if (lower()) DeferReplacement(node, node->InputAt(0)); |
996 break; | 1003 break; |
997 } | 1004 } |
998 case IrOpcode::kNumberToUint32: { | 1005 case IrOpcode::kNumberToUint32: { |
999 // Just change representation if necessary. | 1006 // Just change representation if necessary. |
1000 VisitUnop(node, UseInfo::TruncatingWord32(), | 1007 VisitUnop(node, UseInfo::TruncatingWord32(), |
1001 MachineRepresentation::kWord32); | 1008 MachineRepresentation::kWord32); |
1002 if (lower()) DeferReplacement(node, node->InputAt(0)); | 1009 if (lower()) DeferReplacement(node, node->InputAt(0)); |
1003 break; | 1010 break; |
1004 } | 1011 } |
1005 case IrOpcode::kNumberIsHoleNaN: { | 1012 case IrOpcode::kNumberIsHoleNaN: { |
1006 VisitUnop(node, UseInfo::Float64(), MachineRepresentation::kBit); | 1013 VisitUnop(node, UseInfo::TruncatingFloat64(), |
| 1014 MachineRepresentation::kBit); |
1007 if (lower()) { | 1015 if (lower()) { |
1008 // NumberIsHoleNaN(x) => Word32Equal(Float64ExtractLowWord32(x), | 1016 // NumberIsHoleNaN(x) => Word32Equal(Float64ExtractLowWord32(x), |
1009 // #HoleNaNLower32) | 1017 // #HoleNaNLower32) |
1010 node->ReplaceInput(0, | 1018 node->ReplaceInput(0, |
1011 jsgraph_->graph()->NewNode( | 1019 jsgraph_->graph()->NewNode( |
1012 lowering->machine()->Float64ExtractLowWord32(), | 1020 lowering->machine()->Float64ExtractLowWord32(), |
1013 node->InputAt(0))); | 1021 node->InputAt(0))); |
1014 node->AppendInput(jsgraph_->zone(), | 1022 node->AppendInput(jsgraph_->zone(), |
1015 jsgraph_->Int32Constant(kHoleNanLower32)); | 1023 jsgraph_->Int32Constant(kHoleNanLower32)); |
1016 NodeProperties::ChangeOp(node, jsgraph_->machine()->Word32Equal()); | 1024 NodeProperties::ChangeOp(node, jsgraph_->machine()->Word32Equal()); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 // the load's representation. | 1155 // the load's representation. |
1148 output = access.machine_type().representation(); | 1156 output = access.machine_type().representation(); |
1149 } else { | 1157 } else { |
1150 // If undefined is truncated to a number, but the use can | 1158 // If undefined is truncated to a number, but the use can |
1151 // observe NaN, we need to output at least the float32 | 1159 // observe NaN, we need to output at least the float32 |
1152 // representation. | 1160 // representation. |
1153 if (access.machine_type().representation() == | 1161 if (access.machine_type().representation() == |
1154 MachineRepresentation::kFloat32) { | 1162 MachineRepresentation::kFloat32) { |
1155 output = access.machine_type().representation(); | 1163 output = access.machine_type().representation(); |
1156 } else { | 1164 } else { |
1157 if (access.machine_type().representation() != | |
1158 MachineRepresentation::kFloat64) { | |
1159 // TODO(bmeurer): See comment on abort_compilation_. | |
1160 if (lower()) lowering->abort_compilation_ = true; | |
1161 } | |
1162 output = MachineRepresentation::kFloat64; | 1165 output = MachineRepresentation::kFloat64; |
1163 } | 1166 } |
1164 } | 1167 } |
1165 } else { | 1168 } else { |
1166 // TODO(bmeurer): See comment on abort_compilation_. | |
1167 if (lower()) lowering->abort_compilation_ = true; | |
1168 | |
1169 // If undefined is not truncated away, we need to have the tagged | 1169 // If undefined is not truncated away, we need to have the tagged |
1170 // representation. | 1170 // representation. |
1171 output = MachineRepresentation::kTagged; | 1171 output = MachineRepresentation::kTagged; |
1172 } | 1172 } |
1173 SetOutput(node, output); | 1173 SetOutput(node, output); |
1174 if (lower()) lowering->DoLoadBuffer(node, output, changer_); | 1174 if (lower()) lowering->DoLoadBuffer(node, output, changer_); |
1175 break; | 1175 break; |
1176 } | 1176 } |
1177 case IrOpcode::kStoreBuffer: { | 1177 case IrOpcode::kStoreBuffer: { |
1178 BufferAccess access = BufferAccessOf(node->op()); | 1178 BufferAccess access = BufferAccessOf(node->op()); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 return VisitBinop(node, UseInfo::TruncatingWord64(), | 1310 return VisitBinop(node, UseInfo::TruncatingWord64(), |
1311 MachineRepresentation::kBit); | 1311 MachineRepresentation::kBit); |
1312 | 1312 |
1313 case IrOpcode::kChangeInt32ToInt64: | 1313 case IrOpcode::kChangeInt32ToInt64: |
1314 return VisitUnop(node, UseInfo::TruncatingWord32(), | 1314 return VisitUnop(node, UseInfo::TruncatingWord32(), |
1315 MachineRepresentation::kWord64); | 1315 MachineRepresentation::kWord64); |
1316 case IrOpcode::kChangeUint32ToUint64: | 1316 case IrOpcode::kChangeUint32ToUint64: |
1317 return VisitUnop(node, UseInfo::TruncatingWord32(), | 1317 return VisitUnop(node, UseInfo::TruncatingWord32(), |
1318 MachineRepresentation::kWord64); | 1318 MachineRepresentation::kWord64); |
1319 case IrOpcode::kTruncateFloat64ToFloat32: | 1319 case IrOpcode::kTruncateFloat64ToFloat32: |
1320 return VisitUnop(node, UseInfo::Float64(), | 1320 return VisitUnop(node, UseInfo::TruncatingFloat64(), |
1321 MachineRepresentation::kFloat32); | 1321 MachineRepresentation::kFloat32); |
1322 case IrOpcode::kTruncateFloat64ToInt32: | 1322 case IrOpcode::kTruncateFloat64ToInt32: |
1323 return VisitUnop(node, UseInfo::Float64(), | 1323 return VisitUnop(node, UseInfo::TruncatingFloat64(), |
1324 MachineRepresentation::kWord32); | 1324 MachineRepresentation::kWord32); |
1325 | 1325 |
1326 case IrOpcode::kChangeFloat32ToFloat64: | 1326 case IrOpcode::kChangeFloat32ToFloat64: |
1327 return VisitUnop(node, UseInfo::Float32(), | 1327 UNREACHABLE(); |
| 1328 return VisitUnop(node, UseInfo::TruncatingFloat32(), |
1328 MachineRepresentation::kFloat64); | 1329 MachineRepresentation::kFloat64); |
1329 case IrOpcode::kChangeInt32ToFloat64: | 1330 case IrOpcode::kChangeInt32ToFloat64: |
1330 return VisitUnop(node, UseInfo::TruncatingWord32(), | 1331 return VisitUnop(node, UseInfo::TruncatingWord32(), |
1331 MachineRepresentation::kFloat64); | 1332 MachineRepresentation::kFloat64); |
1332 case IrOpcode::kChangeUint32ToFloat64: | 1333 case IrOpcode::kChangeUint32ToFloat64: |
1333 return VisitUnop(node, UseInfo::TruncatingWord32(), | 1334 return VisitUnop(node, UseInfo::TruncatingWord32(), |
1334 MachineRepresentation::kFloat64); | 1335 MachineRepresentation::kFloat64); |
1335 case IrOpcode::kFloat64Add: | 1336 case IrOpcode::kFloat64Add: |
1336 case IrOpcode::kFloat64Sub: | 1337 case IrOpcode::kFloat64Sub: |
1337 case IrOpcode::kFloat64Mul: | 1338 case IrOpcode::kFloat64Mul: |
1338 case IrOpcode::kFloat64Div: | 1339 case IrOpcode::kFloat64Div: |
1339 case IrOpcode::kFloat64Mod: | 1340 case IrOpcode::kFloat64Mod: |
1340 case IrOpcode::kFloat64Min: | 1341 case IrOpcode::kFloat64Min: |
1341 return VisitFloat64Binop(node); | 1342 return VisitFloat64Binop(node); |
1342 case IrOpcode::kFloat64Abs: | 1343 case IrOpcode::kFloat64Abs: |
1343 case IrOpcode::kFloat64Sqrt: | 1344 case IrOpcode::kFloat64Sqrt: |
1344 case IrOpcode::kFloat64RoundDown: | 1345 case IrOpcode::kFloat64RoundDown: |
1345 case IrOpcode::kFloat64RoundTruncate: | 1346 case IrOpcode::kFloat64RoundTruncate: |
1346 case IrOpcode::kFloat64RoundTiesAway: | 1347 case IrOpcode::kFloat64RoundTiesAway: |
1347 case IrOpcode::kFloat64RoundUp: | 1348 case IrOpcode::kFloat64RoundUp: |
1348 return VisitUnop(node, UseInfo::Float64(), | 1349 return VisitUnop(node, UseInfo::TruncatingFloat64(), |
1349 MachineRepresentation::kFloat64); | 1350 MachineRepresentation::kFloat64); |
1350 case IrOpcode::kFloat64Equal: | 1351 case IrOpcode::kFloat64Equal: |
1351 case IrOpcode::kFloat64LessThan: | 1352 case IrOpcode::kFloat64LessThan: |
1352 case IrOpcode::kFloat64LessThanOrEqual: | 1353 case IrOpcode::kFloat64LessThanOrEqual: |
1353 return VisitFloat64Cmp(node); | 1354 return VisitFloat64Cmp(node); |
1354 case IrOpcode::kFloat64ExtractLowWord32: | 1355 case IrOpcode::kFloat64ExtractLowWord32: |
1355 case IrOpcode::kFloat64ExtractHighWord32: | 1356 case IrOpcode::kFloat64ExtractHighWord32: |
1356 return VisitUnop(node, UseInfo::Float64(), | 1357 return VisitUnop(node, UseInfo::TruncatingFloat64(), |
1357 MachineRepresentation::kWord32); | 1358 MachineRepresentation::kWord32); |
1358 case IrOpcode::kFloat64InsertLowWord32: | 1359 case IrOpcode::kFloat64InsertLowWord32: |
1359 case IrOpcode::kFloat64InsertHighWord32: | 1360 case IrOpcode::kFloat64InsertHighWord32: |
1360 return VisitBinop(node, UseInfo::Float64(), UseInfo::TruncatingWord32(), | 1361 return VisitBinop(node, UseInfo::TruncatingFloat64(), |
| 1362 UseInfo::TruncatingWord32(), |
1361 MachineRepresentation::kFloat64); | 1363 MachineRepresentation::kFloat64); |
1362 case IrOpcode::kLoadStackPointer: | 1364 case IrOpcode::kLoadStackPointer: |
1363 case IrOpcode::kLoadFramePointer: | 1365 case IrOpcode::kLoadFramePointer: |
1364 case IrOpcode::kLoadParentFramePointer: | 1366 case IrOpcode::kLoadParentFramePointer: |
1365 return VisitLeaf(node, MachineType::PointerRepresentation()); | 1367 return VisitLeaf(node, MachineType::PointerRepresentation()); |
1366 case IrOpcode::kStateValues: | 1368 case IrOpcode::kStateValues: |
1367 VisitStateValues(node); | 1369 VisitStateValues(node); |
1368 break; | 1370 break; |
1369 | 1371 |
1370 // The following opcodes are not produced before representation | 1372 // The following opcodes are not produced before representation |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1494 ? graph()->NewNode(machine()->ChangeUint32ToUint64(), offset) | 1496 ? graph()->NewNode(machine()->ChangeUint32ToUint64(), offset) |
1495 : offset; | 1497 : offset; |
1496 | 1498 |
1497 Node* check = graph()->NewNode(machine()->Uint32LessThan(), offset, length); | 1499 Node* check = graph()->NewNode(machine()->Uint32LessThan(), offset, length); |
1498 Node* branch = | 1500 Node* branch = |
1499 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); | 1501 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); |
1500 | 1502 |
1501 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 1503 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
1502 Node* etrue = graph()->NewNode(machine()->Load(access_type), buffer, index, | 1504 Node* etrue = graph()->NewNode(machine()->Load(access_type), buffer, index, |
1503 effect, if_true); | 1505 effect, if_true); |
| 1506 Type* element_type = |
| 1507 Type::Intersect(NodeProperties::GetType(node), Type::Number(), zone()); |
1504 Node* vtrue = changer->GetRepresentationFor( | 1508 Node* vtrue = changer->GetRepresentationFor( |
1505 etrue, access_type.representation(), NodeProperties::GetType(node), | 1509 etrue, access_type.representation(), element_type, output_rep, |
1506 output_rep, Truncation::None()); | 1510 Truncation::None()); |
1507 | 1511 |
1508 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 1512 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
1509 Node* efalse = effect; | 1513 Node* efalse = effect; |
1510 Node* vfalse; | 1514 Node* vfalse; |
1511 if (output_rep == MachineRepresentation::kTagged) { | 1515 if (output_rep == MachineRepresentation::kTagged) { |
1512 vfalse = jsgraph()->UndefinedConstant(); | 1516 vfalse = jsgraph()->UndefinedConstant(); |
1513 } else if (output_rep == MachineRepresentation::kFloat64) { | 1517 } else if (output_rep == MachineRepresentation::kFloat64) { |
1514 vfalse = | 1518 vfalse = |
1515 jsgraph()->Float64Constant(std::numeric_limits<double>::quiet_NaN()); | 1519 jsgraph()->Float64Constant(std::numeric_limits<double>::quiet_NaN()); |
1516 } else if (output_rep == MachineRepresentation::kFloat32) { | 1520 } else if (output_rep == MachineRepresentation::kFloat32) { |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2190 if (!rhs_type->Is(type_cache_.kZeroToThirtyOne)) { | 2194 if (!rhs_type->Is(type_cache_.kZeroToThirtyOne)) { |
2191 node->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rhs, | 2195 node->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rhs, |
2192 jsgraph()->Int32Constant(0x1f))); | 2196 jsgraph()->Int32Constant(0x1f))); |
2193 } | 2197 } |
2194 NodeProperties::ChangeOp(node, op); | 2198 NodeProperties::ChangeOp(node, op); |
2195 } | 2199 } |
2196 | 2200 |
2197 } // namespace compiler | 2201 } // namespace compiler |
2198 } // namespace internal | 2202 } // namespace internal |
2199 } // namespace v8 | 2203 } // namespace v8 |
OLD | NEW |