Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1225)

Unified Diff: src/compiler/js-graph.cc

Issue 822923002: [turbofan] Cache float32 constants on the JSGraph level. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/common-node-cache.cc ('k') | src/compiler/node-cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « src/compiler/common-node-cache.cc ('k') | src/compiler/node-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698