Index: src/compiler/representation-change.cc |
diff --git a/src/compiler/representation-change.cc b/src/compiler/representation-change.cc |
index 404eb1c16cb7c38ccec1e9f5cefea7d4b94ad01c..9a054504b64fc649c05331971338d978033df9c9 100644 |
--- a/src/compiler/representation-change.cc |
+++ b/src/compiler/representation-change.cc |
@@ -322,7 +322,13 @@ Node* RepresentationChanger::GetFloat64RepresentationFor( |
op = machine()->ChangeUint32ToFloat64(); |
} |
} else if (output_rep == MachineRepresentation::kTagged) { |
- if (output_type->Is(Type::NumberOrUndefined())) { |
+ if (output_type->Is(Type::Undefined())) { |
+ return jsgraph()->Float64Constant( |
+ std::numeric_limits<double>::quiet_NaN()); |
Jarin
2016/04/22 10:35:30
Nice! Thanks.
|
+ } else if (output_type->Is(Type::TaggedSigned())) { |
+ node = InsertChangeTaggedSignedToInt32(node); |
+ op = machine()->ChangeInt32ToFloat64(); |
+ } else if (output_type->Is(Type::NumberOrUndefined())) { |
op = simplified()->ChangeTaggedToFloat64(); |
} |
} else if (output_rep == MachineRepresentation::kFloat32) { |
@@ -377,7 +383,9 @@ Node* RepresentationChanger::GetWord32RepresentationFor( |
op = machine()->TruncateFloat64ToInt32(TruncationMode::kJavaScript); |
} |
} else if (output_rep == MachineRepresentation::kTagged) { |
- if (output_type->Is(Type::Unsigned32())) { |
+ if (output_type->Is(Type::TaggedSigned())) { |
+ op = simplified()->ChangeTaggedSignedToInt32(); |
+ } else if (output_type->Is(Type::Unsigned32())) { |
op = simplified()->ChangeTaggedToUint32(); |
} else if (output_type->Is(Type::Signed32())) { |
op = simplified()->ChangeTaggedToInt32(); |
@@ -553,6 +561,11 @@ Node* RepresentationChanger::InsertChangeFloat64ToInt32(Node* node) { |
return jsgraph()->graph()->NewNode(machine()->ChangeFloat64ToInt32(), node); |
} |
+Node* RepresentationChanger::InsertChangeTaggedSignedToInt32(Node* node) { |
+ return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedSignedToInt32(), |
+ node); |
+} |
+ |
Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { |
return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), |
node); |