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

Side by Side 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 5 years, 12 months 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/code-stubs.h" 5 #include "src/code-stubs.h"
6 #include "src/compiler/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "src/compiler/node-properties-inl.h" 7 #include "src/compiler/node-properties-inl.h"
8 #include "src/compiler/typer.h" 8 #include "src/compiler/typer.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 Node* JSGraph::NumberConstant(double value) { 167 Node* JSGraph::NumberConstant(double value) {
168 Node** loc = cache_.FindNumberConstant(value); 168 Node** loc = cache_.FindNumberConstant(value);
169 if (*loc == NULL) { 169 if (*loc == NULL) {
170 *loc = graph()->NewNode(common()->NumberConstant(value)); 170 *loc = graph()->NewNode(common()->NumberConstant(value));
171 } 171 }
172 return *loc; 172 return *loc;
173 } 173 }
174 174
175 175
176 Node* JSGraph::Float32Constant(float value) { 176 Node* JSGraph::Float32Constant(float value) {
177 // TODO(turbofan): cache float32 constants. 177 Node** loc = cache_.FindFloat32Constant(value);
178 return graph()->NewNode(common()->Float32Constant(value)); 178 if (*loc == NULL) {
179 *loc = graph()->NewNode(common()->Float32Constant(value));
180 }
181 return *loc;
179 } 182 }
180 183
181 184
182 Node* JSGraph::Float64Constant(double value) { 185 Node* JSGraph::Float64Constant(double value) {
183 Node** loc = cache_.FindFloat64Constant(value); 186 Node** loc = cache_.FindFloat64Constant(value);
184 if (*loc == NULL) { 187 if (*loc == NULL) {
185 *loc = graph()->NewNode(common()->Float64Constant(value)); 188 *loc = graph()->NewNode(common()->Float64Constant(value));
186 } 189 }
187 return *loc; 190 return *loc;
188 } 191 }
(...skipping 15 matching lines...) Expand all
204 &true_constant_, &false_constant_, &null_constant_, 207 &true_constant_, &false_constant_, &null_constant_,
205 &zero_constant_, &one_constant_, &nan_constant_}; 208 &zero_constant_, &one_constant_, &nan_constant_};
206 for (size_t i = 0; i < arraysize(ptrs); i++) { 209 for (size_t i = 0; i < arraysize(ptrs); i++) {
207 if (ptrs[i]->is_set()) nodes->push_back(ptrs[i]->get()); 210 if (ptrs[i]->is_set()) nodes->push_back(ptrs[i]->get());
208 } 211 }
209 } 212 }
210 213
211 } // namespace compiler 214 } // namespace compiler
212 } // namespace internal 215 } // namespace internal
213 } // namespace v8 216 } // namespace v8
OLDNEW
« 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