Index: src/compiler/js-graph.cc |
diff --git a/src/compiler/js-graph.cc b/src/compiler/js-graph.cc |
index b8a7f976e82ce6e4a91726ea7faff57dc87a4b6b..7759ba14418c29c26aaa165d470958ba1abc0f93 100644 |
--- a/src/compiler/js-graph.cc |
+++ b/src/compiler/js-graph.cc |
@@ -174,8 +174,11 @@ Node* JSGraph::NumberConstant(double value) { |
Node* JSGraph::Float32Constant(float value) { |
- // TODO(turbofan): cache float32 constants. |
- return graph()->NewNode(common()->Float32Constant(value)); |
+ Node** loc = cache_.FindFloat32Constant(value); |
+ if (*loc == NULL) { |
+ *loc = graph()->NewNode(common()->Float32Constant(value)); |
+ } |
+ return *loc; |
} |