anchor.diff:    final HTypeMap types;
     final ConstantSystem constantSystem;
     final Set<HInstruction> boundsChecked;
  +  final WorkItem work;
     final String name = "SsaCheckInserter";
     HGraph graph;
     Element lengthInterceptor;
     Selector lengthSelector;
   
  -  SsaCheckInserter(JavaScriptBackend backend, this.types, this.boundsChecked)
  +  SsaCheckInserter(JavaScriptBackend backend,
  +                   this.work,
  +                   this.types,
  +                   this.boundsChecked)
         : constantSystem = backend.constantSystem {
       SourceString lengthString = const SourceString('length');
  -    lengthSelector = new Selector.getter(
  -        lengthString,
  -        backend.compiler.currentElement.getLibrary());
  +    lengthSelector =
  +        new Selector.getter(lengthString, work.element.getLibrary());
       lengthInterceptor =
           backend.builder.interceptors.getStaticInterceptor(lengthSelector);
     }
  
positive.code:           new SsaConstantFolder(constantSystem, backend, work, types),
            new SsaTypeConversionInserter(compiler),
            new SsaTypePropagator(compiler, types),
            new SsaCheckInserter(backend, types, context.boundsChecked),
            new SsaConstantFolder(constantSystem, backend, work, types),
            new SsaRedundantPhiEliminator(),
            new SsaDeadPhiEliminator(),
  
negative.code:       // Also run the type propagator, to please the codegen in case
        // no other optimization is run.
        runPhases(graph, <OptimizationPhase>[
            new SsaCheckInserter(backend, work, types, context.boundsChecked),
            new SsaTypePropagator(compiler, types)]);
      });
    }
  