Chromium Code Reviews| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 } | 65 } |
| 66 | 66 |
| 67 | 67 |
| 68 Node* JSGraph::NaNConstant() { | 68 Node* JSGraph::NaNConstant() { |
| 69 return CACHED(kNaNConstant, | 69 return CACHED(kNaNConstant, |
| 70 NumberConstant(std::numeric_limits<double>::quiet_NaN())); | 70 NumberConstant(std::numeric_limits<double>::quiet_NaN())); |
| 71 } | 71 } |
| 72 | 72 |
| 73 | 73 |
| 74 Node* JSGraph::HeapConstant(Handle<HeapObject> value) { | 74 Node* JSGraph::HeapConstant(Handle<HeapObject> value) { |
| 75 // TODO(bmeurer): Flatten cons strings here before we canonicalize them? | 75 if (value->IsConsString()) { |
|
Yang
2015/12/16 06:24:16
String::Flatten already checks for cons string. No
Benedikt Meurer
2015/12/16 06:26:02
That doesn't really help, since we'd have to test
| |
| 76 value = String::Flatten(Handle<String>::cast(value), TENURED); | |
| 77 } | |
| 76 Node** loc = cache_.FindHeapConstant(value); | 78 Node** loc = cache_.FindHeapConstant(value); |
| 77 if (*loc == nullptr) { | 79 if (*loc == nullptr) { |
| 78 *loc = graph()->NewNode(common()->HeapConstant(value)); | 80 *loc = graph()->NewNode(common()->HeapConstant(value)); |
| 79 } | 81 } |
| 80 return *loc; | 82 return *loc; |
| 81 } | 83 } |
| 82 | 84 |
| 83 | 85 |
| 84 Node* JSGraph::Constant(Handle<Object> value) { | 86 Node* JSGraph::Constant(Handle<Object> value) { |
| 85 // Dereference the handle to determine if a number constant or other | 87 // Dereference the handle to determine if a number constant or other |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 for (size_t i = 0; i < arraysize(cached_nodes_); i++) { | 202 for (size_t i = 0; i < arraysize(cached_nodes_); i++) { |
| 201 if (Node* node = cached_nodes_[i]) { | 203 if (Node* node = cached_nodes_[i]) { |
| 202 if (!node->IsDead()) nodes->push_back(node); | 204 if (!node->IsDead()) nodes->push_back(node); |
| 203 } | 205 } |
| 204 } | 206 } |
| 205 } | 207 } |
| 206 | 208 |
| 207 } // namespace compiler | 209 } // namespace compiler |
| 208 } // namespace internal | 210 } // namespace internal |
| 209 } // namespace v8 | 211 } // namespace v8 |
| OLD | NEW |