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, 23 JSHeapBroker* js_heap_broker); 24 ~TypeNarrowingReducer() final; 25 26 const char* reducer_name() const override { return "TypeNarrowingReducer"; } 27 28 Reduction Reduce(Node* node) final; 29 30 private: 31 JSGraph* jsgraph() const { return jsgraph_; } 32 Graph* graph() const; 33 Zone* zone() const; 34 35 JSGraph* const jsgraph_; 36 OperationTyper op_typer_; 37 38 DISALLOW_COPY_AND_ASSIGN(TypeNarrowingReducer); 39 }; 40 41 } // namespace compiler 42 } // namespace internal 43 } // namespace v8 44 45 #endif // V8_COMPILER_TYPE_NARROWING_REDUCER_H_ 46