• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef V8_COMPILER_VALUE_NUMBERING_REDUCER_H_
6 #define V8_COMPILER_VALUE_NUMBERING_REDUCER_H_
7 
8 #include "src/base/compiler-specific.h"
9 #include "src/compiler/graph-reducer.h"
10 #include "src/globals.h"
11 
12 namespace v8 {
13 namespace internal {
14 namespace compiler {
15 
16 class V8_EXPORT_PRIVATE ValueNumberingReducer final
NON_EXPORTED_BASE(Reducer)17     : public NON_EXPORTED_BASE(Reducer) {
18  public:
19   explicit ValueNumberingReducer(Zone* temp_zone, Zone* graph_zone);
20   ~ValueNumberingReducer();
21 
22   const char* reducer_name() const override { return "ValueNumberingReducer"; }
23 
24   Reduction Reduce(Node* node) override;
25 
26  private:
27   enum { kInitialCapacity = 256u };
28 
29   Reduction ReplaceIfTypesMatch(Node* node, Node* replacement);
30   void Grow();
31   Zone* temp_zone() const { return temp_zone_; }
32   Zone* graph_zone() const { return graph_zone_; }
33 
34   Node** entries_;
35   size_t capacity_;
36   size_t size_;
37   Zone* temp_zone_;
38   Zone* graph_zone_;
39 };
40 
41 }  // namespace compiler
42 }  // namespace internal
43 }  // namespace v8
44 
45 #endif  // V8_COMPILER_VALUE_NUMBERING_REDUCER_H_
46