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

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

Issue 1285173002: dart2js cps: Rewrite more List operations into JS array operations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: receiverIsNotNull -> optional param Created 5 years, 4 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 import '../../io/source_information.dart'; 9 import '../../io/source_information.dart';
10 10
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 // Impure expressions cannot be propagated across the method lookup, 484 // Impure expressions cannot be propagated across the method lookup,
485 // because it throws when the receiver is null. 485 // because it throws when the receiver is null.
486 inEmptyEnvironment(() { 486 inEmptyEnvironment(() {
487 _rewriteList(node.arguments); 487 _rewriteList(node.arguments);
488 }); 488 });
489 node.receiver = visitExpression(node.receiver); 489 node.receiver = visitExpression(node.receiver);
490 } 490 }
491 return node; 491 return node;
492 } 492 }
493 493
494 Expression visitApplyBuiltinMethod(ApplyBuiltinMethod node) {
495 if (node.receiverIsNotNull) {
496 _rewriteList(node.arguments);
497 node.receiver = visitExpression(node.receiver);
498 } else {
499 // Impure expressions cannot be propagated across the method lookup,
500 // because it throws when the receiver is null.
501 inEmptyEnvironment(() {
502 _rewriteList(node.arguments);
503 });
504 node.receiver = visitExpression(node.receiver);
505 }
506 return node;
507 }
508
494 Expression visitInvokeMethodDirectly(InvokeMethodDirectly node) { 509 Expression visitInvokeMethodDirectly(InvokeMethodDirectly node) {
495 _rewriteList(node.arguments); 510 _rewriteList(node.arguments);
496 node.receiver = visitExpression(node.receiver); 511 node.receiver = visitExpression(node.receiver);
497 return node; 512 return node;
498 } 513 }
499 514
500 Expression visitInvokeConstructor(InvokeConstructor node) { 515 Expression visitInvokeConstructor(InvokeConstructor node) {
501 _rewriteList(node.arguments); 516 _rewriteList(node.arguments);
502 return node; 517 return node;
503 } 518 }
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 VariableUseVisitor(this.callback); 1217 VariableUseVisitor(this.callback);
1203 1218
1204 visitVariableUse(VariableUse use) => callback(use); 1219 visitVariableUse(VariableUse use) => callback(use);
1205 1220
1206 visitInnerFunction(FunctionDefinition node) {} 1221 visitInnerFunction(FunctionDefinition node) {}
1207 1222
1208 static void visit(Expression node, VariableUseCallback callback) { 1223 static void visit(Expression node, VariableUseCallback callback) {
1209 new VariableUseVisitor(callback).visitExpression(node); 1224 new VariableUseVisitor(callback).visitExpression(node);
1210 } 1225 }
1211 } 1226 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698