Index: pkg/compiler/lib/src/cps_ir/type_propagation.dart |
diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart |
index b583dc49a4e828f7755580d2ce047abb7888cf18..eb7f202075131dadcfeb0595e8935316d53a77e9 100644 |
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart |
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart |
@@ -19,6 +19,8 @@ import '../dart_types.dart' as types; |
import '../elements/elements.dart'; |
import '../io/source_information.dart' show |
SourceInformation; |
+import '../js_backend/backend_helpers.dart' show |
+ BackendHelpers; |
import '../js_backend/js_backend.dart' show |
JavaScriptBackend; |
import '../js_backend/codegen/task.dart' show |
@@ -664,6 +666,7 @@ class TransformingVisitor extends DeepRecursiveVisitor { |
final CpsFunctionCompiler functionCompiler; |
JavaScriptBackend get backend => compiler.backend; |
+ BackendHelpers get helpers => backend.helpers; |
TypeMaskSystem get typeSystem => lattice.typeSystem; |
types.DartTypes get dartTypes => lattice.dartTypes; |
Map<Variable, ConstantValue> get values => analyzer.values; |
@@ -1005,8 +1008,8 @@ class TransformingVisitor extends DeepRecursiveVisitor { |
for (Element target in getAllTargets(left.type, node.selector)) { |
ClassElement clazz = target.enclosingClass.declaration; |
if (clazz != compiler.world.objectClass && |
- clazz != backend.jsInterceptorClass && |
- clazz != backend.jsNullClass) { |
+ clazz != helpers.jsInterceptorClass && |
+ clazz != helpers.jsNullClass) { |
behavesLikeIdentical = false; |
break; |
} |
@@ -1185,7 +1188,7 @@ class TransformingVisitor extends DeepRecursiveVisitor { |
<Primitive>[index, cps.letPrim(new GetLength(list))]); |
cps.ifTruthy(isTooLarge).invokeContinuation(fail); |
cps.insideContinuation(fail).invokeStaticThrower( |
- backend.helpers.throwIndexOutOfBoundsError, |
+ helpers.throwIndexOutOfBoundsError, |
<Primitive>[list, index]); |
return cps; |
} |
@@ -1203,7 +1206,7 @@ class TransformingVisitor extends DeepRecursiveVisitor { |
BuiltinOperator.StrictNeq, |
<Primitive>[originalLength, cps.letPrim(new GetLength(list))]); |
cps.ifTruthy(lengthChanged).invokeStaticThrower( |
- backend.helpers.throwConcurrentModificationError, |
+ helpers.throwConcurrentModificationError, |
<Primitive>[list]); |
return cps; |
} |
@@ -1310,7 +1313,7 @@ class TransformingVisitor extends DeepRecursiveVisitor { |
[length, cps.makeZero()]); |
CpsFragment fail = cps.ifTruthy(isEmpty); |
fail.invokeStaticThrower( |
- backend.helpers.throwIndexOutOfBoundsError, |
+ helpers.throwIndexOutOfBoundsError, |
[list, fail.makeConstant(new IntConstantValue(-1))]); |
Primitive removedItem = cps.invokeBuiltin(BuiltinMethod.Pop, |
list, |
@@ -2203,19 +2206,19 @@ class TransformingVisitor extends DeepRecursiveVisitor { |
if (lattice.isDefinitelyInt(value)) { |
// Classes like JSUInt31 and JSUInt32 do not exist at runtime, so ensure |
// all the int classes get mapped tor their runtime class. |
- singleClass = backend.jsIntClass; |
+ singleClass = helpers.jsIntClass; |
} else if (lattice.isDefinitelyNum(value)) { |
if (jsNumberClassSuffices(node)) { |
- singleClass = backend.jsNumberClass; |
+ singleClass = helpers.jsNumberClass; |
} |
} else if (lattice.isDefinitelyNativeList(value)) { |
// Ensure all the array subclasses get mapped to the array class. |
- singleClass = backend.jsArrayClass; |
+ singleClass = helpers.jsArrayClass; |
} else { |
singleClass = typeSystem.singleClass(value.type); |
} |
if (singleClass != null && |
- singleClass.isSubclassOf(backend.jsInterceptorClass)) { |
+ singleClass.isSubclassOf(helpers.jsInterceptorClass)) { |
node.constantValue = new InterceptorConstantValue(singleClass.rawType); |
} |
// Filter out intercepted classes that do not match the input type. |
@@ -2245,8 +2248,8 @@ class TransformingVisitor extends DeepRecursiveVisitor { |
if (invoke.receiver != ref) return false; |
var interceptedClasses = |
functionCompiler.glue.getInterceptedClassesOn(invoke.selector); |
- if (interceptedClasses.contains(backend.jsDoubleClass)) return false; |
- if (interceptedClasses.contains(backend.jsIntClass)) return false; |
+ if (interceptedClasses.contains(helpers.jsDoubleClass)) return false; |
+ if (interceptedClasses.contains(helpers.jsIntClass)) return false; |
continue; |
} |
// Other uses need full distinction. |
@@ -2908,7 +2911,7 @@ class TypePropagationVisitor implements Visitor { |
if (value.isNothing) { |
setValue(node, nothing); |
} else if (value.isNullable && |
- !node.interceptedClasses.contains(backend.jsNullClass)) { |
+ !node.interceptedClasses.contains(backend.helpers.jsNullClass)) { |
// If the input is null and null is not mapped to an interceptor then |
// null gets returned. |
// TODO(asgerf): Add the NullInterceptor when it enables us to |