anchor.diff:   * list [checks] (at the respective positions), possibly applying [substitution]
    * to the arguments before the check.
    *
  - * See the comment in the beginning of this file for a description of the
  - * possible values for [substitution].
  + * See [:RuntimeTypes.getSubtypeSubstitution:] for a description of the possible
  + * values for [substitution].
    */
   bool checkArguments(var substitution, var arguments, var checks) {
     return areSubtypes(substitute(substitution, arguments), checks);
   }
   
  -/**
  - * Checks whether the types of [s] are all subtypes of the types of [t].
  - *
  - * [s] and [t] are either [:null:] or JavaScript arrays of type representations,
  - * A [:null:] argument is interpreted as the arguments of a raw type, that is a
  - * list of [:dynamic:]. If [s] and [t] are JavaScript arrays they must be of the
  - * same length.
  - *
  - * See the comment in the beginning of this file for a description of type
  - * representations.
  - */
  -bool areSubtypes(var s, var t) {
  +bool areSubtypes(List s, List t) {
     // [:null:] means a raw type.
  -  if (isNull(s) || isNull(t)) return true;
  -
  -  assert(isJsArray(s));
  -  assert(isJsArray(t));
  -  assert(getLength(s) == getLength(t));
  -
  -  int len = getLength(s);
  +  if (s == null || t == null) return true;
  +
  +  assert(s is JSArray);
  +  assert(t is JSArray);
  +  assert(s.length == t.length);
  +
  +  int len = s.length;
     for (int i = 0; i < len; i++) {
  -    if (!isSubtype(getIndex(s, i), getIndex(t, i))) {
  +    if (!isSubtype(s[i], t[i])) {
         return false;
       }
     }
     return true;
   }
   
  -/**
  - * Returns [:true:] if the runtime type representation [type] is a supertype of
  - * [:Null:].
  - */
  -bool isSupertypeOfNull(var type) {
  +getArguments(var type) {
  +  return type is JSArray ? JS('var', r'#.slice(1)', type) : null;
  +}
  +
  +getField(var object, var name) => JS('var', r'#[#]', object, name);
  +
  +bool isSubtypeOfNull(type) {
     // `null` means `dynamic`.
  -  return isNull(type) || getConstructorName(type) == JS_OBJECT_CLASS_NAME();
  +  return type == null || getConstructorName(type) == JS_OBJECT_CLASS_NAME();
   }
   
   /**
    * Tests whether the Dart object [o] is a subtype of the runtime type
  - * representation [t].
  - *
  - * See the comment in the beginning of this file for a description of type
  - * representations.
  + * representation [t], which is a type representation as described in the
  + * comment on [isSubtype].
    */
   bool checkSubtypeOfRuntimeType(Object o, var t) {
  -  if (isNull(o)) return isSupertypeOfNull(t);
  -  if (isNull(t)) return true;
  -  assert(isJsArray(t));
  +  if (JS('bool', '# == null', o)) return isSubtypeOfNull(t);
  +  if (JS('bool', '# == null', t)) return true;
     // Get the runtime type information from the object here, because we may
     // overwrite o with the interceptor below.
     var rti = getRuntimeTypeInfo(o);
  
positive.code:   return allDynamic ? '' : '<$buffer>';
  }
  
  /**
   * Returns a human-readable representation of the type of [object].
   */
  String getRuntimeTypeString(var object) {
    String className = isJsArray(object) ? 'List' : getClassName(object);
    var typeInfo = JS('var', r'#.$builtinTypeInfo', object);
    return "$className${joinArguments(typeInfo, 0)}";
  }
  
negative.code: }
  
  /**
   * Check whether the type represented by [s] is a subtype of the type
   * represented by [t].
   *
   * Type representations can be:
   *  1) a JavaScript constructor for a class C: the represented type is the raw
   *     type C.
   *  2) a Dart object: this is the interceptor instance for a native type.
   *  3) a JavaScript object: this represents a class for which there is no
   *     JavaScript constructor, because it is only used in type arguments or it
   *     is native. The represented type is the raw type of this class.
   *  4) a JavaScript array: the first entry is of type 1, 2 or 3 and contains the
   *     subtyping flags and the substitution of the type and the rest of the
   *     array are the type arguments.
   *  5) [:null:]: the dynamic type.
   */
  bool isSubtype(var s, var t) {
    // If either type is dynamic, [s] is a subtype of [t].
    if (JS('bool', '# == null', s) || JS('bool', '# == null', t)) return true;
    // Subtyping is reflexive.
    if (JS('bool', '# === #', s, t)) return true;
    // Get the object describing the class and check for the subtyping flag
    // constructed from the type of [t].
    var typeOfS = s is JSArray ? s[0] : s;
    var typeOfT = t is JSArray ? t[0] : t;
    // TODO(johnniwinther): replace this with the real function subtype test.
    if (JS('bool', '#.func', s) == true || JS('bool', '#.func', t) == true ) {
      return true;
    }
    // Check for a subtyping flag.
    var test = '${JS_OPERATOR_IS_PREFIX()}${runtimeTypeToString(typeOfT)}';
    if (getField(typeOfS, test) == null) return false;
    // Get the necessary substitution of the type arguments, if there is one.
    var substitution;
    if (JS('bool', '# !== #', typeOfT, typeOfS)) {
      var field = '${JS_OPERATOR_AS_PREFIX()}${runtimeTypeToString(typeOfT)}';
      substitution = getField(typeOfS, field);
    }
  