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

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

Issue 1188253006: dart2js cps: Replace getter/setter calls with direct field access. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix test case 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 dart2js.cps_ir.shrinking_reductions; 5 library dart2js.cps_ir.shrinking_reductions;
6 6
7 import 'cps_ir_nodes.dart'; 7 import 'cps_ir_nodes.dart';
8 import 'optimizers.dart'; 8 import 'optimizers.dart';
9 9
10 /** 10 /**
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 239 }
240 parameters.removeLast(); 240 parameters.removeLast();
241 241
242 // Removing an unused parameter can create an eta-redex. 242 // Removing an unused parameter can create an eta-redex.
243 if (_isEtaCont(continuation)) { 243 if (_isEtaCont(continuation)) {
244 _worklist.add(new _ReductionTask(_ReductionKind.ETA_CONT, continuation)); 244 _worklist.add(new _ReductionTask(_ReductionKind.ETA_CONT, continuation));
245 } 245 }
246 } 246 }
247 } 247 }
248 248
249 /// Returns true iff the bound primitive is unused. 249 /// Returns true iff the bound primitive is unused, and has no effects
250 bool _isDeadVal(LetPrim node) => !node.primitive.hasAtLeastOneUse; 250 /// preventing it from being eliminated.
251 bool _isDeadVal(LetPrim node) {
252 return node.primitive.hasNoUses && node.primitive.isSafeForElimination;
253 }
251 254
252 /// Returns true iff the continuation is unused. 255 /// Returns true iff the continuation is unused.
253 bool _isDeadCont(Continuation cont) { 256 bool _isDeadCont(Continuation cont) {
254 return !cont.isReturnContinuation && !cont.hasAtLeastOneUse; 257 return !cont.isReturnContinuation && !cont.hasAtLeastOneUse;
255 } 258 }
256 259
257 /// Returns true iff the continuation has a body (i.e., it is not the return 260 /// Returns true iff the continuation has a body (i.e., it is not the return
258 /// continuation), it is used exactly once, and that use is as the continuation 261 /// continuation), it is used exactly once, and that use is as the continuation
259 /// of a continuation invocation. 262 /// of a continuation invocation.
260 bool _isBetaContLin(Continuation cont) { 263 bool _isBetaContLin(Continuation cont) {
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 } 715 }
713 716
714 String toString() => "$kind: $node"; 717 String toString() => "$kind: $node";
715 } 718 }
716 719
717 /// A dummy class used solely to mark nodes as deleted once they are removed 720 /// A dummy class used solely to mark nodes as deleted once they are removed
718 /// from a term. 721 /// from a term.
719 class _DeletedNode extends Node { 722 class _DeletedNode extends Node {
720 accept(_) => null; 723 accept(_) => null;
721 } 724 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698