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

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

Issue 2246623002: Delete CPS IR (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library dart2js.cps_ir.optimizers;
6
7 import '../common/names.dart';
8 import '../constants/values.dart';
9 import '../universe/selector.dart';
10 import 'cps_ir_nodes.dart';
11
12 export 'backward_null_check_remover.dart' show BackwardNullCheckRemover;
13 export 'bounds_checker.dart' show BoundsChecker;
14 export 'eagerly_load_statics.dart' show EagerlyLoadStatics;
15 export 'gvn.dart' show GVN;
16 export 'inline.dart' show Inliner;
17 export 'insert_refinements.dart' show InsertRefinements;
18 export 'loop_invariant_branch.dart' show LoopInvariantBranchMotion;
19 export 'mutable_ssa.dart' show MutableVariableEliminator;
20 export 'optimize_interceptors.dart' show OptimizeInterceptors;
21 export 'parent_visitor.dart' show ParentVisitor;
22 export 'path_based_optimizer.dart' show PathBasedOptimizer;
23 export 'redundant_join.dart' show RedundantJoinEliminator;
24 export 'redundant_phi.dart' show RedundantPhiEliminator;
25 export 'redundant_refinement.dart' show RedundantRefinementEliminator;
26 export 'scalar_replacement.dart' show ScalarReplacer;
27 export 'shrinking_reductions.dart' show ShrinkingReducer;
28 export 'type_propagation.dart' show TypePropagator;
29 export 'update_refinements.dart' show UpdateRefinements;
30 export 'use_field_initializers.dart' show UseFieldInitializers;
31
32 /// An optimization pass over the CPS IR.
33 abstract class Pass {
34 /// Applies optimizations to root, rewriting it in the process.
35 void rewrite(FunctionDefinition root);
36
37 String get passName;
38 }
39
40 // Shared code between optimizations
41
42 /// Returns true if [value] is false, null, 0, -0, NaN, or the empty string.
43 bool isFalsyConstant(ConstantValue value) {
44 return value.isFalse ||
45 value.isNull ||
46 value.isZero ||
47 value.isMinusZero ||
48 value.isNaN ||
49 value is StringConstantValue && value.primitiveValue.isEmpty;
50 }
51
52 /// Returns true if [value] satisfies a branching condition with the
53 /// given strictness.
54 ///
55 /// For non-strict, this is the opposite of [isFalsyConstant].
56 bool isTruthyConstant(ConstantValue value, {bool strict: false}) {
57 return strict ? value.isTrue : !isFalsyConstant(value);
58 }
59
60 /// Selectors that do not throw when invoked on the null value.
61 final List<Selector> selectorsOnNull = <Selector>[
62 Selectors.equals,
63 Selectors.hashCode_,
64 Selectors.runtimeType_,
65 Selectors.toString_,
66 Selectors.toStringGetter,
67 Selectors.noSuchMethodGetter
68 ];
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/optimize_interceptors.dart ('k') | pkg/compiler/lib/src/cps_ir/parent_visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698