| 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 // Either the output is uint32 or the uses only care about the | 429 // Either the output is uint32 or the uses only care about the |
| 430 // low 32 bits (so we can pick uint32 safely). | 430 // low 32 bits (so we can pick uint32 safely). |
| 431 op = simplified()->ChangeUint32ToTagged(); | 431 op = simplified()->ChangeUint32ToTagged(); |
| 432 } else { | 432 } else { |
| 433 return TypeError(node, output_rep, output_type, | 433 return TypeError(node, output_rep, output_type, |
| 434 MachineRepresentation::kTagged); | 434 MachineRepresentation::kTagged); |
| 435 } | 435 } |
| 436 } else if (output_rep == | 436 } else if (output_rep == |
| 437 MachineRepresentation::kFloat32) { // float32 -> float64 -> tagged | 437 MachineRepresentation::kFloat32) { // float32 -> float64 -> tagged |
| 438 node = InsertChangeFloat32ToFloat64(node); | 438 node = InsertChangeFloat32ToFloat64(node); |
| 439 op = simplified()->ChangeFloat64ToTagged(); | 439 op = simplified()->ChangeFloat64ToTagged( |
| 440 output_type->Maybe(Type::MinusZero()) |
| 441 ? CheckForMinusZeroMode::kCheckForMinusZero |
| 442 : CheckForMinusZeroMode::kDontCheckForMinusZero); |
| 440 } else if (output_rep == MachineRepresentation::kFloat64) { | 443 } else if (output_rep == MachineRepresentation::kFloat64) { |
| 441 if (output_type->Is(Type::Signed31())) { // float64 -> int32 -> tagged | 444 if (output_type->Is(Type::Signed31())) { // float64 -> int32 -> tagged |
| 442 node = InsertChangeFloat64ToInt32(node); | 445 node = InsertChangeFloat64ToInt32(node); |
| 443 op = simplified()->ChangeInt31ToTaggedSigned(); | 446 op = simplified()->ChangeInt31ToTaggedSigned(); |
| 444 } else if (output_type->Is( | 447 } else if (output_type->Is( |
| 445 Type::Signed32())) { // float64 -> int32 -> tagged | 448 Type::Signed32())) { // float64 -> int32 -> tagged |
| 446 node = InsertChangeFloat64ToInt32(node); | 449 node = InsertChangeFloat64ToInt32(node); |
| 447 op = simplified()->ChangeInt32ToTagged(); | 450 op = simplified()->ChangeInt32ToTagged(); |
| 448 } else if (output_type->Is( | 451 } else if (output_type->Is( |
| 449 Type::Unsigned32())) { // float64 -> uint32 -> tagged | 452 Type::Unsigned32())) { // float64 -> uint32 -> tagged |
| 450 node = InsertChangeFloat64ToUint32(node); | 453 node = InsertChangeFloat64ToUint32(node); |
| 451 op = simplified()->ChangeUint32ToTagged(); | 454 op = simplified()->ChangeUint32ToTagged(); |
| 452 } else { | 455 } else { |
| 453 op = simplified()->ChangeFloat64ToTagged(); | 456 op = simplified()->ChangeFloat64ToTagged( |
| 457 output_type->Maybe(Type::MinusZero()) |
| 458 ? CheckForMinusZeroMode::kCheckForMinusZero |
| 459 : CheckForMinusZeroMode::kDontCheckForMinusZero); |
| 454 } | 460 } |
| 455 } else { | 461 } else { |
| 456 return TypeError(node, output_rep, output_type, | 462 return TypeError(node, output_rep, output_type, |
| 457 MachineRepresentation::kTagged); | 463 MachineRepresentation::kTagged); |
| 458 } | 464 } |
| 459 return jsgraph()->graph()->NewNode(op, node); | 465 return jsgraph()->graph()->NewNode(op, node); |
| 460 } | 466 } |
| 461 | 467 |
| 462 | 468 |
| 463 Node* RepresentationChanger::GetFloat32RepresentationFor( | 469 Node* RepresentationChanger::GetFloat32RepresentationFor( |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 node); | 1097 node); |
| 1092 } | 1098 } |
| 1093 | 1099 |
| 1094 Node* RepresentationChanger::InsertChangeUint32ToFloat64(Node* node) { | 1100 Node* RepresentationChanger::InsertChangeUint32ToFloat64(Node* node) { |
| 1095 return jsgraph()->graph()->NewNode(machine()->ChangeUint32ToFloat64(), node); | 1101 return jsgraph()->graph()->NewNode(machine()->ChangeUint32ToFloat64(), node); |
| 1096 } | 1102 } |
| 1097 | 1103 |
| 1098 } // namespace compiler | 1104 } // namespace compiler |
| 1099 } // namespace internal | 1105 } // namespace internal |
| 1100 } // namespace v8 | 1106 } // namespace v8 |
| OLD | NEW |