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 } |
84 Node** loc = cache_.FindHeapConstant(value); | 87 Node** loc = cache_.FindHeapConstant(value); |
85 if (*loc == nullptr) { | 88 if (*loc == nullptr) { |
86 *loc = graph()->NewNode(common()->HeapConstant(value)); | 89 *loc = graph()->NewNode(common()->HeapConstant(value)); |
87 } | 90 } |
88 return *loc; | 91 return *loc; |
89 } | 92 } |
90 | 93 |
91 | 94 |
92 Node* JSGraph::Constant(Handle<Object> value) { | 95 Node* JSGraph::Constant(Handle<Object> value) { |
93 // Dereference the handle to determine if a number constant or other | 96 // Dereference the handle to determine if a number constant or other |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 for (size_t i = 0; i < arraysize(cached_nodes_); i++) { | 233 for (size_t i = 0; i < arraysize(cached_nodes_); i++) { |
231 if (Node* node = cached_nodes_[i]) { | 234 if (Node* node = cached_nodes_[i]) { |
232 if (!node->IsDead()) nodes->push_back(node); | 235 if (!node->IsDead()) nodes->push_back(node); |
233 } | 236 } |
234 } | 237 } |
235 } | 238 } |
236 | 239 |
237 } // namespace compiler | 240 } // namespace compiler |
238 } // namespace internal | 241 } // namespace internal |
239 } // namespace v8 | 242 } // namespace v8 |
OLD | NEW |