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.h" | 7 #include "src/compiler/node-properties.h" |
8 #include "src/compiler/typer.h" | 8 #include "src/compiler/typer.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 return NumberConstant(value); | 143 return NumberConstant(value); |
144 } | 144 } |
145 | 145 |
146 | 146 |
147 Node* JSGraph::Constant(int32_t value) { | 147 Node* JSGraph::Constant(int32_t value) { |
148 if (value == 0) return ZeroConstant(); | 148 if (value == 0) return ZeroConstant(); |
149 if (value == 1) return OneConstant(); | 149 if (value == 1) return OneConstant(); |
150 return NumberConstant(value); | 150 return NumberConstant(value); |
151 } | 151 } |
152 | 152 |
| 153 Node* JSGraph::Constant(uint32_t value) { |
| 154 if (value == 0) return ZeroConstant(); |
| 155 if (value == 1) return OneConstant(); |
| 156 return NumberConstant(value); |
| 157 } |
153 | 158 |
154 Node* JSGraph::Int32Constant(int32_t value) { | 159 Node* JSGraph::Int32Constant(int32_t value) { |
155 Node** loc = cache_.FindInt32Constant(value); | 160 Node** loc = cache_.FindInt32Constant(value); |
156 if (*loc == nullptr) { | 161 if (*loc == nullptr) { |
157 *loc = graph()->NewNode(common()->Int32Constant(value)); | 162 *loc = graph()->NewNode(common()->Int32Constant(value)); |
158 } | 163 } |
159 return *loc; | 164 return *loc; |
160 } | 165 } |
161 | 166 |
162 | 167 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 for (size_t i = 0; i < arraysize(cached_nodes_); i++) { | 252 for (size_t i = 0; i < arraysize(cached_nodes_); i++) { |
248 if (Node* node = cached_nodes_[i]) { | 253 if (Node* node = cached_nodes_[i]) { |
249 if (!node->IsDead()) nodes->push_back(node); | 254 if (!node->IsDead()) nodes->push_back(node); |
250 } | 255 } |
251 } | 256 } |
252 } | 257 } |
253 | 258 |
254 } // namespace compiler | 259 } // namespace compiler |
255 } // namespace internal | 260 } // namespace internal |
256 } // namespace v8 | 261 } // namespace v8 |
OLD | NEW |