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

Unified Diff: pkg/compiler/lib/src/cps_ir/type_mask_system.dart

Issue 1413213004: Move remaining helpers to BackendHelpers (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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/cps_ir/type_mask_system.dart
diff --git a/pkg/compiler/lib/src/cps_ir/type_mask_system.dart b/pkg/compiler/lib/src/cps_ir/type_mask_system.dart
index 6910d46392df3b18538939d2143c30cd88b22459..4abf1b29d85176947270e9a72552fe5c9a4f78be 100644
--- a/pkg/compiler/lib/src/cps_ir/type_mask_system.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_mask_system.dart
@@ -9,6 +9,7 @@ import '../compiler.dart' as dart2js show Compiler;
import '../constants/values.dart';
import '../dart_types.dart' as types;
import '../elements/elements.dart';
+import '../js_backend/backend_helpers.dart' show BackendHelpers;
import '../js_backend/js_backend.dart' show JavaScriptBackend;
import '../types/types.dart';
import '../types/constants.dart' show computeTypeMask;
@@ -48,7 +49,9 @@ class TypeMaskSystem {
TypeMask _indexableTypeTest;
- ClassElement get jsNullClass => backend.jsNullClass;
+ ClassElement get jsNullClass => helpers.jsNullClass;
+
+ BackendHelpers get helpers => backend.helpers;
// TODO(karlklose): remove compiler here.
TypeMaskSystem(dart2js.Compiler compiler)
@@ -69,9 +72,9 @@ class TypeMaskSystem {
new TypeMask.unionOf(<TypeMask>[anyNum, anyString, anyBool],
classWorld);
interceptorType =
- new TypeMask.nonNullSubtype(backend.jsInterceptorClass, classWorld);
+ new TypeMask.nonNullSubtype(helpers.jsInterceptorClass, classWorld);
- TypeMask typedArray = nonNullSubclass(backend.typedArrayClass);
+ TypeMask typedArray = nonNullSubclass(helpers.typedArrayClass);
fixedLengthType = new TypeMask.unionOf(
<TypeMask>[stringType, backend.fixedArrayType, typedArray],
classWorld);
@@ -80,7 +83,7 @@ class TypeMaskSystem {
// string because the type inference does not infer that all strings are
// indexables.
TypeMask indexable =
- new TypeMask.nonNullSubtype(backend.jsIndexableClass, classWorld);
+ new TypeMask.nonNullSubtype(helpers.jsIndexableClass, classWorld);
_indexableTypeTest = new TypeMask.unionOf(
<TypeMask>[indexable, anyString],
classWorld);
@@ -89,7 +92,7 @@ class TypeMaskSystem {
bool methodUsesReceiverArgument(FunctionElement function) {
assert(backend.isInterceptedMethod(function));
ClassElement clazz = function.enclosingClass.declaration;
- return clazz.isSubclassOf(backend.jsInterceptorClass) ||
+ return clazz.isSubclassOf(helpers.jsInterceptorClass) ||
classWorld.isUsedAsMixin(clazz);
}
@@ -218,7 +221,7 @@ class TypeMaskSystem {
bool isDefinitelyNonNegativeInt(TypeMask t, {bool allowNull: false}) {
if (!allowNull && t.isNullable) return false;
// The JSPositiveInt class includes zero, despite the name.
- return t.satisfies(backend.jsPositiveIntClass, classWorld);
+ return t.satisfies(helpers.jsPositiveIntClass, classWorld);
}
bool isDefinitelyInt(TypeMask t, {bool allowNull: false}) {
@@ -228,17 +231,17 @@ class TypeMaskSystem {
bool isDefinitelyUint31(TypeMask t, {bool allowNull: false}) {
if (!allowNull && t.isNullable) return false;
- return t.satisfies(backend.jsUInt31Class, classWorld);
+ return t.satisfies(helpers.jsUInt31Class, classWorld);
}
bool isDefinitelyUint32(TypeMask t, {bool allowNull: false}) {
if (!allowNull && t.isNullable) return false;
- return t.satisfies(backend.jsUInt32Class, classWorld);
+ return t.satisfies(helpers.jsUInt32Class, classWorld);
}
bool isDefinitelyUint(TypeMask t, {bool allowNull: false}) {
if (!allowNull && t.isNullable) return false;
- return t.satisfies(backend.jsPositiveIntClass, classWorld);
+ return t.satisfies(helpers.jsPositiveIntClass, classWorld);
}
// TODO(sra): Find a better name. 'NativeList' is a bad name because there
@@ -246,22 +249,22 @@ class TypeMaskSystem {
// should not be) included in this predicate.
bool isDefinitelyNativeList(TypeMask t, {bool allowNull: false}) {
if (!allowNull && t.isNullable) return false;
- return t.nonNullable().satisfies(backend.jsArrayClass, classWorld);
+ return t.nonNullable().satisfies(helpers.jsArrayClass, classWorld);
}
bool isDefinitelyMutableNativeList(TypeMask t, {bool allowNull: false}) {
if (!allowNull && t.isNullable) return false;
- return t.nonNullable().satisfies(backend.jsMutableArrayClass, classWorld);
+ return t.nonNullable().satisfies(helpers.jsMutableArrayClass, classWorld);
}
bool isDefinitelyFixedNativeList(TypeMask t, {bool allowNull: false}) {
if (!allowNull && t.isNullable) return false;
- return t.nonNullable().satisfies(backend.jsFixedArrayClass, classWorld);
+ return t.nonNullable().satisfies(helpers.jsFixedArrayClass, classWorld);
}
bool isDefinitelyExtendableNativeList(TypeMask t, {bool allowNull: false}) {
if (!allowNull && t.isNullable) return false;
- return t.nonNullable().satisfies(backend.jsExtendableArrayClass,
+ return t.nonNullable().satisfies(helpers.jsExtendableArrayClass,
classWorld);
}
@@ -272,7 +275,7 @@ class TypeMaskSystem {
bool isDefinitelyMutableIndexable(TypeMask t, {bool allowNull: false}) {
if (!allowNull && t.isNullable) return false;
- return t.nonNullable().satisfies(backend.jsMutableIndexableClass,
+ return t.nonNullable().satisfies(helpers.jsMutableIndexableClass,
classWorld);
}
@@ -383,8 +386,8 @@ class TypeMaskSystem {
if (isDefinitelyString(type)) {
return stringType;
}
- if (type.satisfies(backend.typedArrayClass, classWorld)) {
- if (type.satisfies(backend.typedArrayOfIntClass, classWorld)) {
+ if (type.satisfies(helpers.typedArrayClass, classWorld)) {
+ if (type.satisfies(helpers.typedArrayOfIntClass, classWorld)) {
return intType;
}
return numType;
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart ('k') | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698