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

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

Issue 1521553003: dart2js cps: Replace GetLazyStatic with GetStatic. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Remove obsolete comment 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) 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.optimizers; 5 library dart2js.cps_ir.optimizers;
6 6
7 import 'cps_ir_nodes.dart'; 7 import 'cps_ir_nodes.dart';
8 import '../constants/values.dart'; 8 import '../constants/values.dart';
9 9
10 export 'type_propagation.dart' show TypePropagator; 10 export 'type_propagation.dart' show TypePropagator;
11 export 'scalar_replacement.dart' show ScalarReplacer; 11 export 'scalar_replacement.dart' show ScalarReplacer;
12 export 'redundant_phi.dart' show RedundantPhiEliminator; 12 export 'redundant_phi.dart' show RedundantPhiEliminator;
13 export 'redundant_join.dart' show RedundantJoinEliminator; 13 export 'redundant_join.dart' show RedundantJoinEliminator;
14 export 'shrinking_reductions.dart' show ShrinkingReducer; 14 export 'shrinking_reductions.dart' show ShrinkingReducer;
15 export 'mutable_ssa.dart' show MutableVariableEliminator; 15 export 'mutable_ssa.dart' show MutableVariableEliminator;
16 export 'insert_refinements.dart' show InsertRefinements; 16 export 'insert_refinements.dart' show InsertRefinements;
17 export 'update_refinements.dart' show UpdateRefinements; 17 export 'update_refinements.dart' show UpdateRefinements;
18 export 'redundant_refinement.dart' show RedundantRefinementEliminator; 18 export 'redundant_refinement.dart' show RedundantRefinementEliminator;
19 export 'optimize_interceptors.dart' show OptimizeInterceptors; 19 export 'optimize_interceptors.dart' show OptimizeInterceptors;
20 export 'bounds_checker.dart' show BoundsChecker; 20 export 'bounds_checker.dart' show BoundsChecker;
21 export 'gvn.dart' show GVN; 21 export 'gvn.dart' show GVN;
22 export 'eagerly_load_statics.dart' show EagerlyLoadStatics;
22 export 'parent_visitor.dart' show ParentVisitor; 23 export 'parent_visitor.dart' show ParentVisitor;
23 24
24 /// An optimization pass over the CPS IR. 25 /// An optimization pass over the CPS IR.
25 abstract class Pass { 26 abstract class Pass {
26 /// Applies optimizations to root, rewriting it in the process. 27 /// Applies optimizations to root, rewriting it in the process.
27 void rewrite(FunctionDefinition root); 28 void rewrite(FunctionDefinition root);
28 29
29 String get passName; 30 String get passName;
30 } 31 }
31 32
32 // Shared code between optimizations 33 // Shared code between optimizations
33 34
34 /// Returns true if [value] is false, null, 0, -0, NaN, or the empty string. 35 /// Returns true if [value] is false, null, 0, -0, NaN, or the empty string.
35 bool isFalsyConstant(ConstantValue value) { 36 bool isFalsyConstant(ConstantValue value) {
36 return value.isFalse || 37 return value.isFalse ||
37 value.isNull || 38 value.isNull ||
38 value.isZero || 39 value.isZero ||
39 value.isMinusZero || 40 value.isMinusZero ||
40 value.isNaN || 41 value.isNaN ||
41 value is StringConstantValue && value.primitiveValue.isEmpty; 42 value is StringConstantValue && value.primitiveValue.isEmpty;
42 } 43 }
43 44
44 /// Returns true if [value] satisfies a branching condition with the 45 /// Returns true if [value] satisfies a branching condition with the
45 /// given strictness. 46 /// given strictness.
46 /// 47 ///
47 /// For non-strict, this is the opposite of [isFalsyConstant]. 48 /// For non-strict, this is the opposite of [isFalsyConstant].
48 bool isTruthyConstant(ConstantValue value, {bool strict: false}) { 49 bool isTruthyConstant(ConstantValue value, {bool strict: false}) {
49 return strict ? value.isTrue : !isFalsyConstant(value); 50 return strict ? value.isTrue : !isFalsyConstant(value);
50 } 51 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/gvn.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698