value-numbering-reducer.h 1.17 KB
Newer Older
1 2 3 4 5 6 7
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_COMPILER_VALUE_NUMBERING_REDUCER_H_
#define V8_COMPILER_VALUE_NUMBERING_REDUCER_H_

8
#include "src/base/compiler-specific.h"
9
#include "src/compiler/graph-reducer.h"
10
#include "src/globals.h"
11 12 13 14 15

namespace v8 {
namespace internal {
namespace compiler {

16 17
class V8_EXPORT_PRIVATE ValueNumberingReducer final
    : public NON_EXPORTED_BASE(Reducer) {
18
 public:
19
  explicit ValueNumberingReducer(Zone* temp_zone, Zone* graph_zone);
20 21
  ~ValueNumberingReducer();

22 23
  const char* reducer_name() const override { return "ValueNumberingReducer"; }

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 32
  Zone* temp_zone() const { return temp_zone_; }
  Zone* graph_zone() const { return graph_zone_; }
33

34 35 36
  Node** entries_;
  size_t capacity_;
  size_t size_;
37 38
  Zone* temp_zone_;
  Zone* graph_zone_;
39 40 41 42 43 44 45
};

}  // namespace compiler
}  // namespace internal
}  // namespace v8

#endif  // V8_COMPILER_VALUE_NUMBERING_REDUCER_H_