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

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

Issue 1159643005: dart2js cps: Do not propagate impure expressions across null receiver. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Extra fix in type propagation Created 5 years, 6 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 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.statement_rewriter; 5 library tree_ir.optimization.statement_rewriter;
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 /** 10 /**
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 nodes[i] = visitExpression(nodes[i]); 340 nodes[i] = visitExpression(nodes[i]);
341 } 341 }
342 } 342 }
343 343
344 Expression visitInvokeStatic(InvokeStatic node) { 344 Expression visitInvokeStatic(InvokeStatic node) {
345 _rewriteList(node.arguments); 345 _rewriteList(node.arguments);
346 return node; 346 return node;
347 } 347 }
348 348
349 Expression visitInvokeMethod(InvokeMethod node) { 349 Expression visitInvokeMethod(InvokeMethod node) {
350 _rewriteList(node.arguments); 350 if (node.receiverIsNotNull) {
351 node.receiver = visitExpression(node.receiver); 351 _rewriteList(node.arguments);
352 node.receiver = visitExpression(node.receiver);
353 } else {
354 // Impure expressions cannot be propagated across the method lookup,
355 // because it throws when the receiver is null.
356 inEmptyEnvironment(() {
357 _rewriteList(node.arguments);
358 });
359 node.receiver = visitExpression(node.receiver);
360 }
352 return node; 361 return node;
353 } 362 }
354 363
355 Expression visitInvokeMethodDirectly(InvokeMethodDirectly node) { 364 Expression visitInvokeMethodDirectly(InvokeMethodDirectly node) {
356 _rewriteList(node.arguments); 365 _rewriteList(node.arguments);
357 node.receiver = visitExpression(node.receiver); 366 node.receiver = visitExpression(node.receiver);
358 return node; 367 return node;
359 } 368 }
360 369
361 Expression visitInvokeConstructor(InvokeConstructor node) { 370 Expression visitInvokeConstructor(InvokeConstructor node) {
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 } 912 }
904 913
905 /// Result of combining two expressions that do not affect reference counting. 914 /// Result of combining two expressions that do not affect reference counting.
906 class GenericCombinedExpressions implements CombinedExpressions { 915 class GenericCombinedExpressions implements CombinedExpressions {
907 Expression combined; 916 Expression combined;
908 917
909 GenericCombinedExpressions(this.combined); 918 GenericCombinedExpressions(this.combined);
910 919
911 void uncombine() {} 920 void uncombine() {}
912 } 921 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698