| 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 return jsgraph()->Float64Constant( | 366 return jsgraph()->Float64Constant( |
| 367 std::numeric_limits<double>::quiet_NaN()); | 367 std::numeric_limits<double>::quiet_NaN()); |
| 368 } else if (output_type->Is(Type::TaggedSigned())) { | 368 } else if (output_type->Is(Type::TaggedSigned())) { |
| 369 node = InsertChangeTaggedSignedToInt32(node); | 369 node = InsertChangeTaggedSignedToInt32(node); |
| 370 op = machine()->ChangeInt32ToFloat64(); | 370 op = machine()->ChangeInt32ToFloat64(); |
| 371 } else if (output_type->Is(Type::Number())) { | 371 } else if (output_type->Is(Type::Number())) { |
| 372 op = simplified()->ChangeTaggedToFloat64(); | 372 op = simplified()->ChangeTaggedToFloat64(); |
| 373 } else if (output_type->Is(Type::NumberOrOddball())) { | 373 } else if (output_type->Is(Type::NumberOrOddball())) { |
| 374 // TODO(jarin) Here we should check that truncation is Number. | 374 // TODO(jarin) Here we should check that truncation is Number. |
| 375 op = simplified()->TruncateTaggedToFloat64(); | 375 op = simplified()->TruncateTaggedToFloat64(); |
| 376 } else if (use_info.type_check() == TypeCheckKind::kNumber || |
| 377 (use_info.type_check() == TypeCheckKind::kNumberOrOddball && |
| 378 !output_type->Maybe(Type::BooleanOrNullOrNumber()))) { |
| 379 op = simplified()->CheckedTaggedToFloat64(CheckTaggedInputMode::kNumber); |
| 376 } else if (use_info.type_check() == TypeCheckKind::kNumberOrOddball) { | 380 } else if (use_info.type_check() == TypeCheckKind::kNumberOrOddball) { |
| 377 op = simplified()->CheckedTaggedToFloat64(); | 381 op = simplified()->CheckedTaggedToFloat64( |
| 382 CheckTaggedInputMode::kNumberOrOddball); |
| 378 } | 383 } |
| 379 } else if (output_rep == MachineRepresentation::kFloat32) { | 384 } else if (output_rep == MachineRepresentation::kFloat32) { |
| 380 op = machine()->ChangeFloat32ToFloat64(); | 385 op = machine()->ChangeFloat32ToFloat64(); |
| 381 } | 386 } |
| 382 if (op == nullptr) { | 387 if (op == nullptr) { |
| 383 return TypeError(node, output_rep, output_type, | 388 return TypeError(node, output_rep, output_type, |
| 384 MachineRepresentation::kFloat64); | 389 MachineRepresentation::kFloat64); |
| 385 } | 390 } |
| 386 return InsertConversion(node, op, use_node); | 391 return InsertConversion(node, op, use_node); |
| 387 } | 392 } |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 } | 815 } |
| 811 | 816 |
| 812 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { | 817 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { |
| 813 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), | 818 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), |
| 814 node); | 819 node); |
| 815 } | 820 } |
| 816 | 821 |
| 817 } // namespace compiler | 822 } // namespace compiler |
| 818 } // namespace internal | 823 } // namespace internal |
| 819 } // namespace v8 | 824 } // namespace v8 |
| OLD | NEW |