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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/tree_ir_integrity.dart

Issue 1474713002: dart2js cps: Clean up and avoid processing unreachable code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge Created 5 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 library tree_ir.integrity; 1 library tree_ir.integrity;
2 2
3 import 'tree_ir_nodes.dart'; 3 import 'tree_ir_nodes.dart';
4 4
5 /// Performs integrity checks on the tree_ir. 5 /// Performs integrity checks on the tree_ir.
6 /// 6 ///
7 /// Should only be run for debugging purposes, not in production. 7 /// Should only be run for debugging purposes, not in production.
8 /// 8 ///
9 /// - Reference counts on must match the actual number of references. 9 /// - Reference counts on must match the actual number of references.
10 /// - Labels must be in scope when referenced. 10 /// - Labels must be in scope when referenced.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 visitContinue(Continue node) { 122 visitContinue(Continue node) {
123 if (!label2declaration.containsKey(node.target)) { 123 if (!label2declaration.containsKey(node.target)) {
124 error('Continue to label that is not in scope'); 124 error('Continue to label that is not in scope');
125 } 125 }
126 if (label2declaration[node.target] is! Loop) { 126 if (label2declaration[node.target] is! Loop) {
127 error('Continue to non-loop statement ${label2declaration[node.target]}'); 127 error('Continue to non-loop statement ${label2declaration[node.target]}');
128 } 128 }
129 labelUses[node.target]++; 129 labelUses[node.target]++;
130 } 130 }
131 131
132 visitInnerFunction(FunctionDefinition node) {
133 checkBody(node);
134 }
135
136 void checkBody(FunctionDefinition node) { 132 void checkBody(FunctionDefinition node) {
137 node.parameters.forEach(declare); 133 node.parameters.forEach(declare);
138 visitStatement(node.body); 134 visitStatement(node.body);
139 node.parameters.forEach(undeclare); 135 node.parameters.forEach(undeclare);
140 } 136 }
141 137
142 dynamic error(String message) { 138 dynamic error(String message) {
143 throw 'Tree IR integrity violation in ${topLevelNode.element}:\n$message'; 139 throw 'Tree IR integrity violation in ${topLevelNode.element}:\n$message';
144 } 140 }
145 141
(...skipping 11 matching lines...) Expand all
157 if (reads != variable.readCount || writes != variable.writeCount) { 153 if (reads != variable.readCount || writes != variable.writeCount) {
158 error('Invalid reference count for $variable:\n' 154 error('Invalid reference count for $variable:\n'
159 '- Variable has $reads reads and $writes writes\n' 155 '- Variable has $reads reads and $writes writes\n'
160 '- Reference count is ${variable.readCount} reads and ' 156 '- Reference count is ${variable.readCount} reads and '
161 '${variable.writeCount} writes'); 157 '${variable.writeCount} writes');
162 } 158 }
163 } 159 }
164 } 160 }
165 161
166 } 162 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698