Home | History | Annotate | Download | only in compiler
      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
     17     : public NON_EXPORTED_BASE(Reducer) {
     18  public:
     19   explicit ValueNumberingReducer(Zone* temp_zone, Zone* graph_zone);
     20   ~ValueNumberingReducer();
     21 
     22   Reduction Reduce(Node* node) override;
     23 
     24  private:
     25   enum { kInitialCapacity = 256u };
     26 
     27   Reduction ReplaceIfTypesMatch(Node* node, Node* replacement);
     28   void Grow();
     29   Zone* temp_zone() const { return temp_zone_; }
     30   Zone* graph_zone() const { return graph_zone_; }
     31 
     32   Node** entries_;
     33   size_t capacity_;
     34   size_t size_;
     35   Zone* temp_zone_;
     36   Zone* graph_zone_;
     37 };
     38 
     39 }  // namespace compiler
     40 }  // namespace internal
     41 }  // namespace v8
     42 
     43 #endif  // V8_COMPILER_VALUE_NUMBERING_REDUCER_H_
     44