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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 106 } |
107 return *loc; | 107 return *loc; |
108 } | 108 } |
109 | 109 |
110 | 110 |
111 Node* JSGraph::Constant(Handle<Object> value) { | 111 Node* JSGraph::Constant(Handle<Object> value) { |
112 // Dereference the handle to determine if a number constant or other | 112 // Dereference the handle to determine if a number constant or other |
113 // canonicalized node can be used. | 113 // canonicalized node can be used. |
114 if (value->IsNumber()) { | 114 if (value->IsNumber()) { |
115 return Constant(value->Number()); | 115 return Constant(value->Number()); |
116 } else if (value->IsUndefined()) { | 116 } else if (value->IsUndefined(isolate())) { |
117 return UndefinedConstant(); | 117 return UndefinedConstant(); |
118 } else if (value->IsTrue()) { | 118 } else if (value->IsTrue()) { |
119 return TrueConstant(); | 119 return TrueConstant(); |
120 } else if (value->IsFalse()) { | 120 } else if (value->IsFalse()) { |
121 return FalseConstant(); | 121 return FalseConstant(); |
122 } else if (value->IsNull()) { | 122 } else if (value->IsNull()) { |
123 return NullConstant(); | 123 return NullConstant(); |
124 } else if (value->IsTheHole()) { | 124 } else if (value->IsTheHole(isolate())) { |
125 return TheHoleConstant(); | 125 return TheHoleConstant(); |
126 } else { | 126 } else { |
127 return HeapConstant(Handle<HeapObject>::cast(value)); | 127 return HeapConstant(Handle<HeapObject>::cast(value)); |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 | 131 |
132 Node* JSGraph::Constant(double value) { | 132 Node* JSGraph::Constant(double value) { |
133 if (bit_cast<int64_t>(value) == bit_cast<int64_t>(0.0)) return ZeroConstant(); | 133 if (bit_cast<int64_t>(value) == bit_cast<int64_t>(0.0)) return ZeroConstant(); |
134 if (bit_cast<int64_t>(value) == bit_cast<int64_t>(1.0)) return OneConstant(); | 134 if (bit_cast<int64_t>(value) == bit_cast<int64_t>(1.0)) return OneConstant(); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 for (size_t i = 0; i < arraysize(cached_nodes_); i++) { | 237 for (size_t i = 0; i < arraysize(cached_nodes_); i++) { |
238 if (Node* node = cached_nodes_[i]) { | 238 if (Node* node = cached_nodes_[i]) { |
239 if (!node->IsDead()) nodes->push_back(node); | 239 if (!node->IsDead()) nodes->push_back(node); |
240 } | 240 } |
241 } | 241 } |
242 } | 242 } |
243 | 243 |
244 } // namespace compiler | 244 } // namespace compiler |
245 } // namespace internal | 245 } // namespace internal |
246 } // namespace v8 | 246 } // namespace v8 |
OLD | NEW |