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/compiler/js-graph.h" | 5 #include "src/compiler/js-graph.h" |
6 #include "src/compiler/node-properties-inl.h" | 6 #include "src/compiler/node-properties-inl.h" |
7 #include "src/compiler/typer.h" | 7 #include "src/compiler/typer.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 Node* JSGraph::NumberConstant(double value) { | 159 Node* JSGraph::NumberConstant(double value) { |
160 Node** loc = cache_.FindNumberConstant(value); | 160 Node** loc = cache_.FindNumberConstant(value); |
161 if (*loc == NULL) { | 161 if (*loc == NULL) { |
162 *loc = NewNode(common()->NumberConstant(value)); | 162 *loc = NewNode(common()->NumberConstant(value)); |
163 } | 163 } |
164 return *loc; | 164 return *loc; |
165 } | 165 } |
166 | 166 |
167 | 167 |
| 168 Node* JSGraph::Float32Constant(float value) { |
| 169 // TODO(turbofan): cache float32 constants. |
| 170 return NewNode(common()->Float32Constant(value)); |
| 171 } |
| 172 |
| 173 |
168 Node* JSGraph::Float64Constant(double value) { | 174 Node* JSGraph::Float64Constant(double value) { |
169 Node** loc = cache_.FindFloat64Constant(value); | 175 Node** loc = cache_.FindFloat64Constant(value); |
170 if (*loc == NULL) { | 176 if (*loc == NULL) { |
171 *loc = NewNode(common()->Float64Constant(value)); | 177 *loc = NewNode(common()->Float64Constant(value)); |
172 } | 178 } |
173 return *loc; | 179 return *loc; |
174 } | 180 } |
175 | 181 |
176 | 182 |
177 Node* JSGraph::ExternalConstant(ExternalReference reference) { | 183 Node* JSGraph::ExternalConstant(ExternalReference reference) { |
178 Node** loc = cache_.FindExternalConstant(reference); | 184 Node** loc = cache_.FindExternalConstant(reference); |
179 if (*loc == NULL) { | 185 if (*loc == NULL) { |
180 *loc = NewNode(common()->ExternalConstant(reference)); | 186 *loc = NewNode(common()->ExternalConstant(reference)); |
181 } | 187 } |
182 return *loc; | 188 return *loc; |
183 } | 189 } |
184 } // namespace compiler | 190 } // namespace compiler |
185 } // namespace internal | 191 } // namespace internal |
186 } // namespace v8 | 192 } // namespace v8 |
OLD | NEW |