Version 0.1.4.0

svn merge -r 13592:13622 https://dart.googlecode.com/svn/branches/bleeding_edge
trunk

git-svn-id: http://dart.googlecode.com/svn/trunk@13623 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.java b/compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.java
index b72e73a..2a4e52b 100644
--- a/compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.java
+++ b/compiler/java/com/google/dart/compiler/resolver/TopLevelElementBuilder.java
@@ -144,8 +144,14 @@
     // Fill "library" export scope with re-exports.
     for (LibraryExport export : library.getExports()) {
       LibraryUnit lib = export.getLibrary();
+      fillInLibraryScope(lib, listener);
       for (Element element : lib.getElement().getExportedElements()) {
         String name = element.getName();
+        // re-export only in not defined locally
+        if (scope.findLocalElement(name) != null) {
+          continue;
+        }
+        // check if show/hide combinators of "export" are satisfied
         if (export.isVisible(name)) {
           Elements.addExportedElement(library.getElement(), element);
         }
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java b/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
index c13c42a..8f586e5 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
@@ -716,6 +716,42 @@
             ""));
   }
 
+  /**
+   * <p>
+   * http://code.google.com/p/dart/issues/detail?id=5735
+   */
+  public void test_importConflict_hideNoPrefix_importAgainWithPrefix() throws Exception {
+    appSource.setContent(
+        "A.dart",
+        makeCode(
+            "// filler filler filler filler filler filler filler filler filler filler filler",
+            "library lib_a;",
+            "var E = 2.7;",
+            ""));
+    appSource.setContent(
+        "B.dart",
+        makeCode(
+            "// filler filler filler filler filler filler filler filler filler filler filler",
+            "library lib_b;",
+            "export 'A.dart' show E;",
+            "var E = 'E';",
+            ""));
+    appSource.setContent(
+        APP,
+        makeCode(
+            "// filler filler filler filler filler filler filler filler filler filler filler",
+            "library test.app;",
+            "import 'B.dart';",
+            "import 'A.dart' as M show E;",
+            "main() {",
+            "  print(E);",
+            "  print(M.E);",
+            "}",
+            ""));
+    compile();
+    assertErrors(errors);
+  }
+
   public void test_reportMissingSource() throws Exception {
     appSource.setContent(
         APP,
@@ -1041,7 +1077,7 @@
     assertErrors(errors, errEx(TypeErrorCode.NO_SUCH_TYPE, 7, 3, 10));
   }
 
-  public void test_newLibrarySyntax_export() throws Exception {
+  public void test_newLibrarySyntax_export_show() throws Exception {
     appSource.setContent(
         "A.dart",
         makeCode(
@@ -1056,7 +1092,6 @@
         makeCode(
             "// filler filler filler filler filler filler filler filler filler filler filler",
             "library test.B;",
-            "import 'A.dart' as libA hide TypeAC;",
             "export 'A.dart' show TypeAA, TypeAB;",
             "class TypeBA {}",
             "class TypeBB {}",
@@ -1088,6 +1123,52 @@
     assertTrue(errors.toString().contains("libB.TypeBB"));
   }
   
+  public void test_newLibrarySyntax_export_hide() throws Exception {
+    appSource.setContent(
+        "A.dart",
+        makeCode(
+            "// filler filler filler filler filler filler filler filler filler filler filler",
+            "library test.A;",
+            "class TypeAA {}",
+            "class TypeAB {}",
+            "class TypeAC {}",
+            ""));
+    appSource.setContent(
+        "B.dart",
+        makeCode(
+            "// filler filler filler filler filler filler filler filler filler filler filler",
+            "library test.B;",
+            "export 'A.dart' hide TypeAC;",
+            "class TypeBA {}",
+            "class TypeBB {}",
+            "class TypeBC {}",
+            ""));
+    appSource.setContent(
+        APP,
+        makeCode(
+            "// filler filler filler filler filler filler filler filler filler filler filler",
+            "library test.app;",
+            "import 'B.dart' as libB hide TypeAA, TypeBB;",
+            "main() {",
+            "  libB.TypeAA aa;",
+            "  libB.TypeAB ab;",
+            "  libB.TypeAC ac;",
+            "  libB.TypeBA ba;",
+            "  libB.TypeBB bb;",
+            "  libB.TypeBC bc;",
+            "}",
+            ""));
+    compile();
+    assertErrors(
+        errors,
+        errEx(TypeErrorCode.NO_SUCH_TYPE, 5, 3, 11),
+        errEx(TypeErrorCode.NO_SUCH_TYPE, 7, 3, 11),
+        errEx(TypeErrorCode.NO_SUCH_TYPE, 9, 3, 11));
+    assertTrue(errors.toString().contains("libB.TypeAA"));
+    assertTrue(errors.toString().contains("libB.TypeAC"));
+    assertTrue(errors.toString().contains("libB.TypeBB"));
+  }
+  
   public void test_newLibrarySyntax_noExport() throws Exception {
     appSource.setContent(
         "A.dart",
diff --git a/lib/_internal/libraries.dart b/lib/_internal/libraries.dart
index 881e955..239cec4 100644
--- a/lib/_internal/libraries.dart
+++ b/lib/_internal/libraries.dart
@@ -57,8 +57,7 @@
 
   "mirrors": const LibraryInfo(
       "mirrors/mirrors.dart",
-      documented: false,
-      platforms: VM_PLATFORM),
+      dart2jsPath: "compiler/implementation/lib/mirrors.dart"),
 
   "nativewrappers": const LibraryInfo(
       "html/dartium/nativewrappers.dart",
diff --git a/lib/compiler/implementation/apiimpl.dart b/lib/compiler/implementation/apiimpl.dart
index 40030da..d65f8c7 100644
--- a/lib/compiler/implementation/apiimpl.dart
+++ b/lib/compiler/implementation/apiimpl.dart
@@ -113,7 +113,12 @@
   Uri translateDartUri(Uri uri, tree.Node node) {
     String path = lookupLibraryPath(uri.path);
     if (path === null || LIBRARIES[uri.path].category == "Internal") {
-      reportError(node, 'library not found ${uri}');
+      if (node != null) {
+        reportError(node, 'library not found ${uri}');
+      } else {
+        reportDiagnostic(null, 'library not found ${uri}',
+                         api.Diagnostic.ERROR);
+      }
       return null;
     }
     if (uri.path == 'html' ||
diff --git a/lib/compiler/implementation/compile_time_constants.dart b/lib/compiler/implementation/compile_time_constants.dart
index ce96502..0f3fd37 100644
--- a/lib/compiler/implementation/compile_time_constants.dart
+++ b/lib/compiler/implementation/compile_time_constants.dart
@@ -767,16 +767,17 @@
       if (enclosingClass != compiler.objectClass) {
         assert(superClass !== null);
         assert(superClass.resolutionState == STATE_DONE);
+
+        Selector selector =
+            new Selector.callDefaultConstructor(enclosingClass.getLibrary());
+
         FunctionElement targetConstructor =
-            superClass.lookupConstructor(superClass.name);
+            superClass.lookupConstructor(selector);
         if (targetConstructor === null) {
           compiler.internalError("no default constructor available",
                                  node: functionNode);
         }
 
-        Selector selector = new Selector.call(superClass.name,
-                                              enclosingClass.getLibrary(),
-                                              0);
         evaluateSuperOrRedirectSend(functionNode,
                                     selector,
                                     const Link<Node>(),
diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart
index e461074..fe032d9 100644
--- a/lib/compiler/implementation/compiler.dart
+++ b/lib/compiler/implementation/compiler.dart
@@ -390,7 +390,7 @@
     addForeignFunctions(jsHelperLibrary);
     addForeignFunctions(interceptorsLibrary);
 
-    assertMethod = jsHelperLibrary.find(const SourceString('assert'));
+    assertMethod = jsHelperLibrary.find(const SourceString('assertHelper'));
     identicalFunction = coreLibrary.find(const SourceString('identical'));
 
     initializeSpecialClasses();
diff --git a/lib/compiler/implementation/dart_backend/placeholder_collector.dart b/lib/compiler/implementation/dart_backend/placeholder_collector.dart
index 381b5da..6e815c1 100644
--- a/lib/compiler/implementation/dart_backend/placeholder_collector.dart
+++ b/lib/compiler/implementation/dart_backend/placeholder_collector.dart
@@ -394,7 +394,10 @@
       if (send.receiver !== null) tryMakeMemberPlaceholder(send.selector);
     } else if (!element.isErroneous()) {
       if (Elements.isStaticOrTopLevel(element)) {
-        assert(element is VariableElement || element.isAccessor());
+        // TODO(smok): Worth investigating why sometimes we get getter/setter
+        // here and sometimes abstract field.
+        assert(element is VariableElement || element.isAccessor()
+            || element.isAbstractField() || element.isFunction());
         makeElementPlaceholder(send.selector, element);
       } else {
         assert(send.selector is Identifier);
diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart
index 5ae0939..dc70d0f 100644
--- a/lib/compiler/implementation/elements/elements.dart
+++ b/lib/compiler/implementation/elements/elements.dart
@@ -1475,24 +1475,42 @@
     }
   }
 
-  Element lookupConstructor(SourceString className,
-                            [SourceString constructorName =
-                                 const SourceString(''),
-                            Element noMatch(Element)]) {
-    // TODO(karlklose): have a map from class names to a map of constructors
-    //                  instead of creating the name here?
+  Element validateConstructorLookupResults(Selector selector,
+                                           Element result,
+                                           Element noMatch(Element)) {
+    if (result === null
+        || !result.isConstructor()
+        || (selector.name.isPrivate()
+            && result.getLibrary() != selector.library)) {
+      result = noMatch !== null ? noMatch(result) : null;
+    }
+    return result;
+  }
+
+  // TODO(aprelev@gmail.com): Peter believes that it would be great to
+  // make noMatch a required argument. Peter's suspicion is that most
+  // callers of this method would benefit from using the noMatch method.
+  Element lookupConstructor(Selector selector, [Element noMatch(Element)]) {
     SourceString normalizedName;
-    if (constructorName !== const SourceString('')) {
+    SourceString className = this.name;
+    SourceString constructorName = selector.name;
+    if (constructorName !== const SourceString('') &&
+        ((className === null) ||
+         (constructorName.slowToString() != className.slowToString()))) {
       normalizedName = Elements.constructConstructorName(className,
                                                          constructorName);
     } else {
       normalizedName = className;
     }
     Element result = localLookup(normalizedName);
-    if (result === null || !result.isConstructor()) {
-      result = noMatch !== null ? noMatch(result) : null;
-    }
-    return result;
+    return validateConstructorLookupResults(selector, result, noMatch);
+  }
+
+  Element lookupFactoryConstructor(Selector selector,
+                                   [Element noMatch(Element)]) {
+    SourceString constructorName = selector.name;
+    Element result = localLookup(constructorName);
+    return validateConstructorLookupResults(selector, result, noMatch);
   }
 
   bool get hasConstructor {
diff --git a/lib/compiler/implementation/js/printer.dart b/lib/compiler/implementation/js/printer.dart
index 27c9aa5..e29ef8d 100644
--- a/lib/compiler/implementation/js/printer.dart
+++ b/lib/compiler/implementation/js/printer.dart
@@ -20,7 +20,8 @@
         namer = determineRenamer(compiler.enableMinification);
   
   static Namer determineRenamer(bool shouldCompressOutput) {
-    return shouldCompressOutput ? new MinifyRenamer() : new IdentityNamer();
+    // TODO(erikcorry): Re-enable the MinifyRenamer after M1.
+    return new IdentityNamer();
   }
 
   void spaceOut() {
diff --git a/lib/compiler/implementation/lib/js_helper.dart b/lib/compiler/implementation/lib/js_helper.dart
index 7170d2c..2515116 100644
--- a/lib/compiler/implementation/lib/js_helper.dart
+++ b/lib/compiler/implementation/lib/js_helper.dart
@@ -849,6 +849,10 @@
   throw new RuntimeError(message);
 }
 
+throwAbstractClassInstantiationError(className) {
+  throw new AbstractClassInstantiationError(className);
+}
+
 /**
  * Called from catch blocks in generated code to extract the Dart
  * exception from the thrown value. The thrown value may have been
@@ -1361,7 +1365,7 @@
 /**
  * Helper function for implementing asserts. The compiler treats this specially.
  */
-void assert(condition) {
+void assertHelper(condition) {
   if (condition is Function) condition = condition();
   if (condition is !bool) {
     throw new TypeErrorImplementation(condition, 'bool');
diff --git a/lib/compiler/implementation/lib/mirrors.dart b/lib/compiler/implementation/lib/mirrors.dart
new file mode 100644
index 0000000..f717d9b
--- /dev/null
+++ b/lib/compiler/implementation/lib/mirrors.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#library("dart:mirrors");
+
+#import("dart:isolate");
+
+#source("../../../mirrors/mirrors.dart");
+
+/**
+ * Stub class for the mirror system.
+ */
+class _Mirrors {
+  static MirrorSystem currentMirrorSystem() {
+    throw new UnsupportedOperationException("MirrorSystem not implemented");
+  }
+
+  static Future<MirrorSystem> mirrorSystemOf(SendPort port) {
+    throw new UnsupportedOperationException("MirrorSystem not implemented");
+  }
+
+  static InstanceMirror reflect(Object reflectee) {
+    throw new UnsupportedOperationException("MirrorSystem not implemented");
+  }
+}
diff --git a/lib/compiler/implementation/resolver.dart b/lib/compiler/implementation/resolver.dart
index 17c9d56..7409bc6 100644
--- a/lib/compiler/implementation/resolver.dart
+++ b/lib/compiler/implementation/resolver.dart
@@ -87,15 +87,23 @@
     });
   }
 
+  bool isNamedConstructor(Send node) => node.receiver !== null;
+
   SourceString getConstructorName(Send node) {
-    if (node.receiver !== null) {
-      return node.selector.asIdentifier().source;
-    } else {
-      return const SourceString('');
-    }
+    return node.selector.asIdentifier().source;
   }
 
-  FunctionElement resolveConstructorRedirection(FunctionElement constructor) {
+  String constructorNameForDiagnostics(SourceString className,
+                                   SourceString constructorName) {
+    String classNameString = className.slowToString();
+    String constructorNameString = constructorName.slowToString();
+    return (constructorName === const SourceString(''))
+        ? classNameString
+        : "$classNameString.$constructorNameString";
+   }
+
+  FunctionElement resolveConstructorRedirection(InitializerResolver resolver,
+                                                FunctionElement constructor) {
     if (constructor.isPatched) {
       checkMatchingPatchSignatures(constructor, constructor.patch);
       constructor = constructor.patch;
@@ -109,10 +117,17 @@
     if (!initializers.isEmpty() &&
         Initializers.isConstructorRedirect(initializers.head)) {
       final ClassElement classElement = constructor.getEnclosingClass();
-      final SourceString constructorName =
-          getConstructorName(initializers.head);
-      final SourceString className = classElement.name;
-      return classElement.lookupConstructor(className, constructorName);
+      Selector selector;
+      if (isNamedConstructor(initializers.head)) {
+        SourceString constructorName = getConstructorName(initializers.head);
+        selector = new Selector.callConstructor(
+            constructorName,
+            resolver.visitor.enclosingElement.getLibrary());
+      } else {
+        selector = new Selector.callDefaultConstructor(
+            resolver.visitor.enclosingElement.getLibrary());
+      }
+      return classElement.lookupConstructor(selector);
     }
     return null;
   }
@@ -129,7 +144,7 @@
         return;
       }
       seen.add(redirection);
-      redirection = resolveConstructorRedirection(redirection);
+      redirection = resolveConstructorRedirection(resolver, redirection);
     }
   }
 
@@ -290,26 +305,42 @@
     // [intrface] is an interface, let's say "MyInterface".
     // [defaultClass] is a class, let's say "MyClass".
 
+    Selector selector;
     // If the default class implements the interface then we must use the
     // default class' name. Otherwise we look for a factory with the name
     // of the interface.
-    SourceString name;
     if (defaultClass.implementsInterface(intrface)) {
-      // TODO(ahe): Don't use string replacement here.
-      name = new SourceString(constructor.name.slowToString().replaceFirst(
-                 intrface.name.slowToString(),
-                 defaultClass.name.slowToString()));
+      var constructorNameString = constructor.name.slowToString();
+      // Create selector based on constructor.name but where interface
+      // is replaced with default class name.
+      // TODO(ahe): Don't use string manipulations here.
+      int classNameSeparatorIndex = constructorNameString.indexOf('\$');
+      if (classNameSeparatorIndex < 0) {
+        selector = new Selector.callDefaultConstructor(
+            defaultClass.getLibrary());
+      } else {
+        selector = new Selector.callConstructor(
+            new SourceString(
+                constructorNameString.substring(classNameSeparatorIndex + 1)),
+            defaultClass.getLibrary());
+      }
+      constructor.defaultImplementation =
+          defaultClass.lookupConstructor(selector);
     } else {
-      name = constructor.name;
+      selector =
+          new Selector.callConstructor(constructor.name,
+                                       defaultClass.getLibrary());
+      constructor.defaultImplementation =
+          defaultClass.lookupFactoryConstructor(selector);
     }
-    constructor.defaultImplementation = defaultClass.lookupConstructor(name);
-
     if (constructor.defaultImplementation === null) {
       // We failed to find a constructor named either
       // "MyInterface.name" or "MyClass.name".
+      // TODO(aprelev@gmail.com): Use constructorNameForDiagnostics in
+      // the error message below.
       error(node,
             MessageKind.CANNOT_FIND_CONSTRUCTOR2,
-            [name, defaultClass.name]);
+            [selector.name, defaultClass.name]);
     }
   }
 
@@ -682,6 +713,21 @@
     visitor.visitInStaticContext(init.arguments.head);
   }
 
+  ClassElement getSuperOrThisLookupTarget(FunctionElement constructor,
+                                          bool isSuperCall,
+                                          Node diagnosticNode) {
+    ClassElement lookupTarget = constructor.getEnclosingClass();
+    if (isSuperCall) {
+      // Calculate correct lookup target and constructor name.
+      if (lookupTarget === visitor.compiler.objectClass) {
+        error(diagnosticNode, MessageKind.SUPER_INITIALIZER_IN_OBJECT);
+      } else {
+        return lookupTarget.supertype.element;
+      }
+    }
+    return lookupTarget;
+  }
+
   Element resolveSuperOrThisForSend(FunctionElement constructor,
                                     FunctionExpression functionNode,
                                     Send call) {
@@ -693,12 +739,39 @@
     });
     Selector selector = visitor.mapping.getSelector(call);
     bool isSuperCall = Initializers.isSuperConstructorCall(call);
-    SourceString constructorName = resolver.getConstructorName(call);
-    Element result = resolveSuperOrThis(
-        constructor, isSuperCall, false, constructorName, selector, call);
-    visitor.useElement(call, result);
-    visitor.world.registerStaticUse(result);
-    return result;
+
+    ClassElement lookupTarget = getSuperOrThisLookupTarget(constructor,
+                                                           isSuperCall,
+                                                           call);
+    final SourceString className = lookupTarget.name;
+
+    SourceString constructorName;
+    Selector lookupSelector;
+    if (resolver.isNamedConstructor(call)) {
+      constructorName = resolver.getConstructorName(call);
+      lookupSelector = new Selector.callConstructor(
+          constructorName,
+          visitor.enclosingElement.getLibrary());
+    } else {
+      constructorName = const SourceString('');
+      lookupSelector = new Selector.callDefaultConstructor(
+          visitor.enclosingElement.getLibrary());
+    }
+
+    FunctionElement lookedupConstructor =
+        lookupTarget.lookupConstructor(lookupSelector);
+
+    final bool isImplicitSuperCall = false;
+    verifyThatConstructorMatchesCall(lookedupConstructor,
+                                     selector,
+                                     isImplicitSuperCall,
+                                     call,
+                                     constructorName,
+                                     className);
+
+    visitor.useElement(call, lookedupConstructor);
+    visitor.world.registerStaticUse(lookedupConstructor);
+    return lookedupConstructor;
   }
 
   void resolveImplicitSuperConstructorSend(FunctionElement constructor,
@@ -709,55 +782,57 @@
     if (classElement != visitor.compiler.objectClass) {
       assert(superClass !== null);
       assert(superClass.resolutionState == STATE_DONE);
-      SourceString name = const SourceString('');
-      Selector call = new Selector.call(name, classElement.getLibrary(), 0);
-      var element = resolveSuperOrThis(constructor, true, true,
-                                       name, call, functionNode);
-      visitor.world.registerStaticUse(element);
+      SourceString constructorName = const SourceString('');
+      Selector callToMatch = new Selector.call(
+          constructorName,
+          classElement.getLibrary(),
+          0);
+
+      final bool isSuperCall = true;
+      ClassElement lookupTarget = getSuperOrThisLookupTarget(constructor,
+                                                             isSuperCall,
+                                                             functionNode);
+      final SourceString className = lookupTarget.name;
+      Element calledConstructor = lookupTarget.lookupConstructor(
+          new Selector.callDefaultConstructor(
+              visitor.enclosingElement.getLibrary()));
+
+      final bool isImplicitSuperCall = true;
+      verifyThatConstructorMatchesCall(calledConstructor,
+                                       callToMatch,
+                                       isImplicitSuperCall,
+                                       functionNode,
+                                       className,
+                                       const SourceString(''));
+
+      visitor.world.registerStaticUse(calledConstructor);
     }
   }
 
-  Element resolveSuperOrThis(FunctionElement constructor,
-                             bool isSuperCall,
-                             bool isImplicitSuperCall,
-                             SourceString constructorName,
-                             Selector selector,
-                             Node diagnosticNode) {
-    ClassElement lookupTarget = constructor.getEnclosingClass();
-    bool validTarget = true;
-    FunctionElement result;
-    if (isSuperCall) {
-      // Calculate correct lookup target and constructor name.
-      if (lookupTarget === visitor.compiler.objectClass) {
-        error(diagnosticNode, MessageKind.SUPER_INITIALIZER_IN_OBJECT);
-      } else {
-        lookupTarget = lookupTarget.supertype.element;
-      }
-    }
-
-    // Lookup constructor and try to match it to the selector.
-    ResolverTask resolver = visitor.compiler.resolver;
-    final SourceString className = lookupTarget.name;
-    result = lookupTarget.lookupConstructor(className, constructorName);
-    if (result === null || !result.isGenerativeConstructor()) {
-      String classNameString = className.slowToString();
-      String constructorNameString = constructorName.slowToString();
-      String name = (constructorName === const SourceString(''))
-                        ? classNameString
-                        : "$classNameString.$constructorNameString";
+  void verifyThatConstructorMatchesCall(
+      FunctionElement lookedupConstructor,
+      Selector call,
+      bool isImplicitSuperCall,
+      Node diagnosticNode,
+      SourceString className,
+      SourceString constructorName) {
+    if (lookedupConstructor === null
+        || !lookedupConstructor.isGenerativeConstructor()) {
+      var fullConstructorName =
+          visitor.compiler.resolver.constructorNameForDiagnostics(className,
+                                                              constructorName);
       MessageKind kind = isImplicitSuperCall
-                         ? MessageKind.CANNOT_RESOLVE_CONSTRUCTOR_FOR_IMPLICIT
-                         : MessageKind.CANNOT_RESOLVE_CONSTRUCTOR;
-      error(diagnosticNode, kind, [name]);
+          ? MessageKind.CANNOT_RESOLVE_CONSTRUCTOR_FOR_IMPLICIT
+          : MessageKind.CANNOT_RESOLVE_CONSTRUCTOR;
+      error(diagnosticNode, kind, [fullConstructorName]);
     } else {
-      if (!selector.applies(result, visitor.compiler)) {
+      if (!call.applies(lookedupConstructor, visitor.compiler)) {
         MessageKind kind = isImplicitSuperCall
                            ? MessageKind.NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT
                            : MessageKind.NO_MATCHING_CONSTRUCTOR;
         error(diagnosticNode, kind);
       }
     }
-    return result;
   }
 
   FunctionElement resolveRedirection(FunctionElement constructor,
@@ -1412,33 +1487,22 @@
     return (str === '&&' || str == '||' || str == '!');
   }
 
-  /**
-   * Check the lexical scope chain for a declaration with the name "assert".
-   *
-   * This is used to detect whether "assert(x)" is actually an assertion or
-   * just a call expression.
-   * It does not check fields inherited from a superclass.
-   */
-  bool isAssertInLexicalScope() {
-    return scope.lexicalLookup(const SourceString("assert")) !== null;
-  }
-
-  /** Check if [node] is the expression of the current expression statement. */
-  bool isExpressionStatementExpression(Node node) {
-    return currentExpressionStatement !== null &&
-        currentExpressionStatement.expression === node;
-  }
-
   Element resolveSend(Send node) {
     Selector selector = resolveSelector(node);
 
     if (node.receiver === null) {
-      // If this send is the expression of an expression statement, and is on
-      // the form "assert(expr);", and there is no declaration with name
-      // "assert" in the lexical scope, then this is actually an assertion.
-      if (isExpressionStatementExpression(node) &&
-          selector.isAssertSyntax() &&
-          !isAssertInLexicalScope()) {
+      // If this send is of the form "assert(expr);", then
+      // this is an assertion.
+      if (selector.isAssert()) {
+        if (selector.argumentCount != 1) {
+          error(node.selector,
+                MessageKind.WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT,
+                [selector.argumentCount]);
+        } else if (selector.namedArgumentCount != 0) {
+          error(node.selector,
+                MessageKind.ASSERT_IS_GIVEN_NAMED_ARGUMENTS,
+                [selector.namedArgumentCount]);
+        }
         return compiler.assertMethod;
       }
       return node.selector.accept(this);
@@ -2809,22 +2873,33 @@
     }
   }
 
+  Selector createConstructorSelector(SourceString constructorName) {
+    return constructorName == const SourceString('')
+        ? new Selector.callDefaultConstructor(
+            resolver.enclosingElement.getLibrary())
+        : new Selector.callConstructor(
+            constructorName,
+            resolver.enclosingElement.getLibrary());
+  }
+
   // TODO(ngeoffray): method named lookup should not report errors.
   FunctionElement lookupConstructor(ClassElement cls,
                                     Node diagnosticNode,
                                     SourceString constructorName) {
     cls.ensureResolved(compiler);
-    Element result = cls.lookupConstructor(cls.name, constructorName);
+    Selector selector = createConstructorSelector(constructorName);
+    Element result = cls.lookupConstructor(selector);
     if (result === null) {
-      String fullConstructorName = cls.name.slowToString();
-      if (constructorName !== const SourceString('')) {
-        fullConstructorName = '$fullConstructorName'
-                              '.${constructorName.slowToString()}';
-      }
-      return failOrReturnErroneousElement(cls, diagnosticNode,
-                                          new SourceString(fullConstructorName),
-                                          MessageKind.CANNOT_FIND_CONSTRUCTOR,
-                                          [fullConstructorName]);
+      String fullConstructorName =
+          resolver.compiler.resolver.constructorNameForDiagnostics(
+              cls.name,
+              constructorName);
+      return failOrReturnErroneousElement(
+          cls,
+          diagnosticNode,
+          new SourceString(fullConstructorName),
+          MessageKind.CANNOT_FIND_CONSTRUCTOR,
+          [fullConstructorName]);
     } else if (inConstContext && !result.modifiers.isConst()) {
       error(diagnosticNode, MessageKind.CONSTRUCTOR_IS_NOT_CONST);
     }
diff --git a/lib/compiler/implementation/scanner/keyword.dart b/lib/compiler/implementation/scanner/keyword.dart
index be4e652..31a4614 100644
--- a/lib/compiler/implementation/scanner/keyword.dart
+++ b/lib/compiler/implementation/scanner/keyword.dart
@@ -7,6 +7,7 @@
  */
 class Keyword implements SourceString {
   static const List<Keyword> values = const <Keyword> [
+      const Keyword("assert"),
       const Keyword("break"),
       const Keyword("case"),
       const Keyword("catch"),
@@ -23,9 +24,6 @@
       const Keyword("for"),
       const Keyword("if"),
       const Keyword("in"),
-      // TODO(ahe): Don't think this is a reserved word.
-      // See: http://dartbug.com/5579
-      const Keyword("is", info: IS_INFO),
       const Keyword("new"),
       const Keyword("null"),
       const Keyword("return"),
@@ -39,28 +37,31 @@
       const Keyword("void"),
       const Keyword("while"),
 
+      // TODO(ahe): Don't think this is a reserved word.
+      // See: http://dartbug.com/5579
+      const Keyword("is", info: IS_INFO),
+
       const Keyword("abstract", isBuiltIn: true),
       const Keyword("as", info: AS_INFO, isBuiltIn: true),
-      const Keyword("assert", isBuiltIn: true),
       const Keyword("dynamic", isBuiltIn: true),
+      const Keyword("export", isBuiltIn: true),
       const Keyword("external", isBuiltIn: true),
       const Keyword("factory", isBuiltIn: true),
       const Keyword("get", isBuiltIn: true),
       const Keyword("implements", isBuiltIn: true),
+      const Keyword("import", isBuiltIn: true),
       const Keyword("interface", isBuiltIn: true),
+      const Keyword("library", isBuiltIn: true),
       const Keyword("operator", isBuiltIn: true),
+      const Keyword("part", isBuiltIn: true),
       const Keyword("set", isBuiltIn: true),
       const Keyword("static", isBuiltIn: true),
       const Keyword("typedef", isBuiltIn: true),
 
-      const Keyword("export", isPseudo: true),
       const Keyword("hide", isPseudo: true),
-      const Keyword("import", isPseudo: true),
-      const Keyword("library", isPseudo: true),
       const Keyword("native", isPseudo: true),
       const Keyword("of", isPseudo: true),
       const Keyword("on", isPseudo: true),
-      const Keyword("part", isPseudo: true),
       const Keyword("show", isPseudo: true),
       const Keyword("source", isPseudo: true) ];
 
diff --git a/lib/compiler/implementation/scanner/listener.dart b/lib/compiler/implementation/scanner/listener.dart
index 86d088c..424d17f 100644
--- a/lib/compiler/implementation/scanner/listener.dart
+++ b/lib/compiler/implementation/scanner/listener.dart
@@ -436,6 +436,9 @@
   void handleEmptyStatement(Token token) {
   }
 
+  void handleAssertStatement(Token assertKeyword, Token semicolonToken) {
+  }
+
   /** Called with either the token containing a double literal, or
     * an immediately preceding "unary plus" token.
     */
@@ -1697,6 +1700,13 @@
                                 beginToken, inKeyword));
   }
 
+  void handleAssertStatement(Token assertKeyword, Token semicolonToken) {
+    NodeList arguments = popNode();
+    Node selector = new Identifier(assertKeyword);
+    Node send = new Send(null, selector, arguments);
+    pushNode(new ExpressionStatement(send, semicolonToken));
+  }
+
   void endUnamedFunction(Token token) {
     Statement body = popNode();
     NodeList formals = popNode();
diff --git a/lib/compiler/implementation/scanner/parser.dart b/lib/compiler/implementation/scanner/parser.dart
index b2faf1a..a276ebe 100644
--- a/lib/compiler/implementation/scanner/parser.dart
+++ b/lib/compiler/implementation/scanner/parser.dart
@@ -1149,6 +1149,8 @@
       return parseBreakStatement(token);
     } else if (value === 'continue') {
       return parseContinueStatement(token);
+    } else if (value === 'assert') {
+      return parseAssertStatement(token);
     } else if (value === ';') {
       return parseEmptyStatement(token);
     } else if (value === 'const') {
@@ -2130,6 +2132,14 @@
     return expectSemicolon(token);
   }
 
+  Token parseAssertStatement(Token token) {
+    Token assertKeyword = token;
+    token = expect('assert', token);
+    token = parseArguments(token);
+    listener.handleAssertStatement(assertKeyword, token);
+    return expectSemicolon(token);
+  }
+
   Token parseContinueStatement(Token token) {
     assert(optional('continue', token));
     Token continueKeyword = token;
diff --git a/lib/compiler/implementation/ssa/builder.dart b/lib/compiler/implementation/ssa/builder.dart
index 5cf3d37..7c573d4 100644
--- a/lib/compiler/implementation/ssa/builder.dart
+++ b/lib/compiler/implementation/ssa/builder.dart
@@ -119,6 +119,11 @@
     return compiler.findHelper(const SourceString('throwRuntimeError'));
   }
 
+  Element getThrowAbstractClassInstantiationError() {
+    return compiler.findHelper(
+        const SourceString('throwAbstractClassInstantiationError'));
+  }
+
   Element getClosureConverter() {
     return compiler.findHelper(const SourceString('convertDartClosureToJS'));
   }
@@ -1213,9 +1218,9 @@
         assert(superClass !== null);
         assert(superClass.resolutionState == STATE_DONE);
         Selector selector =
-            new Selector.call(superClass.name, enclosingClass.getLibrary(), 0);
+            new Selector.callDefaultConstructor(enclosingClass.getLibrary());
         // TODO(johnniwinther): Should we find injected constructors as well?
-        FunctionElement target = superClass.lookupConstructor(superClass.name);
+        FunctionElement target = superClass.lookupConstructor(selector);
         if (target === null) {
           compiler.internalError("no default constructor available");
         }
@@ -2937,6 +2942,11 @@
       compiler.internalError("malformed send in new expression");
     }
     InterfaceType type = elements.getType(annotation);
+    if (type.element.modifiers.isAbstract() &&
+        constructor.isGenerativeConstructor()) {
+      generateAbstractClassInstantiationError(node, type.name.slowToString());
+      return;
+    }
     if (compiler.world.needsRti(constructor.enclosingElement)) {
       type.arguments.forEach((DartType argument) {
         inputs.add(analyzeTypeArgument(argument, node));
@@ -3011,15 +3021,24 @@
     compiler.internalError(reason, node: node);
   }
 
-  void generateRuntimeError(Node node, String message) {
+  void generateError(Node node, String message, Element helper) {
     DartString messageObject = new DartString.literal(message);
     Constant messageConstant =
         constantSystem.createString(messageObject, node);
     HInstruction errorMessage = graph.addConstant(messageConstant);
-    Element helper = interceptors.getThrowRuntimeError();
     pushInvokeHelper1(helper, errorMessage);
   }
 
+  void generateRuntimeError(Node node, String message) {
+    generateError(node, message, interceptors.getThrowRuntimeError());
+  }
+
+  void generateAbstractClassInstantiationError(Node node, String message) {
+    generateError(node,
+                  message,
+                  interceptors.getThrowAbstractClassInstantiationError());
+  }
+
   void generateThrowNoSuchMethod(Node diagnosticNode,
                                  String methodName,
                                  [Link<Node> argumentNodes,
diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart
index 27e1b23..b4e06b3 100644
--- a/lib/compiler/implementation/ssa/codegen.dart
+++ b/lib/compiler/implementation/ssa/codegen.dart
@@ -2696,12 +2696,15 @@
     return labels.last();
   }
 
+  js.VariableUse generateStateUse()
+      => new js.VariableUse(variableNames.stateName);
+
   HBasicBlock beginGraph(HGraph graph) {
     propagator = new SsaBailoutPropagator(compiler, generateAtUseSite);
     propagator.visitGraph(graph);
     // TODO(ngeoffray): We could avoid generating the state at the
     // call site for non-complex bailout methods.
-    newParameters.add(new js.Parameter('state'));
+    newParameters.add(new js.Parameter(variableNames.stateName));
 
     if (propagator.hasComplexBailoutTargets) {
       // Use generic parameters that will be assigned to
@@ -2717,7 +2720,7 @@
       // The setup phase of a bailout function sets up the environment for
       // each bailout target. Each bailout target will populate this
       // setup phase. It is put at the beginning of the function.
-      setup = new js.Switch(new js.VariableUse('state'), <js.SwitchClause>[]);
+      setup = new js.Switch(generateStateUse(), <js.SwitchClause>[]);
       return graph.entry;
     } else {
       // We have a simple bailout target, so we can reuse the names that
@@ -2788,7 +2791,7 @@
                                  nextBlock);
     currentBailoutSwitch.cases.add(clause);
     currentContainer = nextBlock;
-    pushExpressionAsStatement(new js.Assignment(new js.VariableUse('state'),
+    pushExpressionAsStatement(new js.Assignment(generateStateUse(),
                                                 new js.LiteralNumber('0')));
     js.Block setupBlock = new js.Block.empty();
     int i = 0;
@@ -2845,7 +2848,7 @@
     List<js.SwitchClause> cases = <js.SwitchClause>[];
     js.Block firstBlock = new js.Block.empty();
     cases.add(new js.Case(new js.LiteralNumber("0"), firstBlock));
-    currentBailoutSwitch = new js.Switch(new js.VariableUse('state'), cases);
+    currentBailoutSwitch = new js.Switch(generateStateUse(), cases);
     pushStatement(currentBailoutSwitch);
     oldContainerStack.add(currentContainer);
     currentContainer = firstBlock;
@@ -2922,14 +2925,13 @@
 
     use(node.inputs[0]);
     js.Binary stateEquals0 =
-        new js.Binary('===',
-                      new js.VariableUse('state'), new js.LiteralNumber('0'));
+        new js.Binary('===', generateStateUse(), new js.LiteralNumber('0'));
     js.Expression condition = new js.Binary('&&', stateEquals0, pop());
     // TODO(ngeoffray): Put the condition initialization in the
     // [setup] buffer.
     List<HBailoutTarget> targets = node.thenBlock.bailoutTargets;
     for (int i = 0, len = targets.length; i < len; i++) {
-      js.VariableUse stateRef = new js.VariableUse('state');
+      js.VariableUse stateRef = generateStateUse();
       js.Expression targetState = new js.LiteralNumber('${targets[i].state}');
       js.Binary stateTest = new js.Binary('===', stateRef, targetState);
       condition = new js.Binary('||', stateTest, condition);
diff --git a/lib/compiler/implementation/ssa/variable_allocator.dart b/lib/compiler/implementation/ssa/variable_allocator.dart
index 167c91f..d317a4a 100644
--- a/lib/compiler/implementation/ssa/variable_allocator.dart
+++ b/lib/compiler/implementation/ssa/variable_allocator.dart
@@ -369,22 +369,30 @@
   final Map<HInstruction, String> ownName;
   final Map<HBasicBlock, CopyHandler> copyHandlers;
   /**
-   * Name that is being used as a temporary to break cycles in
+   * Name that is used as a temporary to break cycles in
    * parallel copies. We make sure this name is not being used
    * anywhere by reserving it when we allocate names for instructions.
    */
   final String swapTemp;
+  /**
+   * Name that is used in bailout code. We make sure this name is not being used
+   * anywhere by reserving it when we allocate names for instructions.
+   */
+  final String stateName;
 
   VariableNames(Map<Element, String> parameterNames)
     : ownName = new Map<HInstruction, String>(),
       copyHandlers = new Map<HBasicBlock, CopyHandler>(),
-      swapTemp = computeSwapTemp(parameterNames);
+      swapTemp = computeFreshWithPrefix("t", parameterNames),
+      stateName = computeFreshWithPrefix("state", parameterNames);
 
-  static String computeSwapTemp(Map<Element, String> parameterNames) {
+  /** Returns a fresh variable with the given prefix. */
+  static String computeFreshWithPrefix(String prefix,
+                                       Map<Element, String> parameterNames) {
     Set<String> parameters = new Set<String>.from(parameterNames.getValues());
-    String name = 't0';
+    String name = '${prefix}0';
     int i = 1;
-    while (parameters.contains(name)) name = 't${i++}';
+    while (parameters.contains(name)) name = '$prefix${i++}';
     return name;
   }
 
@@ -424,9 +432,11 @@
   VariableNamer(LiveEnvironment environment, this.names, this.parameterNames)
     : usedNames = new Set<String>(),
       freeTemporaryNames = new List<String>() {
-    // [VariableNames.swapTemp] is being used when there is a cycle
-    // in a copy handler. Therefore we make sure no one will use it.
+    // [VariableNames.swapTemp] and [VariableNames.stateName] are being used
+    // throughout the function. Therefore we make sure no one uses it at any
+    // time.
     usedNames.add(names.swapTemp);
+    usedNames.add(names.stateName);
 
     // All liveIns instructions must have a name at this point, so we
     // add them to the list of used names.
diff --git a/lib/compiler/implementation/types/concrete_types_inferrer.dart b/lib/compiler/implementation/types/concrete_types_inferrer.dart
index cd22a7a..d93cb38 100644
--- a/lib/compiler/implementation/types/concrete_types_inferrer.dart
+++ b/lib/compiler/implementation/types/concrete_types_inferrer.dart
@@ -682,7 +682,8 @@
     if (!foundSuperOrRedirect) {
       ClassElement superClass = enclosingClass.superclass;
       if (enclosingClass != compiler.objectClass) {
-        FunctionElement target = superClass.lookupConstructor(superClass.name);
+        FunctionElement target = superClass.lookupConstructor(
+          new Selector.callDefaultConstructor(enclosingClass.getLibrary()));
         final superClassConcreteType = new ConcreteType.singleton(
             new ClassBaseType(enclosingClass));
         getSendReturnType(target, new ClassBaseType(enclosingClass),
diff --git a/lib/compiler/implementation/types/types.dart b/lib/compiler/implementation/types/types.dart
index dbbb11e..ca44c69 100644
--- a/lib/compiler/implementation/types/types.dart
+++ b/lib/compiler/implementation/types/types.dart
@@ -9,6 +9,7 @@
 #import('../elements/elements.dart');
 #import('../util/util.dart');
 #import('../scanner/scannerlib.dart');
+#import('../universe/universe.dart');
 
 #source('concrete_types_inferrer.dart');
 
diff --git a/lib/compiler/implementation/universe/universe.dart b/lib/compiler/implementation/universe/universe.dart
index 3baa353..03bb1a6 100644
--- a/lib/compiler/implementation/universe/universe.dart
+++ b/lib/compiler/implementation/universe/universe.dart
@@ -186,6 +186,17 @@
       : this(SelectorKind.CALL, Compiler.CALL_OPERATOR_NAME, null,
              selector.argumentCount, selector.namedArguments);
 
+  Selector.callConstructor(SourceString constructorName,
+                           LibraryElement library)
+      : this(SelectorKind.CALL,
+             constructorName,
+             library,
+             0,
+             const []);
+
+  Selector.callDefaultConstructor(LibraryElement library)
+      : this(SelectorKind.CALL, const SourceString(""), library, 0, const []);
+
   // TODO(kasperl): This belongs somewhere else.
   Selector.noSuchMethod()
       : this(SelectorKind.CALL, Compiler.NO_SUCH_METHOD, null, 2);
@@ -201,13 +212,8 @@
   bool isUnaryOperator() => isOperator() && argumentCount == 0;
   bool isBinaryOperator() => isOperator() && argumentCount == 1;
 
-  /** Check whether this is a call to 'assert' with one positional parameter. */
-  bool isAssertSyntax() {
-    return (isCall() &&
-            name.stringValue === "assert" &&
-            argumentCount == 1 &&
-            namedArgumentCount == 0);
-  }
+  /** Check whether this is a call to 'assert'. */
+  bool isAssert() => isCall() && name.stringValue === "assert";
 
   int hashCode() => argumentCount + 1000 * namedArguments.length;
   int get namedArgumentCount => namedArguments.length;
diff --git a/lib/compiler/implementation/warnings.dart b/lib/compiler/implementation/warnings.dart
index 0e57d68..9d00fd4 100644
--- a/lib/compiler/implementation/warnings.dart
+++ b/lib/compiler/implementation/warnings.dart
@@ -303,6 +303,13 @@
   static const TOP_LEVEL_VARIABLE_DECLARED_STATIC = const MessageKind(
       "Top-level variable cannot be declared static.");
 
+  static const WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT = const MessageKind(
+      "Wrong number of arguments to assert. Should be 1, but given #{1}.");
+
+  static const ASSERT_IS_GIVEN_NAMED_ARGUMENTS = const MessageKind(
+      "assert takes no named arguments, but given #{1}.");
+
+
   static const COMPILER_CRASHED = const MessageKind(
       "Error: The compiler crashed when compiling this element.");
 
diff --git a/lib/core/errors.dart b/lib/core/errors.dart
index 85e9f93..cef165e 100644
--- a/lib/core/errors.dart
+++ b/lib/core/errors.dart
@@ -46,7 +46,10 @@
   const FallThroughError();
 }
 
-class AbstractClassInstantiationError {
+class AbstractClassInstantiationError implements Error {
+  final String _className;
+  const AbstractClassInstantiationError(String this._className);
+  String toString() => "Cannot instantiate abstract class: '$_className'";
 }
 
 /**
diff --git a/lib/html/dart2js/html_dart2js.dart b/lib/html/dart2js/html_dart2js.dart
index 68bcf42..e5cdd97 100644
--- a/lib/html/dart2js/html_dart2js.dart
+++ b/lib/html/dart2js/html_dart2js.dart
@@ -36918,18 +36918,24 @@
   /** @domName WheelEvent.webkitDirectionInvertedFromDevice */
   abstract bool get webkitDirectionInvertedFromDevice;
 
-  /** @domName WheelEvent.deltaX */
-  abstract int get deltaX;
+  /** @domName WheelEvent.wheelDeltaX */
+  abstract int get $dom_wheelDeltaX;
 
-  /** @domName WheelEvent.deltaY */
-  abstract int get deltaY;
+  /** @domName WheelEvent.wheelDeltaY */
+  abstract int get $dom_wheelDeltaY;
 
   /** @domName WheelEvent.initWebKitWheelEvent */
   void initWebKitWheelEvent(int wheelDeltaX, int wheelDeltaY, LocalWindow view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
 
 
+  /** @domName WheelEvent.deltaX */
+  abstract num get deltaX;
+
+  /** @domName WheelEvent.deltaY */
+  abstract num get deltaY;
+
   /** @domName WheelEvent.deltaMode */
-  int get deltaMode;
+  abstract int get deltaMode;
 }
 // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
diff --git a/lib/html/dartium/html_dartium.dart b/lib/html/dartium/html_dartium.dart
index 973b4bb..6535ef4 100644
--- a/lib/html/dartium/html_dartium.dart
+++ b/lib/html/dartium/html_dartium.dart
@@ -41115,18 +41115,24 @@
   /** @domName WheelEvent.webkitDirectionInvertedFromDevice */
   abstract bool get webkitDirectionInvertedFromDevice;
 
-  /** @domName WheelEvent.deltaX */
-  abstract int get deltaX;
+  /** @domName WheelEvent.wheelDeltaX */
+  abstract int get $dom_wheelDeltaX;
 
-  /** @domName WheelEvent.deltaY */
-  abstract int get deltaY;
+  /** @domName WheelEvent.wheelDeltaY */
+  abstract int get $dom_wheelDeltaY;
 
   /** @domName WheelEvent.initWebKitWheelEvent */
   void initWebKitWheelEvent(int wheelDeltaX, int wheelDeltaY, LocalWindow view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
 
 
+  /** @domName WheelEvent.deltaX */
+  abstract num get deltaX;
+
+  /** @domName WheelEvent.deltaY */
+  abstract num get deltaY;
+
   /** @domName WheelEvent.deltaMode */
-  int get deltaMode;
+  abstract int get deltaMode;
 }
 // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
@@ -41136,13 +41142,15 @@
 
   bool get webkitDirectionInvertedFromDevice native "WheelEvent_webkitDirectionInvertedFromDevice_Getter";
 
-  int get deltaX native "WheelEvent_wheelDeltaX_Getter";
+  int get $dom_wheelDeltaX native "WheelEvent_wheelDeltaX_Getter";
 
-  int get deltaY native "WheelEvent_wheelDeltaY_Getter";
+  int get $dom_wheelDeltaY native "WheelEvent_wheelDeltaY_Getter";
 
   void initWebKitWheelEvent(int wheelDeltaX, int wheelDeltaY, LocalWindow view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) native "WheelEvent_initWebKitWheelEvent_Callback";
 
 
+  num get deltaX => $dom_wheelDeltaX;
+  num get deltaY => $dom_wheelDeltaY;
   int get deltaMode => 0;
 
 }
diff --git a/lib/html/idl/dart/dart.idl b/lib/html/idl/dart/dart.idl
index f9e1b9a..86017f6 100644
--- a/lib/html/idl/dart/dart.idl
+++ b/lib/html/idl/dart/dart.idl
@@ -391,12 +391,3 @@
     [Custom] void handleEvent(in DOMTimeStamp time);
   };
 }
-
-module events {
-  [Supplemental]
-  interface WheelEvent {
-    [Suppressed] readonly attribute long wheelDelta;
-    [DartName=deltaX] readonly attribute long wheelDeltaX;
-    [DartName=deltaY] readonly attribute long wheelDeltaY;
-  };
-}
diff --git a/lib/html/scripts/htmlrenamer.py b/lib/html/scripts/htmlrenamer.py
index 55aca93..ee7892f 100644
--- a/lib/html/scripts/htmlrenamer.py
+++ b/lib/html/scripts/htmlrenamer.py
@@ -36,14 +36,14 @@
   'Document.createEvent',
   'Document.createTextNode',
   'Document.createTouchList',
+  'DocumentFragment.querySelector',
+  'DocumentFragment.querySelectorAll',
   'Document.getElementById',
   'Document.getElementsByClassName',
   'Document.getElementsByName',
   'Document.getElementsByTagName',
   'Document.querySelector',
   'Document.querySelectorAll',
-  'DocumentFragment.querySelector',
-  'DocumentFragment.querySelectorAll',
   'Element.childElementCount',
   'Element.children',
   'Element.className',
@@ -61,6 +61,7 @@
   'EventTarget.addEventListener',
   'EventTarget.dispatchEvent',
   'EventTarget.removeEventListener',
+  'LocalWindow.getComputedStyle',
   'MouseEvent.initMouseEvent',
   'Node.appendChild',
   'Node.attributes',
@@ -73,13 +74,14 @@
   'ShadowRoot.getElementById',
   'ShadowRoot.getElementsByClassName',
   'ShadowRoot.getElementsByTagName',
-  'Storage.length',
   'Storage.clear',
   'Storage.getItem',
   'Storage.key',
+  'Storage.length',
   'Storage.removeItem',
   'Storage.setItem',
-  'LocalWindow.getComputedStyle',
+  'WheelEvent.wheelDeltaX',
+  'WheelEvent.wheelDeltaY',
 ])
 
 # Members from the standard dom that exist in the dart:html library with
@@ -268,6 +270,7 @@
     "LocalWindow.get:frames",
     "LocalWindow.get:length",
     "LocalWindow.webkitCancelRequestAnimationFrame",
+    "WheelEvent.wheelDelta",
     ])
 
 class HtmlRenamer(object):
diff --git a/lib/html/templates/html/impl/impl_WheelEvent.darttemplate b/lib/html/templates/html/impl/impl_WheelEvent.darttemplate
index a2fbc06..e4b6609 100644
--- a/lib/html/templates/html/impl/impl_WheelEvent.darttemplate
+++ b/lib/html/templates/html/impl/impl_WheelEvent.darttemplate
@@ -77,6 +77,8 @@
   int get _deltaMode() native 'return this.deltaMode';
 
 $else
+  num get deltaX => $dom_wheelDeltaX;
+  num get deltaY => $dom_wheelDeltaY;
   int get deltaMode => 0;
 
 $endif
diff --git a/lib/html/templates/html/interface/interface_WheelEvent.darttemplate b/lib/html/templates/html/interface/interface_WheelEvent.darttemplate
index d623c4c..1966c89 100644
--- a/lib/html/templates/html/interface/interface_WheelEvent.darttemplate
+++ b/lib/html/templates/html/interface/interface_WheelEvent.darttemplate
@@ -6,6 +6,12 @@
 abstract class $ID$EXTENDS {
 $!MEMBERS
 
+  /** @domName WheelEvent.deltaX */
+  abstract num get deltaX;
+
+  /** @domName WheelEvent.deltaY */
+  abstract num get deltaY;
+
   /** @domName WheelEvent.deltaMode */
-  int get deltaMode;
+  abstract int get deltaMode;
 }
diff --git a/lib/isolate/timer.dart b/lib/isolate/timer.dart
index a90c2d0..8684de7 100644
--- a/lib/isolate/timer.dart
+++ b/lib/isolate/timer.dart
@@ -8,10 +8,10 @@
    * [milliSeconds] milliseconds.
    */
   factory Timer(int milliSeconds, void callback(Timer timer)) {
-    if (_factory == null) {
+    if (_TimerFactory._factory == null) {
       throw new UnsupportedOperationException("Timer interface not supported.");
     }
-    return _factory(milliSeconds, callback, false);
+    return _TimerFactory._factory(milliSeconds, callback, false);
   }
 
   /**
@@ -19,18 +19,16 @@
    * [milliSeconds] millisecond until cancelled.
    */
   factory Timer.repeating(int milliSeconds, void callback(Timer timer)) {
-    if (_factory == null) {
+    if (_TimerFactory._factory == null) {
       throw new UnsupportedOperationException("Timer interface not supported.");
     }
-    return _factory(milliSeconds, callback, true);
+    return _TimerFactory._factory(milliSeconds, callback, true);
   }
 
   /**
    * Cancels the timer.
    */
   void cancel();
-
-  static _TimerFactoryClosure _factory;
 }
 
 // TODO(ajohnsen): Patch timer once we have support for patching named
@@ -40,6 +38,12 @@
                                    void callback(Timer timer),
                                    bool repeating);
 
+class _TimerFactory {
+  static _TimerFactoryClosure _factory;
+}
+
+// TODO(ahe): Warning: this is NOT called by Dartium. Instead, it sets
+// [_TimerFactory._factory] directly.
 void _setTimerFactoryClosure(_TimerFactoryClosure closure) {
-  Timer._factory = closure;
+  _TimerFactory._factory = closure;
 }
diff --git a/pkg/dartdoc/lib/dartdoc.dart b/pkg/dartdoc/lib/dartdoc.dart
index 8e9a159..5acdba1 100644
--- a/pkg/dartdoc/lib/dartdoc.dart
+++ b/pkg/dartdoc/lib/dartdoc.dart
@@ -819,7 +819,11 @@
     writeln('<button id="show-inherited" class="show-inherited">'
             'Hide inherited</button>');
 
-    docCode(type, type.location, getTypeComment(type));
+    writeln('<div class="doc">');
+    docComment(type, getTypeComment(type));
+    docCode(type.location);
+    writeln('</div>');
+
     docInheritance(type);
     docTypedef(type);
 
@@ -964,7 +968,9 @@
               title="Permalink to ${type.simpleName}">#</a>''');
     writeln('</h4>');
 
-    docCode(type, type.location, null, showCode: true);
+    writeln('<div class="doc">');
+    docCode(type.location);
+    writeln('</div>');
 
     writeln('</div>');
   }
@@ -991,21 +997,48 @@
     }
   }
 
+  static const operatorOrder = const <String>[
+      '[]', '[]=', // Indexing.
+      '+', Mirror.UNARY_MINUS, '-', '*', '/', '~/', '%', // Arithmetic.
+      '&', '|', '^', '~', // Bitwise.
+      '<<', '>>', // Shift.
+      '<', '<=', '>', '>=', // Relational.
+      '==', // Equality.
+  ];
+
+  static final Map<String, int> operatorOrderMap = (){
+    var map = new Map<String, int>();
+    var index = 0;
+    for (String operator in operatorOrder) {
+      map[operator] = index++;
+    }
+    return map;
+  }();
+
   void docMembers(ObjectMirror host) {
     // Collect the different kinds of members.
     final staticMethods = [];
-    final staticFields = [];
+    final staticGetters = new Map<String,MemberMirror>();
+    final staticSetters = new Map<String,MemberMirror>();
     final memberMap = new Map<String,MemberMirror>();
     final instanceMethods = [];
-    final instanceFields = [];
+    final instanceOperators = [];
+    final instanceGetters = new Map<String,MemberMirror>();
+    final instanceSetters = new Map<String,MemberMirror>();
 
     host.declaredMembers.forEach((_, MemberMirror member) {
       if (member.isPrivate) return;
       if (host is LibraryMirror || member.isStatic) {
-        if (member.isMethod) {
-          staticMethods.add(member);
-        } else  if (member.isField) {
-          staticFields.add(member);
+        if (member is MethodMirror) {
+          if (member.isGetter) {
+            staticGetters[member.displayName] = member;
+          } else if (member.isSetter) {
+            staticSetters[member.displayName] = member;
+          } else {
+            staticMethods.add(member);
+          }
+        } else if (member is FieldMirror) {
+          staticGetters[member.displayName] = member;
         }
       }
     });
@@ -1016,53 +1049,117 @@
         type.declaredMembers.forEach((_, MemberMirror member) {
           if (member.isPrivate) return;
           if (!member.isStatic) {
-            memberMap.putIfAbsent(member.simpleName, () => member);
+            if (member.isField) {
+              // Fields override both getters and setters.
+              memberMap.putIfAbsent(member.simpleName, () => member);
+              memberMap.putIfAbsent('${member.simpleName}=', () => member);
+            } else {
+              memberMap.putIfAbsent(member.simpleName, () => member);
+            }
           }
         });
       }
     }
 
     memberMap.forEach((_, MemberMirror member) {
-      if (member.isMethod) {
-        instanceMethods.add(member);
-      } else  if (member.isField) {
-        instanceFields.add(member);
+      if (member is MethodMirror) {
+        if (member.isGetter) {
+          instanceGetters[member.displayName] = member;
+        } else if (member.isSetter) {
+          instanceSetters[member.displayName] = member;
+        } else if (member.isOperator) {
+          instanceOperators.add(member);
+        } else {
+          instanceMethods.add(member);
+        }
+      } else if (member is FieldMirror) {
+        instanceGetters[member.displayName] = member;
       }
     });
 
-    if (staticFields.length > 0) {
-      final title = host is LibraryMirror ? 'Variables' : 'Static Fields';
+    instanceOperators.sort((MethodMirror a, MethodMirror b) {
+      return operatorOrderMap[a.simpleName].compareTo(
+          operatorOrderMap[b.simpleName]);
+    });
+
+    docProperties(host,
+                  host is LibraryMirror ? 'Properties' : 'Static Properties',
+                  staticGetters, staticSetters);
+    docMethods(host,
+               host is LibraryMirror ? 'Functions' : 'Static Methods',
+               staticMethods);
+
+    docProperties(host, 'Properties', instanceGetters, instanceSetters);
+    docMethods(host, 'Operators', instanceOperators);
+    docMethods(host, 'Methods', orderByName(instanceMethods));
+  }
+
+  /**
+   * Documents fields, getters, and setters as properties.
+   */
+  void docProperties(ObjectMirror host, String title,
+                     Map<String,MemberMirror> getters,
+                     Map<String,MemberMirror> setters) {
+    if (getters.isEmpty() && setters.isEmpty()) return;
+
+    var nameSet = new Set<String>.from(getters.getKeys());
+    nameSet.addAll(setters.getKeys());
+    var nameList = new List<String>.from(nameSet);
+    nameList.sort((String a, String b) {
+      return a.toLowerCase().compareTo(b.toLowerCase());
+    });
+
+    writeln('<div>');
+    writeln('<h3>$title</h3>');
+    for (String name in nameList) {
+      MemberMirror getter = getters[name];
+      MemberMirror setter = setters[name];
+      if (setter == null) {
+        if (getter is FieldMirror) {
+          // We have a field.
+          docField(host, getter);
+        } else {
+          // We only have a getter.
+          assert(getter is MethodMirror);
+          docProperty(host, getter, null);
+        }
+      } else if (getter == null) {
+        // We only have a setter => Document as a method.
+        assert(setter is MethodMirror);
+        docMethod(host, setter);
+      } else {
+        DocComment getterComment = getMemberComment(getter);
+        DocComment setterComment = getMemberComment(setter);
+        if (getter.surroundingDeclaration !== setter.surroundingDeclaration ||
+            getterComment != null && setterComment != null) {
+          // Both have comments or are not declared in the same class
+          // => Documents separately.
+          if (getter is FieldMirror) {
+            // Document field as a getter (setter is inherited).
+            docField(host, getter, asGetter: true);
+          } else {
+            docMethod(host, getter);
+          }
+          if (setter is FieldMirror) {
+            // Document field as a setter (getter is inherited).
+            docField(host, setter, asSetter: true);
+          } else {
+            docMethod(host, setter);
+          }
+        } else {
+          // Document as field.
+          docProperty(host, getter, setter);
+        }
+      }
+    }
+    writeln('</div>');
+  }
+
+  void docMethods(ObjectMirror host, String title, List<MethodMirror> methods) {
+    if (methods.length > 0) {
       writeln('<div>');
       writeln('<h3>$title</h3>');
-      for (final field in orderByName(staticFields)) {
-        docField(host, field);
-      }
-      writeln('</div>');
-    }
-
-    if (staticMethods.length > 0) {
-      final title = host is LibraryMirror ? 'Functions' : 'Static Methods';
-      writeln('<div>');
-      writeln('<h3>$title</h3>');
-      for (final method in orderByName(staticMethods)) {
-        docMethod(host, method);
-      }
-      writeln('</div>');
-    }
-
-    if (instanceFields.length > 0) {
-      writeln('<div>');
-      writeln('<h3>Fields</h3>');
-      for (final field in orderByName(instanceFields)) {
-        docField(host, field);
-      }
-      writeln('</div>');
-    }
-
-    if (instanceMethods.length > 0) {
-      writeln('<div>');
-      writeln('<h3>Methods</h3>');
-      for (final method in orderByName(instanceMethods)) {
+      for (final method in methods) {
         docMethod(host, method);
       }
       writeln('</div>');
@@ -1070,104 +1167,188 @@
   }
 
   /**
-   * Documents the [method] in type [type]. Handles all kinds of methods
-   * including getters, setters, and constructors.
+   * Documents the [member] declared in [host]. Handles all kinds of members
+   * including getters, setters, and constructors. If [member] is a
+   * [FieldMirror] it is documented as a getter or setter depending upon the
+   * value of [asGetter].
    */
-  void docMethod(ObjectMirror host, MethodMirror method) {
+  void docMethod(ObjectMirror host, MemberMirror member,
+                 {bool asGetter: false}) {
     _totalMembers++;
-    _currentMember = method;
+    _currentMember = member;
 
-    bool showCode = includeSource && !method.isAbstract;
-    bool inherited = host != method.surroundingDeclaration;
+    bool isAbstract = false;
+    String name = member.displayName;
+    if (member is FieldMirror) {
+      if (asGetter) {
+        // Getter.
+        name = 'get $name';
+      } else {
+        // Setter.
+        name = 'set $name';
+      }
+    } else {
+      assert(member is MethodMirror);
+      isAbstract = member.isAbstract;
+      if (member.isGetter) {
+        // Getter.
+        name = 'get $name';
+      } else if (member.isSetter) {
+        // Setter.
+        name = 'set $name';
+      }
+    }
+
+    bool showCode = includeSource && !isAbstract;
+    bool inherited = host != member.surroundingDeclaration;
 
     writeln('<div class="method${inherited ? ' inherited': ''}">'
-            '<h4 id="${memberAnchor(method)}">');
+            '<h4 id="${memberAnchor(member)}">');
 
     if (showCode) {
       writeln('<button class="show-code">Code</button>');
     }
 
-    if (method.isConstructor) {
-      if (method.isFactory) {
-        write('factory ');
-      } else {
-        write(method.isConst ? 'const ' : 'new ');
+    if (member is MethodMirror) {
+      if (member.isConstructor) {
+        if (member.isFactory) {
+          write('factory ');
+        } else {
+          write(member.isConst ? 'const ' : 'new ');
+        }
+      } else if (member.isAbstract) {
+        write('abstract ');
       }
-    } else if (method.isAbstract) {
-      write('abstract ');
-    }
 
-    if (!method.isConstructor) {
-      annotateType(host, method.returnType);
-    }
-
-    var name = method.displayName;
-    // Translate specially-named methods: getters, setters, operators.
-    if (method.isGetter) {
-      // Getter.
-      name = 'get $name';
-    } else if (method.isSetter) {
-      // Setter.
-      name = 'set $name';
+      if (!member.isConstructor) {
+        annotateType(host, member.returnType);
+      }
+    } else {
+      assert(member is FieldMirror);
+      if (asGetter) {
+        annotateType(host, member.type);
+      } else {
+        write('void ');
+      }
     }
 
     write('<strong>$name</strong>');
 
-    docParamList(host, method.parameters);
+    if (member is MethodMirror) {
+      if (!member.isGetter) {
+        docParamList(host, member.parameters);
+      }
+    } else {
+      assert(member is FieldMirror);
+      if (!asGetter) {
+        write('(');
+        annotateType(host, member.type);
+        write(' value)');
+      }
+    }
 
     var prefix = host is LibraryMirror ? '' : '${typeName(host)}.';
-    write(''' <a class="anchor-link" href="#${memberAnchor(method)}"
+    write(''' <a class="anchor-link" href="#${memberAnchor(member)}"
               title="Permalink to $prefix$name">#</a>''');
     writeln('</h4>');
 
     if (inherited) {
       write('<div class="inherited-from">inherited from ');
-      annotateType(host, method.surroundingDeclaration);
+      annotateType(host, member.surroundingDeclaration);
       write('</div>');
     }
 
-    docCode(host, method.location, getMemberComment(method), showCode: showCode);
+    writeln('<div class="doc">');
+    docComment(host, getMemberComment(member));
+    if (showCode) {
+      docCode(member.location);
+    }
+    writeln('</div>');
 
     writeln('</div>');
   }
 
-  /** Documents the field [field] of type [type]. */
-  void docField(ObjectMirror host, FieldMirror field) {
-    _totalMembers++;
-    _currentMember = field;
+  void docField(ObjectMirror host, FieldMirror field,
+                {bool asGetter: false, bool asSetter: false}) {
+    if (asGetter) {
+      docMethod(host, field, asGetter: true);
+    } else if (asSetter) {
+      docMethod(host, field, asGetter: false);
+    } else {
+      docProperty(host, field, null);
+    }
+  }
 
-    bool inherited = host != field.surroundingDeclaration;
+  /**
+   * Documents the property defined by [getter] and [setter] of declared in
+   * [host]. If [getter] is a [FieldMirror], [setter] must be [:null:].
+   * Otherwise, if [getter] is a [MethodMirror], the property is considered
+   * final if [setter] is [:null:].
+   */
+  void docProperty(ObjectMirror host,
+                   MemberMirror getter, MemberMirror setter) {
+    assert(getter != null);
+    _totalMembers++;
+    _currentMember = getter;
+
+    bool inherited = host != getter.surroundingDeclaration;
 
     writeln('<div class="field${inherited ? ' inherited' : ''}">'
-            '<h4 id="${memberAnchor(field)}">');
+            '<h4 id="${memberAnchor(getter)}">');
 
     if (includeSource) {
       writeln('<button class="show-code">Code</button>');
     }
 
-    if (field.isFinal) {
+    bool isConst = false;
+    bool isFinal;
+    TypeMirror type;
+    if (getter is FieldMirror) {
+      assert(setter == null);
+      isConst = getter.isConst;
+      isFinal = getter.isFinal;
+      type = getter.type;
+    } else {
+      assert(getter is MethodMirror);
+      isFinal = setter == null;
+      type = getter.returnType;
+    }
+
+    if (isConst) {
+      write('const ');
+    } else if (isFinal) {
       write('final ');
-    } else if (field.type.isDynamic) {
+    } else if (type.isDynamic) {
       write('var ');
     }
 
-    annotateType(host, field.type);
+    annotateType(host, type);
     var prefix = host is LibraryMirror ? '' : '${typeName(host)}.';
     write(
         '''
-        <strong>${field.simpleName}</strong> <a class="anchor-link"
-            href="#${memberAnchor(field)}"
-            title="Permalink to $prefix${field.simpleName}">#</a>
+        <strong>${getter.simpleName}</strong> <a class="anchor-link"
+            href="#${memberAnchor(getter)}"
+            title="Permalink to $prefix${getter.simpleName}">#</a>
         </h4>
         ''');
 
     if (inherited) {
       write('<div class="inherited-from">inherited from ');
-      annotateType(host, field.surroundingDeclaration);
+      annotateType(host, getter.surroundingDeclaration);
       write('</div>');
     }
 
-    docCode(host, field.location, getMemberComment(field), showCode: true);
+    DocComment comment = getMemberComment(getter);
+    if (comment == null && setter != null) {
+      comment = getMemberComment(setter);
+    }
+    writeln('<div class="doc">');
+    docComment(host, comment);
+    docCode(getter.location);
+    if (setter != null) {
+      docCode(setter.location);
+    }
+    writeln('</div>');
 
     writeln('</div>');
   }
@@ -1200,13 +1381,7 @@
     write(')');
   }
 
-  /**
-   * Documents the code contained within [span] with [comment]. If [showCode]
-   * is `true` (and [includeSource] is set), also includes the source code.
-   */
-  void docCode(ObjectMirror host, Location location, DocComment comment,
-               [bool showCode = false]) {
-    writeln('<div class="doc">');
+  void docComment(ObjectMirror host, DocComment comment) {
     if (comment != null) {
       if (comment.inheritedFrom !== null) {
         writeln('<div class="inherited">');
@@ -1219,14 +1394,17 @@
         writeln(comment.html);
       }
     }
+  }
 
-    if (includeSource && showCode) {
+  /**
+   * Documents the source code contained within [location].
+   */
+  void docCode(Location location) {
+    if (includeSource) {
       writeln('<pre class="source">');
       writeln(md.escapeHtml(unindentCode(location)));
       writeln('</pre>');
     }
-
-    writeln('</div>');
   }
 
   DocComment createDocComment(String text, [InterfaceMirror inheritedFrom]) =>
diff --git a/pkg/dartdoc/lib/mirrors.dart b/pkg/dartdoc/lib/mirrors.dart
index 326d1be..692e37a 100644
--- a/pkg/dartdoc/lib/mirrors.dart
+++ b/pkg/dartdoc/lib/mirrors.dart
@@ -353,6 +353,11 @@
   bool get isFinal;
 
   /**
+   * Returns true if this field is const.
+   */
+  bool get isConst;
+
+  /**
    * Returns the type of this field.
    */
   TypeMirror get type;
diff --git a/pkg/dartdoc/lib/src/client/client-shared.dart b/pkg/dartdoc/lib/src/client/client-shared.dart
index bddaa12..a448ae2 100644
--- a/pkg/dartdoc/lib/src/client/client-shared.dart
+++ b/pkg/dartdoc/lib/src/client/client-shared.dart
@@ -38,18 +38,20 @@
     // disabled.
     if (showCode == null) continue;
 
-    var pre = elem.query('pre.source');
+    var preList = elem.queryAll('pre.source');
 
     showCode.on.click.add((e) {
-      if (pre.classes.contains('expanded')) {
-        pre.classes.remove('expanded');
-      } else {
-        // Syntax highlight.
-        if (!pre.classes.contains('formatted')) {
-          pre.innerHTML = classifySource(pre.text);
-          pre.classes.add('formatted');
-        };
-        pre.classes.add('expanded');
+      for (final pre in preList) {
+        if (pre.classes.contains('expanded')) {
+          pre.classes.remove('expanded');
+        } else {
+          // Syntax highlight.
+          if (!pre.classes.contains('formatted')) {
+            pre.innerHTML = classifySource(pre.text);
+            pre.classes.add('formatted');
+          };
+          pre.classes.add('expanded');
+        }
       }
     });
   }
diff --git a/pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart b/pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart
index af3f858..1925ec2 100644
--- a/pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart
+++ b/pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart
@@ -1374,9 +1374,10 @@
 
   bool get isStatic => _variable.modifiers.isStatic();
 
-  // TODO(johnniwinther): Should this return true on const as well?
   bool get isFinal => _variable.modifiers.isFinal();
 
+  bool get isConst => _variable.modifiers.isConst();
+
   TypeMirror get type => _convertTypeToTypeMirror(system,
       _variable.computeType(system.compiler),
       system.compiler.types.dynamicType);
diff --git a/pkg/dartdoc/static/styles.css b/pkg/dartdoc/static/styles.css
index fd643c6..bd9452f 100644
--- a/pkg/dartdoc/static/styles.css
+++ b/pkg/dartdoc/static/styles.css
@@ -361,9 +361,9 @@
 /* Only show the "code" link for the highlighted member. */
 .show-code, .show-inherited {
   float: right;
-  font: 600 11px/22px 'Open Sans', 'Lucida Sans Unicode', 'Lucida Grande',
+  font: 600 11px 'Open Sans', 'Lucida Sans Unicode', 'Lucida Grande',
       sans-serif;
-  padding: 0 0 6px 0; /* In case it gets too close to the member. */
+  padding: 0 0 0 6px; /* In case it gets too close to the member. */
   border: none;
   background: transparent;
   margin: 0;
@@ -395,7 +395,7 @@
 
 /* Links that don't cause a page refresh. */
 .anchor-link, .anchor-link:visited,
-.show-code, .show-code:visited, 
+.show-code, .show-code:visited,
 .show-inherited, .show-inherited:visited {
   color: hsl(40, 100%, 40%);
   cursor: pointer;
@@ -407,7 +407,7 @@
 }
 
 .anchor-link:hover,
-.show-code:hover, 
+.show-code:hover,
 .show-inherited:hover {
   color: hsl(40, 100%, 60%);
 }
diff --git a/runtime/bin/http_impl.dart b/runtime/bin/http_impl.dart
index 7e71ca8..a0d73ba 100644
--- a/runtime/bin/http_impl.dart
+++ b/runtime/bin/http_impl.dart
@@ -2105,29 +2105,92 @@
   }
 
   HttpClientConnection _prepareHttpClientConnection(
-    String method,
-    Uri url,
-    [_HttpClientConnection connection]) {
+      String method,
+      Uri url,
+      [_HttpClientConnection connection]) {
 
-    String host = url.domain;
-    int port = url.port == 0 ? HttpClient.DEFAULT_HTTP_PORT : url.port;
+    void _establishConnection(String host,
+                              int port,
+                              _ProxyConfiguration proxyConfiguration,
+                              int proxyIndex) {
 
-    void _connectionOpened(_SocketConnection socketConn,
-                           _HttpClientConnection connection,
-                           bool usingProxy) {
-      connection._usingProxy = usingProxy;
-      connection._connectionEstablished(socketConn);
-      HttpClientRequest request = connection.open(method, url);
-      request.headers.host = host;
-      request.headers.port = port;
-      if (connection._onRequest != null) {
-        connection._onRequest(request);
+      void _connectionOpened(_SocketConnection socketConn,
+                             _HttpClientConnection connection,
+                             bool usingProxy) {
+        connection._usingProxy = usingProxy;
+        connection._connectionEstablished(socketConn);
+        HttpClientRequest request = connection.open(method, url);
+        request.headers.host = host;
+        request.headers.port = port;
+        if (connection._onRequest != null) {
+          connection._onRequest(request);
+        } else {
+          request.outputStream.close();
+        }
+      }
+
+      assert(proxyIndex < proxyConfiguration.proxies.length);
+
+      // Determine the actual host to connect to.
+      String connectHost;
+      int connectPort;
+      _Proxy proxy = proxyConfiguration.proxies[proxyIndex];
+      if (proxy.isDirect) {
+        connectHost = host;
+        connectPort = port;
       } else {
-        request.outputStream.close();
+        connectHost = proxy.host;
+        connectPort = proxy.port;
+      }
+
+      // If there are active connections for this key get the first one
+      // otherwise create a new one.
+      String key = _connectionKey(connectHost, connectPort);
+      Queue socketConnections = _openSockets[key];
+      if (socketConnections == null || socketConnections.isEmpty()) {
+        Socket socket = new Socket(connectHost, connectPort);
+        // Until the connection is established handle connection errors
+        // here as the HttpClientConnection object is not yet associated
+        // with the socket.
+        socket.onError = (e) {
+          proxyIndex++;
+          if (proxyIndex < proxyConfiguration.proxies.length) {
+            // Try the next proxy in the list.
+            _establishConnection(host, port, proxyConfiguration, proxyIndex);
+          } else {
+            // Report the error through the HttpClientConnection object to
+            // the client.
+            connection._onError(e);
+          }
+        };
+        socket.onConnect = () {
+          // When the connection is established, clear the error
+          // callback as it will now be handled by the
+          // HttpClientConnection object which will be associated with
+          // the connected socket.
+          socket.onError = null;
+          _SocketConnection socketConn =
+          new _SocketConnection(connectHost, connectPort, socket);
+          _activeSockets.add(socketConn);
+          _connectionOpened(socketConn, connection, !proxy.isDirect);
+        };
+      } else {
+        _SocketConnection socketConn = socketConnections.removeFirst();
+        _activeSockets.add(socketConn);
+        new Timer(0, (ignored) =>
+                  _connectionOpened(socketConn, connection, !proxy.isDirect));
+
+        // Get rid of eviction timer if there are no more active connections.
+        if (socketConnections.isEmpty()) _openSockets.remove(key);
+        if (_openSockets.isEmpty()) _cancelEvictionTimer();
       }
     }
 
-    // Create a new connection if we are not re-using an existing one.
+    // Find the TCP host and port.
+    String host = url.domain;
+    int port = url.port == 0 ? HttpClient.DEFAULT_HTTP_PORT : url.port;
+
+    // Create a new connection object if we are not re-using an existing one.
     if (connection == null) {
       connection = new _HttpClientConnection(this);
     }
@@ -2141,53 +2204,8 @@
       proxyConfiguration = new _ProxyConfiguration(_findProxy(url));
     }
 
-    // Determine the actual host to connect to.
-    String connectHost;
-    int connectPort;
-    _Proxy proxy = proxyConfiguration.proxies[0];
-    if (proxy.isDirect) {
-      connectHost = host;
-      connectPort = port;
-    } else {
-      connectHost = proxy.host;
-      connectPort = proxy.port;
-    }
-
-    // If there are active connections for this key get the first one
-    // otherwise create a new one.
-    String key = _connectionKey(connectHost, connectPort);
-    Queue socketConnections = _openSockets[key];
-    if (socketConnections == null || socketConnections.isEmpty()) {
-      Socket socket = new Socket(connectHost, connectPort);
-      // Until the connection is established handle connection errors
-      // here as the HttpClientConnection object is not yet associated
-      // with the socket.
-      socket.onError = (e) {
-        // Report the error through the HttpClientConnection object to
-        // the client.
-        connection._onError(e);
-      };
-      socket.onConnect = () {
-        // When the connection is established, clear the error
-        // callback as it will now be handled by the
-        // HttpClientConnection object which will be associated with
-        // the connected socket.
-        socket.onError = null;
-        _SocketConnection socketConn =
-            new _SocketConnection(connectHost, connectPort, socket);
-        _activeSockets.add(socketConn);
-        _connectionOpened(socketConn, connection, !proxy.isDirect);
-      };
-    } else {
-      _SocketConnection socketConn = socketConnections.removeFirst();
-      _activeSockets.add(socketConn);
-      new Timer(0, (ignored) =>
-                _connectionOpened(socketConn, connection, !proxy.isDirect));
-
-      // Get rid of eviction timer if there are no more active connections.
-      if (socketConnections.isEmpty()) _openSockets.remove(key);
-      if (_openSockets.isEmpty()) _cancelEvictionTimer();
-    }
+    // Establish the connection starting with the first proxy configured.
+    _establishConnection(host, port, proxyConfiguration, 0);
 
     return connection;
   }
diff --git a/runtime/vm/disassembler_x64.cc b/runtime/vm/disassembler_x64.cc
index 5cac646..db52c38 100644
--- a/runtime/vm/disassembler_x64.cc
+++ b/runtime/vm/disassembler_x64.cc
@@ -426,12 +426,19 @@
 
 // Append the str to the output buffer.
 void DisassemblerX64::AppendToBuffer(const char* format, ...) {
+  intptr_t available = buffer_size_ - buffer_pos_;
+  if (available <= 1) {
+    ASSERT(buffer_[buffer_pos_] == '\0');
+    return;
+  }
   char* buf = buffer_ + buffer_pos_;
   va_list args;
   va_start(args, format);
-  int retval = OS::VSNPrint(buf, buffer_size_, format, args);
+  int length = OS::VSNPrint(buf, available, format, args);
   va_end(args);
-  buffer_pos_ += retval;
+  buffer_pos_ =
+      (length >= available) ? (buffer_size_ - 1) : (buffer_pos_ + length);
+  ASSERT(buffer_pos_ < buffer_size_);
 }
 
 
@@ -1801,9 +1808,7 @@
     }
   }  // !processed
 
-  if (buffer_pos_ < buffer_size_) {
-    buffer_[buffer_pos_] = '\0';
-  }
+  ASSERT(buffer_[buffer_pos_] == '\0');
 
   int instr_len = data - reinterpret_cast<uint8_t*>(pc);
   ASSERT(instr_len > 0);  // Ensure progress.
diff --git a/tests/co19/co19-compiler.status b/tests/co19/co19-compiler.status
index cb3c6f5..e745c56 100644
--- a/tests/co19/co19-compiler.status
+++ b/tests/co19/co19-compiler.status
@@ -188,9 +188,7 @@
 Language/13_Libraries_and_Scripts/13_Libraries_and_Scripts_A05_t04: Fail, OK # contains syntax error
 Language/13_Libraries_and_Scripts/2_Imports_A01_t18: Fail, OK # contains semantic error
 Language/13_Libraries_and_Scripts/2_Imports_A02_t18: Fail, OK # contains syntax error
-Language/13_Libraries_and_Scripts/2_Imports_A02_t20: Fail, OK # contains syntax error
 Language/13_Libraries_and_Scripts/2_Imports_A02_t21: Fail, OK # contains syntax error
-Language/13_Libraries_and_Scripts/2_Imports_A02_t22: Fail, OK # contains syntax error
 Language/13_Libraries_and_Scripts/2_Imports_A02_t24: Fail, OK # co19 issue 243
 Language/13_Libraries_and_Scripts/2_Imports_A05_t02: Fail, OK # invalid directive syntax
 Language/06_Functions/06_Functions_A01_t06: Fail, OK # expecting error that doesn't exist
diff --git a/tests/co19/co19-dart2dart.status b/tests/co19/co19-dart2dart.status
index a15d037..d9365ce 100644
--- a/tests/co19/co19-dart2dart.status
+++ b/tests/co19/co19-dart2dart.status
@@ -45,7 +45,6 @@
 Language/05_Variables/05_Variables_A05_t02: Fail # http://dartbug.com/5519
 Language/06_Functions/06_Functions_A01_t06: Fail # inherited from VM
 Language/06_Functions/06_Functions_A01_t22: Fail # inherited from VM
-Language/06_Functions/06_Functions_A01_t23: Fail # http://dartbug.com/5519
 Language/06_Functions/06_Functions_A01_t31: Fail # http://dartbug.com/5519
 Language/06_Functions/1_Function_Declaration_A01_t01: Fail # http://dartbug.com/5519
 Language/06_Functions/1_Function_Declaration_A02_t02: Fail # http://dartbug.com/5519
@@ -401,7 +400,6 @@
 Language/10_Expressions/28_Identifier_Reference_A04_t06: Fail # Inherited from dart2js
 Language/10_Expressions/28_Identifier_Reference_A04_t07: Fail, OK # co19 issue 184
 Language/10_Expressions/28_Identifier_Reference_A05_t09: Fail # inherited from VM
-Language/10_Expressions/28_Identifier_Reference_A06_t07: Fail # inherited from VM
 Language/10_Expressions/28_Identifier_Reference_A06_t13: Fail, OK # co19 issue 254
 Language/10_Expressions/28_Identifier_Reference_A06_t15: Fail # inherited from VM
 Language/10_Expressions/28_Identifier_Reference_A07_t01: Fail # http://dartbug.com/5519
@@ -466,9 +464,6 @@
 Language/11_Statements/11_Labels_A03_t04: Fail # inherited from dart2js
 Language/11_Statements/13_Continue_A02_t12: Fail # inherited from dart2js
 Language/11_Statements/13_Continue_A02_t13: Fail # inherited from dart2js
-Language/11_Statements/15_Assert_A01_t03: Fail # http://dartbug.com/5519
-Language/11_Statements/15_Assert_A01_t04: Fail # http://dartbug.com/5519
-Language/11_Statements/15_Assert_A01_t05: Fail # http://dartbug.com/5519
 Language/13_Libraries_and_Scripts/13_Libraries_and_Scripts_A05_t04: Fail # inherited from VM
 Language/13_Libraries_and_Scripts/2_Imports_A01_t39: Fail # inherited from VM
 Language/13_Libraries_and_Scripts/2_Imports_A02_t01: Fail # inherited from VM
@@ -501,8 +496,6 @@
 Language/14_Types/4_Interface_Types_A02_t01: Fail # Looks like dart2js issue, let's wait when interfaces are phased away
 Language/14_Types/5_Function_Types_A01_t05: Fail # inherited from dart2js
 Language/14_Types/5_Function_Types_A02_t01: Fail # inherited from VM
-Language/15_Reference/1_Lexical_Rules/1_Reserved_Words_A30_t04: Fail # inherited from dart2js
-Language/15_Reference/1_Lexical_Rules/1_Reserved_Words_A30_t05: Fail # inherited from dart2js
 Language/15_Reference/1_Lexical_Rules/1_Reserved_Words_A40_t04: Fail # inherited from dart2js
 Language/15_Reference/1_Lexical_Rules_A01_t06: Fail # inherited from VM
 Language/15_Reference/1_Lexical_Rules_A02_t06: Fail # inherited from dart2js
@@ -568,6 +561,8 @@
 # Partially implemented redirecting constructors makes this fail.
 Language/07_Classes/6_Constructors/2_Factories_A01_t05: Fail
 
+Language/07_Classes/6_Constructors/1_Generative_Constructors_A16_t07: Fail # Redirecting constructors can not use initializing formals. This bug was previously masked - compilation failed, but for different, wrong reason.
+
 [ $compiler == dart2dart && $system == windows ]
 LibTest/core/double/operator_remainder_A01_t04: Fail # Result is NaN
 LibTest/core/double/round_A01_t01: Fail # Result is NaN
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index d43d6e2..5750632 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -37,8 +37,6 @@
 Language/10_Expressions/11_Instance_Creation/1_New_A02_t05: Fail # TODO(ahe): Please triage this failure.
 Language/10_Expressions/11_Instance_Creation/1_New_A02_t06: Fail # TODO(ahe): Please triage this failure.
 Language/10_Expressions/11_Instance_Creation/1_New_A02_t07: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A06_t01: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A06_t02: Fail # TODO(ahe): Please triage this failure.
 Language/10_Expressions/11_Instance_Creation/1_New_A06_t06: Fail # TODO(ahe): Please triage this failure.
 Language/10_Expressions/11_Instance_Creation/1_New_A07_t01: Fail # TODO(ahe): Please triage this failure.
 Language/10_Expressions/11_Instance_Creation/1_New_A11_t01: Fail # TODO(ahe): Please triage this failure.
@@ -125,7 +123,6 @@
 Language/11_Statements/09_Try_A01_t18: Fail # TODO(ahe): Please triage this failure.
 Language/13_Libraries_and_Scripts/2_Imports_A02_t19: Fail # TODO(ahe): Please triage this failure.
 Language/13_Libraries_and_Scripts/2_Imports_A02_t28: Fail # TODO(ahe): Please triage this failure.
-Language/15_Reference/1_Lexical_Rules/1_Reserved_Words_A30_t05: Fail # TODO(ahe): Please triage this failure.
 Language/15_Reference/1_Lexical_Rules/1_Reserved_Words_A40_t04: Fail # TODO(ahe): Please triage this failure.
 Language/15_Reference/1_Lexical_Rules_A01_t06: Fail # TODO(ahe): Please triage this failure.
 LibTest/core/RegExp/hasMatch_A01_t02: Fail # TODO(ahe): Please triage this failure.
@@ -247,6 +244,8 @@
 LibTest/core/double/operator_remainder_A01_t04: Fail
 
 [ $compiler == dart2js ]
+Language/07_Classes/6_Constructors/1_Generative_Constructors_A16_t07: Fail # Redirecting constructors can not use initializing formals. This bug was previously masked - compilation failed, but for different, wrong reason.
+
 Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t10: Fail # TODO(ahe): Enforce optional parameter semantics.
 Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t11: Fail # TODO(ahe): Enforce optional parameter semantics.
 Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A03_t03: Fail # TODO(ahe): Enforce optional parameter semantics.
@@ -348,12 +347,12 @@
 Language/10_Expressions/22_Shift_A01_t01: Fail, OK # Function declaration takes precedence over function expression.
 Language/10_Expressions/26_Postfix_Expressions_A01_t01: Fail, OK # A map literal cannot start an expression statement.
 Language/10_Expressions/27_Assignable_Expressions_A01_t27: Fail, OK # A map literal cannot start an expression statement.
+Language/10_Expressions/28_Identifier_Reference_A04_t07: Fail # assert is a reserved word, which can not be used as a variable name.
 Language/11_Statements/07_Do_A02_t02: Fail, OK # co19 issue 145.
 LibTest/core/String/String_class_A02_t01: Fail, OK # compiler cancelled: Unhandled non-BMP character: U+10000
 LibTest/core/String/charCodeAt_A01_t01: Fail, OK # compiler cancelled: Unhandled non-BMP character: U+10000
 LibTest/core/String/charCodes_A01_t01: Fail, OK # compiler cancelled: Unhandled non-BMP character: U+10000
 
-Language/06_Functions/06_Functions_A01_t23: Fail, OK # co19 issue 210
 Language/06_Functions/1_Function_Declaration_A02_t03: Fail, OK # co19 issue 210
 Language/06_Functions/1_Function_Declaration_A03_t03: Fail, OK # co19 issue 210
 Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t14: Fail, OK # co19 issue 210
@@ -362,16 +361,12 @@
 Language/11_Statements/03_Variable_Declaration_A01_t10: Fail, OK # co19 issue 210
 Language/11_Statements/03_Variable_Declaration_A02_t04: Fail, OK # co19 issue 210
 Language/11_Statements/08_Switch_A07_t02: Fail, OK # co19 issue 210
-Language/11_Statements/15_Assert_A01_t03: Fail, OK # co19 issue 210
-Language/11_Statements/15_Assert_A01_t04: Fail, OK # co19 issue 210
-Language/11_Statements/15_Assert_A01_t05: Fail, OK # co19 issue 210
 
 LibTest/core/Math/max_A01_t03: Fail, OK # co19 issue 157
 LibTest/core/Math/min_A01_t03: Fail, OK # co19 issue 157
 
 Language/03_Overview/1_Scoping_A01_t40: Fail, OK # co19 issue 188
 Language/03_Overview/1_Scoping_A01_t41: Fail, OK # co19 issue 188
-Language/10_Expressions/28_Identifier_Reference_A06_t07: Fail, OK # co19 issue 188
 Language/10_Expressions/28_Identifier_Reference_A06_t13: Fail, OK # co19 issue 254
 Language/10_Expressions/28_Identifier_Reference_A06_t15: Fail, OK # co19 issue 188
 
@@ -393,8 +388,6 @@
 
 Language/03_Overview/2_Privacy_A01_t09: Fail, OK # co19 issue 198
 Language/03_Overview/2_Privacy_A01_t10: Fail, OK # co19 issue 198
-Language/03_Overview/2_Privacy_A01_t19: Fail, OK # co19 issue 198
-Language/03_Overview/2_Privacy_A01_t20: Fail, OK # co19 issue 198
 
 Language/10_Expressions/30_Type_Cast_A02_t03: Fail, OK # co19 issue 236
 
@@ -656,7 +649,6 @@
 Language/14_Types/3_Type_Declarations/1_Typedef_A07_t01: Fail # Checks that self-referencing typedef is not allowed (return value type annotation has the same name as a type alias).
 Language/14_Types/3_Type_Declarations/1_Typedef_A07_t02: Fail # Checks that self-referencing typedef is not allowed (positional formal parameter type annotation has the same name as a type alias).
 Language/14_Types/3_Type_Declarations/1_Typedef_A07_t03: Fail # Checks that self-referencing typedef is not allowed (optional formal parameter type annotation has the same name as a type alias).
-Language/15_Reference/1_Lexical_Rules/1_Reserved_Words_A30_t04: Fail # Checks that other Unicode whitespaces are not allowed:  check NO-BREAK SPACE (U+00A0)
 Language/15_Reference/1_Lexical_Rules_A02_t06: Fail # Checks that Unicode whitespaces other than WHITESPACE are not permitted in the source code. Checks symbol U+00a0.
 
 
diff --git a/tests/compiler/dart2js/dart2js.status b/tests/compiler/dart2js/dart2js.status
index f63da2e..0478963 100644
--- a/tests/compiler/dart2js/dart2js.status
+++ b/tests/compiler/dart2js/dart2js.status
@@ -2,12 +2,13 @@
 # for details. All rights reserved. Use of this source code is governed by a
 # BSD-style license that can be found in the LICENSE file.
 
-link_test: Fail # TODO(ahe): I'm fixing this.
-
 constant_folding_string_test: Fail
 redundant_phi_eliminator_test: Fail # Fails because of hack to allow aborting loops.
 pretty_parameter_test: Fail # TODO(floitsch): investigate.
 tree_shaking_test: Fail # Issue 4811
 
+# Minification of locals temporarily disabled due to issue 5808
+minify_many_locals_test: Fail
+
 [ $runtime == d8 || $runtime == drt || $runtime == dartium || $runtime == ff || $runtime == firefox || $runtime == chrome || $runtime == safari || $runtime == ie || $runtime == opera ]
 *: Skip # dart2js uses #import('dart:io'); and it is not self-hosted (yet).
diff --git a/tests/compiler/dart2js/link_test.dart b/tests/compiler/dart2js/link_test.dart
index 92baa10..f108fd8 100644
--- a/tests/compiler/dart2js/link_test.dart
+++ b/tests/compiler/dart2js/link_test.dart
@@ -2,15 +2,16 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-#import('../../../lib/compiler/implementation/util/util.dart');
-#import('../../../lib/compiler/implementation/util/util_implementation.dart');
+import '../../../lib/compiler/implementation/util/util.dart';
+import '../../../lib/compiler/implementation/util/util_implementation.dart';
 
 main() {
-  test(new Link<Comparable>('three').prepend(2).prepend('one'),
+  test(const Link<Comparable>().prepend('three').prepend(2).prepend('one'),
        ['one', 2, 'three']);
-  test(new Link<Comparable>(3).prepend('two').prepend(1), [1, 'two', 3]);
-  test(new Link<String>('single'), ['single']);
-  test(new LinkTail(), []);
+  test(const Link<Comparable>().prepend(3).prepend('two').prepend(1),
+       [1, 'two', 3]);
+  test(const Link<String>().prepend('single'), ['single']);
+  test(const Link(), []);
   testFromList([]);
   testFromList([0]);
   testFromList([0, 1]);
diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart
index a3aa2df..6c37746 100644
--- a/tests/compiler/dart2js/mock_compiler.dart
+++ b/tests/compiler/dart2js/mock_compiler.dart
@@ -41,7 +41,7 @@
   boolConversionCheck(x) {}
   abstract class JavaScriptIndexingBehavior {}
   S() {}
-  assert(a){}''';
+  assertHelper(a){}''';
 
 const String DEFAULT_INTERCEPTORSLIB = r'''
   add$1(receiver, value) {}
diff --git a/tests/compiler/dart2js/resolver_test.dart b/tests/compiler/dart2js/resolver_test.dart
index 01cd912..fe4db71c 100644
--- a/tests/compiler/dart2js/resolver_test.dart
+++ b/tests/compiler/dart2js/resolver_test.dart
@@ -8,6 +8,7 @@
 #import("../../../lib/compiler/implementation/elements/elements.dart");
 #import("../../../lib/compiler/implementation/tree/tree.dart");
 #import("../../../lib/compiler/implementation/scanner/scannerlib.dart");
+#import("../../../lib/compiler/implementation/universe/universe.dart");
 #import("../../../lib/compiler/implementation/util/util.dart");
 #import("compiler_helper.dart");
 #import("mock_compiler.dart");
@@ -563,7 +564,9 @@
   ClassElement classElement =
       compiler.mainApp.find(buildSourceString(className));
   Element element =
-      classElement.lookupConstructor(buildSourceString(constructor));
+      classElement.lookupConstructor(
+          new Selector.callConstructor(buildSourceString(constructor),
+                                       classElement.getLibrary()));
   FunctionExpression tree = element.parseNode(compiler);
   ResolverVisitor visitor = new ResolverVisitor(compiler, element);
   new InitializerResolver(visitor).resolveInitializers(element, tree);
@@ -663,7 +666,7 @@
                 A.a() : this.b(0);
                 A.b(int i);
               }""";
-  resolveConstructor(script, "A a = new A.a();", "A", r"A$a", 1,
+  resolveConstructor(script, "A a = new A.a();", "A", "a", 1,
                      [], []);
 
   script = """class A {
@@ -671,7 +674,7 @@
                 A.a() : i = 42, this(0);
                 A(int i);
               }""";
-  resolveConstructor(script, "A a = new A.a();", "A", r"A$a", 2,
+  resolveConstructor(script, "A a = new A.a();", "A", "a", 2,
                      [], [MessageKind.REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER]);
 
   script = """class A {
diff --git a/tests/compiler/dart2js_extra/dart2js_extra.status b/tests/compiler/dart2js_extra/dart2js_extra.status
index 9d53c1c..f24783d 100644
--- a/tests/compiler/dart2js_extra/dart2js_extra.status
+++ b/tests/compiler/dart2js_extra/dart2js_extra.status
@@ -6,7 +6,6 @@
 class_test: Fail
 statements_test: Fail
 typed_locals_test: Fail
-regress/4740_test: Fail
 inline_position_crash_test: Fail # http://www.dartbug.com/3905
 constant_javascript_semantics3_test: Fail # http://www.dartbug.com/5581
 
diff --git a/tests/language/call_constructor_on_unresolvable_class_test.dart b/tests/language/call_constructor_on_unresolvable_class_test.dart
index 3ecf056..0998eec 100644
--- a/tests/language/call_constructor_on_unresolvable_class_test.dart
+++ b/tests/language/call_constructor_on_unresolvable_class_test.dart
@@ -20,12 +20,12 @@
     // These should not produce errors because the calls are never executed.
     new A();         /// 01: static type warning
     new A.foo();     /// 02: static type warning
-    new library.A(); /// 03: static type warning
+    new lib.A();     /// 03: static type warning
   }
 
   new A();         /// 04: runtime error
   new A.foo();     /// 05: runtime error
-  new library.A(); /// 06: runtime error
+  new lib.A();     /// 06: runtime error
 
   var ex;                    /// 07: static type warning
   try {                      /// 07: continued
diff --git a/tests/language/language.status b/tests/language/language.status
index 456875a..3f2bad9 100644
--- a/tests/language/language.status
+++ b/tests/language/language.status
@@ -87,10 +87,8 @@
 compile_time_constant_checked3_test/06: Fail, OK
 
 [ $compiler == dartc ]
-import_combinators_test: Fail # Issue 5735
 implicit_this_test/none: Fail # should not warn about allocating SubAbstract2
 metadata_test: Fail
-call_constructor_on_unresolvable_class_test/03: Fail, OK # 'library' cannot be used as a prefix because it is a built-in identifier
 get_set_syntax_test/none: Fail # does not accept getter/setter with no method body
 application_negative_test: Fail # Runtime only test, rewrite as multitest
 assign_instance_method_negative_test: Fail # Runtime only test, rewrite as multitest
@@ -328,8 +326,6 @@
 # chokes on things like typedef(x) => "typedef $x" and alike.
 abstract_syntax_test/01: Fail
 abstract_syntax_test/02: Fail
-pseudo_kw_illegal_test/08: Fail
-pseudo_kw_illegal_test/10: Fail
 pseudo_kw_illegal_test/11: Fail
 pseudo_kw_illegal_test/14: Fail
 pseudo_kw_test: Fail
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index cf021ae..f17d87c 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -58,7 +58,6 @@
 compile_time_constant_checked3_test/06: Fail, OK
 
 [ $compiler == dart2js ]
-abstract_runtime_error_test: Fail # http://dartbug.com/4737
 bad_constructor_test/04: Fail # http://dartbug.com/5519
 bad_constructor_test/05: Fail # http://dartbug.com/5519
 bad_constructor_test/06: Fail # http://dartbug.com/5519
@@ -162,8 +161,6 @@
 method_override2_test/01: Fail # accepts illegal override
 method_override2_test/02: Fail # accepts illegal override
 method_override2_test/03: Fail # accepts illegal override
-implicit_this_test/02: Fail # instantiation of abstract class
-implicit_this_test/03: Fail # instantiation of abstract class
 abstract_getter_test/01: Fail # instantiation of abstract class
 abstract_factory_constructor_test/01: Fail # instantiation of abstract class
 parameter_initializer6_negative_test: Fail # Issue 3502
@@ -270,8 +267,6 @@
 prefix20_negative_test: Fail # Negative language test.
 prefix23_negative_test: Fail # Negative language test.
 pseudo_kw_illegal_test/03: Fail # Negative language test.
-pseudo_kw_illegal_test/08: Fail # Negative language test.
-pseudo_kw_illegal_test/10: Fail # Negative language test.
 pseudo_kw_illegal_test/11: Fail # Negative language test.
 pseudo_kw_illegal_test/14: Fail # Negative language test.
 scope_negative_test: Fail # Negative language test.
@@ -358,8 +353,8 @@
 first_class_types_test: Fail # http://dartbug.com/5523
 part2_test: Fail # TODO(ahe): Enable wrapper-less tests on Firefox/Windows.
 part_test: Fail # TODO(ahe): Enable wrapper-less tests on Firefox/Windows.
-export_test: Fail # Issue 5785
-export_cyclic_test: Fail # Issue 5785
-generic_creation_test: Fail # Issue 5785l
-import_combinators_test: Fail # Issue 3454
+export_test: Fail # Issue 5785 (root cause: issue 2264)
+export_cyclic_test: Fail # Issue 5785 (root cause: issue 2264)
+generic_creation_test: Fail # Issue 5785 (root cause: issue 2264)
+import_combinators_test: Fail # Issue 5785 (root cause: issue 2264)
 first_class_types_libraries_test: Fail
diff --git a/tests/language/state_mangling2_test.dart b/tests/language/state_mangling2_test.dart
new file mode 100644
index 0000000..637df3e
--- /dev/null
+++ b/tests/language/state_mangling2_test.dart
@@ -0,0 +1,36 @@
+// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+foo(state) {
+  if (state == null) return 0;
+  var sum = 0;
+  state = inscrutableId(state);
+  for (int i = 0; i < state.length; i++) {
+    sum += state[i];
+  }
+  state = inscrutableId(state);
+  for (int i = 0; i < state.length; i++) {
+    sum += state[i];
+  }
+  return sum;
+}
+
+int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
+
+inscrutableId(x) {
+  if (x == 0) return inscrutable(x);
+  return (3 == inscrutable(3)) ? x : false;
+}
+
+class A {
+  int length = 3;
+  operator [](i) => 1;
+}
+
+main() {
+  Expect.equals(12, foo([1, 2, 3]));
+  if (inscrutableId(0) == 0) {
+    Expect.equals(6, foo(new A()));
+  }
+}
diff --git a/tests/language/state_mangling_test.dart b/tests/language/state_mangling_test.dart
new file mode 100644
index 0000000..02df690
--- /dev/null
+++ b/tests/language/state_mangling_test.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+foo(state) {
+  if (state == null) return 0;
+  var sum = 0;
+  for (int i = 0; i < state.length; i++) {
+    sum += state[i];
+  }
+  state = inscrutableId(state);
+  for (int i = 0; i < state.length; i++) {
+    sum += state[i];
+  }
+  return sum;
+}
+
+int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
+
+inscrutableId(x) {
+  if (x == 0) return inscrutable(x);
+  return (3 == inscrutable(3)) ? x : false;
+}
+
+class A {
+  int length = 3;
+  operator [](i) => 1;
+}
+
+main() {
+  Expect.equals(12, foo([1, 2, 3]));
+  if (inscrutableId(0) == 0) {
+    Expect.equals(6, foo(new A()));
+  }
+}
diff --git a/tests/standalone/io/http_proxy_test.dart b/tests/standalone/io/http_proxy_test.dart
index 4eb185e..5ab12b1 100644
--- a/tests/standalone/io/http_proxy_test.dart
+++ b/tests/standalone/io/http_proxy_test.dart
@@ -8,16 +8,21 @@
 class Server {
   HttpServer server;
   int proxyHops;
+  List<String> directRequestPaths;
   int requestCount = 0;
 
-  Server(this.proxyHops) : server = new HttpServer();
+  Server(this.proxyHops, this.directRequestPaths) : server = new HttpServer();
 
   void start() {
     server.listen("127.0.0.1", 0);
     server.defaultRequestHandler =
         (HttpRequest request, HttpResponse response) {
           requestCount++;
-          if (proxyHops > 0) {
+          // Check whether a proxy or direct connection is expected.
+          bool direct = directRequestPaths.reduce(
+              false,
+              (prev, path) => prev ? prev : path == request.path);
+          if (!direct && proxyHops > 0) {
             Expect.isNotNull(request.headers[HttpHeaders.VIA]);
             Expect.equals(1, request.headers[HttpHeaders.VIA].length);
             Expect.equals(
@@ -46,8 +51,9 @@
   int get port => server.port;
 }
 
-Server setupServer(int proxyHops) {
-  Server server = new Server(proxyHops);
+Server setupServer(int proxyHops,
+                   [List<String> directRequestPaths = const <String>[]]) {
+  Server server = new Server(proxyHops, directRequestPaths);
   server.start();
   return server;
 }
@@ -165,12 +171,15 @@
 int testProxyDoneCount = 0;
 void testProxy() {
   ProxyServer proxyServer = setupProxyServer();
-  Server server = setupServer(1);
+  Server server = setupServer(1, ["/4"]);
   HttpClient client = new HttpClient();
 
   List<String> proxy =
       ["PROXY localhost:${proxyServer.port}",
        "PROXY localhost:${proxyServer.port}; PROXY hede.hule.hest:8080",
+       "PROXY hede.hule.hest:8080; PROXY localhost:${proxyServer.port}",
+       "PROXY hede.hule.hest:8080; PROXY hede.hule.hest:8181; PROXY localhost:${proxyServer.port}",
+       "PROXY hede.hule.hest:8080; PROXY hede.hule.hest:8181; DIRECT",
        "PROXY localhost:${proxyServer.port}; DIRECT"];
 
   client.findProxy = (Uri uri) {
@@ -210,12 +219,15 @@
   ProxyServer proxyServer2 = setupProxyServer();
   proxyServer1.client.findProxy = (_) => "PROXY 127.0.0.1:${proxyServer2.port}";
 
-  Server server = setupServer(2);
+  Server server = setupServer(2, ["/4"]);
   HttpClient client = new HttpClient();
 
   List<String> proxy =
       ["PROXY localhost:${proxyServer1.port}",
        "PROXY localhost:${proxyServer1.port}; PROXY hede.hule.hest:8080",
+       "PROXY hede.hule.hest:8080; PROXY localhost:${proxyServer1.port}",
+       "PROXY hede.hule.hest:8080; PROXY hede.hule.hest:8181; PROXY localhost:${proxyServer1.port}",
+       "PROXY hede.hule.hest:8080; PROXY hede.hule.hest:8181; DIRECT",
        "PROXY localhost:${proxyServer1.port}; DIRECT"];
 
   client.findProxy = (Uri uri) {
@@ -257,6 +269,7 @@
   List<String> proxy =
       ["PROXY localhost:8080",
        "PROXY localhost:8080; PROXY hede.hule.hest:8080",
+       "PROXY hede.hule.hest:8080; PROXY localhost:8080",
        "PROXY localhost:8080; DIRECT"];
 
   client.findProxy = (Uri uri) {
diff --git a/tools/VERSION b/tools/VERSION
index 82ee775..d278f4e 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -1,4 +1,4 @@
 MAJOR 0
 MINOR 1
-BUILD 3
+BUILD 4
 PATCH 0
diff --git a/tools/release/version.dart b/tools/release/version.dart
index 5197f75..efb014a 100644
--- a/tools/release/version.dart
+++ b/tools/release/version.dart
@@ -122,7 +122,7 @@
   int getRevisionFromSvnInfo(String info) {
     if (info == null || info == '') return 0;
     var lines = info.split("\n");
-    RegExp exp = const RegExp(r"Revision: (\d*)");
+    RegExp exp = const RegExp(r"Last Changed Rev: (\d*)");
     for (var line in lines) {
       if (exp.hasMatch(line)) {
         String revisionString = (exp.firstMatch(line).group(1));
@@ -144,7 +144,15 @@
     var command = isSvn ? "svn" : "git";
     command = "$command${getExecutableSuffix()}";
     var arguments = isSvn ? ["info"] : ["svn", "info"];
-    return Process.run(command, arguments).transform((result) {
+    ProcessOptions options = new ProcessOptions();
+    // Run the command from the root to get the last changed revision for this
+    // "branch". Since we have both trunk and bleeding edge in the same
+    // repository and since we always build TOT we need this to get the
+    // right version number.
+    Path toolsDirectory = new Path.fromNative(_versionFileName).directoryPath;
+    Path root = toolsDirectory.join(new Path(".."));
+    options.workingDirectory = root.toNativePath();
+    return Process.run(command, arguments, options).transform((result) {
       if (result.exitCode != 0) {
         return 0;
       }