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

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

Issue 2813603002: Less direct Compiler use in SSA (Closed)
Patch Set: Created 3 years, 8 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 '../compiler.dart'; 5 import '../common.dart';
6 import '../io/source_information.dart'; 6 import '../io/source_information.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';
11 import 'nodes.dart'; 11 import 'nodes.dart';
12 12
13 class SsaBranch { 13 class SsaBranch {
14 final SsaBranchBuilder branchBuilder; 14 final SsaBranchBuilder branchBuilder;
15 final HBasicBlock block; 15 final HBasicBlock block;
16 LocalsHandler startLocals; 16 LocalsHandler startLocals;
17 LocalsHandler exitLocals; 17 LocalsHandler exitLocals;
18 SubGraph graph; 18 SubGraph graph;
19 19
20 SsaBranch(this.branchBuilder) : block = new HBasicBlock(); 20 SsaBranch(this.branchBuilder) : block = new HBasicBlock();
21 } 21 }
22 22
23 class SsaBranchBuilder { 23 class SsaBranchBuilder {
24 final GraphBuilder builder; 24 final GraphBuilder builder;
25 final Compiler compiler;
26 final ast.Node diagnosticNode; 25 final ast.Node diagnosticNode;
27 26
28 SsaBranchBuilder(this.builder, this.compiler, [this.diagnosticNode]); 27 SsaBranchBuilder(this.builder, [this.diagnosticNode]);
29 28
30 void checkNotAborted() { 29 void checkNotAborted() {
31 if (builder.isAborted()) { 30 if (builder.isAborted()) {
32 compiler.unimplemented(diagnosticNode, "aborted control flow"); 31 throw new SpannableAssertionFailure(
32 diagnosticNode, "aborted control flow");
33 } 33 }
34 } 34 }
35 35
36 void buildCondition( 36 void buildCondition(
37 void visitCondition(), 37 void visitCondition(),
38 SsaBranch conditionBranch, 38 SsaBranch conditionBranch,
39 SsaBranch thenBranch, 39 SsaBranch thenBranch,
40 SsaBranch elseBranch, 40 SsaBranch elseBranch,
41 SourceInformation sourceInformation) { 41 SourceInformation sourceInformation) {
42 startBranch(conditionBranch); 42 startBranch(conditionBranch);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 new HSubGraphBlockInformation(elseBranch.graph)); 219 new HSubGraphBlockInformation(elseBranch.graph));
220 220
221 HBasicBlock conditionStartBlock = conditionBranch.block; 221 HBasicBlock conditionStartBlock = conditionBranch.block;
222 conditionStartBlock.setBlockFlow(info, joinBlock); 222 conditionStartBlock.setBlockFlow(info, joinBlock);
223 SubGraph conditionGraph = conditionBranch.graph; 223 SubGraph conditionGraph = conditionBranch.graph;
224 HIf branch = conditionGraph.end.last; 224 HIf branch = conditionGraph.end.last;
225 assert(branch is HIf); 225 assert(branch is HIf);
226 branch.blockInformation = conditionStartBlock.blockFlow; 226 branch.blockInformation = conditionStartBlock.blockFlow;
227 } 227 }
228 } 228 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698