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