| 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-inl.h" | 7 #include "src/compiler/node-properties-inl.h" |
| 8 #include "src/compiler/typer.h" | 8 #include "src/compiler/typer.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 namespace compiler { | 12 namespace compiler { |
| 13 | 13 |
| 14 Node* JSGraph::ImmovableHeapConstant(Handle<HeapObject> object) { | 14 Node* JSGraph::ImmovableHeapConstant(Handle<HeapObject> object) { |
| 15 Unique<HeapObject> unique = Unique<HeapObject>::CreateImmovable(object); | 15 Unique<HeapObject> unique = Unique<HeapObject>::CreateImmovable(object); |
| 16 return graph()->NewNode(common()->HeapConstant(unique)); | 16 return graph()->NewNode(common()->HeapConstant(unique)); |
| 17 } | 17 } |
| 18 | 18 |
| 19 | 19 |
| 20 Node* JSGraph::CEntryStubConstant() { | |
| 21 if (!c_entry_stub_constant_.is_set()) { | |
| 22 c_entry_stub_constant_.set( | |
| 23 ImmovableHeapConstant(CEntryStub(isolate(), 1).GetCode())); | |
| 24 } | |
| 25 return c_entry_stub_constant_.get(); | |
| 26 } | |
| 27 | |
| 28 | |
| 29 Node* JSGraph::UndefinedConstant() { | 20 Node* JSGraph::UndefinedConstant() { |
| 30 if (!undefined_constant_.is_set()) { | 21 if (!undefined_constant_.is_set()) { |
| 31 undefined_constant_.set( | 22 undefined_constant_.set( |
| 32 ImmovableHeapConstant(factory()->undefined_value())); | 23 ImmovableHeapConstant(factory()->undefined_value())); |
| 33 } | 24 } |
| 34 return undefined_constant_.get(); | 25 return undefined_constant_.get(); |
| 35 } | 26 } |
| 36 | 27 |
| 37 | 28 |
| 38 Node* JSGraph::TheHoleConstant() { | 29 Node* JSGraph::TheHoleConstant() { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 Node** loc = cache_.FindExternalConstant(reference); | 179 Node** loc = cache_.FindExternalConstant(reference); |
| 189 if (*loc == NULL) { | 180 if (*loc == NULL) { |
| 190 *loc = graph()->NewNode(common()->ExternalConstant(reference)); | 181 *loc = graph()->NewNode(common()->ExternalConstant(reference)); |
| 191 } | 182 } |
| 192 return *loc; | 183 return *loc; |
| 193 } | 184 } |
| 194 | 185 |
| 195 | 186 |
| 196 void JSGraph::GetCachedNodes(NodeVector* nodes) { | 187 void JSGraph::GetCachedNodes(NodeVector* nodes) { |
| 197 cache_.GetCachedNodes(nodes); | 188 cache_.GetCachedNodes(nodes); |
| 198 SetOncePointer<Node>* ptrs[] = { | 189 SetOncePointer<Node>* ptrs[] = {&undefined_constant_, &the_hole_constant_, |
| 199 &c_entry_stub_constant_, &undefined_constant_, &the_hole_constant_, | 190 &true_constant_, &false_constant_, |
| 200 &true_constant_, &false_constant_, &null_constant_, | 191 &null_constant_, &zero_constant_, |
| 201 &zero_constant_, &one_constant_, &nan_constant_}; | 192 &one_constant_, &nan_constant_}; |
| 202 for (size_t i = 0; i < arraysize(ptrs); i++) { | 193 for (size_t i = 0; i < arraysize(ptrs); i++) { |
| 203 if (ptrs[i]->is_set()) nodes->push_back(ptrs[i]->get()); | 194 if (ptrs[i]->is_set()) nodes->push_back(ptrs[i]->get()); |
| 204 } | 195 } |
| 205 } | 196 } |
| 206 | 197 |
| 207 } // namespace compiler | 198 } // namespace compiler |
| 208 } // namespace internal | 199 } // namespace internal |
| 209 } // namespace v8 | 200 } // namespace v8 |
| OLD | NEW |