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

Side by Side Diff: pkg/compiler/lib/src/js_backend/codegen/unsugar.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 dart2js.unsugar_cps; 1 library dart2js.unsugar_cps;
2 2
3 import '../../cps_ir/cps_ir_nodes.dart'; 3 import '../../cps_ir/cps_ir_nodes.dart';
4 4
5 import '../../cps_ir/optimizers.dart' show ParentVisitor, Pass; 5 import '../../cps_ir/optimizers.dart' show ParentVisitor, Pass;
6 import '../../constants/values.dart'; 6 import '../../constants/values.dart';
7 import '../../elements/elements.dart'; 7 import '../../elements/elements.dart';
8 import '../../js_backend/codegen/glue.dart'; 8 import '../../js_backend/codegen/glue.dart';
9 import '../../universe/selector.dart' show Selector; 9 import '../../universe/selector.dart' show Selector;
10 import '../../cps_ir/cps_ir_builder.dart' show ThisParameterLocal; 10 import '../../cps_ir/cps_ir_builder.dart' show ThisParameterLocal;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // Rethrow can only appear in a catch block. It throws that block's 183 // Rethrow can only appear in a catch block. It throws that block's
184 // (wrapped) caught exception. 184 // (wrapped) caught exception.
185 Throw replacement = new Throw(_exceptionParameter); 185 Throw replacement = new Throw(_exceptionParameter);
186 InteriorNode parent = node.parent; 186 InteriorNode parent = node.parent;
187 parent.body = replacement; 187 parent.body = replacement;
188 replacement.parent = parent; 188 replacement.parent = parent;
189 // The original rethrow does not have any references that we need to 189 // The original rethrow does not have any references that we need to
190 // worry about unlinking. 190 // worry about unlinking.
191 } 191 }
192 192
193 // TODO(24523): Insert interceptor on demand when we discover we want to use
194 // one rather than on every check.
195 processTypeTest(TypeTest node) {
196 assert(node.interceptor == null);
197 Primitive receiver = node.value.definition;
198 Primitive interceptor = new Interceptor(receiver, node.sourceInformation)
199 ..interceptedClasses.addAll(_glue.interceptedClasses);
200 new LetPrim(interceptor).insertAbove(node.parent);
201 node.interceptor = new Reference<Primitive>(interceptor);
202 node.interceptor.parent = node;
203 }
204
205 bool isNullConstant(Primitive prim) { 193 bool isNullConstant(Primitive prim) {
206 return prim is Constant && prim.value.isNull; 194 return prim is Constant && prim.value.isNull;
207 } 195 }
208 196
209 processInvokeMethod(InvokeMethod node) { 197 processInvokeMethod(InvokeMethod node) {
210 Selector selector = node.selector; 198 Selector selector = node.selector;
211 if (!_glue.isInterceptedSelector(selector)) return; 199 if (!_glue.isInterceptedSelector(selector)) return;
212 200
213 // Some platform libraries will compare non-interceptable objects against 201 // Some platform libraries will compare non-interceptable objects against
214 // null using the Dart == operator. These must be translated directly. 202 // null using the Dart == operator. These must be translated directly.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 253 }
266 node.arguments.insert(0, node.receiver); 254 node.arguments.insert(0, node.receiver);
267 node.receiver = new Reference<Primitive>(newReceiver)..parent = node; 255 node.receiver = new Reference<Primitive>(newReceiver)..parent = node;
268 node.callingConvention = CallingConvention.Intercepted; 256 node.callingConvention = CallingConvention.Intercepted;
269 } 257 }
270 258
271 processInterceptor(Interceptor node) { 259 processInterceptor(Interceptor node) {
272 _glue.registerSpecializedGetInterceptor(node.interceptedClasses); 260 _glue.registerSpecializedGetInterceptor(node.interceptedClasses);
273 } 261 }
274 } 262 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/codegen.dart ('k') | pkg/compiler/lib/src/tree_ir/optimization/logical_rewriter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698