| Index: src/compiler/representation-change.h
|
| diff --git a/src/compiler/representation-change.h b/src/compiler/representation-change.h
|
| index 3ba5b4e5cb6b670fa6a2370135f208a9d431c583..e803d512027d98b4475e1a3bb50a1150cc355755 100644
|
| --- a/src/compiler/representation-change.h
|
| +++ b/src/compiler/representation-change.h
|
| @@ -51,10 +51,10 @@ class RepresentationChanger {
|
| }
|
| if (use_type & kRepTagged) {
|
| return GetTaggedRepresentationFor(node, output_type);
|
| + } else if (use_type & kRepFloat32) {
|
| + return GetFloat32RepresentationFor(node, output_type);
|
| } else if (use_type & kRepFloat64) {
|
| return GetFloat64RepresentationFor(node, output_type);
|
| - } else if (use_type & kRepFloat32) {
|
| - return TypeError(node, output_type, use_type); // TODO(titzer): handle
|
| } else if (use_type & kRepBit) {
|
| return GetBitRepresentationFor(node, output_type);
|
| } else if (use_type & rWord) {
|
| @@ -103,6 +103,10 @@ class RepresentationChanger {
|
| } else {
|
| return TypeError(node, output_type, kRepTagged);
|
| }
|
| + } else if (output_type & kRepFloat32) {
|
| + node = jsgraph()->graph()->NewNode(machine()->ChangeFloat32ToFloat64(),
|
| + node);
|
| + op = simplified()->ChangeFloat64ToTagged();
|
| } else if (output_type & kRepFloat64) {
|
| op = simplified()->ChangeFloat64ToTagged();
|
| } else {
|
| @@ -111,6 +115,19 @@ class RepresentationChanger {
|
| return jsgraph()->graph()->NewNode(op, node);
|
| }
|
|
|
| + Node* GetFloat32RepresentationFor(Node* node, MachineTypeUnion output_type) {
|
| + // Eagerly fold representation changes for constants.
|
| + switch (node->opcode()) {
|
| + // TODO(turbofan): NumberConstant, Int32Constant, and Float64Constant?
|
| + case IrOpcode::kFloat32Constant:
|
| + return node; // No change necessary.
|
| + default:
|
| + break;
|
| + }
|
| + // TODO(turbofan): Select the correct X -> Float32 operator.
|
| + return TypeError(node, output_type, kRepFloat32);
|
| + }
|
| +
|
| Node* GetFloat64RepresentationFor(Node* node, MachineTypeUnion output_type) {
|
| // Eagerly fold representation changes for constants.
|
| switch (node->opcode()) {
|
| @@ -141,6 +158,8 @@ class RepresentationChanger {
|
| }
|
| } else if (output_type & kRepTagged) {
|
| op = simplified()->ChangeTaggedToFloat64();
|
| + } else if (output_type & kRepFloat32) {
|
| + op = machine()->ChangeFloat32ToFloat64();
|
| } else {
|
| return TypeError(node, output_type, kRepFloat64);
|
| }
|
| @@ -341,8 +360,9 @@ class RepresentationChanger {
|
| SimplifiedOperatorBuilder* simplified() { return simplified_; }
|
| MachineOperatorBuilder* machine() { return jsgraph()->machine(); }
|
| };
|
| -}
|
| -}
|
| -} // namespace v8::internal::compiler
|
| +
|
| +} // namespace compiler
|
| +} // namespace internal
|
| +} // namespace v8
|
|
|
| #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_
|
|
|