Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/compiler/common-node-cache.h

Issue 822923002: [turbofan] Cache float32 constants on the JSGraph level. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « BUILD.gn ('k') | src/compiler/common-node-cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/assembler.h"
9 #include "src/compiler/node-cache.h" 8 #include "src/compiler/node-cache.h"
10 9
11 namespace v8 { 10 namespace v8 {
12 namespace internal { 11 namespace internal {
12
13 // Forward declarations.
14 class ExternalReference;
15
16
13 namespace compiler { 17 namespace compiler {
14 18
15 // Bundles various caches for common nodes. 19 // Bundles various caches for common nodes.
16 class CommonNodeCache FINAL : public ZoneObject { 20 class CommonNodeCache FINAL {
17 public: 21 public:
18 explicit CommonNodeCache(Zone* zone) : zone_(zone) {} 22 explicit CommonNodeCache(Zone* zone) : zone_(zone) {}
23 ~CommonNodeCache() {}
19 24
20 Node** FindInt32Constant(int32_t value) { 25 Node** FindInt32Constant(int32_t value) {
21 return int32_constants_.Find(zone_, value); 26 return int32_constants_.Find(zone(), value);
22 } 27 }
23 28
24 Node** FindInt64Constant(int64_t value) { 29 Node** FindInt64Constant(int64_t value) {
25 return int64_constants_.Find(zone_, value); 30 return int64_constants_.Find(zone(), value);
31 }
32
33 Node** FindFloat32Constant(float value) {
34 // We canonicalize float constants at the bit representation level.
35 return float32_constants_.Find(zone(), bit_cast<int32_t>(value));
26 } 36 }
27 37
28 Node** FindFloat64Constant(double value) { 38 Node** FindFloat64Constant(double value) {
29 // We canonicalize double constants at the bit representation level. 39 // We canonicalize double constants at the bit representation level.
30 return float64_constants_.Find(zone_, bit_cast<int64_t>(value)); 40 return float64_constants_.Find(zone(), bit_cast<int64_t>(value));
31 } 41 }
32 42
33 Node** FindExternalConstant(ExternalReference reference) { 43 Node** FindExternalConstant(ExternalReference value);
34 return external_constants_.Find(zone_, reference.address());
35 }
36 44
37 Node** FindNumberConstant(double value) { 45 Node** FindNumberConstant(double value) {
38 // We canonicalize double constants at the bit representation level. 46 // We canonicalize double constants at the bit representation level.
39 return number_constants_.Find(zone_, bit_cast<int64_t>(value)); 47 return number_constants_.Find(zone(), bit_cast<int64_t>(value));
40 } 48 }
41 49
50 // Return all nodes from the cache.
51 void GetCachedNodes(ZoneVector<Node*>* nodes);
52
42 Zone* zone() const { return zone_; } 53 Zone* zone() const { return zone_; }
43 54
44 void GetCachedNodes(NodeVector* nodes) {
45 int32_constants_.GetCachedNodes(nodes);
46 int64_constants_.GetCachedNodes(nodes);
47 float64_constants_.GetCachedNodes(nodes);
48 external_constants_.GetCachedNodes(nodes);
49 number_constants_.GetCachedNodes(nodes);
50 }
51
52 private: 55 private:
53 Int32NodeCache int32_constants_; 56 Int32NodeCache int32_constants_;
54 Int64NodeCache int64_constants_; 57 Int64NodeCache int64_constants_;
58 Int32NodeCache float32_constants_;
55 Int64NodeCache float64_constants_; 59 Int64NodeCache float64_constants_;
56 PtrNodeCache external_constants_; 60 IntPtrNodeCache external_constants_;
57 Int64NodeCache number_constants_; 61 Int64NodeCache number_constants_;
58 Zone* zone_; 62 Zone* zone_;
63
64 DISALLOW_COPY_AND_ASSIGN(CommonNodeCache);
59 }; 65 };
60 66
61 } // namespace compiler 67 } // namespace compiler
62 } // namespace internal 68 } // namespace internal
63 } // namespace v8 69 } // namespace v8
64 70
65 #endif // V8_COMPILER_COMMON_NODE_CACHE_H_ 71 #endif // V8_COMPILER_COMMON_NODE_CACHE_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/compiler/common-node-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698