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