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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
450 op = simplified()->CheckedFloat64ToInt32(); | 450 op = simplified()->CheckedFloat64ToInt32(); |
451 } | 451 } |
452 } else if (output_rep == MachineRepresentation::kTagged) { | 452 } else if (output_rep == MachineRepresentation::kTagged) { |
453 if (output_type->Is(Type::TaggedSigned())) { | 453 if (output_type->Is(Type::TaggedSigned())) { |
454 op = simplified()->ChangeTaggedSignedToInt32(); | 454 op = simplified()->ChangeTaggedSignedToInt32(); |
455 } else if (output_type->Is(Type::Unsigned32())) { | 455 } else if (output_type->Is(Type::Unsigned32())) { |
456 op = simplified()->ChangeTaggedToUint32(); | 456 op = simplified()->ChangeTaggedToUint32(); |
457 } else if (output_type->Is(Type::Signed32())) { | 457 } else if (output_type->Is(Type::Signed32())) { |
458 op = simplified()->ChangeTaggedToInt32(); | 458 op = simplified()->ChangeTaggedToInt32(); |
459 } else if (use_info.truncation().IsUsedAsWord32()) { | 459 } else if (use_info.truncation().IsUsedAsWord32()) { |
460 if (use_info.type_check() == TypeCheckKind::kNumberOrOddball) { | |
461 op = simplified()->CheckedTaggedToFloat64(); | |
462 Node* effect = NodeProperties::GetEffectInput(use_node); | |
463 Node* control = NodeProperties::GetControlInput(use_node); | |
464 Node* to_float_checked = | |
465 jsgraph()->graph()->NewNode(op, node, effect, control); | |
466 NodeProperties::ReplaceEffectInput(use_node, to_float_checked); | |
467 return jsgraph()->graph()->NewNode(machine()->TruncateFloat64ToWord32(), | |
468 to_float_checked); | |
Jarin
2016/07/27 05:34:01
As discussed offline, we should introduce a dedica
epertoso
2016/07/27 08:26:36
Acknowledged.
| |
469 } | |
460 op = simplified()->TruncateTaggedToWord32(); | 470 op = simplified()->TruncateTaggedToWord32(); |
461 } else if (use_info.type_check() == TypeCheckKind::kSigned32) { | 471 } else if (use_info.type_check() == TypeCheckKind::kSigned32) { |
462 op = simplified()->CheckedTaggedToInt32(); | 472 op = simplified()->CheckedTaggedToInt32(); |
463 } | 473 } |
464 } else if (output_rep == MachineRepresentation::kWord32) { | 474 } else if (output_rep == MachineRepresentation::kWord32) { |
465 // Only the checked case should get here, the non-checked case is | 475 // Only the checked case should get here, the non-checked case is |
466 // handled in GetRepresentationFor. | 476 // handled in GetRepresentationFor. |
467 DCHECK(use_info.type_check() == TypeCheckKind::kSigned32); | 477 if (use_info.type_check() == TypeCheckKind::kSigned32) { |
468 if (output_type->Is(Type::Signed32())) { | 478 if (output_type->Is(Type::Signed32())) { |
479 return node; | |
480 } else if (output_type->Is(Type::Unsigned32())) { | |
481 op = simplified()->CheckedUint32ToInt32(); | |
482 } | |
483 } else { | |
484 DCHECK(use_info.type_check() == TypeCheckKind::kNumberOrOddball); | |
Benedikt Meurer
2016/07/27 03:34:36
Nit: Use DCHECK_EQ(TypeCheckKind::kNumberOrOddball
epertoso
2016/07/27 08:26:36
Done.
| |
469 return node; | 485 return node; |
470 } else if (output_type->Is(Type::Unsigned32())) { | |
471 op = simplified()->CheckedUint32ToInt32(); | |
472 } | 486 } |
473 } else if (output_rep == MachineRepresentation::kWord8 || | 487 } else if (output_rep == MachineRepresentation::kWord8 || |
474 output_rep == MachineRepresentation::kWord16) { | 488 output_rep == MachineRepresentation::kWord16) { |
475 DCHECK(use_info.representation() == MachineRepresentation::kWord32); | 489 DCHECK(use_info.representation() == MachineRepresentation::kWord32); |
476 DCHECK(use_info.type_check() == TypeCheckKind::kSigned32); | 490 DCHECK(use_info.type_check() == TypeCheckKind::kSigned32); |
477 return node; | 491 return node; |
478 } | 492 } |
479 | 493 |
480 if (op == nullptr) { | 494 if (op == nullptr) { |
481 return TypeError(node, output_rep, output_type, | 495 return TypeError(node, output_rep, output_type, |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
848 } | 862 } |
849 | 863 |
850 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { | 864 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { |
851 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), | 865 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), |
852 node); | 866 node); |
853 } | 867 } |
854 | 868 |
855 } // namespace compiler | 869 } // namespace compiler |
856 } // namespace internal | 870 } // namespace internal |
857 } // namespace v8 | 871 } // namespace v8 |
OLD | NEW |