5#ifndef V8_COMPILER_LOAD_ELIMINATION_H_
6#define V8_COMPILER_LOAD_ELIMINATION_H_
24class CommonOperatorBuilder;
42 const
char* reducer_name()
const override {
return "LoadElimination"; }
47 static const size_t kMaxTrackedElements = 8;
69 Element(
object, index, value, representation);
90 representation(representation) {}
99 size_t next_index_ = 0;
113 representation(representation),
115 const_field_info(const_field_info) {}
118 return value == other.value && representation == other.representation &&
119 name.address() == other.name.address() &&
120 const_field_info == other.const_field_info;
136 : info_for_node_(zone) {
137 info_for_node_.insert(std::make_pair(
object, info));
141 int current_field_count)
const {
143 if ((current_field_count >= kMaxTrackedFields &&
144 that->info_for_node_.size() > 0) ||
145 that->info_for_node_.size() >= kMaxTrackedObjects) {
148 that->info_for_node_.erase(that->info_for_node_.begin());
158 return this == that || this->info_for_node_ == that->info_for_node_;
162 if (this->Equals(that))
return this;
164 for (
auto this_it : this->info_for_node_) {
165 Node* this_object = this_it.first;
167 if (this_object->
IsDead())
continue;
168 auto that_it = that->info_for_node_.find(this_object);
169 if (that_it != that->info_for_node_.end() &&
170 that_it->second == this_second) {
180 int count()
const {
return static_cast<int>(info_for_node_.size()); }
186 static size_t const kMaxTrackedFieldsPerObject = 32;
187 static size_t const kMaxTrackedObjects = 100;
188 static int const kMaxTrackedFields = 300;
203 return this == that || this->info_for_node_ == that->info_for_node_;
218 if (
end_ >
static_cast<int>(kMaxTrackedFieldsPerObject)) {
219 *
this = IndexRange::Invalid();
225 return begin_ == other.begin_ &&
end_ == other.end_;
289 std::array<AbstractField const*, kMaxTrackedFieldsPerObject>;
300 int const_fields_count_ = 0;
304 int fields_count_ = 0;
313 Zone*
zone()
const {
return info_for_node_.zone(); }
325 Reduction ReduceTransitionElementsKindOrCheckMap(
Node* node);
350 return AbstractState::empty_state();
AbstractElements(Node *object, Node *index, Node *value, MachineRepresentation representation, Zone *zone)
AbstractElements(Zone *zone)
Element elements_[kMaxTrackedElements]
AbstractElements const * Extend(Node *object, Node *index, Node *value, MachineRepresentation representation, Zone *zone) const
AbstractField(Node *object, FieldInfo info, Zone *zone)
ZoneMap< Node *, FieldInfo > info_for_node_
bool Equals(AbstractField const *that) const
AbstractField const * Merge(AbstractField const *that, Zone *zone, int *count) const
AbstractField const * Extend(Node *object, FieldInfo info, Zone *zone, int current_field_count) const
AbstractField(Zone *zone)
bool Equals(AbstractMaps const *that) const
ZoneMap< Node *, ZoneRefSet< Map > > info_for_node_
ZoneVector< AbstractState const * > info_for_node_
AbstractStateForEffectNodes(Zone *zone)
std::array< AbstractField const *, kMaxTrackedFieldsPerObject > AbstractFields
static AbstractState const empty_state_
static AbstractState const * empty_state()
static IndexRange Invalid()
IndexRange(int begin, int size)
bool operator==(const IndexRange &other) const
bool operator!=(const IndexRange &other) const
JSGraph * jsgraph() const
AbstractStateForEffectNodes node_states_
~LoadElimination() final=default
JSHeapBroker * broker() const
LoadElimination(Editor *editor, JSHeapBroker *broker, JSGraph *jsgraph, Zone *zone)
static AbstractState const * empty_state()
JSHeapBroker *const broker_
const v8::base::TimeTicks end_
Handle< SharedFunctionInfo > info
Handle< FixedArray > elements_
V8_INLINE const Operation & Get(const Graph &graph, OpIndex index)
Node::Uses::const_iterator begin(const Node::Uses &uses)
#define NON_EXPORTED_BASE(code)
#define DCHECK_LE(v1, v2)
#define V8_EXPORT_PRIVATE
Element(Node *object, Node *index, Node *value, MachineRepresentation representation)
bool operator==(const FieldInfo &other) const
FieldInfo(Node *value, MachineRepresentation representation, MaybeHandle< Name > name={}, ConstFieldInfo const_field_info=ConstFieldInfo::None())
ConstFieldInfo const_field_info
bool operator!=(const FieldInfo &other) const
bool operator!=(Iterator other)