| 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/compiler/change-lowering.h" | 5 #include "src/compiler/change-lowering.h" |
| 6 | 6 |
| 7 #include "src/compiler/common-node-cache.h" | 7 #include "src/compiler/common-node-cache.h" |
| 8 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 Node* ChangeLoweringBase::ExternalConstant(ExternalReference reference) { | 27 Node* ChangeLoweringBase::ExternalConstant(ExternalReference reference) { |
| 28 Node** loc = cache()->FindExternalConstant(reference); | 28 Node** loc = cache()->FindExternalConstant(reference); |
| 29 if (*loc == NULL) { | 29 if (*loc == NULL) { |
| 30 *loc = graph()->NewNode(common()->ExternalConstant(reference)); | 30 *loc = graph()->NewNode(common()->ExternalConstant(reference)); |
| 31 } | 31 } |
| 32 return *loc; | 32 return *loc; |
| 33 } | 33 } |
| 34 | 34 |
| 35 | 35 |
| 36 Node* ChangeLoweringBase::HeapConstant(PrintableUnique<HeapObject> value) { | 36 Node* ChangeLoweringBase::HeapConstant(PrintableUnique<HeapObject> value) { |
| 37 // TODO(bmeurer): Use common node cache. | 37 Node** loc = cache()->FindHeapConstant(value); |
| 38 return graph()->NewNode(common()->HeapConstant(value)); | 38 if (*loc == NULL) { |
| 39 *loc = graph()->NewNode(common()->HeapConstant(value)); |
| 40 } |
| 41 return *loc; |
| 39 } | 42 } |
| 40 | 43 |
| 41 | 44 |
| 42 Node* ChangeLoweringBase::ImmovableHeapConstant(Handle<HeapObject> value) { | 45 Node* ChangeLoweringBase::ImmovableHeapConstant(Handle<HeapObject> value) { |
| 43 return HeapConstant( | 46 return HeapConstant( |
| 44 PrintableUnique<HeapObject>::CreateImmovable(graph()->zone(), value)); | 47 PrintableUnique<HeapObject>::CreateImmovable(graph()->zone(), value)); |
| 45 } | 48 } |
| 46 | 49 |
| 47 | 50 |
| 48 Node* ChangeLoweringBase::Int32Constant(int32_t value) { | 51 Node* ChangeLoweringBase::Int32Constant(int32_t value) { |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 return Replace(phi); | 254 return Replace(phi); |
| 252 } | 255 } |
| 253 | 256 |
| 254 | 257 |
| 255 template class ChangeLowering<4>; | 258 template class ChangeLowering<4>; |
| 256 template class ChangeLowering<8>; | 259 template class ChangeLowering<8>; |
| 257 | 260 |
| 258 } // namespace compiler | 261 } // namespace compiler |
| 259 } // namespace internal | 262 } // namespace internal |
| 260 } // namespace v8 | 263 } // namespace v8 |
| OLD | NEW |