Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Unified Diff: src/compiler/js-native-context-specialization.cc

Issue 2431563002: [turbofan] Track multiple maps for LoadElimination. (Closed)
Patch Set: REBASE. Address comment. Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/js-inlining.cc ('k') | src/compiler/load-elimination.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-native-context-specialization.cc
diff --git a/src/compiler/js-native-context-specialization.cc b/src/compiler/js-native-context-specialization.cc
index 520268bdb68491f84d981652e81fec7b4c11b764..78a32713ad413cf008a0d0d2e771f4c3e4d90340 100644
--- a/src/compiler/js-native-context-specialization.cc
+++ b/src/compiler/js-native-context-specialization.cc
@@ -643,13 +643,13 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
Handle<Map> const transition_source = transition.first;
Handle<Map> const transition_target = transition.second;
effect = graph()->NewNode(
- simplified()->TransitionElementsKind(
+ simplified()->TransitionElementsKind(ElementsTransition(
IsSimpleMapChangeTransition(transition_source->elements_kind(),
transition_target->elements_kind())
? ElementsTransition::kFastTransition
- : ElementsTransition::kSlowTransition),
- receiver, jsgraph()->HeapConstant(transition_source),
- jsgraph()->HeapConstant(transition_target), effect, control);
+ : ElementsTransition::kSlowTransition,
+ transition_source, transition_target)),
+ receiver, effect, control);
}
// TODO(turbofan): The effect/control linearization will not find a
@@ -694,14 +694,13 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
Handle<Map> const transition_target = transition.second;
this_effect = graph()->NewNode(
simplified()->TransitionElementsKind(
- IsSimpleMapChangeTransition(
- transition_source->elements_kind(),
- transition_target->elements_kind())
- ? ElementsTransition::kFastTransition
- : ElementsTransition::kSlowTransition),
- receiver, jsgraph()->HeapConstant(transition_source),
- jsgraph()->HeapConstant(transition_target), this_effect,
- this_control);
+ ElementsTransition(IsSimpleMapChangeTransition(
+ transition_source->elements_kind(),
+ transition_target->elements_kind())
+ ? ElementsTransition::kFastTransition
+ : ElementsTransition::kSlowTransition,
+ transition_source, transition_target)),
+ receiver, this_effect, this_control);
}
// Load the {receiver} map.
@@ -1179,9 +1178,9 @@ JSNativeContextSpecialization::BuildPropertyAccess(
Handle<Map> field_map;
if (access_info.field_map().ToHandle(&field_map)) {
// Emit a map check for the value.
- effect = graph()->NewNode(simplified()->CheckMaps(1), value,
- jsgraph()->HeapConstant(field_map),
- effect, control);
+ effect = graph()->NewNode(
+ simplified()->CheckMaps(ZoneHandleSet<Map>(field_map)), value,
+ effect, control);
}
field_access.write_barrier_kind = kPointerWriteBarrier;
break;
@@ -1418,9 +1417,9 @@ JSNativeContextSpecialization::BuildElementAccess(
if (access_mode == AccessMode::kStore &&
IsFastSmiOrObjectElementsKind(elements_kind) &&
store_mode != STORE_NO_TRANSITION_HANDLE_COW) {
- effect =
- graph()->NewNode(simplified()->CheckMaps(1), elements,
- jsgraph()->FixedArrayMapConstant(), effect, control);
+ effect = graph()->NewNode(simplified()->CheckMaps(ZoneHandleSet<Map>(
+ factory()->fixed_array_map())),
+ elements, effect, control);
}
// Check if the {receiver} is a JSArray.
@@ -1640,12 +1639,12 @@ Node* JSNativeContextSpecialization::BuildCheckHeapObject(Node* receiver,
Node* JSNativeContextSpecialization::BuildCheckMaps(
Node* receiver, Node* effect, Node* control,
- std::vector<Handle<Map>> const& maps) {
+ std::vector<Handle<Map>> const& receiver_maps) {
HeapObjectMatcher m(receiver);
if (m.HasValue()) {
Handle<Map> receiver_map(m.Value()->map(), isolate());
if (receiver_map->is_stable()) {
- for (Handle<Map> map : maps) {
+ for (Handle<Map> map : receiver_maps) {
if (map.is_identical_to(receiver_map)) {
dependencies()->AssumeMapStable(receiver_map);
return effect;
@@ -1653,17 +1652,12 @@ Node* JSNativeContextSpecialization::BuildCheckMaps(
}
}
}
- int const map_input_count = static_cast<int>(maps.size());
- int const input_count = 1 + map_input_count + 1 + 1;
- Node** inputs = zone()->NewArray<Node*>(input_count);
- inputs[0] = receiver;
- for (int i = 0; i < map_input_count; ++i) {
- inputs[1 + i] = jsgraph()->HeapConstant(maps[i]);
+ ZoneHandleSet<Map> maps;
+ for (Handle<Map> map : receiver_maps) {
+ maps.insert(map, graph()->zone());
}
- inputs[input_count - 2] = effect;
- inputs[input_count - 1] = control;
- return graph()->NewNode(simplified()->CheckMaps(map_input_count), input_count,
- inputs);
+ return graph()->NewNode(simplified()->CheckMaps(maps), receiver, effect,
+ control);
}
void JSNativeContextSpecialization::AssumePrototypesStable(
« no previous file with comments | « src/compiler/js-inlining.cc ('k') | src/compiler/load-elimination.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698