anchor.diff:          collect(cls);
   
           if (cls.mixinClass != null) {
  -          mixinCalls.add(js.js.statement('mixin(#, #)',
  +          locals['_mixin'] ??= js.js('mixin');
  +          mixinCalls.add(js.js.statement('_mixin(#, #)',
                 [classReference(cls), classReference(cls.mixinClass)]));
           }
         }
       }
   
  -    js.Expression temp = null;
       for (Class superclass in subclasses.keys) {
         List<Class> list = subclasses[superclass];
         js.Expression superclassReference = (superclass == null)
             ? new js.LiteralNull()
             : classReference(superclass);
         if (list.length == 1) {
  -        inheritCalls.add(js.js.statement('inherit(#, #)',
  +        locals['_inherit'] ??= js.js('inherit');
  +        inheritCalls.add(js.js.statement('_inherit(#, #)',
               [classReference(list.single), superclassReference]));
         } else {
  -        // Hold common superclass in temporary for sequence of calls.
  -        if (temp == null) {
  -          String tempName = '_';
  -          temp = new js.VariableUse(tempName);
  -          var declaration = new js.VariableDeclaration(tempName);
  -          inheritCalls.add(
  -              js.js.statement('var # = #', [declaration, superclassReference]));
  -        } else {
  -          inheritCalls
  -              .add(js.js.statement('# = #', [temp, superclassReference]));
  -        }
  -        for (Class cls in list) {
  -          inheritCalls.add(
  -              js.js.statement('inherit(#, #)', [classReference(cls), temp]));
  -        }
  -      }
  -    }
  -
  -    return wrapPhase('inheritance', inheritCalls.toList()..addAll(mixinCalls));
  +        locals['_inheritMany'] ??= js.js('inheritMany');
  +        var listElements = list.map(classReference).toList();
  +        inheritCalls.add(js.js.statement('_inheritMany(#, #)',
  +            [superclassReference, js.ArrayInitializer(listElements)]));
  +      }
  +    }
  +
  +    List<js.Statement> statements = [];
  +    if (locals.isNotEmpty) {
  +      List<js.VariableInitialization> initializations = [];
  +      locals.forEach((local, value) {
  +        initializations.add(
  +            js.VariableInitialization(js.VariableDeclaration(local), value));
  +      });
  +      statements.add(
  +          js.ExpressionStatement(js.VariableDeclarationList(initializations)));
  +    }
  +    statements.addAll(inheritCalls);
  +    statements.addAll(mixinCalls);
  +    return wrapPhase('inheritance', statements);
     }
   
     /// Emits the setup of method aliases.
  
positive.code:   typesOffset = #embeddedTypes.length;
  
    // TODO(floitsch): extend natives.
    hunk(inherit, mixin, lazy, makeConstList, convertToFastObject, installTearOff,
         setFunctionNamesIfNecessary, updateHolder, updateTypes,
         setOrUpdateInterceptorsByTag, setOrUpdateLeafTags,
         #embeddedGlobalsObject, holders, #staticState);
  
negative.code:   }
  }
  
  // Batched version of [inherit] for multiple classes from one superclass.
  function inheritMany(sup, classes) {
    for (var i = 0; i < classes.length; i++) {
      inherit(classes[i], sup);
    }
  }
  
  // Mixes in the properties of [mixin] into [cls].
  function mixin(cls, mixin) {
    copyProperties(mixin.prototype, cls.prototype);
  