| 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 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 | 12 |
| 13 // Forward declarations. | 13 // Forward declarations. |
| 14 class ExternalReference; | 14 class ExternalReference; |
| 15 class HeapObject; |
| 16 template <typename> |
| 17 class Handle; |
| 15 | 18 |
| 16 | 19 |
| 17 namespace compiler { | 20 namespace compiler { |
| 18 | 21 |
| 19 // Bundles various caches for common nodes. | 22 // Bundles various caches for common nodes. |
| 20 class CommonNodeCache final { | 23 class CommonNodeCache final { |
| 21 public: | 24 public: |
| 22 explicit CommonNodeCache(Zone* zone) : zone_(zone) {} | 25 explicit CommonNodeCache(Zone* zone) : zone_(zone) {} |
| 23 ~CommonNodeCache() {} | 26 ~CommonNodeCache() {} |
| 24 | 27 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 40 return float64_constants_.Find(zone(), bit_cast<int64_t>(value)); | 43 return float64_constants_.Find(zone(), bit_cast<int64_t>(value)); |
| 41 } | 44 } |
| 42 | 45 |
| 43 Node** FindExternalConstant(ExternalReference value); | 46 Node** FindExternalConstant(ExternalReference value); |
| 44 | 47 |
| 45 Node** FindNumberConstant(double value) { | 48 Node** FindNumberConstant(double value) { |
| 46 // We canonicalize double constants at the bit representation level. | 49 // We canonicalize double constants at the bit representation level. |
| 47 return number_constants_.Find(zone(), bit_cast<int64_t>(value)); | 50 return number_constants_.Find(zone(), bit_cast<int64_t>(value)); |
| 48 } | 51 } |
| 49 | 52 |
| 53 Node** FindHeapConstant(Handle<HeapObject> value); |
| 54 |
| 50 // Return all nodes from the cache. | 55 // Return all nodes from the cache. |
| 51 void GetCachedNodes(ZoneVector<Node*>* nodes); | 56 void GetCachedNodes(ZoneVector<Node*>* nodes); |
| 52 | 57 |
| 53 Zone* zone() const { return zone_; } | 58 Zone* zone() const { return zone_; } |
| 54 | 59 |
| 55 private: | 60 private: |
| 56 Int32NodeCache int32_constants_; | 61 Int32NodeCache int32_constants_; |
| 57 Int64NodeCache int64_constants_; | 62 Int64NodeCache int64_constants_; |
| 58 Int32NodeCache float32_constants_; | 63 Int32NodeCache float32_constants_; |
| 59 Int64NodeCache float64_constants_; | 64 Int64NodeCache float64_constants_; |
| 60 IntPtrNodeCache external_constants_; | 65 IntPtrNodeCache external_constants_; |
| 61 Int64NodeCache number_constants_; | 66 Int64NodeCache number_constants_; |
| 62 Zone* zone_; | 67 IntPtrNodeCache heap_constants_; |
| 68 Zone* const zone_; |
| 63 | 69 |
| 64 DISALLOW_COPY_AND_ASSIGN(CommonNodeCache); | 70 DISALLOW_COPY_AND_ASSIGN(CommonNodeCache); |
| 65 }; | 71 }; |
| 66 | 72 |
| 67 } // namespace compiler | 73 } // namespace compiler |
| 68 } // namespace internal | 74 } // namespace internal |
| 69 } // namespace v8 | 75 } // namespace v8 |
| 70 | 76 |
| 71 #endif // V8_COMPILER_COMMON_NODE_CACHE_H_ | 77 #endif // V8_COMPILER_COMMON_NODE_CACHE_H_ |
| OLD | NEW |