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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/optimization/pull_into_initializers.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 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library tree_ir.optimization.pull_into_initializers; 5 library tree_ir.optimization.pull_into_initializers;
6 6
7 import 'optimization.dart' show Pass; 7 import 'optimization.dart' show Pass;
8 import '../tree_ir_nodes.dart'; 8 import '../tree_ir_nodes.dart';
9 9
10 /// Where a variable has been assigned. 10 /// Where a variable has been assigned.
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 ++impureCounter; 331 ++impureCounter;
332 return node; 332 return node;
333 } 333 }
334 334
335 Expression visitSetIndex(SetIndex node) { 335 Expression visitSetIndex(SetIndex node) {
336 super.visitSetIndex(node); 336 super.visitSetIndex(node);
337 ++impureCounter; 337 ++impureCounter;
338 return node; 338 return node;
339 } 339 }
340 340
341 void visitInnerFunction(FunctionDefinition node) {
342 new PullIntoInitializers().rewrite(node);
343 }
344
345 Expression visitFunctionExpression(FunctionExpression node) {
346 visitInnerFunction(node.definition);
347 return node;
348 }
349
350 Expression visitApplyBuiltinOperator(ApplyBuiltinOperator node) { 341 Expression visitApplyBuiltinOperator(ApplyBuiltinOperator node) {
351 rewriteList(node.arguments); 342 rewriteList(node.arguments);
352 return node; 343 return node;
353 } 344 }
354 345
355 Expression visitApplyBuiltinMethod(ApplyBuiltinMethod node) { 346 Expression visitApplyBuiltinMethod(ApplyBuiltinMethod node) {
356 node.receiver = visitExpression(node.receiver); 347 node.receiver = visitExpression(node.receiver);
357 if (!node.receiverIsNotNull) { 348 if (!node.receiverIsNotNull) {
358 // If the receiver is null, the method lookup throws. 349 // If the receiver is null, the method lookup throws.
359 ++impureCounter; 350 ++impureCounter;
360 } 351 }
361 rewriteList(node.arguments); 352 rewriteList(node.arguments);
362 ++impureCounter; 353 ++impureCounter;
363 return node; 354 return node;
364 } 355 }
365 356
366 @override 357 @override
367 Expression visitForeignExpression(ForeignExpression node) { 358 Expression visitForeignExpression(ForeignExpression node) {
368 rewriteList(node.arguments); 359 rewriteList(node.arguments);
369 if (node.nativeBehavior.sideEffects.hasSideEffects()) { 360 if (node.nativeBehavior.sideEffects.hasSideEffects()) {
370 ++impureCounter; 361 ++impureCounter;
371 } 362 }
372 return node; 363 return node;
373 } 364 }
374 } 365 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698