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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_integrity.dart

Issue 1761903002: dart2js cps: Keep interceptors in a separate field. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase Created 4 years, 9 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 dart2js.cps_ir_integrity; 1 library dart2js.cps_ir_integrity;
2 2
3 import 'cps_ir_nodes.dart'; 3 import 'cps_ir_nodes.dart';
4 import 'cps_ir_nodes_sexpr.dart'; 4 import 'cps_ir_nodes_sexpr.dart';
5 import '../tracer.dart' as tracer; 5 import '../tracer.dart' as tracer;
6 6
7 /// Dump S-expressions on error if the tracer is enabled. 7 /// Dump S-expressions on error if the tracer is enabled.
8 /// 8 ///
9 /// Technically this has nothing to do with the tracer, but if you want one 9 /// Technically this has nothing to do with the tracer, but if you want one
10 /// enabled, you typically want the other as well, so we use the same flag. 10 /// enabled, you typically want the other as well, so we use the same flag.
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 enterScope(cont.parameters); 127 enterScope(cont.parameters);
128 // Put every continuation in scope at its own body. The isRecursive 128 // Put every continuation in scope at its own body. The isRecursive
129 // flag is checked explicitly using [insideContinuations]. 129 // flag is checked explicitly using [insideContinuations].
130 enterScope([cont]); 130 enterScope([cont]);
131 enterContinuation(cont); 131 enterContinuation(cont);
132 return cont.body; 132 return cont.body;
133 } 133 }
134 134
135 @override 135 @override
136 visitFunctionDefinition(FunctionDefinition node) { 136 visitFunctionDefinition(FunctionDefinition node) {
137 if (node.thisParameter != null) { 137 if (node.interceptorParameter != null) {
138 handleDeclaration(node.thisParameter); 138 handleDeclaration(node.interceptorParameter);
139 enterScope([node.thisParameter]); 139 enterScope([node.interceptorParameter]);
140 }
141 if (node.receiverParameter != null) {
142 handleDeclaration(node.receiverParameter);
143 enterScope([node.receiverParameter]);
140 } 144 }
141 node.parameters.forEach(handleDeclaration); 145 node.parameters.forEach(handleDeclaration);
142 enterScope(node.parameters); 146 enterScope(node.parameters);
143 handleDeclaration(node.returnContinuation); 147 handleDeclaration(node.returnContinuation);
144 enterScope([node.returnContinuation]); 148 enterScope([node.returnContinuation]);
145 if (!node.returnContinuation.isReturnContinuation) { 149 if (!node.returnContinuation.isReturnContinuation) {
146 error('Return continuation with a body', node); 150 error('Return continuation with a body', node);
147 } 151 }
148 visit(node.body); 152 visit(node.body);
149 } 153 }
(...skipping 24 matching lines...) Expand all
174 error('Recursive InvokeContinuation marked as non-recursive', node); 178 error('Recursive InvokeContinuation marked as non-recursive', node);
175 } 179 }
176 if (node.isRecursive && !target.isRecursive) { 180 if (node.isRecursive && !target.isRecursive) {
177 error('Recursive Continuation was not marked as recursive', node); 181 error('Recursive Continuation was not marked as recursive', node);
178 } 182 }
179 if (node.argumentRefs.length != target.parameters.length) { 183 if (node.argumentRefs.length != target.parameters.length) {
180 error('Arity mismatch in InvokeContinuation', node); 184 error('Arity mismatch in InvokeContinuation', node);
181 } 185 }
182 } 186 }
183 187
188 @override
189 processInvokeMethod(InvokeMethod node) {
190 if (node.callingConvention == CallingConvention.Intercepted) {
191 if (node.interceptorRef == null) {
192 error('No interceptor on intercepted call', node);
193 }
194 } else {
195 if (node.interceptorRef != null) {
196 error('Interceptor on call with ${node.callingConvention}', node);
197 }
198 }
199 }
200
184 void checkReferenceChain(Definition def) { 201 void checkReferenceChain(Definition def) {
185 Reference previous = null; 202 Reference previous = null;
186 for (Reference ref = def.firstRef; ref != null; ref = ref.next) { 203 for (Reference ref = def.firstRef; ref != null; ref = ref.next) {
187 if (ref.previous != ref) { 204 if (ref.previous != ref) {
188 // Reference was not seen during IR traversal, so it is orphaned. 205 // Reference was not seen during IR traversal, so it is orphaned.
189 error('Orphaned reference in reference chain for $def', def); 206 error('Orphaned reference in reference chain for $def', def);
190 } 207 }
191 // Repair the .previous link that was used for marking. 208 // Repair the .previous link that was used for marking.
192 ref.previous = previous; 209 ref.previous = previous;
193 previous = ref; 210 previous = ref;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 265 }
249 266
250 @override 267 @override
251 processReference(Reference node) { 268 processReference(Reference node) {
252 if (node.parent != _parent) { 269 if (node.parent != _parent) {
253 error('Parent pointer on $node is ${node.parent} but should be $_parent', 270 error('Parent pointer on $node is ${node.parent} but should be $_parent',
254 node); 271 node);
255 } 272 }
256 } 273 }
257 } 274 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_fragment.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698