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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 Node* JSGraph::NaNConstant() { | 77 Node* JSGraph::NaNConstant() { |
78 return CACHED(kNaNConstant, | 78 return CACHED(kNaNConstant, |
79 NumberConstant(std::numeric_limits<double>::quiet_NaN())); | 79 NumberConstant(std::numeric_limits<double>::quiet_NaN())); |
80 } | 80 } |
81 | 81 |
82 | 82 |
83 Node* JSGraph::HeapConstant(Handle<HeapObject> value) { | 83 Node* JSGraph::HeapConstant(Handle<HeapObject> value) { |
84 if (value->IsConsString()) { | |
85 value = String::Flatten(Handle<String>::cast(value), TENURED); | |
86 } | |
87 Node** loc = cache_.FindHeapConstant(value); | 84 Node** loc = cache_.FindHeapConstant(value); |
88 if (*loc == nullptr) { | 85 if (*loc == nullptr) { |
89 *loc = graph()->NewNode(common()->HeapConstant(value)); | 86 *loc = graph()->NewNode(common()->HeapConstant(value)); |
90 } | 87 } |
91 return *loc; | 88 return *loc; |
92 } | 89 } |
93 | 90 |
94 | 91 |
95 Node* JSGraph::Constant(Handle<Object> value) { | 92 Node* JSGraph::Constant(Handle<Object> value) { |
96 // Dereference the handle to determine if a number constant or other | 93 // Dereference the handle to determine if a number constant or other |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 for (size_t i = 0; i < arraysize(cached_nodes_); i++) { | 230 for (size_t i = 0; i < arraysize(cached_nodes_); i++) { |
234 if (Node* node = cached_nodes_[i]) { | 231 if (Node* node = cached_nodes_[i]) { |
235 if (!node->IsDead()) nodes->push_back(node); | 232 if (!node->IsDead()) nodes->push_back(node); |
236 } | 233 } |
237 } | 234 } |
238 } | 235 } |
239 | 236 |
240 } // namespace compiler | 237 } // namespace compiler |
241 } // namespace internal | 238 } // namespace internal |
242 } // namespace v8 | 239 } // namespace v8 |
OLD | NEW |