| 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) { | 460 if (use_info.type_check() == TypeCheckKind::kNumberOrOddball) { |
| 461 op = simplified()->CheckedTaggedToFloat64(); | 461 op = simplified()->CheckedTruncateTaggedToWord32(); |
| 462 Node* effect = NodeProperties::GetEffectInput(use_node); | 462 } else { |
| 463 Node* control = NodeProperties::GetControlInput(use_node); | 463 op = simplified()->TruncateTaggedToWord32(); |
| 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); | |
| 469 } | 464 } |
| 470 op = simplified()->TruncateTaggedToWord32(); | |
| 471 } else if (use_info.type_check() == TypeCheckKind::kSigned32) { | 465 } else if (use_info.type_check() == TypeCheckKind::kSigned32) { |
| 472 op = simplified()->CheckedTaggedToInt32(); | 466 op = simplified()->CheckedTaggedToInt32(); |
| 473 } | 467 } |
| 474 } else if (output_rep == MachineRepresentation::kWord32) { | 468 } else if (output_rep == MachineRepresentation::kWord32) { |
| 475 // Only the checked case should get here, the non-checked case is | 469 // Only the checked case should get here, the non-checked case is |
| 476 // handled in GetRepresentationFor. | 470 // handled in GetRepresentationFor. |
| 477 if (use_info.type_check() == TypeCheckKind::kSigned32) { | 471 if (use_info.type_check() == TypeCheckKind::kSigned32) { |
| 478 if (output_type->Is(Type::Signed32())) { | 472 if (output_type->Is(Type::Signed32())) { |
| 479 return node; | 473 return node; |
| 480 } else if (output_type->Is(Type::Unsigned32())) { | 474 } else if (output_type->Is(Type::Unsigned32())) { |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 } | 784 } |
| 791 | 785 |
| 792 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { | 786 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { |
| 793 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), | 787 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), |
| 794 node); | 788 node); |
| 795 } | 789 } |
| 796 | 790 |
| 797 } // namespace compiler | 791 } // namespace compiler |
| 798 } // namespace internal | 792 } // namespace internal |
| 799 } // namespace v8 | 793 } // namespace v8 |
| OLD | NEW |