11cb0ef41Sopenharmony_ci// Copyright 2016 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_LOAD_ELIMINATION_H_
61cb0ef41Sopenharmony_ci#define V8_COMPILER_LOAD_ELIMINATION_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include "src/base/compiler-specific.h"
91cb0ef41Sopenharmony_ci#include "src/codegen/machine-type.h"
101cb0ef41Sopenharmony_ci#include "src/common/globals.h"
111cb0ef41Sopenharmony_ci#include "src/compiler/graph-reducer.h"
121cb0ef41Sopenharmony_ci#include "src/compiler/simplified-operator.h"
131cb0ef41Sopenharmony_ci#include "src/handles/maybe-handles.h"
141cb0ef41Sopenharmony_ci#include "src/zone/zone-handle-set.h"
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_cinamespace v8 {
171cb0ef41Sopenharmony_cinamespace internal {
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ci// Forward declarations.
201cb0ef41Sopenharmony_ciclass Factory;
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_cinamespace compiler {
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ci// Forward declarations.
251cb0ef41Sopenharmony_ciclass CommonOperatorBuilder;
261cb0ef41Sopenharmony_cistruct FieldAccess;
271cb0ef41Sopenharmony_ciclass Graph;
281cb0ef41Sopenharmony_ciclass JSGraph;
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ciclass V8_EXPORT_PRIVATE LoadElimination final
311cb0ef41Sopenharmony_ci    : public NON_EXPORTED_BASE(AdvancedReducer) {
321cb0ef41Sopenharmony_ci public:
331cb0ef41Sopenharmony_ci  LoadElimination(Editor* editor, JSGraph* jsgraph, Zone* zone)
341cb0ef41Sopenharmony_ci      : AdvancedReducer(editor), node_states_(zone), jsgraph_(jsgraph) {}
351cb0ef41Sopenharmony_ci  ~LoadElimination() final = default;
361cb0ef41Sopenharmony_ci  LoadElimination(const LoadElimination&) = delete;
371cb0ef41Sopenharmony_ci  LoadElimination& operator=(const LoadElimination&) = delete;
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_ci  const char* reducer_name() const override { return "LoadElimination"; }
401cb0ef41Sopenharmony_ci
411cb0ef41Sopenharmony_ci  Reduction Reduce(Node* node) final;
421cb0ef41Sopenharmony_ci
431cb0ef41Sopenharmony_ci private:
441cb0ef41Sopenharmony_ci  static const size_t kMaxTrackedElements = 8;
451cb0ef41Sopenharmony_ci
461cb0ef41Sopenharmony_ci  // Abstract state to approximate the current state of an element along the
471cb0ef41Sopenharmony_ci  // effect paths through the graph.
481cb0ef41Sopenharmony_ci  class AbstractElements final : public ZoneObject {
491cb0ef41Sopenharmony_ci   public:
501cb0ef41Sopenharmony_ci    explicit AbstractElements(Zone* zone) {
511cb0ef41Sopenharmony_ci      for (size_t i = 0; i < arraysize(elements_); ++i) {
521cb0ef41Sopenharmony_ci        elements_[i] = Element();
531cb0ef41Sopenharmony_ci      }
541cb0ef41Sopenharmony_ci    }
551cb0ef41Sopenharmony_ci    AbstractElements(Node* object, Node* index, Node* value,
561cb0ef41Sopenharmony_ci                     MachineRepresentation representation, Zone* zone)
571cb0ef41Sopenharmony_ci        : AbstractElements(zone) {
581cb0ef41Sopenharmony_ci      elements_[next_index_++] = Element(object, index, value, representation);
591cb0ef41Sopenharmony_ci    }
601cb0ef41Sopenharmony_ci
611cb0ef41Sopenharmony_ci    AbstractElements const* Extend(Node* object, Node* index, Node* value,
621cb0ef41Sopenharmony_ci                                   MachineRepresentation representation,
631cb0ef41Sopenharmony_ci                                   Zone* zone) const {
641cb0ef41Sopenharmony_ci      AbstractElements* that = zone->New<AbstractElements>(*this);
651cb0ef41Sopenharmony_ci      that->elements_[that->next_index_] =
661cb0ef41Sopenharmony_ci          Element(object, index, value, representation);
671cb0ef41Sopenharmony_ci      that->next_index_ = (that->next_index_ + 1) % arraysize(elements_);
681cb0ef41Sopenharmony_ci      return that;
691cb0ef41Sopenharmony_ci    }
701cb0ef41Sopenharmony_ci    Node* Lookup(Node* object, Node* index,
711cb0ef41Sopenharmony_ci                 MachineRepresentation representation) const;
721cb0ef41Sopenharmony_ci    AbstractElements const* Kill(Node* object, Node* index, Zone* zone) const;
731cb0ef41Sopenharmony_ci    bool Equals(AbstractElements const* that) const;
741cb0ef41Sopenharmony_ci    AbstractElements const* Merge(AbstractElements const* that,
751cb0ef41Sopenharmony_ci                                  Zone* zone) const;
761cb0ef41Sopenharmony_ci
771cb0ef41Sopenharmony_ci    void Print() const;
781cb0ef41Sopenharmony_ci
791cb0ef41Sopenharmony_ci   private:
801cb0ef41Sopenharmony_ci    struct Element {
811cb0ef41Sopenharmony_ci      Element() = default;
821cb0ef41Sopenharmony_ci      Element(Node* object, Node* index, Node* value,
831cb0ef41Sopenharmony_ci              MachineRepresentation representation)
841cb0ef41Sopenharmony_ci          : object(object),
851cb0ef41Sopenharmony_ci            index(index),
861cb0ef41Sopenharmony_ci            value(value),
871cb0ef41Sopenharmony_ci            representation(representation) {}
881cb0ef41Sopenharmony_ci
891cb0ef41Sopenharmony_ci      Node* object = nullptr;
901cb0ef41Sopenharmony_ci      Node* index = nullptr;
911cb0ef41Sopenharmony_ci      Node* value = nullptr;
921cb0ef41Sopenharmony_ci      MachineRepresentation representation = MachineRepresentation::kNone;
931cb0ef41Sopenharmony_ci    };
941cb0ef41Sopenharmony_ci
951cb0ef41Sopenharmony_ci    Element elements_[kMaxTrackedElements];
961cb0ef41Sopenharmony_ci    size_t next_index_ = 0;
971cb0ef41Sopenharmony_ci  };
981cb0ef41Sopenharmony_ci
991cb0ef41Sopenharmony_ci  // Information we use to resolve object aliasing. Currently, we consider
1001cb0ef41Sopenharmony_ci  // object not aliased if they have different maps or if the nodes may
1011cb0ef41Sopenharmony_ci  // not alias.
1021cb0ef41Sopenharmony_ci  class AliasStateInfo;
1031cb0ef41Sopenharmony_ci
1041cb0ef41Sopenharmony_ci  struct FieldInfo {
1051cb0ef41Sopenharmony_ci    FieldInfo() = default;
1061cb0ef41Sopenharmony_ci    FieldInfo(Node* value, MachineRepresentation representation,
1071cb0ef41Sopenharmony_ci              MaybeHandle<Name> name = {},
1081cb0ef41Sopenharmony_ci              ConstFieldInfo const_field_info = ConstFieldInfo::None())
1091cb0ef41Sopenharmony_ci        : value(value),
1101cb0ef41Sopenharmony_ci          representation(representation),
1111cb0ef41Sopenharmony_ci          name(name),
1121cb0ef41Sopenharmony_ci          const_field_info(const_field_info) {}
1131cb0ef41Sopenharmony_ci
1141cb0ef41Sopenharmony_ci    bool operator==(const FieldInfo& other) const {
1151cb0ef41Sopenharmony_ci      return value == other.value && representation == other.representation &&
1161cb0ef41Sopenharmony_ci             name.address() == other.name.address() &&
1171cb0ef41Sopenharmony_ci             const_field_info == other.const_field_info;
1181cb0ef41Sopenharmony_ci    }
1191cb0ef41Sopenharmony_ci    bool operator!=(const FieldInfo& other) const { return !(*this == other); }
1201cb0ef41Sopenharmony_ci
1211cb0ef41Sopenharmony_ci    Node* value = nullptr;
1221cb0ef41Sopenharmony_ci    MachineRepresentation representation = MachineRepresentation::kNone;
1231cb0ef41Sopenharmony_ci    MaybeHandle<Name> name;
1241cb0ef41Sopenharmony_ci    ConstFieldInfo const_field_info;
1251cb0ef41Sopenharmony_ci  };
1261cb0ef41Sopenharmony_ci
1271cb0ef41Sopenharmony_ci  // Abstract state to approximate the current state of a certain field along
1281cb0ef41Sopenharmony_ci  // the effect paths through the graph.
1291cb0ef41Sopenharmony_ci  class AbstractField final : public ZoneObject {
1301cb0ef41Sopenharmony_ci   public:
1311cb0ef41Sopenharmony_ci    explicit AbstractField(Zone* zone) : info_for_node_(zone) {}
1321cb0ef41Sopenharmony_ci    AbstractField(Node* object, FieldInfo info, Zone* zone)
1331cb0ef41Sopenharmony_ci        : info_for_node_(zone) {
1341cb0ef41Sopenharmony_ci      info_for_node_.insert(std::make_pair(object, info));
1351cb0ef41Sopenharmony_ci    }
1361cb0ef41Sopenharmony_ci
1371cb0ef41Sopenharmony_ci    AbstractField const* Extend(Node* object, FieldInfo info,
1381cb0ef41Sopenharmony_ci                                Zone* zone) const {
1391cb0ef41Sopenharmony_ci      AbstractField* that = zone->New<AbstractField>(zone);
1401cb0ef41Sopenharmony_ci      that->info_for_node_ = this->info_for_node_;
1411cb0ef41Sopenharmony_ci      that->info_for_node_[object] = info;
1421cb0ef41Sopenharmony_ci      return that;
1431cb0ef41Sopenharmony_ci    }
1441cb0ef41Sopenharmony_ci    FieldInfo const* Lookup(Node* object) const;
1451cb0ef41Sopenharmony_ci    AbstractField const* KillConst(Node* object, Zone* zone) const;
1461cb0ef41Sopenharmony_ci    AbstractField const* Kill(const AliasStateInfo& alias_info,
1471cb0ef41Sopenharmony_ci                              MaybeHandle<Name> name, Zone* zone) const;
1481cb0ef41Sopenharmony_ci    bool Equals(AbstractField const* that) const {
1491cb0ef41Sopenharmony_ci      return this == that || this->info_for_node_ == that->info_for_node_;
1501cb0ef41Sopenharmony_ci    }
1511cb0ef41Sopenharmony_ci    AbstractField const* Merge(AbstractField const* that, Zone* zone) const {
1521cb0ef41Sopenharmony_ci      if (this->Equals(that)) return this;
1531cb0ef41Sopenharmony_ci      AbstractField* copy = zone->New<AbstractField>(zone);
1541cb0ef41Sopenharmony_ci      for (auto this_it : this->info_for_node_) {
1551cb0ef41Sopenharmony_ci        Node* this_object = this_it.first;
1561cb0ef41Sopenharmony_ci        FieldInfo this_second = this_it.second;
1571cb0ef41Sopenharmony_ci        if (this_object->IsDead()) continue;
1581cb0ef41Sopenharmony_ci        auto that_it = that->info_for_node_.find(this_object);
1591cb0ef41Sopenharmony_ci        if (that_it != that->info_for_node_.end() &&
1601cb0ef41Sopenharmony_ci            that_it->second == this_second) {
1611cb0ef41Sopenharmony_ci          copy->info_for_node_.insert(this_it);
1621cb0ef41Sopenharmony_ci        }
1631cb0ef41Sopenharmony_ci      }
1641cb0ef41Sopenharmony_ci      return copy;
1651cb0ef41Sopenharmony_ci    }
1661cb0ef41Sopenharmony_ci
1671cb0ef41Sopenharmony_ci    void Print() const;
1681cb0ef41Sopenharmony_ci
1691cb0ef41Sopenharmony_ci   private:
1701cb0ef41Sopenharmony_ci    ZoneMap<Node*, FieldInfo> info_for_node_;
1711cb0ef41Sopenharmony_ci  };
1721cb0ef41Sopenharmony_ci
1731cb0ef41Sopenharmony_ci  static size_t const kMaxTrackedFields = 32;
1741cb0ef41Sopenharmony_ci
1751cb0ef41Sopenharmony_ci  // Abstract state to approximate the current map of an object along the
1761cb0ef41Sopenharmony_ci  // effect paths through the graph.
1771cb0ef41Sopenharmony_ci  class AbstractMaps final : public ZoneObject {
1781cb0ef41Sopenharmony_ci   public:
1791cb0ef41Sopenharmony_ci    explicit AbstractMaps(Zone* zone);
1801cb0ef41Sopenharmony_ci    AbstractMaps(Node* object, ZoneHandleSet<Map> maps, Zone* zone);
1811cb0ef41Sopenharmony_ci
1821cb0ef41Sopenharmony_ci    AbstractMaps const* Extend(Node* object, ZoneHandleSet<Map> maps,
1831cb0ef41Sopenharmony_ci                               Zone* zone) const;
1841cb0ef41Sopenharmony_ci    bool Lookup(Node* object, ZoneHandleSet<Map>* object_maps) const;
1851cb0ef41Sopenharmony_ci    AbstractMaps const* Kill(const AliasStateInfo& alias_info,
1861cb0ef41Sopenharmony_ci                             Zone* zone) const;
1871cb0ef41Sopenharmony_ci    bool Equals(AbstractMaps const* that) const {
1881cb0ef41Sopenharmony_ci      return this == that || this->info_for_node_ == that->info_for_node_;
1891cb0ef41Sopenharmony_ci    }
1901cb0ef41Sopenharmony_ci    AbstractMaps const* Merge(AbstractMaps const* that, Zone* zone) const;
1911cb0ef41Sopenharmony_ci
1921cb0ef41Sopenharmony_ci    void Print() const;
1931cb0ef41Sopenharmony_ci
1941cb0ef41Sopenharmony_ci   private:
1951cb0ef41Sopenharmony_ci    ZoneMap<Node*, ZoneHandleSet<Map>> info_for_node_;
1961cb0ef41Sopenharmony_ci  };
1971cb0ef41Sopenharmony_ci
1981cb0ef41Sopenharmony_ci  class IndexRange {
1991cb0ef41Sopenharmony_ci   public:
2001cb0ef41Sopenharmony_ci    IndexRange(int begin, int size) : begin_(begin), end_(begin + size) {
2011cb0ef41Sopenharmony_ci      DCHECK_LE(0, begin);
2021cb0ef41Sopenharmony_ci      DCHECK_LE(1, size);
2031cb0ef41Sopenharmony_ci      if (end_ > static_cast<int>(kMaxTrackedFields)) {
2041cb0ef41Sopenharmony_ci        *this = IndexRange::Invalid();
2051cb0ef41Sopenharmony_ci      }
2061cb0ef41Sopenharmony_ci    }
2071cb0ef41Sopenharmony_ci    static IndexRange Invalid() { return IndexRange(); }
2081cb0ef41Sopenharmony_ci
2091cb0ef41Sopenharmony_ci    bool operator==(const IndexRange& other) {
2101cb0ef41Sopenharmony_ci      return begin_ == other.begin_ && end_ == other.end_;
2111cb0ef41Sopenharmony_ci    }
2121cb0ef41Sopenharmony_ci    bool operator!=(const IndexRange& other) { return !(*this == other); }
2131cb0ef41Sopenharmony_ci
2141cb0ef41Sopenharmony_ci    struct Iterator {
2151cb0ef41Sopenharmony_ci      int i;
2161cb0ef41Sopenharmony_ci      int operator*() { return i; }
2171cb0ef41Sopenharmony_ci      void operator++() { ++i; }
2181cb0ef41Sopenharmony_ci      bool operator!=(Iterator other) { return i != other.i; }
2191cb0ef41Sopenharmony_ci    };
2201cb0ef41Sopenharmony_ci
2211cb0ef41Sopenharmony_ci    Iterator begin() { return {begin_}; }
2221cb0ef41Sopenharmony_ci    Iterator end() { return {end_}; }
2231cb0ef41Sopenharmony_ci
2241cb0ef41Sopenharmony_ci   private:
2251cb0ef41Sopenharmony_ci    int begin_;
2261cb0ef41Sopenharmony_ci    int end_;
2271cb0ef41Sopenharmony_ci
2281cb0ef41Sopenharmony_ci    IndexRange() : begin_(-1), end_(-1) {}
2291cb0ef41Sopenharmony_ci  };
2301cb0ef41Sopenharmony_ci
2311cb0ef41Sopenharmony_ci  class AbstractState final : public ZoneObject {
2321cb0ef41Sopenharmony_ci   public:
2331cb0ef41Sopenharmony_ci    bool Equals(AbstractState const* that) const;
2341cb0ef41Sopenharmony_ci    void Merge(AbstractState const* that, Zone* zone);
2351cb0ef41Sopenharmony_ci
2361cb0ef41Sopenharmony_ci    AbstractState const* SetMaps(Node* object, ZoneHandleSet<Map> maps,
2371cb0ef41Sopenharmony_ci                                 Zone* zone) const;
2381cb0ef41Sopenharmony_ci    AbstractState const* KillMaps(Node* object, Zone* zone) const;
2391cb0ef41Sopenharmony_ci    AbstractState const* KillMaps(const AliasStateInfo& alias_info,
2401cb0ef41Sopenharmony_ci                                  Zone* zone) const;
2411cb0ef41Sopenharmony_ci    bool LookupMaps(Node* object, ZoneHandleSet<Map>* object_maps) const;
2421cb0ef41Sopenharmony_ci
2431cb0ef41Sopenharmony_ci    AbstractState const* AddField(Node* object, IndexRange index,
2441cb0ef41Sopenharmony_ci                                  FieldInfo info, Zone* zone) const;
2451cb0ef41Sopenharmony_ci    AbstractState const* KillConstField(Node* object, IndexRange index_range,
2461cb0ef41Sopenharmony_ci                                        Zone* zone) const;
2471cb0ef41Sopenharmony_ci    AbstractState const* KillField(const AliasStateInfo& alias_info,
2481cb0ef41Sopenharmony_ci                                   IndexRange index, MaybeHandle<Name> name,
2491cb0ef41Sopenharmony_ci                                   Zone* zone) const;
2501cb0ef41Sopenharmony_ci    AbstractState const* KillField(Node* object, IndexRange index,
2511cb0ef41Sopenharmony_ci                                   MaybeHandle<Name> name, Zone* zone) const;
2521cb0ef41Sopenharmony_ci    AbstractState const* KillFields(Node* object, MaybeHandle<Name> name,
2531cb0ef41Sopenharmony_ci                                    Zone* zone) const;
2541cb0ef41Sopenharmony_ci    AbstractState const* KillAll(Zone* zone) const;
2551cb0ef41Sopenharmony_ci    FieldInfo const* LookupField(Node* object, IndexRange index,
2561cb0ef41Sopenharmony_ci                                 ConstFieldInfo const_field_info) const;
2571cb0ef41Sopenharmony_ci
2581cb0ef41Sopenharmony_ci    AbstractState const* AddElement(Node* object, Node* index, Node* value,
2591cb0ef41Sopenharmony_ci                                    MachineRepresentation representation,
2601cb0ef41Sopenharmony_ci                                    Zone* zone) const;
2611cb0ef41Sopenharmony_ci    AbstractState const* KillElement(Node* object, Node* index,
2621cb0ef41Sopenharmony_ci                                     Zone* zone) const;
2631cb0ef41Sopenharmony_ci    Node* LookupElement(Node* object, Node* index,
2641cb0ef41Sopenharmony_ci                        MachineRepresentation representation) const;
2651cb0ef41Sopenharmony_ci
2661cb0ef41Sopenharmony_ci    void Print() const;
2671cb0ef41Sopenharmony_ci
2681cb0ef41Sopenharmony_ci    static AbstractState const* empty_state() { return &empty_state_; }
2691cb0ef41Sopenharmony_ci
2701cb0ef41Sopenharmony_ci   private:
2711cb0ef41Sopenharmony_ci    static AbstractState const empty_state_;
2721cb0ef41Sopenharmony_ci
2731cb0ef41Sopenharmony_ci    using AbstractFields = std::array<AbstractField const*, kMaxTrackedFields>;
2741cb0ef41Sopenharmony_ci
2751cb0ef41Sopenharmony_ci    bool FieldsEquals(AbstractFields const& this_fields,
2761cb0ef41Sopenharmony_ci                      AbstractFields const& that_fields) const;
2771cb0ef41Sopenharmony_ci    void FieldsMerge(AbstractFields* this_fields,
2781cb0ef41Sopenharmony_ci                     AbstractFields const& that_fields, Zone* zone);
2791cb0ef41Sopenharmony_ci
2801cb0ef41Sopenharmony_ci    AbstractElements const* elements_ = nullptr;
2811cb0ef41Sopenharmony_ci    AbstractFields fields_{};
2821cb0ef41Sopenharmony_ci    AbstractFields const_fields_{};
2831cb0ef41Sopenharmony_ci    AbstractMaps const* maps_ = nullptr;
2841cb0ef41Sopenharmony_ci  };
2851cb0ef41Sopenharmony_ci
2861cb0ef41Sopenharmony_ci  class AbstractStateForEffectNodes final : public ZoneObject {
2871cb0ef41Sopenharmony_ci   public:
2881cb0ef41Sopenharmony_ci    explicit AbstractStateForEffectNodes(Zone* zone) : info_for_node_(zone) {}
2891cb0ef41Sopenharmony_ci    AbstractState const* Get(Node* node) const;
2901cb0ef41Sopenharmony_ci    void Set(Node* node, AbstractState const* state);
2911cb0ef41Sopenharmony_ci
2921cb0ef41Sopenharmony_ci    Zone* zone() const { return info_for_node_.get_allocator().zone(); }
2931cb0ef41Sopenharmony_ci
2941cb0ef41Sopenharmony_ci   private:
2951cb0ef41Sopenharmony_ci    ZoneVector<AbstractState const*> info_for_node_;
2961cb0ef41Sopenharmony_ci  };
2971cb0ef41Sopenharmony_ci
2981cb0ef41Sopenharmony_ci  Reduction ReduceCheckMaps(Node* node);
2991cb0ef41Sopenharmony_ci  Reduction ReduceCompareMaps(Node* node);
3001cb0ef41Sopenharmony_ci  Reduction ReduceMapGuard(Node* node);
3011cb0ef41Sopenharmony_ci  Reduction ReduceEnsureWritableFastElements(Node* node);
3021cb0ef41Sopenharmony_ci  Reduction ReduceMaybeGrowFastElements(Node* node);
3031cb0ef41Sopenharmony_ci  Reduction ReduceTransitionElementsKind(Node* node);
3041cb0ef41Sopenharmony_ci  Reduction ReduceLoadField(Node* node, FieldAccess const& access);
3051cb0ef41Sopenharmony_ci  Reduction ReduceStoreField(Node* node, FieldAccess const& access);
3061cb0ef41Sopenharmony_ci  Reduction ReduceLoadElement(Node* node);
3071cb0ef41Sopenharmony_ci  Reduction ReduceStoreElement(Node* node);
3081cb0ef41Sopenharmony_ci  Reduction ReduceTransitionAndStoreElement(Node* node);
3091cb0ef41Sopenharmony_ci  Reduction ReduceStoreTypedElement(Node* node);
3101cb0ef41Sopenharmony_ci  Reduction ReduceEffectPhi(Node* node);
3111cb0ef41Sopenharmony_ci  Reduction ReduceStart(Node* node);
3121cb0ef41Sopenharmony_ci  Reduction ReduceOtherNode(Node* node);
3131cb0ef41Sopenharmony_ci
3141cb0ef41Sopenharmony_ci  Reduction UpdateState(Node* node, AbstractState const* state);
3151cb0ef41Sopenharmony_ci
3161cb0ef41Sopenharmony_ci  AbstractState const* ComputeLoopState(Node* node,
3171cb0ef41Sopenharmony_ci                                        AbstractState const* state) const;
3181cb0ef41Sopenharmony_ci  AbstractState const* ComputeLoopStateForStoreField(
3191cb0ef41Sopenharmony_ci      Node* current, LoadElimination::AbstractState const* state,
3201cb0ef41Sopenharmony_ci      FieldAccess const& access) const;
3211cb0ef41Sopenharmony_ci  AbstractState const* UpdateStateForPhi(AbstractState const* state,
3221cb0ef41Sopenharmony_ci                                         Node* effect_phi, Node* phi);
3231cb0ef41Sopenharmony_ci
3241cb0ef41Sopenharmony_ci  static IndexRange FieldIndexOf(int offset, int representation_size);
3251cb0ef41Sopenharmony_ci  static IndexRange FieldIndexOf(FieldAccess const& access);
3261cb0ef41Sopenharmony_ci
3271cb0ef41Sopenharmony_ci  static AbstractState const* empty_state() {
3281cb0ef41Sopenharmony_ci    return AbstractState::empty_state();
3291cb0ef41Sopenharmony_ci  }
3301cb0ef41Sopenharmony_ci
3311cb0ef41Sopenharmony_ci  CommonOperatorBuilder* common() const;
3321cb0ef41Sopenharmony_ci  Isolate* isolate() const;
3331cb0ef41Sopenharmony_ci  Factory* factory() const;
3341cb0ef41Sopenharmony_ci  Graph* graph() const;
3351cb0ef41Sopenharmony_ci  JSGraph* jsgraph() const { return jsgraph_; }
3361cb0ef41Sopenharmony_ci  Zone* zone() const { return node_states_.zone(); }
3371cb0ef41Sopenharmony_ci
3381cb0ef41Sopenharmony_ci  AbstractStateForEffectNodes node_states_;
3391cb0ef41Sopenharmony_ci  JSGraph* const jsgraph_;
3401cb0ef41Sopenharmony_ci};
3411cb0ef41Sopenharmony_ci
3421cb0ef41Sopenharmony_ci}  // namespace compiler
3431cb0ef41Sopenharmony_ci}  // namespace internal
3441cb0ef41Sopenharmony_ci}  // namespace v8
3451cb0ef41Sopenharmony_ci
3461cb0ef41Sopenharmony_ci#endif  // V8_COMPILER_LOAD_ELIMINATION_H_
347