OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/representation-change.h" | 5 #include "src/compiler/representation-change.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 node = InsertConversion(node, op, use_node); | 243 node = InsertConversion(node, op, use_node); |
244 if (SmiValuesAre32Bits()) { | 244 if (SmiValuesAre32Bits()) { |
245 op = simplified()->ChangeInt32ToTagged(); | 245 op = simplified()->ChangeInt32ToTagged(); |
246 } else { | 246 } else { |
247 op = simplified()->CheckedInt32ToTaggedSigned(); | 247 op = simplified()->CheckedInt32ToTaggedSigned(); |
248 } | 248 } |
249 } else { | 249 } else { |
250 return TypeError(node, output_rep, output_type, | 250 return TypeError(node, output_rep, output_type, |
251 MachineRepresentation::kTaggedSigned); | 251 MachineRepresentation::kTaggedSigned); |
252 } | 252 } |
| 253 } else if (output_rep == MachineRepresentation::kFloat32) { |
| 254 if (use_info.type_check() == TypeCheckKind::kSignedSmall) { |
| 255 op = machine()->ChangeFloat32ToFloat64(); |
| 256 node = InsertConversion(node, op, use_node); |
| 257 op = simplified()->CheckedFloat64ToInt32( |
| 258 output_type->Maybe(Type::MinusZero()) |
| 259 ? CheckForMinusZeroMode::kCheckForMinusZero |
| 260 : CheckForMinusZeroMode::kDontCheckForMinusZero); |
| 261 node = InsertConversion(node, op, use_node); |
| 262 if (SmiValuesAre32Bits()) { |
| 263 op = simplified()->ChangeInt32ToTagged(); |
| 264 } else { |
| 265 op = simplified()->CheckedInt32ToTaggedSigned(); |
| 266 } |
| 267 } else { |
| 268 return TypeError(node, output_rep, output_type, |
| 269 MachineRepresentation::kTaggedSigned); |
| 270 } |
253 } else if (CanBeTaggedPointer(output_rep) && | 271 } else if (CanBeTaggedPointer(output_rep) && |
254 use_info.type_check() == TypeCheckKind::kSignedSmall) { | 272 use_info.type_check() == TypeCheckKind::kSignedSmall) { |
255 op = simplified()->CheckedTaggedToTaggedSigned(); | 273 op = simplified()->CheckedTaggedToTaggedSigned(); |
256 } else if (output_rep == MachineRepresentation::kBit && | 274 } else if (output_rep == MachineRepresentation::kBit && |
257 use_info.type_check() == TypeCheckKind::kSignedSmall) { | 275 use_info.type_check() == TypeCheckKind::kSignedSmall) { |
258 // TODO(turbofan): Consider adding a Bailout operator that just deopts. | 276 // TODO(turbofan): Consider adding a Bailout operator that just deopts. |
259 // Also use that for MachineRepresentation::kPointer case above. | 277 // Also use that for MachineRepresentation::kPointer case above. |
260 node = InsertChangeBitToTagged(node); | 278 node = InsertChangeBitToTagged(node); |
261 op = simplified()->CheckedTaggedToTaggedSigned(); | 279 op = simplified()->CheckedTaggedToTaggedSigned(); |
262 } else { | 280 } else { |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 } | 1002 } |
985 | 1003 |
986 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { | 1004 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { |
987 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), | 1005 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), |
988 node); | 1006 node); |
989 } | 1007 } |
990 | 1008 |
991 } // namespace compiler | 1009 } // namespace compiler |
992 } // namespace internal | 1010 } // namespace internal |
993 } // namespace v8 | 1011 } // namespace v8 |
OLD | NEW |