Commit a27daf04 authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

[turbofan] Revert "Load elimination for Map.prototype.(has|get)."

This reverts commit 3ca64085.

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/574020Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46952}
parent 48a903eb
...@@ -118,8 +118,6 @@ Reduction LoadElimination::Reduce(Node* node) { ...@@ -118,8 +118,6 @@ Reduction LoadElimination::Reduce(Node* node) {
return ReduceTransitionAndStoreElement(node); return ReduceTransitionAndStoreElement(node);
case IrOpcode::kStoreTypedElement: case IrOpcode::kStoreTypedElement:
return ReduceStoreTypedElement(node); return ReduceStoreTypedElement(node);
case IrOpcode::kLookupHashStorageIndex:
return ReduceLookupHashStorageIndex(node);
case IrOpcode::kEffectPhi: case IrOpcode::kEffectPhi:
return ReduceEffectPhi(node); return ReduceEffectPhi(node);
case IrOpcode::kDead: case IrOpcode::kDead:
...@@ -309,37 +307,6 @@ void LoadElimination::AbstractElements::Print() const { ...@@ -309,37 +307,6 @@ void LoadElimination::AbstractElements::Print() const {
} }
} }
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 { Node* LoadElimination::AbstractField::Lookup(Node* object) const {
for (auto pair : info_for_node_) { for (auto pair : info_for_node_) {
if (MustAlias(object, pair.first)) return pair.second; if (MustAlias(object, pair.first)) return pair.second;
...@@ -469,13 +436,6 @@ void LoadElimination::AbstractState::Merge(AbstractState const* that, ...@@ -469,13 +436,6 @@ void LoadElimination::AbstractState::Merge(AbstractState const* that,
if (this->maps_) { if (this->maps_) {
this->maps_ = that->maps_ ? that->maps_->Merge(this->maps_, zone) : nullptr; 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 { Node* LoadElimination::AbstractState::LookupCheck(Node* node) const {
...@@ -546,26 +506,6 @@ LoadElimination::AbstractState::AddElement(Node* object, Node* index, ...@@ -546,26 +506,6 @@ LoadElimination::AbstractState::AddElement(Node* object, Node* index,
return that; 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 const*
LoadElimination::AbstractState::KillElement(Node* object, Node* index, LoadElimination::AbstractState::KillElement(Node* object, Node* index,
Zone* zone) const { Zone* zone) const {
...@@ -991,25 +931,6 @@ Reduction LoadElimination::ReduceStoreTypedElement(Node* node) { ...@@ -991,25 +931,6 @@ Reduction LoadElimination::ReduceStoreTypedElement(Node* node) {
return UpdateState(node, state); 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) { Reduction LoadElimination::ReduceEffectPhi(Node* node) {
Node* const effect0 = NodeProperties::GetEffectInput(node, 0); Node* const effect0 = NodeProperties::GetEffectInput(node, 0);
Node* const control = NodeProperties::GetControlInput(node); Node* const control = NodeProperties::GetControlInput(node);
......
...@@ -125,46 +125,6 @@ class V8_EXPORT_PRIVATE LoadElimination final ...@@ -125,46 +125,6 @@ class V8_EXPORT_PRIVATE LoadElimination final
size_t next_index_ = 0; 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 // Abstract state to approximate the current state of a certain field along
// the effect paths through the graph. // the effect paths through the graph.
class AbstractField final : public ZoneObject { class AbstractField final : public ZoneObject {
...@@ -282,9 +242,6 @@ class V8_EXPORT_PRIVATE LoadElimination final ...@@ -282,9 +242,6 @@ class V8_EXPORT_PRIVATE LoadElimination final
Zone* zone) const; Zone* zone) const;
Node* LookupElement(Node* object, Node* index, Node* LookupElement(Node* object, Node* index,
MachineRepresentation representation) const; 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; AbstractState const* AddCheck(Node* node, Zone* zone) const;
Node* LookupCheck(Node* node) const; Node* LookupCheck(Node* node) const;
...@@ -296,7 +253,6 @@ class V8_EXPORT_PRIVATE LoadElimination final ...@@ -296,7 +253,6 @@ class V8_EXPORT_PRIVATE LoadElimination final
AbstractElements const* elements_ = nullptr; AbstractElements const* elements_ = nullptr;
AbstractField const* fields_[kMaxTrackedFields]; AbstractField const* fields_[kMaxTrackedFields];
AbstractMaps const* maps_ = nullptr; AbstractMaps const* maps_ = nullptr;
AbstractHashIndexes const* hash_indexes_ = nullptr;
}; };
class AbstractStateForEffectNodes final : public ZoneObject { class AbstractStateForEffectNodes final : public ZoneObject {
...@@ -322,7 +278,6 @@ class V8_EXPORT_PRIVATE LoadElimination final ...@@ -322,7 +278,6 @@ class V8_EXPORT_PRIVATE LoadElimination final
Reduction ReduceStoreElement(Node* node); Reduction ReduceStoreElement(Node* node);
Reduction ReduceTransitionAndStoreElement(Node* node); Reduction ReduceTransitionAndStoreElement(Node* node);
Reduction ReduceStoreTypedElement(Node* node); Reduction ReduceStoreTypedElement(Node* node);
Reduction ReduceLookupHashStorageIndex(Node* node);
Reduction ReduceEffectPhi(Node* node); Reduction ReduceEffectPhi(Node* node);
Reduction ReduceStart(Node* node); Reduction ReduceStart(Node* node);
Reduction ReduceOtherNode(Node* node); Reduction ReduceOtherNode(Node* node);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment