| Index: pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
|
| diff --git a/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart b/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
|
| index 08c0d9a7f479eb9cb16f447641afca437c0329e0..dad06b9456d53d0db4f49573f5f1353a455116e8 100644
|
| --- a/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
|
| +++ b/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
|
| @@ -3,7 +3,6 @@
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| import '../common_elements.dart' show CommonElements;
|
| -import '../common/backend_api.dart' show BackendClasses;
|
| import '../constants/constant_system.dart';
|
| import '../constants/values.dart';
|
| import '../elements/entities.dart';
|
| @@ -46,8 +45,6 @@ class SsaSimplifyInterceptors extends HBaseVisitor
|
| SsaSimplifyInterceptors(this.closedWorld, this._commonElements,
|
| this.interceptorData, this.enclosingClass);
|
|
|
| - BackendClasses get backendClasses => closedWorld.backendClasses;
|
| -
|
| ConstantSystem get constantSystem => closedWorld.constantSystem;
|
|
|
| void visitGraph(HGraph graph) {
|
| @@ -101,7 +98,7 @@ class SsaSimplifyInterceptors extends HBaseVisitor
|
| return false;
|
| }
|
| if (receiver.canBeNull() &&
|
| - interceptedClasses.contains(backendClasses.nullClass)) {
|
| + interceptedClasses.contains(_commonElements.jsNullClass)) {
|
| // Need the JSNull interceptor.
|
| return false;
|
| }
|
| @@ -142,25 +139,25 @@ class SsaSimplifyInterceptors extends HBaseVisitor
|
| TypeMask type, Set<ClassEntity> interceptedClasses) {
|
| if (type.isNullable) {
|
| if (type.isNull) {
|
| - return backendClasses.nullClass;
|
| + return _commonElements.jsNullClass;
|
| }
|
| } else if (type.containsOnlyInt(closedWorld)) {
|
| - return backendClasses.intClass;
|
| + return _commonElements.jsIntClass;
|
| } else if (type.containsOnlyDouble(closedWorld)) {
|
| - return backendClasses.doubleClass;
|
| + return _commonElements.jsDoubleClass;
|
| } else if (type.containsOnlyBool(closedWorld)) {
|
| - return backendClasses.boolClass;
|
| + return _commonElements.jsBoolClass;
|
| } else if (type.containsOnlyString(closedWorld)) {
|
| - return backendClasses.stringClass;
|
| - } else if (type.satisfies(backendClasses.listClass, closedWorld)) {
|
| - return backendClasses.listClass;
|
| + return _commonElements.jsStringClass;
|
| + } else if (type.satisfies(_commonElements.jsArrayClass, closedWorld)) {
|
| + return _commonElements.jsArrayClass;
|
| } else if (type.containsOnlyNum(closedWorld) &&
|
| - !interceptedClasses.contains(backendClasses.intClass) &&
|
| - !interceptedClasses.contains(backendClasses.doubleClass)) {
|
| + !interceptedClasses.contains(_commonElements.jsIntClass) &&
|
| + !interceptedClasses.contains(_commonElements.jsDoubleClass)) {
|
| // If the method being intercepted is not defined in [int] or [double] we
|
| // can safely use the number interceptor. This is because none of the
|
| // [int] or [double] methods are called from a method defined on [num].
|
| - return backendClasses.numClass;
|
| + return _commonElements.jsNumberClass;
|
| } else {
|
| // Try to find constant interceptor for a native class. If the receiver
|
| // is constrained to a leaf native class, we can use the class's
|
| @@ -174,7 +171,7 @@ class SsaSimplifyInterceptors extends HBaseVisitor
|
| // code is completely insensitive to the specific instance subclasses, we
|
| // can use the non-leaf class directly.
|
| ClassEntity element = type.singleClass(closedWorld);
|
| - if (element != null && backendClasses.isNativeClass(element)) {
|
| + if (element != null && closedWorld.nativeData.isNativeClass(element)) {
|
| return element;
|
| }
|
| }
|
| @@ -229,25 +226,25 @@ class SsaSimplifyInterceptors extends HBaseVisitor
|
|
|
| // If we found that we need number, we must still go through all
|
| // uses to check if they require int, or double.
|
| - if (interceptedClasses.contains(backendClasses.numClass) &&
|
| - !(interceptedClasses.contains(backendClasses.doubleClass) ||
|
| - interceptedClasses.contains(backendClasses.intClass))) {
|
| + if (interceptedClasses.contains(_commonElements.jsNumberClass) &&
|
| + !(interceptedClasses.contains(_commonElements.jsDoubleClass) ||
|
| + interceptedClasses.contains(_commonElements.jsIntClass))) {
|
| Set<ClassEntity> required;
|
| for (HInstruction user in node.usedBy) {
|
| if (user is! HInvoke) continue;
|
| Set<ClassEntity> intercepted =
|
| interceptorData.getInterceptedClassesOn(user.selector.name);
|
| - if (intercepted.contains(backendClasses.intClass)) {
|
| + if (intercepted.contains(_commonElements.jsIntClass)) {
|
| // TODO(johnniwinther): Use type argument when all uses of
|
| // intercepted classes expect entities instead of elements.
|
| required ??= new Set/*<ClassEntity>*/();
|
| - required.add(backendClasses.intClass);
|
| + required.add(_commonElements.jsIntClass);
|
| }
|
| - if (intercepted.contains(backendClasses.doubleClass)) {
|
| + if (intercepted.contains(_commonElements.jsDoubleClass)) {
|
| // TODO(johnniwinther): Use type argument when all uses of
|
| // intercepted classes expect entities instead of elements.
|
| required ??= new Set/*<ClassEntity>*/();
|
| - required.add(backendClasses.doubleClass);
|
| + required.add(_commonElements.jsDoubleClass);
|
| }
|
| }
|
| // Don't modify the result of [interceptorData.getInterceptedClassesOn].
|
| @@ -315,7 +312,7 @@ class SsaSimplifyInterceptors extends HBaseVisitor
|
| // constant interceptor `C`. Then we can use `(receiver && C)` for the
|
| // interceptor.
|
| if (receiver.canBeNull()) {
|
| - if (!interceptedClasses.contains(backendClasses.nullClass)) {
|
| + if (!interceptedClasses.contains(_commonElements.jsNullClass)) {
|
| // Can use `(receiver && C)` only if receiver is either null or truthy.
|
| if (!(receiver.canBePrimitiveNumber(closedWorld) ||
|
| receiver.canBePrimitiveBoolean(closedWorld) ||
|
|
|