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

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

Issue 2431563002: [turbofan] Track multiple maps for LoadElimination. (Closed)
Patch Set: REBASE. Address comment. Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « BUILD.gn ('k') | src/compiler/js-builtin-reducer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 control = effect = graph()->NewNode( 1195 control = effect = graph()->NewNode(
1196 common()->DeoptimizeUnless(DeoptimizeReason::kOutOfBounds), check, 1196 common()->DeoptimizeUnless(DeoptimizeReason::kOutOfBounds), check,
1197 frame_state, effect, control); 1197 frame_state, effect, control);
1198 1198
1199 return ValueEffectControl(index, effect, control); 1199 return ValueEffectControl(index, effect, control);
1200 } 1200 }
1201 1201
1202 EffectControlLinearizer::ValueEffectControl 1202 EffectControlLinearizer::ValueEffectControl
1203 EffectControlLinearizer::LowerCheckMaps(Node* node, Node* frame_state, 1203 EffectControlLinearizer::LowerCheckMaps(Node* node, Node* frame_state,
1204 Node* effect, Node* control) { 1204 Node* effect, Node* control) {
1205 CheckMapsParameters const& p = CheckMapsParametersOf(node->op());
1205 Node* value = node->InputAt(0); 1206 Node* value = node->InputAt(0);
1206 1207
1207 // Load the current map of the {value}. 1208 // Load the current map of the {value}.
1208 Node* value_map = effect = graph()->NewNode( 1209 Node* value_map = effect = graph()->NewNode(
1209 simplified()->LoadField(AccessBuilder::ForMap()), value, effect, control); 1210 simplified()->LoadField(AccessBuilder::ForMap()), value, effect, control);
1210 1211
1211 int const map_count = node->op()->ValueInputCount() - 1; 1212 ZoneHandleSet<Map> const& maps = p.maps();
1213 int const map_count = static_cast<int>(maps.size());
1212 Node** controls = temp_zone()->NewArray<Node*>(map_count); 1214 Node** controls = temp_zone()->NewArray<Node*>(map_count);
1213 Node** effects = temp_zone()->NewArray<Node*>(map_count + 1); 1215 Node** effects = temp_zone()->NewArray<Node*>(map_count + 1);
1214 1216
1215 for (int i = 0; i < map_count; ++i) { 1217 for (int i = 0; i < map_count; ++i) {
1216 Node* map = node->InputAt(1 + i); 1218 Node* map = jsgraph()->HeapConstant(maps[i]);
1217 1219
1218 Node* check = graph()->NewNode(machine()->WordEqual(), value_map, map); 1220 Node* check = graph()->NewNode(machine()->WordEqual(), value_map, map);
1219 if (i == map_count - 1) { 1221 if (i == map_count - 1) {
1220 controls[i] = effects[i] = graph()->NewNode( 1222 controls[i] = effects[i] = graph()->NewNode(
1221 common()->DeoptimizeUnless(DeoptimizeReason::kWrongMap), check, 1223 common()->DeoptimizeUnless(DeoptimizeReason::kWrongMap), check,
1222 frame_state, effect, control); 1224 frame_state, effect, control);
1223 } else { 1225 } else {
1224 control = graph()->NewNode(common()->Branch(), check, control); 1226 control = graph()->NewNode(common()->Branch(), check, control);
1225 controls[i] = graph()->NewNode(common()->IfTrue(), control); 1227 controls[i] = graph()->NewNode(common()->IfTrue(), control);
1226 control = graph()->NewNode(common()->IfFalse(), control); 1228 control = graph()->NewNode(common()->IfFalse(), control);
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
2995 vfalse0, control); 2997 vfalse0, control);
2996 2998
2997 return ValueEffectControl(value, effect, control); 2999 return ValueEffectControl(value, effect, control);
2998 } 3000 }
2999 3001
3000 EffectControlLinearizer::ValueEffectControl 3002 EffectControlLinearizer::ValueEffectControl
3001 EffectControlLinearizer::LowerTransitionElementsKind(Node* node, Node* effect, 3003 EffectControlLinearizer::LowerTransitionElementsKind(Node* node, Node* effect,
3002 Node* control) { 3004 Node* control) {
3003 ElementsTransition const transition = ElementsTransitionOf(node->op()); 3005 ElementsTransition const transition = ElementsTransitionOf(node->op());
3004 Node* object = node->InputAt(0); 3006 Node* object = node->InputAt(0);
3005 Node* source_map = node->InputAt(1); 3007 Node* source_map = jsgraph()->HeapConstant(transition.source());
3006 Node* target_map = node->InputAt(2); 3008 Node* target_map = jsgraph()->HeapConstant(transition.target());
3007 3009
3008 // Load the current map of {object}. 3010 // Load the current map of {object}.
3009 Node* object_map = effect = 3011 Node* object_map = effect =
3010 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), object, 3012 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), object,
3011 effect, control); 3013 effect, control);
3012 3014
3013 // Check if {object_map} is the same as {source_map}. 3015 // Check if {object_map} is the same as {source_map}.
3014 Node* check = 3016 Node* check =
3015 graph()->NewNode(machine()->WordEqual(), object_map, source_map); 3017 graph()->NewNode(machine()->WordEqual(), object_map, source_map);
3016 Node* branch = 3018 Node* branch =
3017 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control); 3019 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control);
3018 3020
3019 // Migrate the {object} from {source_map} to {target_map}. 3021 // Migrate the {object} from {source_map} to {target_map}.
3020 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 3022 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
3021 Node* etrue = effect; 3023 Node* etrue = effect;
3022 { 3024 {
3023 switch (transition) { 3025 switch (transition.mode()) {
3024 case ElementsTransition::kFastTransition: { 3026 case ElementsTransition::kFastTransition: {
3025 // In-place migration of {object}, just store the {target_map}. 3027 // In-place migration of {object}, just store the {target_map}.
3026 etrue = 3028 etrue =
3027 graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), 3029 graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()),
3028 object, target_map, etrue, if_true); 3030 object, target_map, etrue, if_true);
3029 break; 3031 break;
3030 } 3032 }
3031 case ElementsTransition::kSlowTransition: { 3033 case ElementsTransition::kSlowTransition: {
3032 // Instance migration, call out to the runtime for {object}. 3034 // Instance migration, call out to the runtime for {object}.
3033 Operator::Properties properties = 3035 Operator::Properties properties =
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
3620 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3622 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3621 Operator::kEliminatable); 3623 Operator::kEliminatable);
3622 to_number_operator_.set(common()->Call(desc)); 3624 to_number_operator_.set(common()->Call(desc));
3623 } 3625 }
3624 return to_number_operator_.get(); 3626 return to_number_operator_.get();
3625 } 3627 }
3626 3628
3627 } // namespace compiler 3629 } // namespace compiler
3628 } // namespace internal 3630 } // namespace internal
3629 } // namespace v8 3631 } // namespace v8
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/compiler/js-builtin-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698