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-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() { | 20 Node* JSGraph::CEntryStubConstant(int result_size) { |
| 21 if (!c_entry_stub_constant_.is_set()) { | 21 if (result_size == 1) { |
| 22 c_entry_stub_constant_.set( | 22 if (!c_entry_stub_constant_.is_set()) { |
| 23 ImmovableHeapConstant(CEntryStub(isolate(), 1).GetCode())); | 23 c_entry_stub_constant_.set( |
| 24 ImmovableHeapConstant(CEntryStub(isolate(), 1).GetCode())); | |
| 25 } | |
| 26 return c_entry_stub_constant_.get(); | |
| 24 } | 27 } |
| 25 return c_entry_stub_constant_.get(); | 28 |
| 29 DCHECK(result_size == 2); | |
|
titzer
2014/11/07 14:53:06
Any risk in just passing the result_size through t
mvstanton
2014/11/07 15:00:00
Done.
| |
| 30 return ImmovableHeapConstant(CEntryStub(isolate(), 2).GetCode()); | |
| 26 } | 31 } |
| 27 | 32 |
| 28 | 33 |
| 29 Node* JSGraph::UndefinedConstant() { | 34 Node* JSGraph::UndefinedConstant() { |
| 30 if (!undefined_constant_.is_set()) { | 35 if (!undefined_constant_.is_set()) { |
| 31 undefined_constant_.set( | 36 undefined_constant_.set( |
| 32 ImmovableHeapConstant(factory()->undefined_value())); | 37 ImmovableHeapConstant(factory()->undefined_value())); |
| 33 } | 38 } |
| 34 return undefined_constant_.get(); | 39 return undefined_constant_.get(); |
| 35 } | 40 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 &true_constant_, &false_constant_, &null_constant_, | 205 &true_constant_, &false_constant_, &null_constant_, |
| 201 &zero_constant_, &one_constant_, &nan_constant_}; | 206 &zero_constant_, &one_constant_, &nan_constant_}; |
| 202 for (size_t i = 0; i < arraysize(ptrs); i++) { | 207 for (size_t i = 0; i < arraysize(ptrs); i++) { |
| 203 if (ptrs[i]->is_set()) nodes->push_back(ptrs[i]->get()); | 208 if (ptrs[i]->is_set()) nodes->push_back(ptrs[i]->get()); |
| 204 } | 209 } |
| 205 } | 210 } |
| 206 | 211 |
| 207 } // namespace compiler | 212 } // namespace compiler |
| 208 } // namespace internal | 213 } // namespace internal |
| 209 } // namespace v8 | 214 } // namespace v8 |
| OLD | NEW |