1// Copyright 2018 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_TYPE_NARROWING_REDUCER_H_
6#define V8_COMPILER_TYPE_NARROWING_REDUCER_H_
7
8#include "src/base/compiler-specific.h"
9#include "src/compiler/graph-reducer.h"
10#include "src/compiler/operation-typer.h"
11
12namespace v8 {
13namespace internal {
14namespace compiler {
15
16// Forward declarations.
17class JSGraph;
18
19class V8_EXPORT_PRIVATE TypeNarrowingReducer final
20 : public NON_EXPORTED_BASE(AdvancedReducer) {
21 public:
22 TypeNarrowingReducer(Editor* editor, JSGraph* jsgraph, JSHeapBroker* broker);
23 ~TypeNarrowingReducer() final;
24
25 const char* reducer_name() const override { return "TypeNarrowingReducer"; }
26
27 Reduction Reduce(Node* node) final;
28
29 private:
30 JSGraph* jsgraph() const { return jsgraph_; }
31 Graph* graph() const;
32 Zone* zone() const;
33
34 JSGraph* const jsgraph_;
35 OperationTyper op_typer_;
36
37 DISALLOW_COPY_AND_ASSIGN(TypeNarrowingReducer);
38};
39
40} // namespace compiler
41} // namespace internal
42} // namespace v8
43
44#endif // V8_COMPILER_TYPE_NARROWING_REDUCER_H_
45