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

Side by Side Diff: pkg/compiler/lib/src/ssa/jump_handler.dart

Issue 3007783004: Handle switch continue (Closed)
Patch Set: Updated cf. comment Created 3 years, 3 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import '../common.dart'; 5 import '../common.dart';
6 import '../elements/jumps.dart'; 6 import '../elements/jumps.dart';
7 import '../tree/tree.dart' as ast; 7 import '../tree/tree.dart' as ast;
8 8
9 import 'graph_builder.dart'; 9 import 'graph_builder.dart';
10 import 'locals_handler.dart'; 10 import 'locals_handler.dart';
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 return label != null && targetIndexMap.containsKey(label.target); 177 return label != null && targetIndexMap.containsKey(label.target);
178 } 178 }
179 179
180 void generateContinue([LabelDefinition label]) { 180 void generateContinue([LabelDefinition label]) {
181 if (isContinueToSwitchCase(label)) { 181 if (isContinueToSwitchCase(label)) {
182 // Creates the special instructions 'label = i; continue l;' used in 182 // Creates the special instructions 'label = i; continue l;' used in
183 // switch statements with continue statements. See 183 // switch statements with continue statements. See
184 // [SsaFromAstMixin.buildComplexSwitchStatement] for detail. 184 // [SsaFromAstMixin.buildComplexSwitchStatement] for detail.
185 185
186 assert(label != null); 186 assert(label != null);
187 // TODO(het): change the graph 'addConstantXXX' to take a ConstantSystem
188 // instead of a Compiler.
189 HInstruction value = builder.graph 187 HInstruction value = builder.graph
190 .addConstantInt(targetIndexMap[label.target], builder.closedWorld); 188 .addConstantInt(targetIndexMap[label.target], builder.closedWorld);
191 builder.localsHandler.updateLocal(target, value); 189 builder.localsHandler.updateLocal(target, value);
192 190
193 assert(label.target.labels.contains(label)); 191 assert(label.target.labels.contains(label));
194 HInstruction continueInstruction = new HContinue(target); 192 HInstruction continueInstruction = new HContinue(target);
195 LocalsHandler locals = new LocalsHandler.from(builder.localsHandler); 193 LocalsHandler locals = new LocalsHandler.from(builder.localsHandler);
196 builder.close(continueInstruction); 194 builder.close(continueInstruction);
197 jumps.add(new _JumpHandlerEntry(continueInstruction, locals)); 195 jumps.add(new _JumpHandlerEntry(continueInstruction, locals));
198 } else { 196 } else {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 targetIndexMap[continueTarget] = switchIndex; 229 targetIndexMap[continueTarget] = switchIndex;
232 assert(builder.jumpTargets[continueTarget] == null); 230 assert(builder.jumpTargets[continueTarget] == null);
233 builder.jumpTargets[continueTarget] = this; 231 builder.jumpTargets[continueTarget] = this;
234 } 232 }
235 } 233 }
236 } 234 }
237 switchIndex++; 235 switchIndex++;
238 } 236 }
239 } 237 }
240 } 238 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_model/locals.dart ('k') | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698