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

Side by Side Diff: src/compiler/effect-control-linearizer.cc

Issue 2431563002: [turbofan] Track multiple maps for LoadElimination. (Closed)
Patch Set: REBASE Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/effect-control-linearizer.h" 5 #include "src/compiler/effect-control-linearizer.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler/access-builder.h" 8 #include "src/compiler/access-builder.h"
9 #include "src/compiler/compiler-source-position-table.h" 9 #include "src/compiler/compiler-source-position-table.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 control = effect = graph()->NewNode( 1191 control = effect = graph()->NewNode(
1192 common()->DeoptimizeUnless(DeoptimizeReason::kOutOfBounds), check, 1192 common()->DeoptimizeUnless(DeoptimizeReason::kOutOfBounds), check,
1193 frame_state, effect, control); 1193 frame_state, effect, control);
1194 1194
1195 return ValueEffectControl(index, effect, control); 1195 return ValueEffectControl(index, effect, control);
1196 } 1196 }
1197 1197
1198 EffectControlLinearizer::ValueEffectControl 1198 EffectControlLinearizer::ValueEffectControl
1199 EffectControlLinearizer::LowerCheckMaps(Node* node, Node* frame_state, 1199 EffectControlLinearizer::LowerCheckMaps(Node* node, Node* frame_state,
1200 Node* effect, Node* control) { 1200 Node* effect, Node* control) {
1201 CheckMapsParameters const& p = CheckMapsParametersOf(node->op());
1201 Node* value = node->InputAt(0); 1202 Node* value = node->InputAt(0);
1202 1203
1203 // Load the current map of the {value}. 1204 // Load the current map of the {value}.
1204 Node* value_map = effect = graph()->NewNode( 1205 Node* value_map = effect = graph()->NewNode(
1205 simplified()->LoadField(AccessBuilder::ForMap()), value, effect, control); 1206 simplified()->LoadField(AccessBuilder::ForMap()), value, effect, control);
1206 1207
1207 int const map_count = node->op()->ValueInputCount() - 1; 1208 ZoneHandleSet<Map> const& maps = p.maps();
1209 int const map_count = static_cast<int>(maps.size());
1208 Node** controls = temp_zone()->NewArray<Node*>(map_count); 1210 Node** controls = temp_zone()->NewArray<Node*>(map_count);
1209 Node** effects = temp_zone()->NewArray<Node*>(map_count + 1); 1211 Node** effects = temp_zone()->NewArray<Node*>(map_count + 1);
1210 1212
1211 for (int i = 0; i < map_count; ++i) { 1213 for (int i = 0; i < map_count; ++i) {
1212 Node* map = node->InputAt(1 + i); 1214 Node* map = jsgraph()->HeapConstant(maps[i]);
1213 1215
1214 Node* check = graph()->NewNode(machine()->WordEqual(), value_map, map); 1216 Node* check = graph()->NewNode(machine()->WordEqual(), value_map, map);
1215 if (i == map_count - 1) { 1217 if (i == map_count - 1) {
1216 controls[i] = effects[i] = graph()->NewNode( 1218 controls[i] = effects[i] = graph()->NewNode(
1217 common()->DeoptimizeUnless(DeoptimizeReason::kWrongMap), check, 1219 common()->DeoptimizeUnless(DeoptimizeReason::kWrongMap), check,
1218 frame_state, effect, control); 1220 frame_state, effect, control);
1219 } else { 1221 } else {
1220 control = graph()->NewNode(common()->Branch(), check, control); 1222 control = graph()->NewNode(common()->Branch(), check, control);
1221 controls[i] = graph()->NewNode(common()->IfTrue(), control); 1223 controls[i] = graph()->NewNode(common()->IfTrue(), control);
1222 control = graph()->NewNode(common()->IfFalse(), control); 1224 control = graph()->NewNode(common()->IfFalse(), control);
(...skipping 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after
2960 vfalse0, control); 2962 vfalse0, control);
2961 2963
2962 return ValueEffectControl(value, effect, control); 2964 return ValueEffectControl(value, effect, control);
2963 } 2965 }
2964 2966
2965 EffectControlLinearizer::ValueEffectControl 2967 EffectControlLinearizer::ValueEffectControl
2966 EffectControlLinearizer::LowerTransitionElementsKind(Node* node, Node* effect, 2968 EffectControlLinearizer::LowerTransitionElementsKind(Node* node, Node* effect,
2967 Node* control) { 2969 Node* control) {
2968 ElementsTransition const transition = ElementsTransitionOf(node->op()); 2970 ElementsTransition const transition = ElementsTransitionOf(node->op());
2969 Node* object = node->InputAt(0); 2971 Node* object = node->InputAt(0);
2970 Node* source_map = node->InputAt(1); 2972 Node* source_map = jsgraph()->HeapConstant(transition.source());
2971 Node* target_map = node->InputAt(2); 2973 Node* target_map = jsgraph()->HeapConstant(transition.target());
2972 2974
2973 // Load the current map of {object}. 2975 // Load the current map of {object}.
2974 Node* object_map = effect = 2976 Node* object_map = effect =
2975 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), object, 2977 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), object,
2976 effect, control); 2978 effect, control);
2977 2979
2978 // Check if {object_map} is the same as {source_map}. 2980 // Check if {object_map} is the same as {source_map}.
2979 Node* check = 2981 Node* check =
2980 graph()->NewNode(machine()->WordEqual(), object_map, source_map); 2982 graph()->NewNode(machine()->WordEqual(), object_map, source_map);
2981 Node* branch = 2983 Node* branch =
2982 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control); 2984 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control);
2983 2985
2984 // Migrate the {object} from {source_map} to {target_map}. 2986 // Migrate the {object} from {source_map} to {target_map}.
2985 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 2987 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
2986 Node* etrue = effect; 2988 Node* etrue = effect;
2987 { 2989 {
2988 switch (transition) { 2990 switch (transition.mode()) {
2989 case ElementsTransition::kFastTransition: { 2991 case ElementsTransition::kFastTransition: {
2990 // In-place migration of {object}, just store the {target_map}. 2992 // In-place migration of {object}, just store the {target_map}.
2991 etrue = 2993 etrue =
2992 graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), 2994 graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()),
2993 object, target_map, etrue, if_true); 2995 object, target_map, etrue, if_true);
2994 break; 2996 break;
2995 } 2997 }
2996 case ElementsTransition::kSlowTransition: { 2998 case ElementsTransition::kSlowTransition: {
2997 // Instance migration, call out to the runtime for {object}. 2999 // Instance migration, call out to the runtime for {object}.
2998 Operator::Properties properties = 3000 Operator::Properties properties =
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
3585 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3587 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3586 Operator::kEliminatable); 3588 Operator::kEliminatable);
3587 to_number_operator_.set(common()->Call(desc)); 3589 to_number_operator_.set(common()->Call(desc));
3588 } 3590 }
3589 return to_number_operator_.get(); 3591 return to_number_operator_.get();
3590 } 3592 }
3591 3593
3592 } // namespace compiler 3594 } // namespace compiler
3593 } // namespace internal 3595 } // namespace internal
3594 } // namespace v8 3596 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698