add-type-assertions-reducer.h 1.32 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
// Copyright 2019 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_ADD_TYPE_ASSERTIONS_REDUCER_H_
#define V8_COMPILER_ADD_TYPE_ASSERTIONS_REDUCER_H_

#include "src/common/globals.h"
#include "src/compiler/graph-reducer.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/node-aux-data.h"
#include "src/compiler/simplified-operator.h"

namespace v8 {
namespace internal {

namespace compiler {

class V8_EXPORT_PRIVATE AddTypeAssertionsReducer final
    : public NON_EXPORTED_BASE(AdvancedReducer) {
 public:
  AddTypeAssertionsReducer(Editor* editor, JSGraph* jsgraph, Zone* zone);
  ~AddTypeAssertionsReducer() final;

25 26 27
  AddTypeAssertionsReducer(const AddTypeAssertionsReducer&) = delete;
  AddTypeAssertionsReducer& operator=(const AddTypeAssertionsReducer&) = delete;

28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
  const char* reducer_name() const override {
    return "AddTypeAssertionsReducer";
  }

  Reduction Reduce(Node* node) final;

 private:
  JSGraph* const jsgraph_;
  NodeAuxData<bool> visited_;

  Graph* graph() { return jsgraph_->graph(); }
  SimplifiedOperatorBuilder* simplified() { return jsgraph_->simplified(); }
};

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

#endif  // V8_COMPILER_ADD_TYPE_ASSERTIONS_REDUCER_H_