[turbofan] Restrict the generality of ElementAccessInfo.

It unnecessarily allowed for transitions in the presence of multiple
receiver maps.

Bug: v8:7790
Change-Id: I226f499f626ffb7c1b084aa5a45684e7782d1760
Reviewed-on: https://chromium-review.googlesource.com/c/1456088
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59459}
This commit is contained in:
Georg Neis 2019-02-06 15:55:01 +01:00 committed by Commit Bot
parent 3724a12549
commit 8dd7212532
3 changed files with 19 additions and 15 deletions

View File

@ -71,7 +71,9 @@ ElementAccessInfo::ElementAccessInfo() = default;
ElementAccessInfo::ElementAccessInfo(MapHandles const& receiver_maps,
ElementsKind elements_kind)
: elements_kind_(elements_kind), receiver_maps_(receiver_maps) {}
: elements_kind_(elements_kind), receiver_maps_(receiver_maps) {
CHECK(!receiver_maps.empty());
}
// static
PropertyAccessInfo PropertyAccessInfo::NotFound(MapHandles const& receiver_maps,
@ -300,7 +302,7 @@ bool AccessInfoFactory::ComputeElementAccessInfos(
// Separate the actual receiver maps and the possible transition sources.
MapHandles receiver_maps;
receiver_maps.reserve(maps.size());
MapTransitionList transitions(maps.size());
std::vector<std::pair<Handle<Map>, Handle<Map>>> transitions(maps.size());
for (Handle<Map> map : maps) {
if (Map::TryUpdate(isolate(), map).ToHandle(&map)) {
// Don't generate elements kind transitions from stable maps.
@ -327,7 +329,7 @@ bool AccessInfoFactory::ComputeElementAccessInfos(
// Collect the possible transitions for the {receiver_map}.
for (auto transition : transitions) {
if (transition.second.is_identical_to(receiver_map)) {
access_info.transitions().push_back(transition);
access_info.AddTransitionSource(transition.first);
}
}

View File

@ -33,9 +33,6 @@ enum class AccessMode { kLoad, kStore, kStoreInLiteral };
std::ostream& operator<<(std::ostream&, AccessMode);
// Mapping of transition source to transition target.
typedef std::vector<std::pair<Handle<Map>, Handle<Map>>> MapTransitionList;
// This class encapsulates all information required to access a certain element.
class ElementAccessInfo final {
public:
@ -45,13 +42,17 @@ class ElementAccessInfo final {
ElementsKind elements_kind() const { return elements_kind_; }
MapHandles const& receiver_maps() const { return receiver_maps_; }
MapTransitionList& transitions() { return transitions_; }
MapTransitionList const& transitions() const { return transitions_; }
MapHandles const& transition_sources() const { return transition_sources_; }
void AddTransitionSource(Handle<Map> map) {
CHECK_EQ(receiver_maps_.size(), 1);
transition_sources_.push_back(map);
}
private:
ElementsKind elements_kind_;
MapHandles receiver_maps_;
MapTransitionList transitions_;
MapHandles transition_sources_;
};
// This class encapsulates all information required to access a certain

View File

@ -1511,9 +1511,9 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
ElementAccessInfo access_info = access_infos.front();
// Perform possible elements kind transitions.
for (auto transition : access_info.transitions()) {
Handle<Map> const transition_source = transition.first;
Handle<Map> const transition_target = transition.second;
Handle<Map> const transition_target = access_info.receiver_maps().front();
for (auto transition_source : access_info.transition_sources()) {
DCHECK_EQ(access_info.receiver_maps().size(), 1);
effect = graph()->NewNode(
simplified()->TransitionElementsKind(ElementsTransition(
IsSimpleMapChangeTransition(transition_source->elements_kind(),
@ -1561,9 +1561,10 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
Node* this_control = fallthrough_control;
// Perform possible elements kind transitions.
for (auto transition : access_info.transitions()) {
Handle<Map> const transition_source = transition.first;
Handle<Map> const transition_target = transition.second;
Handle<Map> const transition_target =
access_info.receiver_maps().front();
for (auto transition_source : access_info.transition_sources()) {
DCHECK_EQ(access_info.receiver_maps().size(), 1);
this_effect = graph()->NewNode(
simplified()->TransitionElementsKind(
ElementsTransition(IsSimpleMapChangeTransition(