| 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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 } else if (output_type->Is(Type::Unsigned32()) || | 487 } else if (output_type->Is(Type::Unsigned32()) || |
| 488 truncation.IsUsedAsWord32()) { | 488 truncation.IsUsedAsWord32()) { |
| 489 // Either the output is uint32 or the uses only care about the | 489 // Either the output is uint32 or the uses only care about the |
| 490 // low 32 bits (so we can pick uint32 safely). | 490 // low 32 bits (so we can pick uint32 safely). |
| 491 | 491 |
| 492 // uint32 -> float64 -> float32 | 492 // uint32 -> float64 -> float32 |
| 493 op = machine()->ChangeUint32ToFloat64(); | 493 op = machine()->ChangeUint32ToFloat64(); |
| 494 node = jsgraph()->graph()->NewNode(op, node); | 494 node = jsgraph()->graph()->NewNode(op, node); |
| 495 op = machine()->TruncateFloat64ToFloat32(); | 495 op = machine()->TruncateFloat64ToFloat32(); |
| 496 } | 496 } |
| 497 } else if (output_rep == MachineRepresentation::kTagged || | 497 } else if (IsAnyTagged(output_rep)) { |
| 498 output_rep == MachineRepresentation::kTaggedPointer) { | |
| 499 if (output_type->Is(Type::NumberOrOddball())) { | 498 if (output_type->Is(Type::NumberOrOddball())) { |
| 500 // tagged -> float64 -> float32 | 499 // tagged -> float64 -> float32 |
| 501 if (output_type->Is(Type::Number())) { | 500 if (output_type->Is(Type::Number())) { |
| 502 op = simplified()->ChangeTaggedToFloat64(); | 501 op = simplified()->ChangeTaggedToFloat64(); |
| 503 } else { | 502 } else { |
| 504 op = simplified()->TruncateTaggedToFloat64(); | 503 op = simplified()->TruncateTaggedToFloat64(); |
| 505 } | 504 } |
| 506 node = jsgraph()->graph()->NewNode(op, node); | 505 node = jsgraph()->graph()->NewNode(op, node); |
| 507 op = machine()->TruncateFloat64ToFloat32(); | 506 op = machine()->TruncateFloat64ToFloat32(); |
| 508 } | 507 } |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 node); | 1069 node); |
| 1071 } | 1070 } |
| 1072 | 1071 |
| 1073 Node* RepresentationChanger::InsertChangeUint32ToFloat64(Node* node) { | 1072 Node* RepresentationChanger::InsertChangeUint32ToFloat64(Node* node) { |
| 1074 return jsgraph()->graph()->NewNode(machine()->ChangeUint32ToFloat64(), node); | 1073 return jsgraph()->graph()->NewNode(machine()->ChangeUint32ToFloat64(), node); |
| 1075 } | 1074 } |
| 1076 | 1075 |
| 1077 } // namespace compiler | 1076 } // namespace compiler |
| 1078 } // namespace internal | 1077 } // namespace internal |
| 1079 } // namespace v8 | 1078 } // namespace v8 |
| OLD | NEW |