| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 113 } |
| 114 | 114 |
| 115 | 115 |
| 116 Node* JSGraph::Constant(Handle<Object> value) { | 116 Node* JSGraph::Constant(Handle<Object> value) { |
| 117 // Dereference the handle to determine if a number constant or other | 117 // Dereference the handle to determine if a number constant or other |
| 118 // canonicalized node can be used. | 118 // canonicalized node can be used. |
| 119 if (value->IsNumber()) { | 119 if (value->IsNumber()) { |
| 120 return Constant(value->Number()); | 120 return Constant(value->Number()); |
| 121 } else if (value->IsUndefined(isolate())) { | 121 } else if (value->IsUndefined(isolate())) { |
| 122 return UndefinedConstant(); | 122 return UndefinedConstant(); |
| 123 } else if (value->IsTrue()) { | 123 } else if (value->IsTrue(isolate())) { |
| 124 return TrueConstant(); | 124 return TrueConstant(); |
| 125 } else if (value->IsFalse()) { | 125 } else if (value->IsFalse(isolate())) { |
| 126 return FalseConstant(); | 126 return FalseConstant(); |
| 127 } else if (value->IsNull()) { | 127 } else if (value->IsNull(isolate())) { |
| 128 return NullConstant(); | 128 return NullConstant(); |
| 129 } else if (value->IsTheHole(isolate())) { | 129 } else if (value->IsTheHole(isolate())) { |
| 130 return TheHoleConstant(); | 130 return TheHoleConstant(); |
| 131 } else { | 131 } else { |
| 132 return HeapConstant(Handle<HeapObject>::cast(value)); | 132 return HeapConstant(Handle<HeapObject>::cast(value)); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 | 136 |
| 137 Node* JSGraph::Constant(double value) { | 137 Node* JSGraph::Constant(double value) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 for (size_t i = 0; i < arraysize(cached_nodes_); i++) { | 244 for (size_t i = 0; i < arraysize(cached_nodes_); i++) { |
| 245 if (Node* node = cached_nodes_[i]) { | 245 if (Node* node = cached_nodes_[i]) { |
| 246 if (!node->IsDead()) nodes->push_back(node); | 246 if (!node->IsDead()) nodes->push_back(node); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace compiler | 251 } // namespace compiler |
| 252 } // namespace internal | 252 } // namespace internal |
| 253 } // namespace v8 | 253 } // namespace v8 |
| OLD | NEW |