11cb0ef41Sopenharmony_ci// Copyright 2014 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_VALUE_NUMBERING_REDUCER_H_ 61cb0ef41Sopenharmony_ci#define V8_COMPILER_VALUE_NUMBERING_REDUCER_H_ 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci#include "src/base/compiler-specific.h" 91cb0ef41Sopenharmony_ci#include "src/common/globals.h" 101cb0ef41Sopenharmony_ci#include "src/compiler/graph-reducer.h" 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_cinamespace v8 { 131cb0ef41Sopenharmony_cinamespace internal { 141cb0ef41Sopenharmony_cinamespace compiler { 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ciclass V8_EXPORT_PRIVATE ValueNumberingReducer final 171cb0ef41Sopenharmony_ci : public NON_EXPORTED_BASE(Reducer) { 181cb0ef41Sopenharmony_ci public: 191cb0ef41Sopenharmony_ci explicit ValueNumberingReducer(Zone* temp_zone, Zone* graph_zone); 201cb0ef41Sopenharmony_ci ~ValueNumberingReducer() override; 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ci const char* reducer_name() const override { return "ValueNumberingReducer"; } 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ci Reduction Reduce(Node* node) override; 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_ci private: 271cb0ef41Sopenharmony_ci enum { kInitialCapacity = 256u }; 281cb0ef41Sopenharmony_ci 291cb0ef41Sopenharmony_ci Reduction ReplaceIfTypesMatch(Node* node, Node* replacement); 301cb0ef41Sopenharmony_ci void Grow(); 311cb0ef41Sopenharmony_ci Zone* temp_zone() const { return temp_zone_; } 321cb0ef41Sopenharmony_ci Zone* graph_zone() const { return graph_zone_; } 331cb0ef41Sopenharmony_ci 341cb0ef41Sopenharmony_ci Node** entries_; 351cb0ef41Sopenharmony_ci size_t capacity_; 361cb0ef41Sopenharmony_ci size_t size_; 371cb0ef41Sopenharmony_ci Zone* temp_zone_; 381cb0ef41Sopenharmony_ci Zone* graph_zone_; 391cb0ef41Sopenharmony_ci}; 401cb0ef41Sopenharmony_ci 411cb0ef41Sopenharmony_ci} // namespace compiler 421cb0ef41Sopenharmony_ci} // namespace internal 431cb0ef41Sopenharmony_ci} // namespace v8 441cb0ef41Sopenharmony_ci 451cb0ef41Sopenharmony_ci#endif // V8_COMPILER_VALUE_NUMBERING_REDUCER_H_ 46