[turbofan] Revert "Load elimination for Map.prototype.(has|get)."
This reverts commit 3ca6408511900328e11175c38b128b3a6cebb7ec.
Reason: it does not seem to improve anything (including microbenchmarks
that only do "if (m.has(x)) s += m.get(x);" in a tight loop).
Bug: v8:6410
Change-Id: I025bf885f313ac5e54ca450ae9cff5b4a15b04fd
Reviewed-on: https://chromium-review.googlesource.com/574020
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46952}
diff --git a/src/compiler/load-elimination.cc b/src/compiler/load-elimination.cc
index 775da82..c0e3bc3 100644
--- a/src/compiler/load-elimination.cc
+++ b/src/compiler/load-elimination.cc
@@ -118,8 +118,6 @@
return ReduceTransitionAndStoreElement(node);
case IrOpcode::kStoreTypedElement:
return ReduceStoreTypedElement(node);
- case IrOpcode::kLookupHashStorageIndex:
- return ReduceLookupHashStorageIndex(node);
case IrOpcode::kEffectPhi:
return ReduceEffectPhi(node);
case IrOpcode::kDead:
@@ -309,37 +307,6 @@
}
}
-Node* LoadElimination::AbstractHashIndexes::Lookup(Node* table,
- Node* key) const {
- if (entry_.table == nullptr) return nullptr;
- if (MustAlias(table, entry_.table) && MustAlias(key, entry_.key)) {
- return entry_.index;
- }
- return nullptr;
-}
-
-bool LoadElimination::AbstractHashIndexes::Equals(
- AbstractHashIndexes const* that) const {
- return entry_.table == that->entry_.table && entry_.key == that->entry_.key &&
- entry_.index == that->entry_.index;
-}
-
-LoadElimination::AbstractHashIndexes const*
-LoadElimination::AbstractHashIndexes::Merge(AbstractHashIndexes const* that,
- Zone* zone) const {
- if (this->Equals(that)) return this;
- return nullptr;
-}
-
-void LoadElimination::AbstractHashIndexes::Print() const {
- if (entry_.table) {
- PrintF(" #%d:%s @ #%d:%s -> #%d:%s\n", entry_.table->id(),
- entry_.table->op()->mnemonic(), entry_.key->id(),
- entry_.key->op()->mnemonic(), entry_.index->id(),
- entry_.index->op()->mnemonic());
- }
-}
-
Node* LoadElimination::AbstractField::Lookup(Node* object) const {
for (auto pair : info_for_node_) {
if (MustAlias(object, pair.first)) return pair.second;
@@ -469,13 +436,6 @@
if (this->maps_) {
this->maps_ = that->maps_ ? that->maps_->Merge(this->maps_, zone) : nullptr;
}
-
- // Merge the information about hash maps.
- if (this->hash_indexes_) {
- this->hash_indexes_ = that->hash_indexes_ ? that->hash_indexes_->Merge(
- this->hash_indexes_, zone)
- : nullptr;
- }
}
Node* LoadElimination::AbstractState::LookupCheck(Node* node) const {
@@ -546,26 +506,6 @@
return that;
}
-Node* LoadElimination::AbstractState::LookupHashIndex(Node* table,
- Node* key) const {
- if (this->hash_indexes_) {
- return this->hash_indexes_->Lookup(table, key);
- }
- return nullptr;
-}
-
-LoadElimination::AbstractState const*
-LoadElimination::AbstractState::AddHashIndex(Node* table, Node* key,
- Node* index, Zone* zone) const {
- AbstractState* that = new (zone) AbstractState(*this);
- if (that->hash_indexes_) {
- that->hash_indexes_ = that->hash_indexes_->Extend(table, key, index, zone);
- } else {
- that->hash_indexes_ = new (zone) AbstractHashIndexes(table, key, index);
- }
- return that;
-}
-
LoadElimination::AbstractState const*
LoadElimination::AbstractState::KillElement(Node* object, Node* index,
Zone* zone) const {
@@ -991,25 +931,6 @@
return UpdateState(node, state);
}
-Reduction LoadElimination::ReduceLookupHashStorageIndex(Node* node) {
- Node* table = node->InputAt(0);
- Node* key = node->InputAt(1);
- Node* effect = NodeProperties::GetEffectInput(node);
-
- AbstractState const* state = node_states_.Get(effect);
- if (state == nullptr) return NoChange();
-
- if (Node* replacement = state->LookupHashIndex(table, key)) {
- // Make sure we don't resurrect dead {replacement} nodes.
- if (!replacement->IsDead()) {
- ReplaceWithValue(node, replacement, effect);
- return Replace(replacement);
- }
- }
- state = state->AddHashIndex(table, key, node, zone());
- return UpdateState(node, state);
-}
-
Reduction LoadElimination::ReduceEffectPhi(Node* node) {
Node* const effect0 = NodeProperties::GetEffectInput(node, 0);
Node* const control = NodeProperties::GetControlInput(node);
diff --git a/src/compiler/load-elimination.h b/src/compiler/load-elimination.h
index dc65a12..41ccd17 100644
--- a/src/compiler/load-elimination.h
+++ b/src/compiler/load-elimination.h
@@ -125,46 +125,6 @@
size_t next_index_ = 0;
};
- // Abstract state to approximate the current state of a hash map along the
- // effect paths through the graph.
- class AbstractHashIndexes final : public ZoneObject {
- public:
- AbstractHashIndexes() {}
-
- AbstractHashIndexes(Node* table, Node* key, Node* index)
- : AbstractHashIndexes() {
- entry_ = Entry(table, key, index);
- }
-
- AbstractHashIndexes const* Extend(Node* table, Node* key, Node* index,
- Zone* zone) const {
- // Currently, we do only hold one entry, so we just create a new
- // state with the one entry.
- AbstractHashIndexes* that =
- new (zone) AbstractHashIndexes(table, key, index);
- return that;
- }
- Node* Lookup(Node* table, Node* key) const;
- bool Equals(AbstractHashIndexes const* that) const;
- AbstractHashIndexes const* Merge(AbstractHashIndexes const* that,
- Zone* zone) const;
-
- void Print() const;
-
- private:
- struct Entry {
- Entry() {}
- Entry(Node* table, Node* key, Node* index)
- : table(table), key(key), index(index) {}
-
- Node* table = nullptr;
- Node* key = nullptr;
- Node* index = nullptr;
- };
-
- Entry entry_;
- };
-
// Abstract state to approximate the current state of a certain field along
// the effect paths through the graph.
class AbstractField final : public ZoneObject {
@@ -282,9 +242,6 @@
Zone* zone) const;
Node* LookupElement(Node* object, Node* index,
MachineRepresentation representation) const;
- AbstractState const* AddHashIndex(Node* table, Node* key, Node* index,
- Zone* zone) const;
- Node* LookupHashIndex(Node* table, Node* key) const;
AbstractState const* AddCheck(Node* node, Zone* zone) const;
Node* LookupCheck(Node* node) const;
@@ -296,7 +253,6 @@
AbstractElements const* elements_ = nullptr;
AbstractField const* fields_[kMaxTrackedFields];
AbstractMaps const* maps_ = nullptr;
- AbstractHashIndexes const* hash_indexes_ = nullptr;
};
class AbstractStateForEffectNodes final : public ZoneObject {
@@ -322,7 +278,6 @@
Reduction ReduceStoreElement(Node* node);
Reduction ReduceTransitionAndStoreElement(Node* node);
Reduction ReduceStoreTypedElement(Node* node);
- Reduction ReduceLookupHashStorageIndex(Node* node);
Reduction ReduceEffectPhi(Node* node);
Reduction ReduceStart(Node* node);
Reduction ReduceOtherNode(Node* node);