| 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 #ifndef V8_COMPILER_COMMON_NODE_CACHE_H_ | 5 #ifndef V8_COMPILER_COMMON_NODE_CACHE_H_ |
| 6 #define V8_COMPILER_COMMON_NODE_CACHE_H_ | 6 #define V8_COMPILER_COMMON_NODE_CACHE_H_ |
| 7 | 7 |
| 8 #include "src/compiler/node-cache.h" | 8 #include "src/compiler/node-cache.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 return float32_constants_.Find(zone(), bit_cast<int32_t>(value)); | 38 return float32_constants_.Find(zone(), bit_cast<int32_t>(value)); |
| 39 } | 39 } |
| 40 | 40 |
| 41 Node** FindFloat64Constant(double value) { | 41 Node** FindFloat64Constant(double value) { |
| 42 // We canonicalize double constants at the bit representation level. | 42 // We canonicalize double constants at the bit representation level. |
| 43 return float64_constants_.Find(zone(), bit_cast<int64_t>(value)); | 43 return float64_constants_.Find(zone(), bit_cast<int64_t>(value)); |
| 44 } | 44 } |
| 45 | 45 |
| 46 Node** FindExternalConstant(ExternalReference value); | 46 Node** FindExternalConstant(ExternalReference value); |
| 47 | 47 |
| 48 Node** FindPointerConstant(intptr_t value) { |
| 49 return pointer_constants_.Find(zone(), value); |
| 50 } |
| 51 |
| 48 Node** FindNumberConstant(double value) { | 52 Node** FindNumberConstant(double value) { |
| 49 // We canonicalize double constants at the bit representation level. | 53 // We canonicalize double constants at the bit representation level. |
| 50 return number_constants_.Find(zone(), bit_cast<int64_t>(value)); | 54 return number_constants_.Find(zone(), bit_cast<int64_t>(value)); |
| 51 } | 55 } |
| 52 | 56 |
| 53 Node** FindHeapConstant(Handle<HeapObject> value); | 57 Node** FindHeapConstant(Handle<HeapObject> value); |
| 54 | 58 |
| 55 Node** FindRelocatableInt32Constant(int32_t value, RelocInfoMode rmode) { | 59 Node** FindRelocatableInt32Constant(int32_t value, RelocInfoMode rmode) { |
| 56 return relocatable_int32_constants_.Find(zone(), | 60 return relocatable_int32_constants_.Find(zone(), |
| 57 std::make_pair(value, rmode)); | 61 std::make_pair(value, rmode)); |
| 58 } | 62 } |
| 59 | 63 |
| 60 Node** FindRelocatableInt64Constant(int64_t value, RelocInfoMode rmode) { | 64 Node** FindRelocatableInt64Constant(int64_t value, RelocInfoMode rmode) { |
| 61 return relocatable_int64_constants_.Find(zone(), | 65 return relocatable_int64_constants_.Find(zone(), |
| 62 std::make_pair(value, rmode)); | 66 std::make_pair(value, rmode)); |
| 63 } | 67 } |
| 64 | 68 |
| 65 // Return all nodes from the cache. | 69 // Return all nodes from the cache. |
| 66 void GetCachedNodes(ZoneVector<Node*>* nodes); | 70 void GetCachedNodes(ZoneVector<Node*>* nodes); |
| 67 | 71 |
| 68 Zone* zone() const { return zone_; } | 72 Zone* zone() const { return zone_; } |
| 69 | 73 |
| 70 private: | 74 private: |
| 71 Int32NodeCache int32_constants_; | 75 Int32NodeCache int32_constants_; |
| 72 Int64NodeCache int64_constants_; | 76 Int64NodeCache int64_constants_; |
| 73 Int32NodeCache float32_constants_; | 77 Int32NodeCache float32_constants_; |
| 74 Int64NodeCache float64_constants_; | 78 Int64NodeCache float64_constants_; |
| 75 IntPtrNodeCache external_constants_; | 79 IntPtrNodeCache external_constants_; |
| 80 IntPtrNodeCache pointer_constants_; |
| 76 Int64NodeCache number_constants_; | 81 Int64NodeCache number_constants_; |
| 77 IntPtrNodeCache heap_constants_; | 82 IntPtrNodeCache heap_constants_; |
| 78 RelocInt32NodeCache relocatable_int32_constants_; | 83 RelocInt32NodeCache relocatable_int32_constants_; |
| 79 RelocInt64NodeCache relocatable_int64_constants_; | 84 RelocInt64NodeCache relocatable_int64_constants_; |
| 80 Zone* const zone_; | 85 Zone* const zone_; |
| 81 | 86 |
| 82 DISALLOW_COPY_AND_ASSIGN(CommonNodeCache); | 87 DISALLOW_COPY_AND_ASSIGN(CommonNodeCache); |
| 83 }; | 88 }; |
| 84 | 89 |
| 85 } // namespace compiler | 90 } // namespace compiler |
| 86 } // namespace internal | 91 } // namespace internal |
| 87 } // namespace v8 | 92 } // namespace v8 |
| 88 | 93 |
| 89 #endif // V8_COMPILER_COMMON_NODE_CACHE_H_ | 94 #endif // V8_COMPILER_COMMON_NODE_CACHE_H_ |
| OLD | NEW |