Skip to content

Commit

Permalink
[turbofan] Remove self-healing wrt. ChangeFloat64ToTagged.
Browse files Browse the repository at this point in the history
Make sure that the input to ChangeFloat64ToTagged is definitely of type
Number, because the operator cannot deal with non-Number inputs.

R=jarin@chromium.org
BUG=v8:5267

Review-Url: https://codereview.chromium.org/2858153003
Cr-Commit-Position: refs/heads/master@{#45087}
  • Loading branch information
bmeurer authored and Commit bot committed May 4, 2017
1 parent d7b65d4 commit 6b4e8c2
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/compiler/representation-change.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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())) {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 6b4e8c2

Please sign in to comment.