Index: src/compiler/representation-change.h |
diff --git a/src/compiler/representation-change.h b/src/compiler/representation-change.h |
index b89d9363de8f3e5f2c9b56f8df9182308c436c5c..2eff131f26550bda84c4a81caa2709d897e198d5 100644 |
--- a/src/compiler/representation-change.h |
+++ b/src/compiler/representation-change.h |
@@ -211,16 +211,8 @@ class RepresentationChanger { |
return jsgraph()->graph()->NewNode(op, node); |
} |
- Node* MakeInt32Constant(double value) { |
- if (value < 0) { |
- DCHECK(IsInt32Double(value)); |
- int32_t iv = static_cast<int32_t>(value); |
- return jsgraph()->Int32Constant(iv); |
- } else { |
- DCHECK(IsUint32Double(value)); |
- int32_t iv = static_cast<int32_t>(static_cast<uint32_t>(value)); |
- return jsgraph()->Int32Constant(iv); |
- } |
+ Node* MakeTruncatedInt32Constant(double value) { |
+ return jsgraph()->Int32Constant(DoubleToInt32(value)); |
} |
Node* GetTruncatedWord32For(Node* node, MachineTypeUnion output_type) { |
@@ -260,10 +252,10 @@ class RepresentationChanger { |
case IrOpcode::kInt32Constant: |
return node; // No change necessary. |
case IrOpcode::kFloat32Constant: |
- return MakeInt32Constant(OpParameter<float>(node)); |
+ return MakeTruncatedInt32Constant(OpParameter<float>(node)); |
case IrOpcode::kNumberConstant: |
case IrOpcode::kFloat64Constant: |
- return MakeInt32Constant(OpParameter<double>(node)); |
+ return MakeTruncatedInt32Constant(OpParameter<double>(node)); |
default: |
break; |
} |