Index: src/compiler/representation-change.cc |
diff --git a/src/compiler/representation-change.cc b/src/compiler/representation-change.cc |
index 42ec73b7a31ccc2a94543218f796c2c5efb3ff6e..f15df671cf0a990e13b6ab04f6ffe386fd63137d 100644 |
--- a/src/compiler/representation-change.cc |
+++ b/src/compiler/representation-change.cc |
@@ -364,12 +364,22 @@ Node* RepresentationChanger::GetTaggedPointerRepresentationFor( |
} |
op = simplified()->ChangeFloat64ToTaggedPointer(); |
} else if (output_rep == MachineRepresentation::kFloat32) { |
- // float32 -> float64 -> tagged |
- node = InsertChangeFloat32ToFloat64(node); |
- op = simplified()->ChangeFloat64ToTaggedPointer(); |
+ if (output_type->Is(Type::Number())) { |
+ // float32 -> float64 -> tagged |
+ node = InsertChangeFloat32ToFloat64(node); |
+ op = simplified()->ChangeFloat64ToTaggedPointer(); |
+ } else { |
+ return TypeError(node, output_rep, output_type, |
+ MachineRepresentation::kTaggedPointer); |
+ } |
} else if (output_rep == MachineRepresentation::kFloat64) { |
- // float64 -> tagged |
- op = simplified()->ChangeFloat64ToTaggedPointer(); |
+ if (output_type->Is(Type::Number())) { |
+ // float64 -> tagged |
+ op = simplified()->ChangeFloat64ToTaggedPointer(); |
+ } else { |
+ return TypeError(node, output_rep, output_type, |
+ MachineRepresentation::kTaggedPointer); |
+ } |
} else if (CanBeTaggedSigned(output_rep) && |
use_info.type_check() == TypeCheckKind::kHeapObject) { |
if (!output_type->Maybe(Type::SignedSmall())) { |
@@ -452,11 +462,14 @@ Node* RepresentationChanger::GetTaggedRepresentationFor( |
Type::Unsigned32())) { // float64 -> uint32 -> tagged |
node = InsertChangeFloat64ToUint32(node); |
op = simplified()->ChangeUint32ToTagged(); |
- } else { |
+ } else if (output_type->Is(Type::Number())) { |
op = simplified()->ChangeFloat64ToTagged( |
output_type->Maybe(Type::MinusZero()) |
? CheckForMinusZeroMode::kCheckForMinusZero |
: CheckForMinusZeroMode::kDontCheckForMinusZero); |
+ } else { |
+ return TypeError(node, output_rep, output_type, |
+ MachineRepresentation::kTagged); |
} |
} else { |
return TypeError(node, output_rep, output_type, |