OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |