| Index: sdk/lib/_internal/compiler/implementation/compiler.dart
 | 
| ===================================================================
 | 
| --- sdk/lib/_internal/compiler/implementation/compiler.dart	(revision 16320)
 | 
| +++ sdk/lib/_internal/compiler/implementation/compiler.dart	(working copy)
 | 
| @@ -128,6 +128,7 @@
 | 
|    Element _currentElement;
 | 
|    LibraryElement coreLibrary;
 | 
|    LibraryElement isolateLibrary;
 | 
| +  LibraryElement isolateHelperLibrary;
 | 
|    LibraryElement jsHelperLibrary;
 | 
|    LibraryElement interceptorsLibrary;
 | 
|    LibraryElement foreignLibrary;
 | 
| @@ -402,12 +403,14 @@
 | 
|    void enableIsolateSupport(LibraryElement element) {
 | 
|      // TODO(ahe): Move this method to Enqueuer.
 | 
|      isolateLibrary = element.patch;
 | 
| -    enqueuer.resolution.addToWorkList(isolateLibrary.find(START_ROOT_ISOLATE));
 | 
|      enqueuer.resolution.addToWorkList(
 | 
| -        isolateLibrary.find(const SourceString('_currentIsolate')));
 | 
| +        isolateHelperLibrary.find(START_ROOT_ISOLATE));
 | 
|      enqueuer.resolution.addToWorkList(
 | 
| -        isolateLibrary.find(const SourceString('_callInIsolate')));
 | 
| -    enqueuer.codegen.addToWorkList(isolateLibrary.find(START_ROOT_ISOLATE));
 | 
| +        isolateHelperLibrary.find(const SourceString('_currentIsolate')));
 | 
| +    enqueuer.resolution.addToWorkList(
 | 
| +        isolateHelperLibrary.find(const SourceString('_callInIsolate')));
 | 
| +    enqueuer.codegen.addToWorkList(
 | 
| +        isolateHelperLibrary.find(START_ROOT_ISOLATE));
 | 
|    }
 | 
|  
 | 
|    bool hasIsolateSupport() => isolateLibrary != null;
 | 
| @@ -463,6 +466,13 @@
 | 
|      jsHelperLibrary = scanBuiltinLibrary('_js_helper');
 | 
|      interceptorsLibrary = scanBuiltinLibrary('_interceptors');
 | 
|      foreignLibrary = scanBuiltinLibrary('_foreign_helper');
 | 
| +    isolateHelperLibrary = scanBuiltinLibrary('_isolate_helper');
 | 
| +    // The helper library does not use the native language extension,
 | 
| +    // so we manually set the native classes this library defines.
 | 
| +    // TODO(ngeoffray): Enable annotations on these classes.
 | 
| +    ClassElement cls =
 | 
| +        isolateHelperLibrary.find(const SourceString('_WorkerStub'));
 | 
| +    cls.setNative('"*Worker"');
 | 
|  
 | 
|      // The core library was loaded and patched before jsHelperLibrary was
 | 
|      // initialized, so it wasn't imported into those two libraries during
 | 
| @@ -473,6 +483,9 @@
 | 
|      importForeignLibrary(jsHelperLibrary);
 | 
|      importForeignLibrary(interceptorsLibrary);
 | 
|  
 | 
| +    importForeignLibrary(isolateHelperLibrary);
 | 
| +    importHelperLibrary(isolateHelperLibrary);
 | 
| +
 | 
|      assertMethod = jsHelperLibrary.find(const SourceString('assertHelper'));
 | 
|      identicalFunction = coreLibrary.find(const SourceString('identical'));
 | 
|  
 | 
| @@ -500,11 +513,17 @@
 | 
|  
 | 
|    /** Define the JS helper functions in the given library. */
 | 
|    void importForeignLibrary(LibraryElement library) {
 | 
| -    if (jsHelperLibrary != null) {
 | 
| +    if (foreignLibrary != null) {
 | 
|        libraryLoader.importLibrary(library, foreignLibrary, null);
 | 
|      }
 | 
|    }
 | 
|  
 | 
| +  void importIsolateHelperLibrary(LibraryElement library) {
 | 
| +    if (isolateHelperLibrary != null) {
 | 
| +      libraryLoader.importLibrary(library, isolateHelperLibrary, null);
 | 
| +    }
 | 
| +  }
 | 
| +
 | 
|    // TODO(karlklose,floitsch): move this to the javascript backend.
 | 
|    /** Enable the 'JS' helper for a library if needed. */
 | 
|    void maybeEnableJSHelper(LibraryElement library) {
 | 
| @@ -513,7 +532,6 @@
 | 
|          'dart/tests/compiler/dart2js_native');
 | 
|      if (nativeTest
 | 
|          || libraryName == 'dart:mirrors'
 | 
| -        || libraryName == 'dart:isolate'
 | 
|          || libraryName == 'dart:math'
 | 
|          || libraryName == 'dart:html'
 | 
|          || libraryName == 'dart:html_common'
 | 
| @@ -540,12 +558,21 @@
 | 
|      }
 | 
|    }
 | 
|  
 | 
| +  void maybeEnableIsolateHelper(LibraryElement library) {
 | 
| +    String libraryName = library.uri.toString();
 | 
| +    if (libraryName == 'dart:isolate'
 | 
| +        || libraryName == 'dart:html') {
 | 
| +      importIsolateHelperLibrary(library);
 | 
| +    }
 | 
| +  }
 | 
| +
 | 
|    void runCompiler(Uri uri) {
 | 
|      log('compiling $uri ($BUILD_ID)');
 | 
|      scanBuiltinLibraries();
 | 
|      mainApp = libraryLoader.loadLibrary(uri, null, uri);
 | 
|      libraries.forEach((_, library) {
 | 
|        maybeEnableJSHelper(library);
 | 
| +      maybeEnableIsolateHelper(library);
 | 
|      });
 | 
|      final Element main = mainApp.find(MAIN);
 | 
|      if (main == null) {
 | 
| 
 |