Commit 5cc1ddaf authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[turbofan] Refactor ComputeElementAccessInfos

... such that the feedback maps can evenentually be processed in the
serialization phase.

Bug: v8:7790
Change-Id: Ic033e88646a1b161710b1ca2028ef10f49d23cfd
Reviewed-on: https://chromium-review.googlesource.com/c/1472293Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59592}
parent dae0f73f
......@@ -271,20 +271,14 @@ bool AccessInfoFactory::ComputeElementAccessInfo(
return true;
}
bool AccessInfoFactory::ComputeElementAccessInfos(
MapHandles const& maps, AccessMode access_mode,
ZoneVector<ElementAccessInfo>* access_infos) const {
if (access_mode == AccessMode::kLoad) {
// For polymorphic loads of similar elements kinds (i.e. all tagged or all
// double), always use the "worst case" code without a transition. This is
// much faster than transitioning the elements to the worst case, trading a
// TransitionElementsKind for a CheckMaps, avoiding mutation of the array.
ElementAccessInfo access_info;
if (ConsolidateElementLoad(maps, &access_info)) {
access_infos->push_back(access_info);
return true;
}
}
typedef std::vector<std::pair<Handle<Map>, Handle<Map>>> TransitionList;
namespace {
void ProcessFeedbackMaps(Isolate* isolate, MapHandles const& maps,
MapHandles* receiver_maps,
TransitionList* transitions) {
DCHECK(receiver_maps->empty());
DCHECK(transitions->empty());
// Collect possible transition targets.
MapHandles possible_transition_targets;
......@@ -298,23 +292,40 @@ bool AccessInfoFactory::ComputeElementAccessInfos(
}
// Separate the actual receiver maps and the possible transition sources.
MapHandles receiver_maps;
receiver_maps.reserve(maps.size());
std::vector<std::pair<Handle<Map>, Handle<Map>>> transitions(maps.size());
for (Handle<Map> map : maps) {
// Don't generate elements kind transitions from stable maps.
Map transition_target = map->is_stable()
? Map()
: map->FindElementsKindTransitionedMap(
isolate(), possible_transition_targets);
isolate, possible_transition_targets);
if (transition_target.is_null()) {
receiver_maps.push_back(map);
receiver_maps->push_back(map);
} else {
transitions.push_back(
std::make_pair(map, handle(transition_target, isolate())));
transitions->emplace_back(map, handle(transition_target, isolate));
}
}
}
} // namespace
bool AccessInfoFactory::ComputeElementAccessInfos(
MapHandles const& maps, AccessMode access_mode,
ZoneVector<ElementAccessInfo>* access_infos) const {
if (access_mode == AccessMode::kLoad) {
// For polymorphic loads of similar elements kinds (i.e. all tagged or all
// double), always use the "worst case" code without a transition. This is
// much faster than transitioning the elements to the worst case, trading a
// TransitionElementsKind for a CheckMaps, avoiding mutation of the array.
ElementAccessInfo access_info;
if (ConsolidateElementLoad(maps, &access_info)) {
access_infos->push_back(access_info);
return true;
}
}
MapHandles receiver_maps;
TransitionList transitions;
ProcessFeedbackMaps(isolate(), maps, &receiver_maps, &transitions);
for (Handle<Map> receiver_map : receiver_maps) {
// Compute the element access information.
ElementAccessInfo access_info;
......
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