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

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

Issue 1388473003: dart2js cps_ir: Use interceptors for is-checks. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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.ir_builder; 5 library dart2js.ir_builder;
6 6
7 import '../common/names.dart' show 7 import '../common/names.dart' show
8 Names, 8 Names,
9 Selectors; 9 Selectors;
10 import '../compile_time_constants.dart' show 10 import '../compile_time_constants.dart' show
(...skipping 2735 matching lines...) Expand 10 before | Expand all | Expand 10 after
2746 // This is not an optimization: the TypeOperator assumes that `null` 2746 // This is not an optimization: the TypeOperator assumes that `null`
2747 // cannot satisfy the type test unless the type is a type variable. 2747 // cannot satisfy the type test unless the type is a type variable.
2748 if (type.isObject || type.isDynamic) { 2748 if (type.isObject || type.isDynamic) {
2749 // `x is Object` and `x is dynamic` are always true, even if x is null. 2749 // `x is Object` and `x is dynamic` are always true, even if x is null.
2750 return buildBooleanConstant(true); 2750 return buildBooleanConstant(true);
2751 } 2751 }
2752 if (type is InterfaceType && type.element == program.nullClass) { 2752 if (type is InterfaceType && type.element == program.nullClass) {
2753 // `x is Null` is true if and only if x is null. 2753 // `x is Null` is true if and only if x is null.
2754 return _buildCheckNull(value); 2754 return _buildCheckNull(value);
2755 } 2755 }
2756 return addPrimitive(new ir.TypeTest(value, type, typeArguments)); 2756 if (type.isInterfaceType && type.isRaw) {
sra1 2015/10/06 06:47:58 I think this could me moved to type_propagation.
sra1 2015/10/07 04:01:06 Done.
2757 return addPrimitive(new ir.TypeTestRaw(value, type));
2758 } else {
2759 return addPrimitive(new ir.TypeTest(value, type, typeArguments));
2760 }
2757 } else { 2761 } else {
2758 if (type.isObject || type.isDynamic) { 2762 if (type.isObject || type.isDynamic) {
2759 // `x as Object` and `x as dynamic` are the same as `x`. 2763 // `x as Object` and `x as dynamic` are the same as `x`.
2760 return value; 2764 return value;
2761 } 2765 }
2762 return _continueWithExpression( 2766 return _continueWithExpression(
2763 (k) => new ir.TypeCast(value, type, typeArguments, k)); 2767 (k) => new ir.TypeCast(value, type, typeArguments, k));
2764 } 2768 }
2765 } 2769 }
2766 2770
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2885 } 2889 }
2886 2890
2887 class SwitchCaseInfo { 2891 class SwitchCaseInfo {
2888 final List<ir.Primitive> constants = <ir.Primitive>[]; 2892 final List<ir.Primitive> constants = <ir.Primitive>[];
2889 final SubbuildFunction buildBody; 2893 final SubbuildFunction buildBody;
2890 2894
2891 SwitchCaseInfo(this.buildBody); 2895 SwitchCaseInfo(this.buildBody);
2892 2896
2893 void addConstant(ir.Primitive constant) => constants.add(constant); 2897 void addConstant(ir.Primitive constant) => constants.add(constant);
2894 } 2898 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698