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

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

Issue 1859343004: dartfmt pkg/compiler (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 if (label2declaration.containsKey(label)) { 82 if (label2declaration.containsKey(label)) {
83 error('Duplicate declaration of label $label'); 83 error('Duplicate declaration of label $label');
84 } 84 }
85 label2declaration[label] = target; 85 label2declaration[label] = target;
86 labelUses[label] = 0; 86 labelUses[label] = 0;
87 visitStatement(target.body); 87 visitStatement(target.body);
88 label2declaration.remove(label); 88 label2declaration.remove(label);
89 89
90 if (labelUses[label] != label.useCount) { 90 if (labelUses[label] != label.useCount) {
91 error('Label $label has ${labelUses[label]} uses ' 91 error('Label $label has ${labelUses[label]} uses '
92 'but its reference count is ${label.useCount}'); 92 'but its reference count is ${label.useCount}');
93 } 93 }
94 } 94 }
95 95
96 visitLabeledStatement(LabeledStatement node) { 96 visitLabeledStatement(LabeledStatement node) {
97 visitJumpTargetBody(node); 97 visitJumpTargetBody(node);
98 visitStatement(node.next); 98 visitStatement(node.next);
99 } 99 }
100 100
101 visitWhileTrue(WhileTrue node) { 101 visitWhileTrue(WhileTrue node) {
102 visitJumpTargetBody(node); 102 visitJumpTargetBody(node);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 // Verify reference counters for all variables. 146 // Verify reference counters for all variables.
147 List<Variable> seenVariables = new List<Variable>(); 147 List<Variable> seenVariables = new List<Variable>();
148 seenVariables.addAll(varReads.keys); 148 seenVariables.addAll(varReads.keys);
149 seenVariables.addAll(varWrites.keys); 149 seenVariables.addAll(varWrites.keys);
150 for (Variable variable in seenVariables) { 150 for (Variable variable in seenVariables) {
151 int reads = varReads.putIfAbsent(variable, () => 0); 151 int reads = varReads.putIfAbsent(variable, () => 0);
152 int writes = varWrites.putIfAbsent(variable, () => 0); 152 int writes = varWrites.putIfAbsent(variable, () => 0);
153 if (reads != variable.readCount || writes != variable.writeCount) { 153 if (reads != variable.readCount || writes != variable.writeCount) {
154 error('Invalid reference count for $variable:\n' 154 error('Invalid reference count for $variable:\n'
155 '- Variable has $reads reads and $writes writes\n' 155 '- Variable has $reads reads and $writes writes\n'
156 '- Reference count is ${variable.readCount} reads and ' 156 '- Reference count is ${variable.readCount} reads and '
157 '${variable.writeCount} writes'); 157 '${variable.writeCount} writes');
158 } 158 }
159 } 159 }
160 } 160 }
161
162 } 161 }
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