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

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

Issue 1859343004: dartfmt pkg/compiler (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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.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 import '../common/names.dart'; 9 import '../common/names.dart';
10 import '../universe/selector.dart'; 10 import '../universe/selector.dart';
(...skipping 24 matching lines...) Expand all
35 void rewrite(FunctionDefinition root); 35 void rewrite(FunctionDefinition root);
36 36
37 String get passName; 37 String get passName;
38 } 38 }
39 39
40 // Shared code between optimizations 40 // Shared code between optimizations
41 41
42 /// Returns true if [value] is false, null, 0, -0, NaN, or the empty string. 42 /// Returns true if [value] is false, null, 0, -0, NaN, or the empty string.
43 bool isFalsyConstant(ConstantValue value) { 43 bool isFalsyConstant(ConstantValue value) {
44 return value.isFalse || 44 return value.isFalse ||
45 value.isNull || 45 value.isNull ||
46 value.isZero || 46 value.isZero ||
47 value.isMinusZero || 47 value.isMinusZero ||
48 value.isNaN || 48 value.isNaN ||
49 value is StringConstantValue && value.primitiveValue.isEmpty; 49 value is StringConstantValue && value.primitiveValue.isEmpty;
50 } 50 }
51 51
52 /// Returns true if [value] satisfies a branching condition with the 52 /// Returns true if [value] satisfies a branching condition with the
53 /// given strictness. 53 /// given strictness.
54 /// 54 ///
55 /// For non-strict, this is the opposite of [isFalsyConstant]. 55 /// For non-strict, this is the opposite of [isFalsyConstant].
56 bool isTruthyConstant(ConstantValue value, {bool strict: false}) { 56 bool isTruthyConstant(ConstantValue value, {bool strict: false}) {
57 return strict ? value.isTrue : !isFalsyConstant(value); 57 return strict ? value.isTrue : !isFalsyConstant(value);
58 } 58 }
59 59
60 /// Selectors that do not throw when invoked on the null value. 60 /// Selectors that do not throw when invoked on the null value.
61 final List<Selector> selectorsOnNull = <Selector>[ 61 final List<Selector> selectorsOnNull = <Selector>[
62 Selectors.equals, Selectors.hashCode_, Selectors.runtimeType_, 62 Selectors.equals,
63 Selectors.toString_, Selectors.toStringGetter, 63 Selectors.hashCode_,
64 Selectors.noSuchMethodGetter]; 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