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

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

Issue 2961563003: Hopefully the last bit of restructuring between closture classes and loop boxing, etc. (Closed)
Patch Set: Created 3 years, 5 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 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../closure.dart' show LoopClosureRepresentationInfo; 7 import '../closure.dart' show ClosureBase;
8 import '../elements/jumps.dart'; 8 import '../elements/jumps.dart';
9 import '../io/source_information.dart'; 9 import '../io/source_information.dart';
10 import '../tree/tree.dart' as ast; 10 import '../tree/tree.dart' as ast;
11 11
12 import 'builder.dart'; 12 import 'builder.dart';
13 import 'builder_kernel.dart'; 13 import 'builder_kernel.dart';
14 import 'graph_builder.dart'; 14 import 'graph_builder.dart';
15 import 'jump_handler.dart'; 15 import 'jump_handler.dart';
16 import 'kernel_ast_adapter.dart'; 16 import 'kernel_ast_adapter.dart';
17 import 'locals_handler.dart'; 17 import 'locals_handler.dart';
18 import 'nodes.dart'; 18 import 'nodes.dart';
19 19
20 /// Builds the SSA graph for loop nodes. 20 /// Builds the SSA graph for loop nodes.
21 abstract class LoopHandler<T> { 21 abstract class LoopHandler<T> {
22 final GraphBuilder builder; 22 final GraphBuilder builder;
23 23
24 LoopHandler(this.builder); 24 LoopHandler(this.builder);
25 25
26 /// Builds a graph for the given [loop] node. 26 /// Builds a graph for the given [loop] node.
27 /// 27 ///
28 /// For while loops, [initialize] and [update] are null. 28 /// For while loops, [initialize] and [update] are null.
29 /// The [condition] function must return a boolean result. 29 /// The [condition] function must return a boolean result.
30 /// None of the functions must leave anything on the stack. 30 /// None of the functions must leave anything on the stack.
31 void handleLoop(T loop, LoopClosureRepresentationInfo loopClosureInfo, 31 void handleLoop(T loop, ClosureBase loopClosureInfo, void initialize(),
32 void initialize(), HInstruction condition(), void update(), void body()) { 32 HInstruction condition(), void update(), void body()) {
33 // Generate: 33 // Generate:
34 // <initializer> 34 // <initializer>
35 // loop-entry: 35 // loop-entry:
36 // if (!<condition>) goto loop-exit; 36 // if (!<condition>) goto loop-exit;
37 // <body> 37 // <body>
38 // <updates> 38 // <updates>
39 // goto loop-entry; 39 // goto loop-entry;
40 // loop-exit: 40 // loop-exit:
41 41
42 builder.localsHandler.startLoop(loopClosureInfo); 42 builder.localsHandler.startLoop(loopClosureInfo);
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 HLoopBlockInformation.DO_WHILE_LOOP; 386 HLoopBlockInformation.DO_WHILE_LOOP;
387 387
388 @override 388 @override
389 int visitForInStatement(ir.ForInStatement node) => 389 int visitForInStatement(ir.ForInStatement node) =>
390 HLoopBlockInformation.FOR_IN_LOOP; 390 HLoopBlockInformation.FOR_IN_LOOP;
391 391
392 @override 392 @override
393 int visitSwitchStatement(ir.SwitchStatement node) => 393 int visitSwitchStatement(ir.SwitchStatement node) =>
394 HLoopBlockInformation.SWITCH_CONTINUE_LOOP; 394 HLoopBlockInformation.SWITCH_CONTINUE_LOOP;
395 } 395 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698