Index: src/compiler/load-elimination.h |
diff --git a/src/compiler/load-elimination.h b/src/compiler/load-elimination.h |
index 2a4ee405003913ae809029d8ddabc029db16ca1f..f2cb6c16f64cc4371b1c7a785839402537a5f4bd 100644 |
--- a/src/compiler/load-elimination.h |
+++ b/src/compiler/load-elimination.h |
@@ -24,6 +24,37 @@ class LoadElimination final : public AdvancedReducer { |
Reduction Reduce(Node* node) final; |
private: |
+ static const size_t kMaxTrackedChecks = 8; |
+ |
+ // Abstract state to approximate the current state of checks that are |
+ // only invalidated by calls, i.e. array buffer neutering checks, along |
+ // the effect paths through the graph. |
+ class AbstractChecks final : public ZoneObject { |
+ public: |
+ explicit AbstractChecks(Zone* zone) { |
+ for (size_t i = 0; i < arraysize(nodes_); ++i) { |
+ nodes_[i] = nullptr; |
+ } |
+ } |
+ AbstractChecks(Node* node, Zone* zone) : AbstractChecks(zone) { |
+ nodes_[next_index_++] = node; |
+ } |
+ |
+ AbstractChecks const* Extend(Node* node, Zone* zone) const { |
+ AbstractChecks* that = new (zone) AbstractChecks(*this); |
+ that->nodes_[that->next_index_] = node; |
+ that->next_index_ = (that->next_index_ + 1) % arraysize(nodes_); |
+ return that; |
+ } |
+ Node* Lookup(Node* node) const; |
+ bool Equals(AbstractChecks const* that) const; |
+ AbstractChecks const* Merge(AbstractChecks const* that, Zone* zone) const; |
+ |
+ private: |
+ Node* nodes_[kMaxTrackedChecks]; |
+ size_t next_index_ = 0; |
+ }; |
+ |
static const size_t kMaxTrackedElements = 8; |
// Abstract state to approximate the current state of an element along the |
@@ -133,7 +164,11 @@ class LoadElimination final : public AdvancedReducer { |
Zone* zone) const; |
Node* LookupElement(Node* object, Node* index) const; |
+ AbstractState const* AddCheck(Node* node, Zone* zone) const; |
+ Node* LookupCheck(Node* node) const; |
+ |
private: |
+ AbstractChecks const* checks_ = nullptr; |
AbstractElements const* elements_ = nullptr; |
AbstractField const* fields_[kMaxTrackedFields]; |
}; |
@@ -150,6 +185,7 @@ class LoadElimination final : public AdvancedReducer { |
ZoneVector<AbstractState const*> info_for_node_; |
}; |
+ Reduction ReduceArrayBufferWasNeutered(Node* node); |
Reduction ReduceCheckMaps(Node* node); |
Reduction ReduceEnsureWritableFastElements(Node* node); |
Reduction ReduceMaybeGrowFastElements(Node* node); |