11cb0ef41Sopenharmony_ci// Copyright 2018 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#ifndef V8_COMPILER_CONSTANT_FOLDING_REDUCER_H_
61cb0ef41Sopenharmony_ci#define V8_COMPILER_CONSTANT_FOLDING_REDUCER_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include "src/compiler/graph-reducer.h"
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_cinamespace v8 {
111cb0ef41Sopenharmony_cinamespace internal {
121cb0ef41Sopenharmony_cinamespace compiler {
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci// Forward declarations.
151cb0ef41Sopenharmony_ciclass JSGraph;
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ciclass V8_EXPORT_PRIVATE ConstantFoldingReducer final
181cb0ef41Sopenharmony_ci    : public NON_EXPORTED_BASE(AdvancedReducer) {
191cb0ef41Sopenharmony_ci public:
201cb0ef41Sopenharmony_ci  ConstantFoldingReducer(Editor* editor, JSGraph* jsgraph,
211cb0ef41Sopenharmony_ci                         JSHeapBroker* broker);
221cb0ef41Sopenharmony_ci  ~ConstantFoldingReducer() final;
231cb0ef41Sopenharmony_ci  ConstantFoldingReducer(const ConstantFoldingReducer&) = delete;
241cb0ef41Sopenharmony_ci  ConstantFoldingReducer& operator=(const ConstantFoldingReducer&) = delete;
251cb0ef41Sopenharmony_ci
261cb0ef41Sopenharmony_ci  const char* reducer_name() const override { return "ConstantFoldingReducer"; }
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_ci  Reduction Reduce(Node* node) final;
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci private:
311cb0ef41Sopenharmony_ci  JSGraph* jsgraph() const { return jsgraph_; }
321cb0ef41Sopenharmony_ci  JSHeapBroker* broker() const { return broker_; }
331cb0ef41Sopenharmony_ci
341cb0ef41Sopenharmony_ci  JSGraph* const jsgraph_;
351cb0ef41Sopenharmony_ci  JSHeapBroker* const broker_;
361cb0ef41Sopenharmony_ci};
371cb0ef41Sopenharmony_ci
381cb0ef41Sopenharmony_ci}  // namespace compiler
391cb0ef41Sopenharmony_ci}  // namespace internal
401cb0ef41Sopenharmony_ci}  // namespace v8
411cb0ef41Sopenharmony_ci
421cb0ef41Sopenharmony_ci#endif  // V8_COMPILER_CONSTANT_FOLDING_REDUCER_H_
43