Version 0.7.2.0

svn merge -r 27023:27229 https://dart.googlecode.com/svn/branches/bleeding_edge trunk

git-svn-id: http://dart.googlecode.com/svn/trunk@27231 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/pkg/analyzer_experimental/lib/src/generated/ast.dart b/pkg/analyzer_experimental/lib/src/generated/ast.dart
index f3e9d2e..9c25d8a 100644
--- a/pkg/analyzer_experimental/lib/src/generated/ast.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/ast.dart
@@ -378,7 +378,7 @@
   /**
    * The strings that are implicitly concatenated.
    */
-  NodeList<StringLiteral> _strings;
+  NodeList<StringLiteral> strings;
 
   /**
    * Initialize a newly created list of adjacent strings.
@@ -386,8 +386,8 @@
    * @param strings the strings that are implicitly concatenated
    */
   AdjacentStrings.full(List<StringLiteral> strings) {
-    this._strings = new NodeList<StringLiteral>(this);
-    this._strings.addAll(strings);
+    this.strings = new NodeList<StringLiteral>(this);
+    this.strings.addAll(strings);
   }
 
   /**
@@ -397,17 +397,10 @@
    */
   AdjacentStrings({List<StringLiteral> strings}) : this.full(strings);
   accept(ASTVisitor visitor) => visitor.visitAdjacentStrings(this);
-  Token get beginToken => _strings.beginToken;
-  Token get endToken => _strings.endToken;
-
-  /**
-   * Return the strings that are implicitly concatenated.
-   *
-   * @return the strings that are implicitly concatenated
-   */
-  NodeList<StringLiteral> get strings => _strings;
+  Token get beginToken => strings.beginToken;
+  Token get endToken => strings.endToken;
   void visitChildren(ASTVisitor visitor) {
-    _strings.accept(visitor);
+    strings.accept(visitor);
   }
   void appendStringValue(JavaStringBuilder builder) {
     for (StringLiteral stringLiteral in strings) {
@@ -570,7 +563,7 @@
   /**
    * The at sign that introduced the annotation.
    */
-  Token _atSign;
+  Token atSign;
 
   /**
    * The name of the class defining the constructor that is being invoked or the name of the field
@@ -582,7 +575,7 @@
    * The period before the constructor name, or `null` if this annotation is not the
    * invocation of a named constructor.
    */
-  Token _period;
+  Token period;
 
   /**
    * The name of the constructor being invoked, or `null` if this annotation is not the
@@ -616,9 +609,9 @@
    *          annotation is not the invocation of a constructor
    */
   Annotation.full(Token atSign, Identifier name, Token period, SimpleIdentifier constructorName, ArgumentList arguments) {
-    this._atSign = atSign;
+    this.atSign = atSign;
     this._name = becomeParentOf(name);
-    this._period = period;
+    this.period = period;
     this._constructorName = becomeParentOf(constructorName);
     this._arguments = becomeParentOf(arguments);
   }
@@ -646,14 +639,7 @@
    * @return the arguments to the constructor being invoked
    */
   ArgumentList get arguments => _arguments;
-
-  /**
-   * Return the at sign that introduced the annotation.
-   *
-   * @return the at sign that introduced the annotation
-   */
-  Token get atSign => _atSign;
-  Token get beginToken => _atSign;
+  Token get beginToken => atSign;
 
   /**
    * Return the name of the constructor being invoked, or `null` if this annotation is not the
@@ -696,14 +682,6 @@
   Identifier get name => _name;
 
   /**
-   * Return the period before the constructor name, or `null` if this annotation is not the
-   * invocation of a named constructor.
-   *
-   * @return the period before the constructor name
-   */
-  Token get period => _period;
-
-  /**
    * Set the arguments to the constructor being invoked to the given arguments.
    *
    * @param arguments the arguments to the constructor being invoked
@@ -713,15 +691,6 @@
   }
 
   /**
-   * Set the at sign that introduced the annotation to the given token.
-   *
-   * @param atSign the at sign that introduced the annotation
-   */
-  void set atSign(Token atSign2) {
-    this._atSign = atSign2;
-  }
-
-  /**
    * Set the name of the constructor being invoked to the given name.
    *
    * @param constructorName the name of the constructor being invoked
@@ -748,15 +717,6 @@
   void set name(Identifier name2) {
     this._name = becomeParentOf(name2);
   }
-
-  /**
-   * Set the period before the constructor name to the given token.
-   *
-   * @param period the period before the constructor name
-   */
-  void set period(Token period2) {
-    this._period = period2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_name, visitor);
     safelyVisitChild(_constructorName, visitor);
@@ -778,7 +738,7 @@
   /**
    * The token representing the question mark.
    */
-  Token _question;
+  Token question;
 
   /**
    * The identifier representing the argument being tested.
@@ -792,7 +752,7 @@
    * @param identifier the identifier representing the argument being tested
    */
   ArgumentDefinitionTest.full(Token question, SimpleIdentifier identifier) {
-    this._question = question;
+    this.question = question;
     this._identifier = becomeParentOf(identifier);
   }
 
@@ -804,7 +764,7 @@
    */
   ArgumentDefinitionTest({Token question, SimpleIdentifier identifier}) : this.full(question, identifier);
   accept(ASTVisitor visitor) => visitor.visitArgumentDefinitionTest(this);
-  Token get beginToken => _question;
+  Token get beginToken => question;
   Token get endToken => _identifier.endToken;
 
   /**
@@ -815,13 +775,6 @@
   SimpleIdentifier get identifier => _identifier;
 
   /**
-   * Return the token representing the question mark.
-   *
-   * @return the token representing the question mark
-   */
-  Token get question => _question;
-
-  /**
    * Set the identifier representing the argument being tested to the given identifier.
    *
    * @param identifier the identifier representing the argument being tested
@@ -829,15 +782,6 @@
   void set identifier(SimpleIdentifier identifier2) {
     this._identifier = becomeParentOf(identifier2);
   }
-
-  /**
-   * Set the token representing the question mark to the given token.
-   *
-   * @param question the token representing the question mark
-   */
-  void set question(Token question2) {
-    this._question = question2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_identifier, visitor);
   }
@@ -867,7 +811,7 @@
   /**
    * The expressions producing the values of the arguments.
    */
-  NodeList<Expression> _arguments;
+  NodeList<Expression> arguments;
 
   /**
    * The right parenthesis.
@@ -900,9 +844,9 @@
    * @param rightParenthesis the right parenthesis
    */
   ArgumentList.full(Token leftParenthesis, List<Expression> arguments, Token rightParenthesis) {
-    this._arguments = new NodeList<Expression>(this);
+    this.arguments = new NodeList<Expression>(this);
     this._leftParenthesis = leftParenthesis;
-    this._arguments.addAll(arguments);
+    this.arguments.addAll(arguments);
     this._rightParenthesis = rightParenthesis;
   }
 
@@ -915,15 +859,6 @@
    */
   ArgumentList({Token leftParenthesis, List<Expression> arguments, Token rightParenthesis}) : this.full(leftParenthesis, arguments, rightParenthesis);
   accept(ASTVisitor visitor) => visitor.visitArgumentList(this);
-
-  /**
-   * Return the expressions producing the values of the arguments. Although the language requires
-   * that positional arguments appear before named arguments, this class allows them to be
-   * intermixed.
-   *
-   * @return the expressions producing the values of the arguments
-   */
-  NodeList<Expression> get arguments => _arguments;
   Token get beginToken => _leftParenthesis;
   Token get endToken => _rightParenthesis;
 
@@ -950,8 +885,8 @@
    * @param parameters the parameter elements corresponding to the arguments
    */
   void set correspondingPropagatedParameters(List<ParameterElement> parameters) {
-    if (parameters.length != _arguments.length) {
-      throw new IllegalArgumentException("Expected ${_arguments.length} parameters, not ${parameters.length}");
+    if (parameters.length != arguments.length) {
+      throw new IllegalArgumentException("Expected ${arguments.length} parameters, not ${parameters.length}");
     }
     _correspondingPropagatedParameters = parameters;
   }
@@ -965,8 +900,8 @@
    * @param parameters the parameter elements corresponding to the arguments
    */
   void set correspondingStaticParameters(List<ParameterElement> parameters) {
-    if (parameters.length != _arguments.length) {
-      throw new IllegalArgumentException("Expected ${_arguments.length} parameters, not ${parameters.length}");
+    if (parameters.length != arguments.length) {
+      throw new IllegalArgumentException("Expected ${arguments.length} parameters, not ${parameters.length}");
     }
     _correspondingStaticParameters = parameters;
   }
@@ -989,7 +924,7 @@
     _rightParenthesis = parenthesis;
   }
   void visitChildren(ASTVisitor visitor) {
-    _arguments.accept(visitor);
+    arguments.accept(visitor);
   }
 
   /**
@@ -1009,7 +944,7 @@
     if (_correspondingPropagatedParameters == null) {
       return null;
     }
-    int index = _arguments.indexOf(expression);
+    int index = arguments.indexOf(expression);
     if (index < 0) {
       return null;
     }
@@ -1033,7 +968,7 @@
     if (_correspondingStaticParameters == null) {
       return null;
     }
-    int index = _arguments.indexOf(expression);
+    int index = arguments.indexOf(expression);
     if (index < 0) {
       return null;
     }
@@ -1060,7 +995,7 @@
   /**
    * The as operator.
    */
-  Token _asOperator;
+  Token asOperator;
 
   /**
    * The name of the type being cast to.
@@ -1076,7 +1011,7 @@
    */
   AsExpression.full(Expression expression, Token isOperator, TypeName type) {
     this._expression = becomeParentOf(expression);
-    this._asOperator = isOperator;
+    this.asOperator = isOperator;
     this._type = becomeParentOf(type);
   }
 
@@ -1089,13 +1024,6 @@
    */
   AsExpression({Expression expression, Token isOperator, TypeName type}) : this.full(expression, isOperator, type);
   accept(ASTVisitor visitor) => visitor.visitAsExpression(this);
-
-  /**
-   * Return the as operator being applied.
-   *
-   * @return the as operator being applied
-   */
-  Token get asOperator => _asOperator;
   Token get beginToken => _expression.beginToken;
   Token get endToken => _type.endToken;
 
@@ -1114,15 +1042,6 @@
   TypeName get type => _type;
 
   /**
-   * Set the is operator being applied to the given operator.
-   *
-   * @param asOperator the is operator being applied
-   */
-  void set asOperator(Token asOperator2) {
-    this._asOperator = asOperator2;
-  }
-
-  /**
    * Set the expression used to compute the value being cast to the given expression.
    *
    * @param expression the expression used to compute the value being cast
@@ -1159,12 +1078,12 @@
   /**
    * The token representing the 'assert' keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The left parenthesis.
    */
-  Token _leftParenthesis;
+  Token leftParenthesis;
 
   /**
    * The condition that is being asserted to be `true`.
@@ -1174,12 +1093,12 @@
   /**
    * The right parenthesis.
    */
-  Token _rightParenthesis;
+  Token rightParenthesis;
 
   /**
    * The semicolon terminating the statement.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created assert statement.
@@ -1191,11 +1110,11 @@
    * @param semicolon the semicolon terminating the statement
    */
   AssertStatement.full(Token keyword, Token leftParenthesis, Expression condition, Token rightParenthesis, Token semicolon) {
-    this._keyword = keyword;
-    this._leftParenthesis = leftParenthesis;
+    this.keyword = keyword;
+    this.leftParenthesis = leftParenthesis;
     this._condition = becomeParentOf(condition);
-    this._rightParenthesis = rightParenthesis;
-    this._semicolon = semicolon;
+    this.rightParenthesis = rightParenthesis;
+    this.semicolon = semicolon;
   }
 
   /**
@@ -1209,7 +1128,7 @@
    */
   AssertStatement({Token keyword, Token leftParenthesis, Expression condition, Token rightParenthesis, Token semicolon}) : this.full(keyword, leftParenthesis, condition, rightParenthesis, semicolon);
   accept(ASTVisitor visitor) => visitor.visitAssertStatement(this);
-  Token get beginToken => _keyword;
+  Token get beginToken => keyword;
 
   /**
    * Return the condition that is being asserted to be `true`.
@@ -1217,35 +1136,7 @@
    * @return the condition that is being asserted to be `true`
    */
   Expression get condition => _condition;
-  Token get endToken => _semicolon;
-
-  /**
-   * Return the token representing the 'assert' keyword.
-   *
-   * @return the token representing the 'assert' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Return the left parenthesis.
-   *
-   * @return the left parenthesis
-   */
-  Token get leftParenthesis => _leftParenthesis;
-
-  /**
-   * Return the right parenthesis.
-   *
-   * @return the right parenthesis
-   */
-  Token get rightParenthesis => _rightParenthesis;
-
-  /**
-   * Return the semicolon terminating the statement.
-   *
-   * @return the semicolon terminating the statement
-   */
-  Token get semicolon => _semicolon;
+  Token get endToken => semicolon;
 
   /**
    * Set the condition that is being asserted to be `true` to the given expression.
@@ -1255,42 +1146,6 @@
   void set condition(Expression condition2) {
     this._condition = becomeParentOf(condition2);
   }
-
-  /**
-   * Set the token representing the 'assert' keyword to the given token.
-   *
-   * @param keyword the token representing the 'assert' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
-
-  /**
-   * Set the left parenthesis to the given token.
-   *
-   * @param the left parenthesis
-   */
-  void set leftParenthesis(Token leftParenthesis2) {
-    this._leftParenthesis = leftParenthesis2;
-  }
-
-  /**
-   * Set the right parenthesis to the given token.
-   *
-   * @param rightParenthesis the right parenthesis
-   */
-  void set rightParenthesis(Token rightParenthesis2) {
-    this._rightParenthesis = rightParenthesis2;
-  }
-
-  /**
-   * Set the semicolon terminating the statement to the given token.
-   *
-   * @param semicolon the semicolon terminating the statement
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_condition, visitor);
   }
@@ -1315,7 +1170,7 @@
   /**
    * The assignment operator being applied.
    */
-  Token _operator;
+  Token operator;
 
   /**
    * The expression used to compute the right hand side.
@@ -1345,7 +1200,7 @@
    */
   AssignmentExpression.full(Expression leftHandSide, Token operator, Expression rightHandSide) {
     this._leftHandSide = becomeParentOf(leftHandSide);
-    this._operator = operator;
+    this.operator = operator;
     this._rightHandSide = becomeParentOf(rightHandSide);
   }
 
@@ -1385,13 +1240,6 @@
   Expression get leftHandSide => _leftHandSide;
 
   /**
-   * Return the assignment operator being applied.
-   *
-   * @return the assignment operator being applied
-   */
-  Token get operator => _operator;
-
-  /**
    * Return the element associated with the operator based on the propagated type of the
    * left-hand-side, or `null` if the AST structure has not been resolved, if the operator is
    * not a compound operator, or if the operator could not be resolved. One example of the latter
@@ -1428,15 +1276,6 @@
   }
 
   /**
-   * Set the assignment operator being applied to the given operator.
-   *
-   * @param operator the assignment operator being applied
-   */
-  void set operator(Token operator2) {
-    this._operator = operator2;
-  }
-
-  /**
    * Set the element associated with the operator based on the propagated type of the left-hand-side
    * to the given element.
    *
@@ -1531,7 +1370,7 @@
   /**
    * The binary operator being applied.
    */
-  Token _operator;
+  Token operator;
 
   /**
    * The expression used to compute the right operand.
@@ -1561,7 +1400,7 @@
    */
   BinaryExpression.full(Expression leftOperand, Token operator, Expression rightOperand) {
     this._leftOperand = becomeParentOf(leftOperand);
-    this._operator = operator;
+    this.operator = operator;
     this._rightOperand = becomeParentOf(rightOperand);
   }
 
@@ -1601,13 +1440,6 @@
   Expression get leftOperand => _leftOperand;
 
   /**
-   * Return the binary operator being applied.
-   *
-   * @return the binary operator being applied
-   */
-  Token get operator => _operator;
-
-  /**
    * Return the element associated with the operator based on the propagated type of the left
    * operand, or `null` if the AST structure has not been resolved, if the operator is not
    * user definable, or if the operator could not be resolved. One example of the latter case is an
@@ -1644,15 +1476,6 @@
   }
 
   /**
-   * Set the binary operator being applied to the given operator.
-   *
-   * @return the binary operator being applied
-   */
-  void set operator(Token operator2) {
-    this._operator = operator2;
-  }
-
-  /**
    * Set the element associated with the operator based on the propagated type of the left operand
    * to the given element.
    *
@@ -1742,17 +1565,17 @@
   /**
    * The left curly bracket.
    */
-  Token _leftBracket;
+  Token leftBracket;
 
   /**
    * The statements contained in the block.
    */
-  NodeList<Statement> _statements;
+  NodeList<Statement> statements;
 
   /**
    * The right curly bracket.
    */
-  Token _rightBracket;
+  Token rightBracket;
 
   /**
    * Initialize a newly created block of code.
@@ -1762,10 +1585,10 @@
    * @param rightBracket the right curly bracket
    */
   Block.full(Token leftBracket, List<Statement> statements, Token rightBracket) {
-    this._statements = new NodeList<Statement>(this);
-    this._leftBracket = leftBracket;
-    this._statements.addAll(statements);
-    this._rightBracket = rightBracket;
+    this.statements = new NodeList<Statement>(this);
+    this.leftBracket = leftBracket;
+    this.statements.addAll(statements);
+    this.rightBracket = rightBracket;
   }
 
   /**
@@ -1777,49 +1600,10 @@
    */
   Block({Token leftBracket, List<Statement> statements, Token rightBracket}) : this.full(leftBracket, statements, rightBracket);
   accept(ASTVisitor visitor) => visitor.visitBlock(this);
-  Token get beginToken => _leftBracket;
-  Token get endToken => _rightBracket;
-
-  /**
-   * Return the left curly bracket.
-   *
-   * @return the left curly bracket
-   */
-  Token get leftBracket => _leftBracket;
-
-  /**
-   * Return the right curly bracket.
-   *
-   * @return the right curly bracket
-   */
-  Token get rightBracket => _rightBracket;
-
-  /**
-   * Return the statements contained in the block.
-   *
-   * @return the statements contained in the block
-   */
-  NodeList<Statement> get statements => _statements;
-
-  /**
-   * Set the left curly bracket to the given token.
-   *
-   * @param leftBracket the left curly bracket
-   */
-  void set leftBracket(Token leftBracket2) {
-    this._leftBracket = leftBracket2;
-  }
-
-  /**
-   * Set the right curly bracket to the given token.
-   *
-   * @param rightBracket the right curly bracket
-   */
-  void set rightBracket(Token rightBracket2) {
-    this._rightBracket = rightBracket2;
-  }
+  Token get beginToken => leftBracket;
+  Token get endToken => rightBracket;
   void visitChildren(ASTVisitor visitor) {
-    _statements.accept(visitor);
+    statements.accept(visitor);
   }
 }
 /**
@@ -1893,12 +1677,12 @@
   /**
    * The token representing the literal.
    */
-  Token _literal;
+  Token literal;
 
   /**
    * The value of the literal.
    */
-  bool _value = false;
+  bool value = false;
 
   /**
    * Initialize a newly created boolean literal.
@@ -1907,8 +1691,8 @@
    * @param value the value of the literal
    */
   BooleanLiteral.full(Token literal, bool value) {
-    this._literal = literal;
-    this._value = value;
+    this.literal = literal;
+    this.value = value;
   }
 
   /**
@@ -1919,41 +1703,9 @@
    */
   BooleanLiteral({Token literal, bool value}) : this.full(literal, value);
   accept(ASTVisitor visitor) => visitor.visitBooleanLiteral(this);
-  Token get beginToken => _literal;
-  Token get endToken => _literal;
-
-  /**
-   * Return the token representing the literal.
-   *
-   * @return the token representing the literal
-   */
-  Token get literal => _literal;
-
-  /**
-   * Return the value of the literal.
-   *
-   * @return the value of the literal
-   */
-  bool get value => _value;
-  bool get isSynthetic => _literal.isSynthetic;
-
-  /**
-   * Set the token representing the literal to the given token.
-   *
-   * @param literal the token representing the literal
-   */
-  void set literal(Token literal2) {
-    this._literal = literal2;
-  }
-
-  /**
-   * Set the value of the literal to the given value.
-   *
-   * @param value the value of the literal
-   */
-  void set value(bool value2) {
-    this._value = value2;
-  }
+  Token get beginToken => literal;
+  Token get endToken => literal;
+  bool get isSynthetic => literal.isSynthetic;
   void visitChildren(ASTVisitor visitor) {
   }
 }
@@ -1972,7 +1724,7 @@
   /**
    * The token representing the 'break' keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The label associated with the statement, or `null` if there is no label.
@@ -1982,7 +1734,7 @@
   /**
    * The semicolon terminating the statement.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created break statement.
@@ -1992,9 +1744,9 @@
    * @param semicolon the semicolon terminating the statement
    */
   BreakStatement.full(Token keyword, SimpleIdentifier label, Token semicolon) {
-    this._keyword = keyword;
+    this.keyword = keyword;
     this._label = becomeParentOf(label);
-    this._semicolon = semicolon;
+    this.semicolon = semicolon;
   }
 
   /**
@@ -2006,15 +1758,8 @@
    */
   BreakStatement({Token keyword, SimpleIdentifier label, Token semicolon}) : this.full(keyword, label, semicolon);
   accept(ASTVisitor visitor) => visitor.visitBreakStatement(this);
-  Token get beginToken => _keyword;
-  Token get endToken => _semicolon;
-
-  /**
-   * Return the token representing the 'break' keyword.
-   *
-   * @return the token representing the 'break' keyword
-   */
-  Token get keyword => _keyword;
+  Token get beginToken => keyword;
+  Token get endToken => semicolon;
 
   /**
    * Return the label associated with the statement, or `null` if there is no label.
@@ -2024,22 +1769,6 @@
   SimpleIdentifier get label => _label;
 
   /**
-   * Return the semicolon terminating the statement.
-   *
-   * @return the semicolon terminating the statement
-   */
-  Token get semicolon => _semicolon;
-
-  /**
-   * Set the token representing the 'break' keyword to the given token.
-   *
-   * @param keyword the token representing the 'break' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
-
-  /**
    * Set the label associated with the statement to the given identifier.
    *
    * @param identifier the label associated with the statement
@@ -2047,15 +1776,6 @@
   void set label(SimpleIdentifier identifier) {
     _label = becomeParentOf(identifier);
   }
-
-  /**
-   * Set the semicolon terminating the statement to the given token.
-   *
-   * @param semicolon the semicolon terminating the statement
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_label, visitor);
   }
@@ -2090,7 +1810,7 @@
   /**
    * The cascade sections sharing the common target.
    */
-  NodeList<Expression> _cascadeSections;
+  NodeList<Expression> cascadeSections;
 
   /**
    * Initialize a newly created cascade expression.
@@ -2099,9 +1819,9 @@
    * @param cascadeSections the cascade sections sharing the common target
    */
   CascadeExpression.full(Expression target, List<Expression> cascadeSections) {
-    this._cascadeSections = new NodeList<Expression>(this);
+    this.cascadeSections = new NodeList<Expression>(this);
     this._target = becomeParentOf(target);
-    this._cascadeSections.addAll(cascadeSections);
+    this.cascadeSections.addAll(cascadeSections);
   }
 
   /**
@@ -2113,14 +1833,7 @@
   CascadeExpression({Expression target, List<Expression> cascadeSections}) : this.full(target, cascadeSections);
   accept(ASTVisitor visitor) => visitor.visitCascadeExpression(this);
   Token get beginToken => _target.beginToken;
-
-  /**
-   * Return the cascade sections sharing the common target.
-   *
-   * @return the cascade sections sharing the common target
-   */
-  NodeList<Expression> get cascadeSections => _cascadeSections;
-  Token get endToken => _cascadeSections.endToken;
+  Token get endToken => cascadeSections.endToken;
 
   /**
    * Return the target of the cascade sections.
@@ -2139,7 +1852,7 @@
   }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_target, visitor);
-    _cascadeSections.accept(visitor);
+    cascadeSections.accept(visitor);
   }
 }
 /**
@@ -2161,18 +1874,18 @@
   /**
    * The token representing the 'on' keyword, or `null` if there is no 'on' keyword.
    */
-  Token _onKeyword;
+  Token onKeyword;
 
   /**
    * The type of exceptions caught by this catch clause, or `null` if this catch clause
    * catches every type of exception.
    */
-  TypeName _exceptionType;
+  TypeName exceptionType;
 
   /**
    * The token representing the 'catch' keyword, or `null` if there is no 'catch' keyword.
    */
-  Token _catchKeyword;
+  Token catchKeyword;
 
   /**
    * The left parenthesis.
@@ -2188,7 +1901,7 @@
    * The comma separating the exception parameter from the stack trace parameter, or `null` if
    * there is no stack trace parameter.
    */
-  Token _comma;
+  Token comma;
 
   /**
    * The parameter whose value will be the stack trace associated with the exception, or
@@ -2220,12 +1933,12 @@
    * @param body the body of the catch block
    */
   CatchClause.full(Token onKeyword, TypeName exceptionType, Token catchKeyword, Token leftParenthesis, SimpleIdentifier exceptionParameter, Token comma, SimpleIdentifier stackTraceParameter, Token rightParenthesis, Block body) {
-    this._onKeyword = onKeyword;
-    this._exceptionType = becomeParentOf(exceptionType);
-    this._catchKeyword = catchKeyword;
+    this.onKeyword = onKeyword;
+    this.exceptionType = becomeParentOf(exceptionType);
+    this.catchKeyword = catchKeyword;
     this._leftParenthesis = leftParenthesis;
     this._exceptionParameter = becomeParentOf(exceptionParameter);
-    this._comma = comma;
+    this.comma = comma;
     this._stackTraceParameter = becomeParentOf(stackTraceParameter);
     this._rightParenthesis = rightParenthesis;
     this._body = becomeParentOf(body);
@@ -2247,10 +1960,10 @@
   CatchClause({Token onKeyword, TypeName exceptionType, Token catchKeyword, Token leftParenthesis, SimpleIdentifier exceptionParameter, Token comma, SimpleIdentifier stackTraceParameter, Token rightParenthesis, Block body}) : this.full(onKeyword, exceptionType, catchKeyword, leftParenthesis, exceptionParameter, comma, stackTraceParameter, rightParenthesis, body);
   accept(ASTVisitor visitor) => visitor.visitCatchClause(this);
   Token get beginToken {
-    if (_onKeyword != null) {
-      return _onKeyword;
+    if (onKeyword != null) {
+      return onKeyword;
     }
-    return _catchKeyword;
+    return catchKeyword;
   }
 
   /**
@@ -2259,21 +1972,6 @@
    * @return the body of the catch block
    */
   Block get body => _body;
-
-  /**
-   * Return the token representing the 'catch' keyword, or `null` if there is no 'catch'
-   * keyword.
-   *
-   * @return the token representing the 'catch' keyword
-   */
-  Token get catchKeyword => _catchKeyword;
-
-  /**
-   * Return the comma, or `null` if there is no stack trace parameter.
-   *
-   * @return the comma
-   */
-  Token get comma => _comma;
   Token get endToken => _body.endToken;
 
   /**
@@ -2284,14 +1982,6 @@
   SimpleIdentifier get exceptionParameter => _exceptionParameter;
 
   /**
-   * Return the type of exceptions caught by this catch clause, or `null` if this catch clause
-   * catches every type of exception.
-   *
-   * @return the type of exceptions caught by this catch clause
-   */
-  TypeName get exceptionType => _exceptionType;
-
-  /**
    * Return the left parenthesis.
    *
    * @return the left parenthesis
@@ -2299,13 +1989,6 @@
   Token get leftParenthesis => _leftParenthesis;
 
   /**
-   * Return the token representing the 'on' keyword, or `null` if there is no 'on' keyword.
-   *
-   * @return the token representing the 'on' keyword
-   */
-  Token get onKeyword => _onKeyword;
-
-  /**
    * Return the right parenthesis.
    *
    * @return the right parenthesis
@@ -2330,24 +2013,6 @@
   }
 
   /**
-   * Set the token representing the 'catch' keyword to the given token.
-   *
-   * @param catchKeyword the token representing the 'catch' keyword
-   */
-  void set catchKeyword(Token catchKeyword2) {
-    this._catchKeyword = catchKeyword2;
-  }
-
-  /**
-   * Set the comma to the given token.
-   *
-   * @param comma the comma
-   */
-  void set comma(Token comma2) {
-    this._comma = comma2;
-  }
-
-  /**
    * Set the parameter whose value will be the exception that was thrown to the given parameter.
    *
    * @param parameter the parameter whose value will be the exception that was thrown
@@ -2357,15 +2022,6 @@
   }
 
   /**
-   * Set the type of exceptions caught by this catch clause to the given type.
-   *
-   * @param exceptionType the type of exceptions caught by this catch clause
-   */
-  void set exceptionType(TypeName exceptionType2) {
-    this._exceptionType = exceptionType2;
-  }
-
-  /**
    * Set the left parenthesis to the given token.
    *
    * @param parenthesis the left parenthesis
@@ -2375,15 +2031,6 @@
   }
 
   /**
-   * Set the token representing the 'on' keyword to the given keyword.
-   *
-   * @param onKeyword the token representing the 'on' keyword
-   */
-  void set onKeyword(Token onKeyword2) {
-    this._onKeyword = onKeyword2;
-  }
-
-  /**
    * Set the right parenthesis to the given token.
    *
    * @param parenthesis the right parenthesis
@@ -2403,7 +2050,7 @@
     _stackTraceParameter = becomeParentOf(parameter);
   }
   void visitChildren(ASTVisitor visitor) {
-    safelyVisitChild(_exceptionType, visitor);
+    safelyVisitChild(exceptionType, visitor);
     safelyVisitChild(_exceptionParameter, visitor);
     safelyVisitChild(_stackTraceParameter, visitor);
     safelyVisitChild(_body, visitor);
@@ -2427,12 +2074,12 @@
   /**
    * The 'abstract' keyword, or `null` if the keyword was absent.
    */
-  Token _abstractKeyword;
+  Token abstractKeyword;
 
   /**
    * The token representing the 'class' keyword.
    */
-  Token _classKeyword;
+  Token classKeyword;
 
   /**
    * The name of the class being declared.
@@ -2443,7 +2090,7 @@
    * The type parameters for the class, or `null` if the class does not have any type
    * parameters.
    */
-  TypeParameterList _typeParameters;
+  TypeParameterList typeParameters;
 
   /**
    * The extends clause for the class, or `null` if the class does not extend any other class.
@@ -2464,22 +2111,22 @@
   /**
    * The native clause for the class, or `null` if the class does not have a native clause.
    */
-  NativeClause _nativeClause;
+  NativeClause nativeClause;
 
   /**
    * The left curly bracket.
    */
-  Token _leftBracket;
+  Token leftBracket;
 
   /**
    * The members defined by the class.
    */
-  NodeList<ClassMember> _members;
+  NodeList<ClassMember> members;
 
   /**
    * The right curly bracket.
    */
-  Token _rightBracket;
+  Token rightBracket;
 
   /**
    * Initialize a newly created class declaration.
@@ -2498,17 +2145,17 @@
    * @param rightBracket the right curly bracket
    */
   ClassDeclaration.full(Comment comment, List<Annotation> metadata, Token abstractKeyword, Token classKeyword, SimpleIdentifier name, TypeParameterList typeParameters, ExtendsClause extendsClause, WithClause withClause, ImplementsClause implementsClause, Token leftBracket, List<ClassMember> members, Token rightBracket) : super.full(comment, metadata) {
-    this._members = new NodeList<ClassMember>(this);
-    this._abstractKeyword = abstractKeyword;
-    this._classKeyword = classKeyword;
+    this.members = new NodeList<ClassMember>(this);
+    this.abstractKeyword = abstractKeyword;
+    this.classKeyword = classKeyword;
     this._name = becomeParentOf(name);
-    this._typeParameters = becomeParentOf(typeParameters);
+    this.typeParameters = becomeParentOf(typeParameters);
     this._extendsClause = becomeParentOf(extendsClause);
     this._withClause = becomeParentOf(withClause);
     this._implementsClause = becomeParentOf(implementsClause);
-    this._leftBracket = leftBracket;
-    this._members.addAll(members);
-    this._rightBracket = rightBracket;
+    this.leftBracket = leftBracket;
+    this.members.addAll(members);
+    this.rightBracket = rightBracket;
   }
 
   /**
@@ -2529,22 +2176,8 @@
    */
   ClassDeclaration({Comment comment, List<Annotation> metadata, Token abstractKeyword, Token classKeyword, SimpleIdentifier name, TypeParameterList typeParameters, ExtendsClause extendsClause, WithClause withClause, ImplementsClause implementsClause, Token leftBracket, List<ClassMember> members, Token rightBracket}) : this.full(comment, metadata, abstractKeyword, classKeyword, name, typeParameters, extendsClause, withClause, implementsClause, leftBracket, members, rightBracket);
   accept(ASTVisitor visitor) => visitor.visitClassDeclaration(this);
-
-  /**
-   * Return the 'abstract' keyword, or `null` if the keyword was absent.
-   *
-   * @return the 'abstract' keyword
-   */
-  Token get abstractKeyword => _abstractKeyword;
-
-  /**
-   * Return the token representing the 'class' keyword.
-   *
-   * @return the token representing the 'class' keyword
-   */
-  Token get classKeyword => _classKeyword;
   ClassElement get element => _name != null ? (_name.staticElement as ClassElement) : null;
-  Token get endToken => _rightBracket;
+  Token get endToken => rightBracket;
 
   /**
    * Return the extends clause for this class, or `null` if the class does not extend any
@@ -2563,20 +2196,6 @@
   ImplementsClause get implementsClause => _implementsClause;
 
   /**
-   * Return the left curly bracket.
-   *
-   * @return the left curly bracket
-   */
-  Token get leftBracket => _leftBracket;
-
-  /**
-   * Return the members defined by the class.
-   *
-   * @return the members defined by the class
-   */
-  NodeList<ClassMember> get members => _members;
-
-  /**
    * Return the name of the class being declared.
    *
    * @return the name of the class being declared
@@ -2584,29 +2203,6 @@
   SimpleIdentifier get name => _name;
 
   /**
-   * Return the native clause for this class, or `null` if the class does not have a native
-   * cluse.
-   *
-   * @return the native clause for this class
-   */
-  NativeClause get nativeClause => _nativeClause;
-
-  /**
-   * Return the right curly bracket.
-   *
-   * @return the right curly bracket
-   */
-  Token get rightBracket => _rightBracket;
-
-  /**
-   * Return the type parameters for the class, or `null` if the class does not have any type
-   * parameters.
-   *
-   * @return the type parameters for the class
-   */
-  TypeParameterList get typeParameters => _typeParameters;
-
-  /**
    * Return the with clause for the class, or `null` if the class does not have a with clause.
    *
    * @return the with clause for the class
@@ -2614,24 +2210,6 @@
   WithClause get withClause => _withClause;
 
   /**
-   * Set the 'abstract' keyword to the given keyword.
-   *
-   * @param abstractKeyword the 'abstract' keyword
-   */
-  void set abstractKeyword(Token abstractKeyword2) {
-    this._abstractKeyword = abstractKeyword2;
-  }
-
-  /**
-   * Set the token representing the 'class' keyword to the given token.
-   *
-   * @param classKeyword the token representing the 'class' keyword
-   */
-  void set classKeyword(Token classKeyword2) {
-    this._classKeyword = classKeyword2;
-  }
-
-  /**
    * Set the extends clause for this class to the given clause.
    *
    * @param extendsClause the extends clause for this class
@@ -2650,15 +2228,6 @@
   }
 
   /**
-   * Set the left curly bracket to the given token.
-   *
-   * @param leftBracket the left curly bracket
-   */
-  void set leftBracket(Token leftBracket2) {
-    this._leftBracket = leftBracket2;
-  }
-
-  /**
    * Set the name of the class being declared to the given identifier.
    *
    * @param identifier the name of the class being declared
@@ -2668,33 +2237,6 @@
   }
 
   /**
-   * Set the native clause for this class to the given clause.
-   *
-   * @param nativeClause the native clause for this class
-   */
-  void set nativeClause(NativeClause nativeClause2) {
-    this._nativeClause = nativeClause2;
-  }
-
-  /**
-   * Set the right curly bracket to the given token.
-   *
-   * @param rightBracket the right curly bracket
-   */
-  void set rightBracket(Token rightBracket2) {
-    this._rightBracket = rightBracket2;
-  }
-
-  /**
-   * Set the type parameters for the class to the given list of type parameters.
-   *
-   * @param typeParameters the type parameters for the class
-   */
-  void set typeParameters(TypeParameterList typeParameters2) {
-    this._typeParameters = typeParameters2;
-  }
-
-  /**
    * Set the with clause for the class to the given clause.
    *
    * @param withClause the with clause for the class
@@ -2705,18 +2247,18 @@
   void visitChildren(ASTVisitor visitor) {
     super.visitChildren(visitor);
     safelyVisitChild(_name, visitor);
-    safelyVisitChild(_typeParameters, visitor);
+    safelyVisitChild(typeParameters, visitor);
     safelyVisitChild(_extendsClause, visitor);
     safelyVisitChild(_withClause, visitor);
     safelyVisitChild(_implementsClause, visitor);
-    safelyVisitChild(_nativeClause, visitor);
+    safelyVisitChild(nativeClause, visitor);
     members.accept(visitor);
   }
   Token get firstTokenAfterCommentAndMetadata {
-    if (_abstractKeyword != null) {
-      return _abstractKeyword;
+    if (abstractKeyword != null) {
+      return abstractKeyword;
     }
-    return _classKeyword;
+    return classKeyword;
   }
 }
 /**
@@ -2772,13 +2314,13 @@
   /**
    * The token for the '=' separating the name from the definition.
    */
-  Token _equals;
+  Token equals;
 
   /**
    * The token for the 'abstract' keyword, or `null` if this is not defining an abstract
    * class.
    */
-  Token _abstractKeyword;
+  Token abstractKeyword;
 
   /**
    * The name of the superclass of the class being declared.
@@ -2813,8 +2355,8 @@
   ClassTypeAlias.full(Comment comment, List<Annotation> metadata, Token keyword, SimpleIdentifier name, TypeParameterList typeParameters, Token equals, Token abstractKeyword, TypeName superclass, WithClause withClause, ImplementsClause implementsClause, Token semicolon) : super.full(comment, metadata, keyword, semicolon) {
     this._name = becomeParentOf(name);
     this._typeParameters = becomeParentOf(typeParameters);
-    this._equals = equals;
-    this._abstractKeyword = abstractKeyword;
+    this.equals = equals;
+    this.abstractKeyword = abstractKeyword;
     this._superclass = becomeParentOf(superclass);
     this._withClause = becomeParentOf(withClause);
     this._implementsClause = becomeParentOf(implementsClause);
@@ -2837,24 +2379,9 @@
    */
   ClassTypeAlias({Comment comment, List<Annotation> metadata, Token keyword, SimpleIdentifier name, TypeParameterList typeParameters, Token equals, Token abstractKeyword, TypeName superclass, WithClause withClause, ImplementsClause implementsClause, Token semicolon}) : this.full(comment, metadata, keyword, name, typeParameters, equals, abstractKeyword, superclass, withClause, implementsClause, semicolon);
   accept(ASTVisitor visitor) => visitor.visitClassTypeAlias(this);
-
-  /**
-   * Return the token for the 'abstract' keyword, or `null` if this is not defining an
-   * abstract class.
-   *
-   * @return the token for the 'abstract' keyword
-   */
-  Token get abstractKeyword => _abstractKeyword;
   ClassElement get element => _name != null ? (_name.staticElement as ClassElement) : null;
 
   /**
-   * Return the token for the '=' separating the name from the definition.
-   *
-   * @return the token for the '=' separating the name from the definition
-   */
-  Token get equals => _equals;
-
-  /**
    * Return the implements clause for this class, or `null` if there is no implements clause.
    *
    * @return the implements clause for this class
@@ -2891,24 +2418,6 @@
   WithClause get withClause => _withClause;
 
   /**
-   * Set the token for the 'abstract' keyword to the given token.
-   *
-   * @param abstractKeyword the token for the 'abstract' keyword
-   */
-  void set abstractKeyword(Token abstractKeyword2) {
-    this._abstractKeyword = abstractKeyword2;
-  }
-
-  /**
-   * Set the token for the '=' separating the name from the definition to the given token.
-   *
-   * @param equals the token for the '=' separating the name from the definition
-   */
-  void set equals(Token equals2) {
-    this._equals = equals2;
-  }
-
-  /**
    * Set the implements clause for this class to the given implements clause.
    *
    * @param implementsClause the implements clause for this class
@@ -2978,7 +2487,7 @@
   /**
    * The keyword specifying what kind of processing is to be done on the imported names.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * Initialize a newly created import combinator.
@@ -2987,7 +2496,7 @@
    *          names
    */
   Combinator.full(Token keyword) {
-    this._keyword = keyword;
+    this.keyword = keyword;
   }
 
   /**
@@ -2997,25 +2506,7 @@
    *          names
    */
   Combinator({Token keyword}) : this.full(keyword);
-  Token get beginToken => _keyword;
-
-  /**
-   * Return the keyword specifying what kind of processing is to be done on the imported names.
-   *
-   * @return the keyword specifying what kind of processing is to be done on the imported names
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Set the keyword specifying what kind of processing is to be done on the imported names to the
-   * given token.
-   *
-   * @param keyword the keyword specifying what kind of processing is to be done on the imported
-   *          names
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
+  Token get beginToken => keyword;
 }
 /**
  * Instances of the class `Comment` represent a comment within the source code.
@@ -3077,7 +2568,7 @@
   /**
    * The tokens representing the comment.
    */
-  List<Token> _tokens;
+  List<Token> tokens;
 
   /**
    * The type of the comment.
@@ -3088,7 +2579,7 @@
    * The references embedded within the documentation comment. This list will be empty unless this
    * is a documentation comment that has references embedded within it.
    */
-  NodeList<CommentReference> _references;
+  NodeList<CommentReference> references;
 
   /**
    * Initialize a newly created comment.
@@ -3098,10 +2589,10 @@
    * @param references the references embedded within the documentation comment
    */
   Comment.full(List<Token> tokens, CommentType type, List<CommentReference> references) {
-    this._references = new NodeList<CommentReference>(this);
-    this._tokens = tokens;
+    this.references = new NodeList<CommentReference>(this);
+    this.tokens = tokens;
     this._type = type;
-    this._references.addAll(references);
+    this.references.addAll(references);
   }
 
   /**
@@ -3113,22 +2604,8 @@
    */
   Comment({List<Token> tokens, CommentType type, List<CommentReference> references}) : this.full(tokens, type, references);
   accept(ASTVisitor visitor) => visitor.visitComment(this);
-  Token get beginToken => _tokens[0];
-  Token get endToken => _tokens[_tokens.length - 1];
-
-  /**
-   * Return the references embedded within the documentation comment.
-   *
-   * @return the references embedded within the documentation comment
-   */
-  NodeList<CommentReference> get references => _references;
-
-  /**
-   * Return the tokens representing the comment.
-   *
-   * @return the tokens representing the comment
-   */
-  List<Token> get tokens => _tokens;
+  Token get beginToken => tokens[0];
+  Token get endToken => tokens[tokens.length - 1];
 
   /**
    * Return `true` if this is a block comment.
@@ -3151,7 +2628,7 @@
    */
   bool get isEndOfLine => identical(_type, CommentType.END_OF_LINE);
   void visitChildren(ASTVisitor visitor) {
-    _references.accept(visitor);
+    references.accept(visitor);
   }
 }
 /**
@@ -3193,7 +2670,7 @@
   /**
    * The token representing the 'new' keyword, or `null` if there was no 'new' keyword.
    */
-  Token _newKeyword;
+  Token newKeyword;
 
   /**
    * The identifier being referenced.
@@ -3207,7 +2684,7 @@
    * @param identifier the identifier being referenced
    */
   CommentReference.full(Token newKeyword, Identifier identifier) {
-    this._newKeyword = newKeyword;
+    this.newKeyword = newKeyword;
     this._identifier = becomeParentOf(identifier);
   }
 
@@ -3230,13 +2707,6 @@
   Identifier get identifier => _identifier;
 
   /**
-   * Return the token representing the 'new' keyword, or `null` if there was no 'new' keyword.
-   *
-   * @return the token representing the 'new' keyword
-   */
-  Token get newKeyword => _newKeyword;
-
-  /**
    * Set the identifier being referenced to the given identifier.
    *
    * @param identifier the identifier being referenced
@@ -3244,15 +2714,6 @@
   void set identifier(Identifier identifier2) {
     identifier2 = becomeParentOf(identifier2);
   }
-
-  /**
-   * Set the token representing the 'new' keyword to the given token.
-   *
-   * @param newKeyword the token representing the 'new' keyword
-   */
-  void set newKeyword(Token newKeyword2) {
-    this._newKeyword = newKeyword2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_identifier, visitor);
   }
@@ -3299,12 +2760,12 @@
   /**
    * The directives contained in this compilation unit.
    */
-  NodeList<Directive> _directives;
+  NodeList<Directive> directives;
 
   /**
    * The declarations contained in this compilation unit.
    */
-  NodeList<CompilationUnitMember> _declarations;
+  NodeList<CompilationUnitMember> declarations;
 
   /**
    * The last token in the token stream that was parsed to form this compilation unit. This token
@@ -3316,12 +2777,12 @@
    * The element associated with this compilation unit, or `null` if the AST structure has not
    * been resolved.
    */
-  CompilationUnitElement _element;
+  CompilationUnitElement element;
 
   /**
    * The line information for this compilation unit.
    */
-  LineInfo _lineInfo;
+  LineInfo lineInfo;
 
   /**
    * The parsing errors encountered when the receiver was parsed.
@@ -3343,12 +2804,12 @@
    * @param endToken the last token in the token stream
    */
   CompilationUnit.full(Token beginToken, ScriptTag scriptTag, List<Directive> directives, List<CompilationUnitMember> declarations, Token endToken) {
-    this._directives = new NodeList<Directive>(this);
-    this._declarations = new NodeList<CompilationUnitMember>(this);
+    this.directives = new NodeList<Directive>(this);
+    this.declarations = new NodeList<CompilationUnitMember>(this);
     this._beginToken = beginToken;
     this._scriptTag = becomeParentOf(scriptTag);
-    this._directives.addAll(directives);
-    this._declarations.addAll(declarations);
+    this.directives.addAll(directives);
+    this.declarations.addAll(declarations);
     this._endToken = endToken;
   }
 
@@ -3364,28 +2825,6 @@
   CompilationUnit({Token beginToken, ScriptTag scriptTag, List<Directive> directives, List<CompilationUnitMember> declarations, Token endToken}) : this.full(beginToken, scriptTag, directives, declarations, endToken);
   accept(ASTVisitor visitor) => visitor.visitCompilationUnit(this);
   Token get beginToken => _beginToken;
-
-  /**
-   * Return the declarations contained in this compilation unit.
-   *
-   * @return the declarations contained in this compilation unit
-   */
-  NodeList<CompilationUnitMember> get declarations => _declarations;
-
-  /**
-   * Return the directives contained in this compilation unit.
-   *
-   * @return the directives contained in this compilation unit
-   */
-  NodeList<Directive> get directives => _directives;
-
-  /**
-   * Return the element associated with this compilation unit, or `null` if the AST structure
-   * has not been resolved.
-   *
-   * @return the element associated with this compilation unit
-   */
-  CompilationUnitElement get element => _element;
   Token get endToken => _endToken;
 
   /**
@@ -3415,13 +2854,6 @@
     }
     return endToken.offset + endToken.length;
   }
-
-  /**
-   * Return the line information for this compilation unit.
-   *
-   * @return the line information for this compilation unit
-   */
-  LineInfo get lineInfo => _lineInfo;
   int get offset => 0;
 
   /**
@@ -3448,24 +2880,6 @@
   ScriptTag get scriptTag => _scriptTag;
 
   /**
-   * Set the element associated with this compilation unit to the given element.
-   *
-   * @param element the element associated with this compilation unit
-   */
-  void set element(CompilationUnitElement element2) {
-    this._element = element2;
-  }
-
-  /**
-   * Set the line information for this compilation unit to the given line information.
-   *
-   * @param errors the line information to associate with this compilation unit
-   */
-  void set lineInfo(LineInfo lineInfo2) {
-    this._lineInfo = lineInfo2;
-  }
-
-  /**
    * Set the parse errors associated with this compilation unit to the given errors.
    *
    * @param the parse errors to be associated with this compilation unit
@@ -3494,8 +2908,8 @@
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_scriptTag, visitor);
     if (directivesAreBeforeDeclarations()) {
-      _directives.accept(visitor);
-      _declarations.accept(visitor);
+      directives.accept(visitor);
+      declarations.accept(visitor);
     } else {
       for (ASTNode child in sortedDirectivesAndDeclarations) {
         child.accept(visitor);
@@ -3509,11 +2923,11 @@
    * @return `true` if all of the directives are lexically before any declarations
    */
   bool directivesAreBeforeDeclarations() {
-    if (_directives.isEmpty || _declarations.isEmpty) {
+    if (directives.isEmpty || declarations.isEmpty) {
       return true;
     }
-    Directive lastDirective = _directives[_directives.length - 1];
-    CompilationUnitMember firstDeclaration = _declarations[0];
+    Directive lastDirective = directives[directives.length - 1];
+    CompilationUnitMember firstDeclaration = declarations[0];
     return lastDirective.offset < firstDeclaration.offset;
   }
 
@@ -3526,8 +2940,8 @@
    */
   List<ASTNode> get sortedDirectivesAndDeclarations {
     List<ASTNode> childList = new List<ASTNode>();
-    childList.addAll(_directives);
-    childList.addAll(_declarations);
+    childList.addAll(directives);
+    childList.addAll(declarations);
     List<ASTNode> children = new List.from(childList);
     children.sort(ASTNode.LEXICAL_ORDER);
     return children;
@@ -3587,7 +3001,7 @@
   /**
    * The token used to separate the condition from the then expression.
    */
-  Token _question;
+  Token question;
 
   /**
    * The expression that is executed if the condition evaluates to `true`.
@@ -3597,7 +3011,7 @@
   /**
    * The token used to separate the then expression from the else expression.
    */
-  Token _colon;
+  Token colon;
 
   /**
    * The expression that is executed if the condition evaluates to `false`.
@@ -3617,9 +3031,9 @@
    */
   ConditionalExpression.full(Expression condition, Token question, Expression thenExpression, Token colon, Expression elseExpression) {
     this._condition = becomeParentOf(condition);
-    this._question = question;
+    this.question = question;
     this._thenExpression = becomeParentOf(thenExpression);
-    this._colon = colon;
+    this.colon = colon;
     this._elseExpression = becomeParentOf(elseExpression);
   }
 
@@ -3639,13 +3053,6 @@
   Token get beginToken => _condition.beginToken;
 
   /**
-   * Return the token used to separate the then expression from the else expression.
-   *
-   * @return the token used to separate the then expression from the else expression
-   */
-  Token get colon => _colon;
-
-  /**
    * Return the condition used to determine which of the expressions is executed next.
    *
    * @return the condition used to determine which expression is executed next
@@ -3661,13 +3068,6 @@
   Token get endToken => _elseExpression.endToken;
 
   /**
-   * Return the token used to separate the condition from the then expression.
-   *
-   * @return the token used to separate the condition from the then expression
-   */
-  Token get question => _question;
-
-  /**
    * Return the expression that is executed if the condition evaluates to `true`.
    *
    * @return the expression that is executed if the condition evaluates to `true`
@@ -3675,15 +3075,6 @@
   Expression get thenExpression => _thenExpression;
 
   /**
-   * Set the token used to separate the then expression from the else expression to the given token.
-   *
-   * @param colon the token used to separate the then expression from the else expression
-   */
-  void set colon(Token colon2) {
-    this._colon = colon2;
-  }
-
-  /**
    * Set the condition used to determine which of the expressions is executed next to the given
    * expression.
    *
@@ -3704,15 +3095,6 @@
   }
 
   /**
-   * Set the token used to separate the condition from the then expression to the given token.
-   *
-   * @param question the token used to separate the condition from the then expression
-   */
-  void set question(Token question2) {
-    this._question = question2;
-  }
-
-  /**
    * Set the expression that is executed if the condition evaluates to `true` to the given
    * expression.
    *
@@ -3757,19 +3139,19 @@
   /**
    * The token for the 'external' keyword, or `null` if the constructor is not external.
    */
-  Token _externalKeyword;
+  Token externalKeyword;
 
   /**
    * The token for the 'const' keyword, or `null` if the constructor is not a const
    * constructor.
    */
-  Token _constKeyword;
+  Token constKeyword;
 
   /**
    * The token for the 'factory' keyword, or `null` if the constructor is not a factory
    * constructor.
    */
-  Token _factoryKeyword;
+  Token factoryKeyword;
 
   /**
    * The type of object being created. This can be different than the type in which the constructor
@@ -3781,7 +3163,7 @@
    * The token for the period before the constructor name, or `null` if the constructor being
    * declared is unnamed.
    */
-  Token _period;
+  Token period;
 
   /**
    * The name of the constructor, or `null` if the constructor being declared is unnamed.
@@ -3797,12 +3179,12 @@
    * The token for the separator (colon or equals) before the initializer list or redirection, or
    * `null` if there are no initializers.
    */
-  Token _separator;
+  Token separator;
 
   /**
    * The initializers associated with the constructor.
    */
-  NodeList<ConstructorInitializer> _initializers;
+  NodeList<ConstructorInitializer> initializers;
 
   /**
    * The name of the constructor to which this constructor will be redirected, or `null` if
@@ -3840,16 +3222,16 @@
    * @param body the body of the constructor
    */
   ConstructorDeclaration.full(Comment comment, List<Annotation> metadata, Token externalKeyword, Token constKeyword, Token factoryKeyword, Identifier returnType, Token period, SimpleIdentifier name, FormalParameterList parameters, Token separator, List<ConstructorInitializer> initializers, ConstructorName redirectedConstructor, FunctionBody body) : super.full(comment, metadata) {
-    this._initializers = new NodeList<ConstructorInitializer>(this);
-    this._externalKeyword = externalKeyword;
-    this._constKeyword = constKeyword;
-    this._factoryKeyword = factoryKeyword;
+    this.initializers = new NodeList<ConstructorInitializer>(this);
+    this.externalKeyword = externalKeyword;
+    this.constKeyword = constKeyword;
+    this.factoryKeyword = factoryKeyword;
     this._returnType = becomeParentOf(returnType);
-    this._period = period;
+    this.period = period;
     this._name = becomeParentOf(name);
     this._parameters = becomeParentOf(parameters);
-    this._separator = separator;
-    this._initializers.addAll(initializers);
+    this.separator = separator;
+    this.initializers.addAll(initializers);
     this._redirectedConstructor = becomeParentOf(redirectedConstructor);
     this._body = becomeParentOf(body);
   }
@@ -3881,46 +3263,17 @@
    * @return the body of the constructor
    */
   FunctionBody get body => _body;
-
-  /**
-   * Return the token for the 'const' keyword.
-   *
-   * @return the token for the 'const' keyword
-   */
-  Token get constKeyword => _constKeyword;
   ConstructorElement get element => _element;
   Token get endToken {
     if (_body != null) {
       return _body.endToken;
-    } else if (!_initializers.isEmpty) {
-      return _initializers.endToken;
+    } else if (!initializers.isEmpty) {
+      return initializers.endToken;
     }
     return _parameters.endToken;
   }
 
   /**
-   * Return the token for the 'external' keyword, or `null` if the constructor is not
-   * external.
-   *
-   * @return the token for the 'external' keyword
-   */
-  Token get externalKeyword => _externalKeyword;
-
-  /**
-   * Return the token for the 'factory' keyword.
-   *
-   * @return the token for the 'factory' keyword
-   */
-  Token get factoryKeyword => _factoryKeyword;
-
-  /**
-   * Return the initializers associated with the constructor.
-   *
-   * @return the initializers associated with the constructor
-   */
-  NodeList<ConstructorInitializer> get initializers => _initializers;
-
-  /**
    * Return the name of the constructor, or `null` if the constructor being declared is
    * unnamed.
    *
@@ -3936,14 +3289,6 @@
   FormalParameterList get parameters => _parameters;
 
   /**
-   * Return the token for the period before the constructor name, or `null` if the constructor
-   * being declared is unnamed.
-   *
-   * @return the token for the period before the constructor name
-   */
-  Token get period => _period;
-
-  /**
    * Return the name of the constructor to which this constructor will be redirected, or
    * `null` if this is not a redirecting factory constructor.
    *
@@ -3961,14 +3306,6 @@
   Identifier get returnType => _returnType;
 
   /**
-   * Return the token for the separator (colon or equals) before the initializer list or
-   * redirection, or `null` if there are no initializers.
-   *
-   * @return the token for the separator before the initializer list or redirection
-   */
-  Token get separator => _separator;
-
-  /**
    * Set the body of the constructor to the given function body.
    *
    * @param functionBody the body of the constructor
@@ -3978,15 +3315,6 @@
   }
 
   /**
-   * Set the token for the 'const' keyword to the given token.
-   *
-   * @param constKeyword the token for the 'const' keyword
-   */
-  void set constKeyword(Token constKeyword2) {
-    this._constKeyword = constKeyword2;
-  }
-
-  /**
    * Set the element associated with this constructor to the given element.
    *
    * @param element the element associated with this constructor
@@ -3996,24 +3324,6 @@
   }
 
   /**
-   * Set the token for the 'external' keyword to the given token.
-   *
-   * @param externalKeyword the token for the 'external' keyword
-   */
-  void set externalKeyword(Token externalKeyword2) {
-    this._externalKeyword = externalKeyword2;
-  }
-
-  /**
-   * Set the token for the 'factory' keyword to the given token.
-   *
-   * @param factoryKeyword the token for the 'factory' keyword
-   */
-  void set factoryKeyword(Token factoryKeyword2) {
-    this._factoryKeyword = factoryKeyword2;
-  }
-
-  /**
    * Set the name of the constructor to the given identifier.
    *
    * @param identifier the name of the constructor
@@ -4032,15 +3342,6 @@
   }
 
   /**
-   * Set the token for the period before the constructor name to the given token.
-   *
-   * @param period the token for the period before the constructor name
-   */
-  void set period(Token period2) {
-    this._period = period2;
-  }
-
-  /**
    * Set the name of the constructor to which this constructor will be redirected to the given
    * constructor name.
    *
@@ -4059,26 +3360,17 @@
   void set returnType(Identifier typeName) {
     _returnType = becomeParentOf(typeName);
   }
-
-  /**
-   * Set the token for the separator (colon or equals) before the initializers to the given token.
-   *
-   * @param separator the token for the separator (colon or equals) before the initializers
-   */
-  void set separator(Token separator2) {
-    this._separator = separator2;
-  }
   void visitChildren(ASTVisitor visitor) {
     super.visitChildren(visitor);
     safelyVisitChild(_returnType, visitor);
     safelyVisitChild(_name, visitor);
     safelyVisitChild(_parameters, visitor);
-    _initializers.accept(visitor);
+    initializers.accept(visitor);
     safelyVisitChild(_redirectedConstructor, visitor);
     safelyVisitChild(_body, visitor);
   }
   Token get firstTokenAfterCommentAndMetadata {
-    Token leftMost2 = leftMost([_externalKeyword, _constKeyword, _factoryKeyword]);
+    Token leftMost2 = leftMost([externalKeyword, constKeyword, factoryKeyword]);
     if (leftMost2 != null) {
       return leftMost2;
     }
@@ -4119,13 +3411,13 @@
   /**
    * The token for the 'this' keyword, or `null` if there is no 'this' keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The token for the period after the 'this' keyword, or `null` if there is no 'this'
    * keyword.
    */
-  Token _period;
+  Token period;
 
   /**
    * The name of the field being initialized.
@@ -4135,7 +3427,7 @@
   /**
    * The token for the equal sign between the field name and the expression.
    */
-  Token _equals;
+  Token equals;
 
   /**
    * The expression computing the value to which the field will be initialized.
@@ -4153,10 +3445,10 @@
    * @param expression the expression computing the value to which the field will be initialized
    */
   ConstructorFieldInitializer.full(Token keyword, Token period, SimpleIdentifier fieldName, Token equals, Expression expression) {
-    this._keyword = keyword;
-    this._period = period;
+    this.keyword = keyword;
+    this.period = period;
     this._fieldName = becomeParentOf(fieldName);
-    this._equals = equals;
+    this.equals = equals;
     this._expression = becomeParentOf(expression);
   }
 
@@ -4173,21 +3465,14 @@
   ConstructorFieldInitializer({Token keyword, Token period, SimpleIdentifier fieldName, Token equals, Expression expression}) : this.full(keyword, period, fieldName, equals, expression);
   accept(ASTVisitor visitor) => visitor.visitConstructorFieldInitializer(this);
   Token get beginToken {
-    if (_keyword != null) {
-      return _keyword;
+    if (keyword != null) {
+      return keyword;
     }
     return _fieldName.beginToken;
   }
   Token get endToken => _expression.endToken;
 
   /**
-   * Return the token for the equal sign between the field name and the expression.
-   *
-   * @return the token for the equal sign between the field name and the expression
-   */
-  Token get equals => _equals;
-
-  /**
    * Return the expression computing the value to which the field will be initialized.
    *
    * @return the expression computing the value to which the field will be initialized
@@ -4202,30 +3487,6 @@
   SimpleIdentifier get fieldName => _fieldName;
 
   /**
-   * Return the token for the 'this' keyword, or `null` if there is no 'this' keyword.
-   *
-   * @return the token for the 'this' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Return the token for the period after the 'this' keyword, or `null` if there is no 'this'
-   * keyword.
-   *
-   * @return the token for the period after the 'this' keyword
-   */
-  Token get period => _period;
-
-  /**
-   * Set the token for the equal sign between the field name and the expression to the given token.
-   *
-   * @param equals the token for the equal sign between the field name and the expression
-   */
-  void set equals(Token equals2) {
-    this._equals = equals2;
-  }
-
-  /**
    * Set the expression computing the value to which the field will be initialized to the given
    * expression.
    *
@@ -4243,24 +3504,6 @@
   void set fieldName(SimpleIdentifier identifier) {
     _fieldName = becomeParentOf(identifier);
   }
-
-  /**
-   * Set the token for the 'this' keyword to the given token.
-   *
-   * @param keyword the token for the 'this' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
-
-  /**
-   * Set the token for the period after the 'this' keyword to the given token.
-   *
-   * @param period the token for the period after the 'this' keyword
-   */
-  void set period(Token period2) {
-    this._period = period2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_fieldName, visitor);
     safelyVisitChild(_expression, visitor);
@@ -4301,7 +3544,7 @@
    * The token for the period before the constructor name, or `null` if the specified
    * constructor is the unnamed constructor.
    */
-  Token _period;
+  Token period;
 
   /**
    * The name of the constructor, or `null` if the specified constructor is the unnamed
@@ -4332,7 +3575,7 @@
    */
   ConstructorName.full(TypeName type, Token period, SimpleIdentifier name) {
     this._type = becomeParentOf(type);
-    this._period = period;
+    this.period = period;
     this._name = becomeParentOf(name);
   }
 
@@ -4371,14 +3614,6 @@
   SimpleIdentifier get name => _name;
 
   /**
-   * Return the token for the period before the constructor name, or `null` if the specified
-   * constructor is the unnamed constructor.
-   *
-   * @return the token for the period before the constructor name
-   */
-  Token get period => _period;
-
-  /**
    * Return the element associated with this constructor name based on static type information, or
    * `null` if the AST structure has not been resolved or if this constructor name could not
    * be resolved.
@@ -4414,15 +3649,6 @@
   }
 
   /**
-   * Return the token for the period before the constructor name to the given token.
-   *
-   * @param period the token for the period before the constructor name
-   */
-  void set period(Token period2) {
-    this._period = period2;
-  }
-
-  /**
    * Set the element associated with this constructor name based on static type information to the
    * given element.
    *
@@ -4460,7 +3686,7 @@
   /**
    * The token representing the 'continue' keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The label associated with the statement, or `null` if there is no label.
@@ -4470,7 +3696,7 @@
   /**
    * The semicolon terminating the statement.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created continue statement.
@@ -4480,9 +3706,9 @@
    * @param semicolon the semicolon terminating the statement
    */
   ContinueStatement.full(Token keyword, SimpleIdentifier label, Token semicolon) {
-    this._keyword = keyword;
+    this.keyword = keyword;
     this._label = becomeParentOf(label);
-    this._semicolon = semicolon;
+    this.semicolon = semicolon;
   }
 
   /**
@@ -4494,15 +3720,8 @@
    */
   ContinueStatement({Token keyword, SimpleIdentifier label, Token semicolon}) : this.full(keyword, label, semicolon);
   accept(ASTVisitor visitor) => visitor.visitContinueStatement(this);
-  Token get beginToken => _keyword;
-  Token get endToken => _semicolon;
-
-  /**
-   * Return the token representing the 'continue' keyword.
-   *
-   * @return the token representing the 'continue' keyword
-   */
-  Token get keyword => _keyword;
+  Token get beginToken => keyword;
+  Token get endToken => semicolon;
 
   /**
    * Return the label associated with the statement, or `null` if there is no label.
@@ -4512,22 +3731,6 @@
   SimpleIdentifier get label => _label;
 
   /**
-   * Return the semicolon terminating the statement.
-   *
-   * @return the semicolon terminating the statement
-   */
-  Token get semicolon => _semicolon;
-
-  /**
-   * Set the token representing the 'continue' keyword to the given token.
-   *
-   * @param keyword the token representing the 'continue' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
-
-  /**
    * Set the label associated with the statement to the given label.
    *
    * @param identifier the label associated with the statement
@@ -4535,15 +3738,6 @@
   void set label(SimpleIdentifier identifier) {
     _label = becomeParentOf(identifier);
   }
-
-  /**
-   * Set the semicolon terminating the statement to the given token.
-   *
-   * @param semicolon the semicolon terminating the statement
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_label, visitor);
   }
@@ -4597,7 +3791,7 @@
    * The token representing either the 'final', 'const' or 'var' keyword, or `null` if no
    * keyword was used.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The name of the declared type of the parameter, or `null` if the parameter does not have
@@ -4608,7 +3802,7 @@
   /**
    * The name of the variable being declared.
    */
-  SimpleIdentifier _identifier;
+  SimpleIdentifier identifier;
 
   /**
    * Initialize a newly created formal parameter.
@@ -4620,9 +3814,9 @@
    * @param identifier the name of the parameter being declared
    */
   DeclaredIdentifier.full(Comment comment, List<Annotation> metadata, Token keyword, TypeName type, SimpleIdentifier identifier) : super.full(comment, metadata) {
-    this._keyword = keyword;
+    this.keyword = keyword;
     this._type = becomeParentOf(type);
-    this._identifier = becomeParentOf(identifier);
+    this.identifier = becomeParentOf(identifier);
   }
 
   /**
@@ -4637,28 +3831,13 @@
   DeclaredIdentifier({Comment comment, List<Annotation> metadata, Token keyword, TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata, keyword, type, identifier);
   accept(ASTVisitor visitor) => visitor.visitDeclaredIdentifier(this);
   LocalVariableElement get element {
-    SimpleIdentifier identifier = this.identifier;
-    if (identifier == null) {
+    SimpleIdentifier identifier2 = identifier;
+    if (identifier2 == null) {
       return null;
     }
-    return identifier.staticElement as LocalVariableElement;
+    return identifier2.staticElement as LocalVariableElement;
   }
-  Token get endToken => _identifier.endToken;
-
-  /**
-   * Return the name of the variable being declared.
-   *
-   * @return the name of the variable being declared
-   */
-  SimpleIdentifier get identifier => _identifier;
-
-  /**
-   * Return the token representing either the 'final', 'const' or 'var' keyword, or `null` if
-   * no keyword was used.
-   *
-   * @return the token representing either the 'final', 'const' or 'var' keyword
-   */
-  Token get keyword => _keyword;
+  Token get endToken => identifier.endToken;
 
   /**
    * Return the name of the declared type of the parameter, or `null` if the parameter does
@@ -4673,7 +3852,7 @@
    *
    * @return `true` if this variable was declared with the 'const' modifier
    */
-  bool get isConst => (_keyword is KeywordToken) && identical(((_keyword as KeywordToken)).keyword, Keyword.CONST);
+  bool get isConst => (keyword is KeywordToken) && identical(((keyword as KeywordToken)).keyword, Keyword.CONST);
 
   /**
    * Return `true` if this variable was declared with the 'final' modifier. Variables that are
@@ -4682,16 +3861,7 @@
    *
    * @return `true` if this variable was declared with the 'final' modifier
    */
-  bool get isFinal => (_keyword is KeywordToken) && identical(((_keyword as KeywordToken)).keyword, Keyword.FINAL);
-
-  /**
-   * Set the token representing either the 'final', 'const' or 'var' keyword to the given token.
-   *
-   * @param keyword the token representing either the 'final', 'const' or 'var' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
+  bool get isFinal => (keyword is KeywordToken) && identical(((keyword as KeywordToken)).keyword, Keyword.FINAL);
 
   /**
    * Set the name of the declared type of the parameter to the given type name.
@@ -4704,15 +3874,15 @@
   void visitChildren(ASTVisitor visitor) {
     super.visitChildren(visitor);
     safelyVisitChild(_type, visitor);
-    safelyVisitChild(_identifier, visitor);
+    safelyVisitChild(identifier, visitor);
   }
   Token get firstTokenAfterCommentAndMetadata {
-    if (_keyword != null) {
-      return _keyword;
+    if (keyword != null) {
+      return keyword;
     } else if (_type != null) {
       return _type.beginToken;
     }
-    return _identifier.beginToken;
+    return identifier.beginToken;
   }
 }
 /**
@@ -4746,7 +3916,7 @@
    * The token separating the parameter from the default value, or `null` if there is no
    * default value.
    */
-  Token _separator;
+  Token separator;
 
   /**
    * The expression computing the default value for the parameter, or `null` if there is no
@@ -4765,7 +3935,7 @@
   DefaultFormalParameter.full(NormalFormalParameter parameter, ParameterKind kind, Token separator, Expression defaultValue) {
     this._parameter = becomeParentOf(parameter);
     this._kind = kind;
-    this._separator = separator;
+    this.separator = separator;
     this._defaultValue = becomeParentOf(defaultValue);
   }
 
@@ -4803,14 +3973,6 @@
    * @return the formal parameter with which the default value is associated
    */
   NormalFormalParameter get parameter => _parameter;
-
-  /**
-   * Return the token separating the parameter from the default value, or `null` if there is
-   * no default value.
-   *
-   * @return the token separating the parameter from the default value
-   */
-  Token get separator => _separator;
   bool get isConst => _parameter != null && _parameter.isConst;
   bool get isFinal => _parameter != null && _parameter.isFinal;
 
@@ -4840,15 +4002,6 @@
   void set parameter(NormalFormalParameter formalParameter) {
     _parameter = becomeParentOf(formalParameter);
   }
-
-  /**
-   * Set the token separating the parameter from the default value to the given token.
-   *
-   * @param separator the token separating the parameter from the default value
-   */
-  void set separator(Token separator2) {
-    this._separator = separator2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_parameter, visitor);
     safelyVisitChild(_defaultValue, visitor);
@@ -4875,7 +4028,7 @@
    * The element associated with this directive, or `null` if the AST structure has not been
    * resolved or if this directive could not be resolved.
    */
-  Element _element;
+  Element element;
 
   /**
    * Initialize a newly create directive.
@@ -4894,30 +4047,12 @@
   Directive({Comment comment, List<Annotation> metadata}) : this.full(comment, metadata);
 
   /**
-   * Return the element associated with this directive, or `null` if the AST structure has not
-   * been resolved or if this directive could not be resolved. Examples of the latter case include a
-   * directive that contains an invalid URL or a URL that does not exist.
-   *
-   * @return the element associated with this directive
-   */
-  Element get element => _element;
-
-  /**
    * Return the token representing the keyword that introduces this directive ('import', 'export',
    * 'library' or 'part').
    *
    * @return the token representing the keyword that introduces this directive
    */
   Token get keyword;
-
-  /**
-   * Set the element associated with this directive to the given element.
-   *
-   * @param element the element associated with this directive
-   */
-  void set element(Element element2) {
-    this._element = element2;
-  }
 }
 /**
  * Instances of the class `DoStatement` represent a do statement.
@@ -4934,7 +4069,7 @@
   /**
    * The token representing the 'do' keyword.
    */
-  Token _doKeyword;
+  Token doKeyword;
 
   /**
    * The body of the loop.
@@ -4944,7 +4079,7 @@
   /**
    * The token representing the 'while' keyword.
    */
-  Token _whileKeyword;
+  Token whileKeyword;
 
   /**
    * The left parenthesis.
@@ -4964,7 +4099,7 @@
   /**
    * The semicolon terminating the statement.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created do loop.
@@ -4978,13 +4113,13 @@
    * @param semicolon the semicolon terminating the statement
    */
   DoStatement.full(Token doKeyword, Statement body, Token whileKeyword, Token leftParenthesis, Expression condition, Token rightParenthesis, Token semicolon) {
-    this._doKeyword = doKeyword;
+    this.doKeyword = doKeyword;
     this._body = becomeParentOf(body);
-    this._whileKeyword = whileKeyword;
+    this.whileKeyword = whileKeyword;
     this._leftParenthesis = leftParenthesis;
     this._condition = becomeParentOf(condition);
     this._rightParenthesis = rightParenthesis;
-    this._semicolon = semicolon;
+    this.semicolon = semicolon;
   }
 
   /**
@@ -5000,7 +4135,7 @@
    */
   DoStatement({Token doKeyword, Statement body, Token whileKeyword, Token leftParenthesis, Expression condition, Token rightParenthesis, Token semicolon}) : this.full(doKeyword, body, whileKeyword, leftParenthesis, condition, rightParenthesis, semicolon);
   accept(ASTVisitor visitor) => visitor.visitDoStatement(this);
-  Token get beginToken => _doKeyword;
+  Token get beginToken => doKeyword;
 
   /**
    * Return the body of the loop.
@@ -5015,14 +4150,7 @@
    * @return the condition that determines when the loop will terminate
    */
   Expression get condition => _condition;
-
-  /**
-   * Return the token representing the 'do' keyword.
-   *
-   * @return the token representing the 'do' keyword
-   */
-  Token get doKeyword => _doKeyword;
-  Token get endToken => _semicolon;
+  Token get endToken => semicolon;
 
   /**
    * Return the left parenthesis.
@@ -5039,20 +4167,6 @@
   Token get rightParenthesis => _rightParenthesis;
 
   /**
-   * Return the semicolon terminating the statement.
-   *
-   * @return the semicolon terminating the statement
-   */
-  Token get semicolon => _semicolon;
-
-  /**
-   * Return the token representing the 'while' keyword.
-   *
-   * @return the token representing the 'while' keyword
-   */
-  Token get whileKeyword => _whileKeyword;
-
-  /**
    * Set the body of the loop to the given statement.
    *
    * @param statement the body of the loop
@@ -5071,15 +4185,6 @@
   }
 
   /**
-   * Set the token representing the 'do' keyword to the given token.
-   *
-   * @param doKeyword the token representing the 'do' keyword
-   */
-  void set doKeyword(Token doKeyword2) {
-    this._doKeyword = doKeyword2;
-  }
-
-  /**
    * Set the left parenthesis to the given token.
    *
    * @param parenthesis the left parenthesis
@@ -5096,24 +4201,6 @@
   void set rightParenthesis(Token parenthesis) {
     _rightParenthesis = parenthesis;
   }
-
-  /**
-   * Set the semicolon terminating the statement to the given token.
-   *
-   * @param semicolon the semicolon terminating the statement
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
-
-  /**
-   * Set the token representing the 'while' keyword to the given token.
-   *
-   * @param whileKeyword the token representing the 'while' keyword
-   */
-  void set whileKeyword(Token whileKeyword2) {
-    this._whileKeyword = whileKeyword2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_body, visitor);
     safelyVisitChild(_condition, visitor);
@@ -5138,12 +4225,12 @@
   /**
    * The token representing the literal.
    */
-  Token _literal;
+  Token literal;
 
   /**
    * The value of the literal.
    */
-  double _value = 0.0;
+  double value = 0.0;
 
   /**
    * Initialize a newly created floating point literal.
@@ -5152,8 +4239,8 @@
    * @param value the value of the literal
    */
   DoubleLiteral.full(Token literal, double value) {
-    this._literal = literal;
-    this._value = value;
+    this.literal = literal;
+    this.value = value;
   }
 
   /**
@@ -5164,40 +4251,8 @@
    */
   DoubleLiteral({Token literal, double value}) : this.full(literal, value);
   accept(ASTVisitor visitor) => visitor.visitDoubleLiteral(this);
-  Token get beginToken => _literal;
-  Token get endToken => _literal;
-
-  /**
-   * Return the token representing the literal.
-   *
-   * @return the token representing the literal
-   */
-  Token get literal => _literal;
-
-  /**
-   * Return the value of the literal.
-   *
-   * @return the value of the literal
-   */
-  double get value => _value;
-
-  /**
-   * Set the token representing the literal to the given token.
-   *
-   * @param literal the token representing the literal
-   */
-  void set literal(Token literal2) {
-    this._literal = literal2;
-  }
-
-  /**
-   * Set the value of the literal to the given value.
-   *
-   * @param value the value of the literal
-   */
-  void set value(double value2) {
-    this._value = value2;
-  }
+  Token get beginToken => literal;
+  Token get endToken => literal;
   void visitChildren(ASTVisitor visitor) {
   }
 }
@@ -5217,7 +4272,7 @@
   /**
    * The token representing the semicolon that marks the end of the function body.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created function body.
@@ -5225,7 +4280,7 @@
    * @param semicolon the token representing the semicolon that marks the end of the function body
    */
   EmptyFunctionBody.full(Token semicolon) {
-    this._semicolon = semicolon;
+    this.semicolon = semicolon;
   }
 
   /**
@@ -5235,25 +4290,8 @@
    */
   EmptyFunctionBody({Token semicolon}) : this.full(semicolon);
   accept(ASTVisitor visitor) => visitor.visitEmptyFunctionBody(this);
-  Token get beginToken => _semicolon;
-  Token get endToken => _semicolon;
-
-  /**
-   * Return the token representing the semicolon that marks the end of the function body.
-   *
-   * @return the token representing the semicolon that marks the end of the function body
-   */
-  Token get semicolon => _semicolon;
-
-  /**
-   * Set the token representing the semicolon that marks the end of the function body to the given
-   * token.
-   *
-   * @param semicolon the token representing the semicolon that marks the end of the function body
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
+  Token get beginToken => semicolon;
+  Token get endToken => semicolon;
   void visitChildren(ASTVisitor visitor) {
   }
 }
@@ -5272,7 +4310,7 @@
   /**
    * The semicolon terminating the statement.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created empty statement.
@@ -5280,7 +4318,7 @@
    * @param semicolon the semicolon terminating the statement
    */
   EmptyStatement.full(Token semicolon) {
-    this._semicolon = semicolon;
+    this.semicolon = semicolon;
   }
 
   /**
@@ -5290,24 +4328,8 @@
    */
   EmptyStatement({Token semicolon}) : this.full(semicolon);
   accept(ASTVisitor visitor) => visitor.visitEmptyStatement(this);
-  Token get beginToken => _semicolon;
-  Token get endToken => _semicolon;
-
-  /**
-   * Return the semicolon terminating the statement.
-   *
-   * @return the semicolon terminating the statement
-   */
-  Token get semicolon => _semicolon;
-
-  /**
-   * Set the semicolon terminating the statement to the given token.
-   *
-   * @param semicolon the semicolon terminating the statement
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
+  Token get beginToken => semicolon;
+  Token get endToken => semicolon;
   void visitChildren(ASTVisitor visitor) {
   }
 }
@@ -5359,9 +4381,9 @@
   ExportDirective({Comment comment, List<Annotation> metadata, Token keyword, StringLiteral libraryUri, List<Combinator> combinators, Token semicolon}) : this.full(comment, metadata, keyword, libraryUri, combinators, semicolon);
   accept(ASTVisitor visitor) => visitor.visitExportDirective(this);
   LibraryElement get uriElement {
-    Element element = this.element;
-    if (element is ExportElement) {
-      return ((element as ExportElement)).exportedLibrary;
+    Element element2 = element;
+    if (element2 is ExportElement) {
+      return ((element2 as ExportElement)).exportedLibrary;
     }
     return null;
   }
@@ -5388,13 +4410,13 @@
   /**
    * The static type of this expression, or `null` if the AST structure has not been resolved.
    */
-  Type2 _staticType;
+  Type2 staticType;
 
   /**
    * The propagated type of this expression, or `null` if type propagation has not been
    * performed on the AST structure.
    */
-  Type2 _propagatedType;
+  Type2 propagatedType;
 
   /**
    * Return the best type information available for this expression. If type propagation was able to
@@ -5405,10 +4427,10 @@
    * @return the best type information available for this expression
    */
   Type2 get bestType {
-    if (_propagatedType != null) {
-      return _propagatedType;
-    } else if (_staticType != null) {
-      return _staticType;
+    if (propagatedType != null) {
+      return propagatedType;
+    } else if (staticType != null) {
+      return staticType;
     }
     return DynamicTypeImpl.instance;
   }
@@ -5451,14 +4473,6 @@
   }
 
   /**
-   * Return the propagated type of this expression, or `null` if type propagation has not been
-   * performed on the AST structure.
-   *
-   * @return the propagated type of this expression
-   */
-  Type2 get propagatedType => _propagatedType;
-
-  /**
    * If this expression is an argument to an invocation, and the AST structure has been resolved,
    * and the function being invoked is known based on static type information, and this expression
    * corresponds to one of the parameters of the function being invoked, then return the parameter
@@ -5496,38 +4510,12 @@
   }
 
   /**
-   * Return the static type of this expression, or `null` if the AST structure has not been
-   * resolved.
-   *
-   * @return the static type of this expression
-   */
-  Type2 get staticType => _staticType;
-
-  /**
    * Return `true` if this expression is syntactically valid for the LHS of an
    * [AssignmentExpression].
    *
    * @return `true` if this expression matches the `assignableExpression` production
    */
   bool get isAssignable => false;
-
-  /**
-   * Set the propagated type of this expression to the given type.
-   *
-   * @param propagatedType the propagated type of this expression
-   */
-  void set propagatedType(Type2 propagatedType2) {
-    this._propagatedType = propagatedType2;
-  }
-
-  /**
-   * Set the static type of this expression to the given type.
-   *
-   * @param staticType the static type of this expression
-   */
-  void set staticType(Type2 staticType2) {
-    this._staticType = staticType2;
-  }
 }
 /**
  * Instances of the class `ExpressionFunctionBody` represent a function body consisting of a
@@ -5545,7 +4533,7 @@
   /**
    * The token introducing the expression that represents the body of the function.
    */
-  Token _functionDefinition;
+  Token functionDefinition;
 
   /**
    * The expression representing the body of the function.
@@ -5555,7 +4543,7 @@
   /**
    * The semicolon terminating the statement.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created function body consisting of a block of statements.
@@ -5566,9 +4554,9 @@
    * @param semicolon the semicolon terminating the statement
    */
   ExpressionFunctionBody.full(Token functionDefinition, Expression expression, Token semicolon) {
-    this._functionDefinition = functionDefinition;
+    this.functionDefinition = functionDefinition;
     this._expression = becomeParentOf(expression);
-    this._semicolon = semicolon;
+    this.semicolon = semicolon;
   }
 
   /**
@@ -5581,10 +4569,10 @@
    */
   ExpressionFunctionBody({Token functionDefinition, Expression expression, Token semicolon}) : this.full(functionDefinition, expression, semicolon);
   accept(ASTVisitor visitor) => visitor.visitExpressionFunctionBody(this);
-  Token get beginToken => _functionDefinition;
+  Token get beginToken => functionDefinition;
   Token get endToken {
-    if (_semicolon != null) {
-      return _semicolon;
+    if (semicolon != null) {
+      return semicolon;
     }
     return _expression.endToken;
   }
@@ -5597,20 +4585,6 @@
   Expression get expression => _expression;
 
   /**
-   * Return the token introducing the expression that represents the body of the function.
-   *
-   * @return the function definition token
-   */
-  Token get functionDefinition => _functionDefinition;
-
-  /**
-   * Return the semicolon terminating the statement.
-   *
-   * @return the semicolon terminating the statement
-   */
-  Token get semicolon => _semicolon;
-
-  /**
    * Set the expression representing the body of the function to the given expression.
    *
    * @param expression the expression representing the body of the function
@@ -5618,25 +4592,6 @@
   void set expression(Expression expression2) {
     this._expression = becomeParentOf(expression2);
   }
-
-  /**
-   * Set the token introducing the expression that represents the body of the function to the given
-   * token.
-   *
-   * @param functionDefinition the function definition token
-   */
-  void set functionDefinition(Token functionDefinition2) {
-    this._functionDefinition = functionDefinition2;
-  }
-
-  /**
-   * Set the semicolon terminating the statement to the given token.
-   *
-   * @param semicolon the semicolon terminating the statement
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_expression, visitor);
   }
@@ -5662,7 +4617,7 @@
    * The semicolon terminating the statement, or `null` if the expression is a function
    * expression and therefore isn't followed by a semicolon.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created expression statement.
@@ -5672,7 +4627,7 @@
    */
   ExpressionStatement.full(Expression expression, Token semicolon) {
     this._expression = becomeParentOf(expression);
-    this._semicolon = semicolon;
+    this.semicolon = semicolon;
   }
 
   /**
@@ -5685,8 +4640,8 @@
   accept(ASTVisitor visitor) => visitor.visitExpressionStatement(this);
   Token get beginToken => _expression.beginToken;
   Token get endToken {
-    if (_semicolon != null) {
-      return _semicolon;
+    if (semicolon != null) {
+      return semicolon;
     }
     return _expression.endToken;
   }
@@ -5697,15 +4652,7 @@
    * @return the expression that comprises the statement
    */
   Expression get expression => _expression;
-
-  /**
-   * Return the semicolon terminating the statement, or `null` if the expression is a function
-   * expression and therefore isn't followed by a semicolon.
-   *
-   * @return the semicolon terminating the statement
-   */
-  Token get semicolon => _semicolon;
-  bool get isSynthetic => _expression.isSynthetic && _semicolon.isSynthetic;
+  bool get isSynthetic => _expression.isSynthetic && semicolon.isSynthetic;
 
   /**
    * Set the expression that comprises the statement to the given expression.
@@ -5715,15 +4662,6 @@
   void set expression(Expression expression2) {
     this._expression = becomeParentOf(expression2);
   }
-
-  /**
-   * Set the semicolon terminating the statement to the given token.
-   *
-   * @param semicolon the semicolon terminating the statement
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_expression, visitor);
   }
@@ -5744,7 +4682,7 @@
   /**
    * The token representing the 'extends' keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The name of the class that is being extended.
@@ -5758,7 +4696,7 @@
    * @param superclass the name of the class that is being extended
    */
   ExtendsClause.full(Token keyword, TypeName superclass) {
-    this._keyword = keyword;
+    this.keyword = keyword;
     this._superclass = becomeParentOf(superclass);
   }
 
@@ -5770,17 +4708,10 @@
    */
   ExtendsClause({Token keyword, TypeName superclass}) : this.full(keyword, superclass);
   accept(ASTVisitor visitor) => visitor.visitExtendsClause(this);
-  Token get beginToken => _keyword;
+  Token get beginToken => keyword;
   Token get endToken => _superclass.endToken;
 
   /**
-   * Return the token representing the 'extends' keyword.
-   *
-   * @return the token representing the 'extends' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
    * Return the name of the class that is being extended.
    *
    * @return the name of the class that is being extended
@@ -5788,15 +4719,6 @@
   TypeName get superclass => _superclass;
 
   /**
-   * Set the token representing the 'extends' keyword to the given token.
-   *
-   * @param keyword the token representing the 'extends' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
-
-  /**
    * Set the name of the class that is being extended to the given name.
    *
    * @param name the name of the class that is being extended
@@ -5824,7 +4746,7 @@
   /**
    * The token representing the 'static' keyword, or `null` if the fields are not static.
    */
-  Token _staticKeyword;
+  Token staticKeyword;
 
   /**
    * The fields being declared.
@@ -5834,7 +4756,7 @@
   /**
    * The semicolon terminating the declaration.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created field declaration.
@@ -5846,9 +4768,9 @@
    * @param semicolon the semicolon terminating the declaration
    */
   FieldDeclaration.full(Comment comment, List<Annotation> metadata, Token staticKeyword, VariableDeclarationList fieldList, Token semicolon) : super.full(comment, metadata) {
-    this._staticKeyword = staticKeyword;
+    this.staticKeyword = staticKeyword;
     this._fieldList = becomeParentOf(fieldList);
-    this._semicolon = semicolon;
+    this.semicolon = semicolon;
   }
 
   /**
@@ -5863,7 +4785,7 @@
   FieldDeclaration({Comment comment, List<Annotation> metadata, Token staticKeyword, VariableDeclarationList fieldList, Token semicolon}) : this.full(comment, metadata, staticKeyword, fieldList, semicolon);
   accept(ASTVisitor visitor) => visitor.visitFieldDeclaration(this);
   Element get element => null;
-  Token get endToken => _semicolon;
+  Token get endToken => semicolon;
 
   /**
    * Return the fields being declared.
@@ -5873,26 +4795,11 @@
   VariableDeclarationList get fields => _fieldList;
 
   /**
-   * Return the token representing the 'static' keyword, or `null` if the fields are not
-   * static.
-   *
-   * @return the token representing the 'static' keyword
-   */
-  Token get staticKeyword => _staticKeyword;
-
-  /**
-   * Return the semicolon terminating the declaration.
-   *
-   * @return the semicolon terminating the declaration
-   */
-  Token get semicolon => _semicolon;
-
-  /**
    * Return `true` if the fields are static.
    *
    * @return `true` if the fields are declared to be static
    */
-  bool get isStatic => _staticKeyword != null;
+  bool get isStatic => staticKeyword != null;
 
   /**
    * Set the fields being declared to the given list of variables.
@@ -5902,31 +4809,13 @@
   void set fields(VariableDeclarationList fieldList) {
     fieldList = becomeParentOf(fieldList);
   }
-
-  /**
-   * Set the token representing the 'static' keyword to the given token.
-   *
-   * @param keyword the token representing the 'static' keyword
-   */
-  void set staticKeyword(Token keyword) {
-    this._staticKeyword = keyword;
-  }
-
-  /**
-   * Set the semicolon terminating the declaration to the given token.
-   *
-   * @param semicolon the semicolon terminating the declaration
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
   void visitChildren(ASTVisitor visitor) {
     super.visitChildren(visitor);
     safelyVisitChild(_fieldList, visitor);
   }
   Token get firstTokenAfterCommentAndMetadata {
-    if (_staticKeyword != null) {
-      return _staticKeyword;
+    if (staticKeyword != null) {
+      return staticKeyword;
     }
     return _fieldList.beginToken;
   }
@@ -5947,7 +4836,7 @@
    * The token representing either the 'final', 'const' or 'var' keyword, or `null` if no
    * keyword was used.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The name of the declared type of the parameter, or `null` if the parameter does not have
@@ -5958,12 +4847,12 @@
   /**
    * The token representing the 'this' keyword.
    */
-  Token _thisToken;
+  Token thisToken;
 
   /**
    * The token representing the period.
    */
-  Token _period;
+  Token period;
 
   /**
    * The parameters of the function-typed parameter, or `null` if this is not a function-typed
@@ -5985,10 +4874,10 @@
    *          not a function-typed field formal parameter
    */
   FieldFormalParameter.full(Comment comment, List<Annotation> metadata, Token keyword, TypeName type, Token thisToken, Token period, SimpleIdentifier identifier, FormalParameterList parameters) : super.full(comment, metadata, identifier) {
-    this._keyword = keyword;
+    this.keyword = keyword;
     this._type = becomeParentOf(type);
-    this._thisToken = thisToken;
-    this._period = period;
+    this.thisToken = thisToken;
+    this.period = period;
     this._parameters = becomeParentOf(parameters);
   }
 
@@ -6008,24 +4897,16 @@
   FieldFormalParameter({Comment comment, List<Annotation> metadata, Token keyword, TypeName type, Token thisToken, Token period, SimpleIdentifier identifier, FormalParameterList parameters}) : this.full(comment, metadata, keyword, type, thisToken, period, identifier, parameters);
   accept(ASTVisitor visitor) => visitor.visitFieldFormalParameter(this);
   Token get beginToken {
-    if (_keyword != null) {
-      return _keyword;
+    if (keyword != null) {
+      return keyword;
     } else if (_type != null) {
       return _type.beginToken;
     }
-    return _thisToken;
+    return thisToken;
   }
   Token get endToken => identifier.endToken;
 
   /**
-   * Return the token representing either the 'final', 'const' or 'var' keyword, or `null` if
-   * no keyword was used.
-   *
-   * @return the token representing either the 'final', 'const' or 'var' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
    * Return the parameters of the function-typed parameter, or `null` if this is not a
    * function-typed field formal parameter.
    *
@@ -6034,20 +4915,6 @@
   FormalParameterList get parameters => _parameters;
 
   /**
-   * Return the token representing the period.
-   *
-   * @return the token representing the period
-   */
-  Token get period => _period;
-
-  /**
-   * Return the token representing the 'this' keyword.
-   *
-   * @return the token representing the 'this' keyword
-   */
-  Token get thisToken => _thisToken;
-
-  /**
    * Return the name of the declared type of the parameter, or `null` if the parameter does
    * not have a declared type. Note that if this is a function-typed field formal parameter this is
    * the return type of the function.
@@ -6055,17 +4922,8 @@
    * @return the name of the declared type of the parameter
    */
   TypeName get type => _type;
-  bool get isConst => (_keyword is KeywordToken) && identical(((_keyword as KeywordToken)).keyword, Keyword.CONST);
-  bool get isFinal => (_keyword is KeywordToken) && identical(((_keyword as KeywordToken)).keyword, Keyword.FINAL);
-
-  /**
-   * Set the token representing either the 'final', 'const' or 'var' keyword to the given token.
-   *
-   * @param keyword the token representing either the 'final', 'const' or 'var' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
+  bool get isConst => (keyword is KeywordToken) && identical(((keyword as KeywordToken)).keyword, Keyword.CONST);
+  bool get isFinal => (keyword is KeywordToken) && identical(((keyword as KeywordToken)).keyword, Keyword.FINAL);
 
   /**
    * Set the parameters of the function-typed parameter to the given parameters.
@@ -6077,24 +4935,6 @@
   }
 
   /**
-   * Set the token representing the period to the given token.
-   *
-   * @param period the token representing the period
-   */
-  void set period(Token period2) {
-    this._period = period2;
-  }
-
-  /**
-   * Set the token representing the 'this' keyword to the given token.
-   *
-   * @param thisToken the token representing the 'this' keyword
-   */
-  void set thisToken(Token thisToken2) {
-    this._thisToken = thisToken2;
-  }
-
-  /**
    * Set the name of the declared type of the parameter to the given type name.
    *
    * @param typeName the name of the declared type of the parameter
@@ -6124,12 +4964,12 @@
   /**
    * The token representing the 'for' keyword.
    */
-  Token _forKeyword;
+  Token forKeyword;
 
   /**
    * The left parenthesis.
    */
-  Token _leftParenthesis;
+  Token leftParenthesis;
 
   /**
    * The declaration of the loop variable.
@@ -6139,7 +4979,7 @@
   /**
    * The token representing the 'in' keyword.
    */
-  Token _inKeyword;
+  Token inKeyword;
 
   /**
    * The expression evaluated to produce the iterator.
@@ -6149,7 +4989,7 @@
   /**
    * The right parenthesis.
    */
-  Token _rightParenthesis;
+  Token rightParenthesis;
 
   /**
    * The body of the loop.
@@ -6167,12 +5007,12 @@
    * @param body the body of the loop
    */
   ForEachStatement.full(Token forKeyword, Token leftParenthesis, DeclaredIdentifier loopVariable, Token inKeyword, Expression iterator, Token rightParenthesis, Statement body) {
-    this._forKeyword = forKeyword;
-    this._leftParenthesis = leftParenthesis;
+    this.forKeyword = forKeyword;
+    this.leftParenthesis = leftParenthesis;
     this._loopVariable = becomeParentOf(loopVariable);
-    this._inKeyword = inKeyword;
+    this.inKeyword = inKeyword;
     this._iterator = becomeParentOf(iterator);
-    this._rightParenthesis = rightParenthesis;
+    this.rightParenthesis = rightParenthesis;
     this._body = becomeParentOf(body);
   }
 
@@ -6188,7 +5028,7 @@
    */
   ForEachStatement({Token forKeyword, Token leftParenthesis, DeclaredIdentifier loopVariable, Token inKeyword, Expression iterator, Token rightParenthesis, Statement body}) : this.full(forKeyword, leftParenthesis, loopVariable, inKeyword, iterator, rightParenthesis, body);
   accept(ASTVisitor visitor) => visitor.visitForEachStatement(this);
-  Token get beginToken => _forKeyword;
+  Token get beginToken => forKeyword;
 
   /**
    * Return the body of the loop.
@@ -6199,20 +5039,6 @@
   Token get endToken => _body.endToken;
 
   /**
-   * Return the token representing the 'for' keyword.
-   *
-   * @return the token representing the 'for' keyword
-   */
-  Token get forKeyword => _forKeyword;
-
-  /**
-   * Return the token representing the 'in' keyword.
-   *
-   * @return the token representing the 'in' keyword
-   */
-  Token get inKeyword => _inKeyword;
-
-  /**
    * Return the expression evaluated to produce the iterator.
    *
    * @return the expression evaluated to produce the iterator
@@ -6220,13 +5046,6 @@
   Expression get iterator => _iterator;
 
   /**
-   * Return the left parenthesis.
-   *
-   * @return the left parenthesis
-   */
-  Token get leftParenthesis => _leftParenthesis;
-
-  /**
    * Return the declaration of the loop variable.
    *
    * @return the declaration of the loop variable
@@ -6234,13 +5053,6 @@
   DeclaredIdentifier get loopVariable => _loopVariable;
 
   /**
-   * Return the right parenthesis.
-   *
-   * @return the right parenthesis
-   */
-  Token get rightParenthesis => _rightParenthesis;
-
-  /**
    * Set the body of the loop to the given block.
    *
    * @param body the body of the loop
@@ -6250,24 +5062,6 @@
   }
 
   /**
-   * Set the token representing the 'for' keyword to the given token.
-   *
-   * @param forKeyword the token representing the 'for' keyword
-   */
-  void set forKeyword(Token forKeyword2) {
-    this._forKeyword = forKeyword2;
-  }
-
-  /**
-   * Set the token representing the 'in' keyword to the given token.
-   *
-   * @param inKeyword the token representing the 'in' keyword
-   */
-  void set inKeyword(Token inKeyword2) {
-    this._inKeyword = inKeyword2;
-  }
-
-  /**
    * Set the expression evaluated to produce the iterator to the given expression.
    *
    * @param expression the expression evaluated to produce the iterator
@@ -6277,15 +5071,6 @@
   }
 
   /**
-   * Set the left parenthesis to the given token.
-   *
-   * @param leftParenthesis the left parenthesis
-   */
-  void set leftParenthesis(Token leftParenthesis2) {
-    this._leftParenthesis = leftParenthesis2;
-  }
-
-  /**
    * Set the declaration of the loop variable to the given variable.
    *
    * @param variable the declaration of the loop variable
@@ -6293,15 +5078,6 @@
   void set loopVariable(DeclaredIdentifier variable) {
     _loopVariable = becomeParentOf(variable);
   }
-
-  /**
-   * Set the right parenthesis to the given token.
-   *
-   * @param rightParenthesis the right parenthesis
-   */
-  void set rightParenthesis(Token rightParenthesis2) {
-    this._rightParenthesis = rightParenthesis2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_loopVariable, visitor);
     safelyVisitChild(_iterator, visitor);
@@ -6330,12 +5106,12 @@
   /**
    * The token representing the 'for' keyword.
    */
-  Token _forKeyword;
+  Token forKeyword;
 
   /**
    * The left parenthesis.
    */
-  Token _leftParenthesis;
+  Token leftParenthesis;
 
   /**
    * The declaration of the loop variables, or `null` if there are no variables. Note that a
@@ -6354,7 +5130,7 @@
   /**
    * The semicolon separating the initializer and the condition.
    */
-  Token _leftSeparator;
+  Token leftSeparator;
 
   /**
    * The condition used to determine when to terminate the loop, or `null` if there is no
@@ -6365,17 +5141,17 @@
   /**
    * The semicolon separating the condition and the updater.
    */
-  Token _rightSeparator;
+  Token rightSeparator;
 
   /**
    * The list of expressions run after each execution of the loop body.
    */
-  NodeList<Expression> _updaters;
+  NodeList<Expression> updaters;
 
   /**
    * The right parenthesis.
    */
-  Token _rightParenthesis;
+  Token rightParenthesis;
 
   /**
    * The body of the loop.
@@ -6397,16 +5173,16 @@
    * @param body the body of the loop
    */
   ForStatement.full(Token forKeyword, Token leftParenthesis, VariableDeclarationList variableList, Expression initialization, Token leftSeparator, Expression condition, Token rightSeparator, List<Expression> updaters, Token rightParenthesis, Statement body) {
-    this._updaters = new NodeList<Expression>(this);
-    this._forKeyword = forKeyword;
-    this._leftParenthesis = leftParenthesis;
+    this.updaters = new NodeList<Expression>(this);
+    this.forKeyword = forKeyword;
+    this.leftParenthesis = leftParenthesis;
     this._variableList = becomeParentOf(variableList);
     this._initialization = becomeParentOf(initialization);
-    this._leftSeparator = leftSeparator;
+    this.leftSeparator = leftSeparator;
     this._condition = becomeParentOf(condition);
-    this._rightSeparator = rightSeparator;
-    this._updaters.addAll(updaters);
-    this._rightParenthesis = rightParenthesis;
+    this.rightSeparator = rightSeparator;
+    this.updaters.addAll(updaters);
+    this.rightParenthesis = rightParenthesis;
     this._body = becomeParentOf(body);
   }
 
@@ -6426,7 +5202,7 @@
    */
   ForStatement({Token forKeyword, Token leftParenthesis, VariableDeclarationList variableList, Expression initialization, Token leftSeparator, Expression condition, Token rightSeparator, List<Expression> updaters, Token rightParenthesis, Statement body}) : this.full(forKeyword, leftParenthesis, variableList, initialization, leftSeparator, condition, rightSeparator, updaters, rightParenthesis, body);
   accept(ASTVisitor visitor) => visitor.visitForStatement(this);
-  Token get beginToken => _forKeyword;
+  Token get beginToken => forKeyword;
 
   /**
    * Return the body of the loop.
@@ -6445,13 +5221,6 @@
   Token get endToken => _body.endToken;
 
   /**
-   * Return the token representing the 'for' keyword.
-   *
-   * @return the token representing the 'for' keyword
-   */
-  Token get forKeyword => _forKeyword;
-
-  /**
    * Return the initialization expression, or `null` if there is no initialization expression.
    *
    * @return the initialization expression
@@ -6459,41 +5228,6 @@
   Expression get initialization => _initialization;
 
   /**
-   * Return the left parenthesis.
-   *
-   * @return the left parenthesis
-   */
-  Token get leftParenthesis => _leftParenthesis;
-
-  /**
-   * Return the semicolon separating the initializer and the condition.
-   *
-   * @return the semicolon separating the initializer and the condition
-   */
-  Token get leftSeparator => _leftSeparator;
-
-  /**
-   * Return the right parenthesis.
-   *
-   * @return the right parenthesis
-   */
-  Token get rightParenthesis => _rightParenthesis;
-
-  /**
-   * Return the semicolon separating the condition and the updater.
-   *
-   * @return the semicolon separating the condition and the updater
-   */
-  Token get rightSeparator => _rightSeparator;
-
-  /**
-   * Return the list of expressions run after each execution of the loop body.
-   *
-   * @return the list of expressions run after each execution of the loop body
-   */
-  NodeList<Expression> get updaters => _updaters;
-
-  /**
    * Return the declaration of the loop variables, or `null` if there are no variables.
    *
    * @return the declaration of the loop variables, or `null` if there are no variables
@@ -6519,15 +5253,6 @@
   }
 
   /**
-   * Set the token representing the 'for' keyword to the given token.
-   *
-   * @param forKeyword the token representing the 'for' keyword
-   */
-  void set forKeyword(Token forKeyword2) {
-    this._forKeyword = forKeyword2;
-  }
-
-  /**
    * Set the initialization expression to the given expression.
    *
    * @param initialization the initialization expression
@@ -6537,42 +5262,6 @@
   }
 
   /**
-   * Set the left parenthesis to the given token.
-   *
-   * @param leftParenthesis the left parenthesis
-   */
-  void set leftParenthesis(Token leftParenthesis2) {
-    this._leftParenthesis = leftParenthesis2;
-  }
-
-  /**
-   * Set the semicolon separating the initializer and the condition to the given token.
-   *
-   * @param leftSeparator the semicolon separating the initializer and the condition
-   */
-  void set leftSeparator(Token leftSeparator2) {
-    this._leftSeparator = leftSeparator2;
-  }
-
-  /**
-   * Set the right parenthesis to the given token.
-   *
-   * @param rightParenthesis the right parenthesis
-   */
-  void set rightParenthesis(Token rightParenthesis2) {
-    this._rightParenthesis = rightParenthesis2;
-  }
-
-  /**
-   * Set the semicolon separating the condition and the updater to the given token.
-   *
-   * @param rightSeparator the semicolon separating the condition and the updater
-   */
-  void set rightSeparator(Token rightSeparator2) {
-    this._rightSeparator = rightSeparator2;
-  }
-
-  /**
    * Set the declaration of the loop variables to the given parameter.
    *
    * @param variableList the declaration of the loop variables
@@ -6584,7 +5273,7 @@
     safelyVisitChild(_variableList, visitor);
     safelyVisitChild(_initialization, visitor);
     safelyVisitChild(_condition, visitor);
-    _updaters.accept(visitor);
+    updaters.accept(visitor);
     safelyVisitChild(_body, visitor);
   }
 }
@@ -6688,7 +5377,7 @@
   /**
    * The parameters associated with the method.
    */
-  NodeList<FormalParameter> _parameters;
+  NodeList<FormalParameter> parameters;
 
   /**
    * The left square bracket ('[') or left curly brace ('{') introducing the optional parameters, or
@@ -6717,9 +5406,9 @@
    * @param rightParenthesis the right parenthesis
    */
   FormalParameterList.full(Token leftParenthesis, List<FormalParameter> parameters, Token leftDelimiter, Token rightDelimiter, Token rightParenthesis) {
-    this._parameters = new NodeList<FormalParameter>(this);
+    this.parameters = new NodeList<FormalParameter>(this);
     this._leftParenthesis = leftParenthesis;
-    this._parameters.addAll(parameters);
+    this.parameters.addAll(parameters);
     this._leftDelimiter = leftDelimiter;
     this._rightDelimiter = rightDelimiter;
     this._rightParenthesis = rightParenthesis;
@@ -6762,22 +5451,15 @@
    * @return the elements representing the parameters in this list
    */
   List<ParameterElement> get parameterElements {
-    int count = _parameters.length;
+    int count = parameters.length;
     List<ParameterElement> types = new List<ParameterElement>(count);
     for (int i = 0; i < count; i++) {
-      types[i] = _parameters[i].element;
+      types[i] = parameters[i].element;
     }
     return types;
   }
 
   /**
-   * Return the parameters associated with the method.
-   *
-   * @return the parameters associated with the method
-   */
-  NodeList<FormalParameter> get parameters => _parameters;
-
-  /**
    * Return the right square bracket (']') or right curly brace ('}') introducing the optional
    * parameters, or `null` if there are no optional parameters.
    *
@@ -6831,7 +5513,7 @@
     _rightParenthesis = parenthesis;
   }
   void visitChildren(ASTVisitor visitor) {
-    _parameters.accept(visitor);
+    parameters.accept(visitor);
   }
 }
 /**
@@ -6869,7 +5551,7 @@
    * The token representing the 'external' keyword, or `null` if this is not an external
    * function.
    */
-  Token _externalKeyword;
+  Token externalKeyword;
 
   /**
    * The return type of the function, or `null` if no return type was declared.
@@ -6880,7 +5562,7 @@
    * The token representing the 'get' or 'set' keyword, or `null` if this is a function
    * declaration rather than a property declaration.
    */
-  Token _propertyKeyword;
+  Token propertyKeyword;
 
   /**
    * The name of the function, or `null` if the function is not named.
@@ -6904,9 +5586,9 @@
    * @param functionExpression the function expression being wrapped
    */
   FunctionDeclaration.full(Comment comment, List<Annotation> metadata, Token externalKeyword, TypeName returnType, Token propertyKeyword, SimpleIdentifier name, FunctionExpression functionExpression) : super.full(comment, metadata) {
-    this._externalKeyword = externalKeyword;
+    this.externalKeyword = externalKeyword;
     this._returnType = becomeParentOf(returnType);
-    this._propertyKeyword = propertyKeyword;
+    this.propertyKeyword = propertyKeyword;
     this._name = becomeParentOf(name);
     this._functionExpression = becomeParentOf(functionExpression);
   }
@@ -6928,14 +5610,6 @@
   Token get endToken => _functionExpression.endToken;
 
   /**
-   * Return the token representing the 'external' keyword, or `null` if this is not an
-   * external function.
-   *
-   * @return the token representing the 'external' keyword
-   */
-  Token get externalKeyword => _externalKeyword;
-
-  /**
    * Return the function expression being wrapped.
    *
    * @return the function expression being wrapped
@@ -6950,14 +5624,6 @@
   SimpleIdentifier get name => _name;
 
   /**
-   * Return the token representing the 'get' or 'set' keyword, or `null` if this is a function
-   * declaration rather than a property declaration.
-   *
-   * @return the token representing the 'get' or 'set' keyword
-   */
-  Token get propertyKeyword => _propertyKeyword;
-
-  /**
    * Return the return type of the function, or `null` if no return type was declared.
    *
    * @return the return type of the function
@@ -6969,23 +5635,14 @@
    *
    * @return `true` if this function declares a getter
    */
-  bool get isGetter => _propertyKeyword != null && identical(((_propertyKeyword as KeywordToken)).keyword, Keyword.GET);
+  bool get isGetter => propertyKeyword != null && identical(((propertyKeyword as KeywordToken)).keyword, Keyword.GET);
 
   /**
    * Return `true` if this function declares a setter.
    *
    * @return `true` if this function declares a setter
    */
-  bool get isSetter => _propertyKeyword != null && identical(((_propertyKeyword as KeywordToken)).keyword, Keyword.SET);
-
-  /**
-   * Set the token representing the 'external' keyword to the given token.
-   *
-   * @param externalKeyword the token representing the 'external' keyword
-   */
-  void set externalKeyword(Token externalKeyword2) {
-    this._externalKeyword = externalKeyword2;
-  }
+  bool get isSetter => propertyKeyword != null && identical(((propertyKeyword as KeywordToken)).keyword, Keyword.SET);
 
   /**
    * Set the function expression being wrapped to the given function expression.
@@ -7006,15 +5663,6 @@
   }
 
   /**
-   * Set the token representing the 'get' or 'set' keyword to the given token.
-   *
-   * @param propertyKeyword the token representing the 'get' or 'set' keyword
-   */
-  void set propertyKeyword(Token propertyKeyword2) {
-    this._propertyKeyword = propertyKeyword2;
-  }
-
-  /**
    * Set the return type of the function to the given name.
    *
    * @param name the return type of the function
@@ -7029,13 +5677,13 @@
     safelyVisitChild(_functionExpression, visitor);
   }
   Token get firstTokenAfterCommentAndMetadata {
-    if (_externalKeyword != null) {
-      return _externalKeyword;
+    if (externalKeyword != null) {
+      return externalKeyword;
     }
     if (_returnType != null) {
       return _returnType.beginToken;
-    } else if (_propertyKeyword != null) {
-      return _propertyKeyword;
+    } else if (propertyKeyword != null) {
+      return propertyKeyword;
     } else if (_name != null) {
       return _name.beginToken;
     }
@@ -7053,7 +5701,7 @@
   /**
    * The function declaration being wrapped.
    */
-  FunctionDeclaration _functionDeclaration;
+  FunctionDeclaration functionDeclaration;
 
   /**
    * Initialize a newly created function declaration statement.
@@ -7061,7 +5709,7 @@
    * @param functionDeclaration the the function declaration being wrapped
    */
   FunctionDeclarationStatement.full(FunctionDeclaration functionDeclaration) {
-    this._functionDeclaration = becomeParentOf(functionDeclaration);
+    this.functionDeclaration = becomeParentOf(functionDeclaration);
   }
 
   /**
@@ -7071,15 +5719,8 @@
    */
   FunctionDeclarationStatement({FunctionDeclaration functionDeclaration}) : this.full(functionDeclaration);
   accept(ASTVisitor visitor) => visitor.visitFunctionDeclarationStatement(this);
-  Token get beginToken => _functionDeclaration.beginToken;
-  Token get endToken => _functionDeclaration.endToken;
-
-  /**
-   * Return the function declaration being wrapped.
-   *
-   * @return the function declaration being wrapped
-   */
-  FunctionDeclaration get functionDeclaration => _functionDeclaration;
+  Token get beginToken => functionDeclaration.beginToken;
+  Token get endToken => functionDeclaration.endToken;
 
   /**
    * Set the function declaration being wrapped to the given function declaration.
@@ -7087,10 +5728,10 @@
    * @param functionDeclaration the function declaration being wrapped
    */
   void set functionExpression(FunctionDeclaration functionDeclaration2) {
-    this._functionDeclaration = becomeParentOf(functionDeclaration2);
+    this.functionDeclaration = becomeParentOf(functionDeclaration2);
   }
   void visitChildren(ASTVisitor visitor) {
-    safelyVisitChild(_functionDeclaration, visitor);
+    safelyVisitChild(functionDeclaration, visitor);
   }
 }
 /**
@@ -7119,7 +5760,7 @@
    * The element associated with the function, or `null` if the AST structure has not been
    * resolved.
    */
-  ExecutableElement _element;
+  ExecutableElement element;
 
   /**
    * Initialize a newly created function declaration.
@@ -7155,14 +5796,6 @@
    * @return the body of the function
    */
   FunctionBody get body => _body;
-
-  /**
-   * Return the element associated with this function, or `null` if the AST structure has not
-   * been resolved.
-   *
-   * @return the element associated with this function
-   */
-  ExecutableElement get element => _element;
   Token get endToken {
     if (_body != null) {
       return _body.endToken;
@@ -7189,15 +5822,6 @@
   }
 
   /**
-   * Set the element associated with this function to the given element.
-   *
-   * @param element the element associated with this function
-   */
-  void set element(ExecutableElement element2) {
-    this._element = element2;
-  }
-
-  /**
    * Set the parameters associated with the function to the given list of parameters.
    *
    * @param parameters the parameters associated with the function
@@ -7240,7 +5864,7 @@
    * The element associated with the function being invoked based on static type information, or
    * `null` if the AST structure has not been resolved or the function could not be resolved.
    */
-  ExecutableElement _staticElement;
+  ExecutableElement staticElement;
 
   /**
    * The element associated with the function being invoked based on propagated type information, or
@@ -7311,16 +5935,6 @@
   ExecutableElement get propagatedElement => _propagatedElement;
 
   /**
-   * Return the element associated with the function being invoked based on static type information,
-   * or `null` if the AST structure has not been resolved or the function could not be
-   * resolved. One common example of the latter case is an expression whose value can change over
-   * time.
-   *
-   * @return the element associated with the function
-   */
-  ExecutableElement get staticElement => _staticElement;
-
-  /**
    * Set the list of arguments to the method to the given list.
    *
    * @param argumentList the list of arguments to the method
@@ -7347,16 +5961,6 @@
   void set propagatedElement(ExecutableElement element) {
     _propagatedElement = element;
   }
-
-  /**
-   * Set the element associated with the function being invoked based on static type information to
-   * the given element.
-   *
-   * @param element the element to be associated with the function
-   */
-  void set staticElement(ExecutableElement element) {
-    this._staticElement = element;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_function, visitor);
     safelyVisitChild(_argumentList, visitor);
@@ -7622,7 +6226,7 @@
   /**
    * The list of names from the library that are hidden by this combinator.
    */
-  NodeList<SimpleIdentifier> _hiddenNames;
+  NodeList<SimpleIdentifier> hiddenNames;
 
   /**
    * Initialize a newly created import show combinator.
@@ -7631,8 +6235,8 @@
    * @param hiddenNames the list of names from the library that are hidden by this combinator
    */
   HideCombinator.full(Token keyword, List<SimpleIdentifier> hiddenNames) : super.full(keyword) {
-    this._hiddenNames = new NodeList<SimpleIdentifier>(this);
-    this._hiddenNames.addAll(hiddenNames);
+    this.hiddenNames = new NodeList<SimpleIdentifier>(this);
+    this.hiddenNames.addAll(hiddenNames);
   }
 
   /**
@@ -7643,16 +6247,9 @@
    */
   HideCombinator({Token keyword, List<SimpleIdentifier> hiddenNames}) : this.full(keyword, hiddenNames);
   accept(ASTVisitor visitor) => visitor.visitHideCombinator(this);
-  Token get endToken => _hiddenNames.endToken;
-
-  /**
-   * Return the list of names from the library that are hidden by this combinator.
-   *
-   * @return the list of names from the library that are hidden by this combinator
-   */
-  NodeList<SimpleIdentifier> get hiddenNames => _hiddenNames;
+  Token get endToken => hiddenNames.endToken;
   void visitChildren(ASTVisitor visitor) {
-    _hiddenNames.accept(visitor);
+    hiddenNames.accept(visitor);
   }
 }
 /**
@@ -7731,12 +6328,12 @@
   /**
    * The token representing the 'if' keyword.
    */
-  Token _ifKeyword;
+  Token ifKeyword;
 
   /**
    * The left parenthesis.
    */
-  Token _leftParenthesis;
+  Token leftParenthesis;
 
   /**
    * The condition used to determine which of the statements is executed next.
@@ -7746,7 +6343,7 @@
   /**
    * The right parenthesis.
    */
-  Token _rightParenthesis;
+  Token rightParenthesis;
 
   /**
    * The statement that is executed if the condition evaluates to `true`.
@@ -7756,7 +6353,7 @@
   /**
    * The token representing the 'else' keyword, or `null` if there is no else statement.
    */
-  Token _elseKeyword;
+  Token elseKeyword;
 
   /**
    * The statement that is executed if the condition evaluates to `false`, or `null` if
@@ -7776,12 +6373,12 @@
    * @param elseStatement the statement that is executed if the condition evaluates to `false`
    */
   IfStatement.full(Token ifKeyword, Token leftParenthesis, Expression condition, Token rightParenthesis, Statement thenStatement, Token elseKeyword, Statement elseStatement) {
-    this._ifKeyword = ifKeyword;
-    this._leftParenthesis = leftParenthesis;
+    this.ifKeyword = ifKeyword;
+    this.leftParenthesis = leftParenthesis;
     this._condition = becomeParentOf(condition);
-    this._rightParenthesis = rightParenthesis;
+    this.rightParenthesis = rightParenthesis;
     this._thenStatement = becomeParentOf(thenStatement);
-    this._elseKeyword = elseKeyword;
+    this.elseKeyword = elseKeyword;
     this._elseStatement = becomeParentOf(elseStatement);
   }
 
@@ -7798,7 +6395,7 @@
    */
   IfStatement({Token ifKeyword, Token leftParenthesis, Expression condition, Token rightParenthesis, Statement thenStatement, Token elseKeyword, Statement elseStatement}) : this.full(ifKeyword, leftParenthesis, condition, rightParenthesis, thenStatement, elseKeyword, elseStatement);
   accept(ASTVisitor visitor) => visitor.visitIfStatement(this);
-  Token get beginToken => _ifKeyword;
+  Token get beginToken => ifKeyword;
 
   /**
    * Return the condition used to determine which of the statements is executed next.
@@ -7808,14 +6405,6 @@
   Expression get condition => _condition;
 
   /**
-   * Return the token representing the 'else' keyword, or `null` if there is no else
-   * statement.
-   *
-   * @return the token representing the 'else' keyword
-   */
-  Token get elseKeyword => _elseKeyword;
-
-  /**
    * Return the statement that is executed if the condition evaluates to `false`, or
    * `null` if there is no else statement.
    *
@@ -7830,27 +6419,6 @@
   }
 
   /**
-   * Return the token representing the 'if' keyword.
-   *
-   * @return the token representing the 'if' keyword
-   */
-  Token get ifKeyword => _ifKeyword;
-
-  /**
-   * Return the left parenthesis.
-   *
-   * @return the left parenthesis
-   */
-  Token get leftParenthesis => _leftParenthesis;
-
-  /**
-   * Return the right parenthesis.
-   *
-   * @return the right parenthesis
-   */
-  Token get rightParenthesis => _rightParenthesis;
-
-  /**
    * Return the statement that is executed if the condition evaluates to `true`.
    *
    * @return the statement that is executed if the condition evaluates to `true`
@@ -7868,15 +6436,6 @@
   }
 
   /**
-   * Set the token representing the 'else' keyword to the given token.
-   *
-   * @param elseKeyword the token representing the 'else' keyword
-   */
-  void set elseKeyword(Token elseKeyword2) {
-    this._elseKeyword = elseKeyword2;
-  }
-
-  /**
    * Set the statement that is executed if the condition evaluates to `false` to the given
    * statement.
    *
@@ -7887,33 +6446,6 @@
   }
 
   /**
-   * Set the token representing the 'if' keyword to the given token.
-   *
-   * @param ifKeyword the token representing the 'if' keyword
-   */
-  void set ifKeyword(Token ifKeyword2) {
-    this._ifKeyword = ifKeyword2;
-  }
-
-  /**
-   * Set the left parenthesis to the given token.
-   *
-   * @param leftParenthesis the left parenthesis
-   */
-  void set leftParenthesis(Token leftParenthesis2) {
-    this._leftParenthesis = leftParenthesis2;
-  }
-
-  /**
-   * Set the right parenthesis to the given token.
-   *
-   * @param rightParenthesis the right parenthesis
-   */
-  void set rightParenthesis(Token rightParenthesis2) {
-    this._rightParenthesis = rightParenthesis2;
-  }
-
-  /**
    * Set the statement that is executed if the condition evaluates to `true` to the given
    * statement.
    *
@@ -7944,12 +6476,12 @@
   /**
    * The token representing the 'implements' keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The interfaces that are being implemented.
    */
-  NodeList<TypeName> _interfaces;
+  NodeList<TypeName> interfaces;
 
   /**
    * Initialize a newly created implements clause.
@@ -7958,9 +6490,9 @@
    * @param interfaces the interfaces that are being implemented
    */
   ImplementsClause.full(Token keyword, List<TypeName> interfaces) {
-    this._interfaces = new NodeList<TypeName>(this);
-    this._keyword = keyword;
-    this._interfaces.addAll(interfaces);
+    this.interfaces = new NodeList<TypeName>(this);
+    this.keyword = keyword;
+    this.interfaces.addAll(interfaces);
   }
 
   /**
@@ -7971,33 +6503,10 @@
    */
   ImplementsClause({Token keyword, List<TypeName> interfaces}) : this.full(keyword, interfaces);
   accept(ASTVisitor visitor) => visitor.visitImplementsClause(this);
-  Token get beginToken => _keyword;
-  Token get endToken => _interfaces.endToken;
-
-  /**
-   * Return the list of the interfaces that are being implemented.
-   *
-   * @return the list of the interfaces that are being implemented
-   */
-  NodeList<TypeName> get interfaces => _interfaces;
-
-  /**
-   * Return the token representing the 'implements' keyword.
-   *
-   * @return the token representing the 'implements' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Set the token representing the 'implements' keyword to the given token.
-   *
-   * @param keyword the token representing the 'implements' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
+  Token get beginToken => keyword;
+  Token get endToken => interfaces.endToken;
   void visitChildren(ASTVisitor visitor) {
-    _interfaces.accept(visitor);
+    interfaces.accept(visitor);
   }
 }
 /**
@@ -8015,7 +6524,7 @@
   /**
    * The token representing the 'as' token, or `null` if the imported names are not prefixed.
    */
-  Token _asToken;
+  Token asToken;
 
   /**
    * The prefix to be used with the imported names, or `null` if the imported names are not
@@ -8036,7 +6545,7 @@
    * @param semicolon the semicolon terminating the directive
    */
   ImportDirective.full(Comment comment, List<Annotation> metadata, Token keyword, StringLiteral libraryUri, Token asToken, SimpleIdentifier prefix, List<Combinator> combinators, Token semicolon) : super.full(comment, metadata, keyword, libraryUri, combinators, semicolon) {
-    this._asToken = asToken;
+    this.asToken = asToken;
     this._prefix = becomeParentOf(prefix);
   }
 
@@ -8056,14 +6565,6 @@
   accept(ASTVisitor visitor) => visitor.visitImportDirective(this);
 
   /**
-   * Return the token representing the 'as' token, or `null` if the imported names are not
-   * prefixed.
-   *
-   * @return the token representing the 'as' token
-   */
-  Token get asToken => _asToken;
-
-  /**
    * Return the prefix to be used with the imported names, or `null` if the imported names are
    * not prefixed.
    *
@@ -8071,23 +6572,14 @@
    */
   SimpleIdentifier get prefix => _prefix;
   LibraryElement get uriElement {
-    Element element = this.element;
-    if (element is ImportElement) {
-      return ((element as ImportElement)).importedLibrary;
+    Element element2 = element;
+    if (element2 is ImportElement) {
+      return ((element2 as ImportElement)).importedLibrary;
     }
     return null;
   }
 
   /**
-   * Set the token representing the 'as' token to the given token.
-   *
-   * @param asToken the token representing the 'as' token
-   */
-  void set asToken(Token asToken2) {
-    this._asToken = asToken2;
-  }
-
-  /**
    * Set the prefix to be used with the imported names to the given identifier.
    *
    * @param prefix the prefix to be used with the imported names
@@ -8123,7 +6615,7 @@
    * The period ("..") before a cascaded index expression, or `null` if this index expression
    * is not part of a cascade expression.
    */
-  Token _period;
+  Token period;
 
   /**
    * The left square bracket.
@@ -8159,7 +6651,7 @@
    * be set to hold onto the static and propagated information. The auxiliary element will hold onto
    * the elements from the getter context.
    */
-  AuxiliaryElements _auxiliaryElements = null;
+  AuxiliaryElements auxiliaryElements = null;
 
   /**
    * Initialize a newly created index expression.
@@ -8195,7 +6687,7 @@
    * @param rightBracket the right square bracket
    */
   IndexExpression.forCascade_full(Token period, Token leftBracket, Expression index, Token rightBracket) {
-    this._period = period;
+    this.period = period;
     this._leftBracket = leftBracket;
     this._index = becomeParentOf(index);
     this._rightBracket = rightBracket;
@@ -8211,17 +6703,11 @@
    */
   IndexExpression.forCascade({Token period, Token leftBracket, Expression index, Token rightBracket}) : this.forCascade_full(period, leftBracket, index, rightBracket);
   accept(ASTVisitor visitor) => visitor.visitIndexExpression(this);
-
-  /**
-   * Get the auxiliary elements, this will be `null` if the node is not in a getter and setter
-   * context, or if it is not yet fully resolved.
-   */
-  AuxiliaryElements get auxiliaryElements => _auxiliaryElements;
   Token get beginToken {
     if (_target != null) {
       return _target.beginToken;
     }
-    return _period;
+    return period;
   }
 
   /**
@@ -8256,14 +6742,6 @@
   Token get leftBracket => _leftBracket;
 
   /**
-   * Return the period ("..") before a cascaded index expression, or `null` if this index
-   * expression is not part of a cascade expression.
-   *
-   * @return the period ("..") before a cascaded index expression
-   */
-  Token get period => _period;
-
-  /**
    * Return the element associated with the operator based on the propagated type of the target, or
    * `null` if the AST structure has not been resolved or if the operator could not be
    * resolved. One example of the latter case is an operator that is not defined for the type of the
@@ -8372,14 +6850,7 @@
    *
    * @return `true` if this expression is cascaded
    */
-  bool get isCascaded => _period != null;
-
-  /**
-   * Set the auxiliary elements.
-   */
-  void set auxiliaryElements(AuxiliaryElements auxiliaryElements2) {
-    this._auxiliaryElements = auxiliaryElements2;
-  }
+  bool get isCascaded => period != null;
 
   /**
    * Set the expression used to compute the index to the given expression.
@@ -8400,15 +6871,6 @@
   }
 
   /**
-   * Set the period ("..") before a cascaded index expression to the given token.
-   *
-   * @param period the period ("..") before a cascaded index expression
-   */
-  void set period(Token period2) {
-    this._period = period2;
-  }
-
-  /**
    * Set the element associated with the operator based on the propagated type of the target to the
    * given element.
    *
@@ -8508,12 +6970,12 @@
   /**
    * The keyword used to indicate how an object should be created.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The name of the constructor to be invoked.
    */
-  ConstructorName _constructorName;
+  ConstructorName constructorName;
 
   /**
    * The list of arguments to the constructor.
@@ -8524,14 +6986,14 @@
    * The element associated with the constructor based on static type information, or `null`
    * if the AST structure has not been resolved or if the constructor could not be resolved.
    */
-  ConstructorElement _staticElement;
+  ConstructorElement staticElement;
 
   /**
    * The element associated with the constructor based on propagated type information, or
    * `null` if the AST structure has not been resolved or if the constructor could not be
    * resolved.
    */
-  ConstructorElement _propagatedElement;
+  ConstructorElement element;
 
   /**
    * Initialize a newly created instance creation expression.
@@ -8541,8 +7003,8 @@
    * @param argumentList the list of arguments to the constructor
    */
   InstanceCreationExpression.full(Token keyword, ConstructorName constructorName, ArgumentList argumentList) {
-    this._keyword = keyword;
-    this._constructorName = becomeParentOf(constructorName);
+    this.keyword = keyword;
+    this.constructorName = becomeParentOf(constructorName);
     this._argumentList = becomeParentOf(argumentList);
   }
 
@@ -8562,47 +7024,15 @@
    * @return the list of arguments to the constructor
    */
   ArgumentList get argumentList => _argumentList;
-  Token get beginToken => _keyword;
-
-  /**
-   * Return the name of the constructor to be invoked.
-   *
-   * @return the name of the constructor to be invoked
-   */
-  ConstructorName get constructorName => _constructorName;
-
-  /**
-   * Return the element associated with the constructor based on propagated type information, or
-   * `null` if the AST structure has not been resolved or if the constructor could not be
-   * resolved.
-   *
-   * @return the element associated with the constructor
-   */
-  ConstructorElement get element => _propagatedElement;
+  Token get beginToken => keyword;
   Token get endToken => _argumentList.endToken;
 
   /**
-   * Return the keyword used to indicate how an object should be created.
-   *
-   * @return the keyword used to indicate how an object should be created
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Return the element associated with the constructor based on static type information, or
-   * `null` if the AST structure has not been resolved or if the constructor could not be
-   * resolved.
-   *
-   * @return the element associated with the constructor
-   */
-  ConstructorElement get staticElement => _staticElement;
-
-  /**
    * Return `true` if this creation expression is used to invoke a constant constructor.
    *
    * @return `true` if this creation expression is used to invoke a constant constructor
    */
-  bool get isConst => _keyword is KeywordToken && identical(((_keyword as KeywordToken)).keyword, Keyword.CONST);
+  bool get isConst => keyword is KeywordToken && identical(((keyword as KeywordToken)).keyword, Keyword.CONST);
 
   /**
    * Set the list of arguments to the constructor to the given list.
@@ -8612,46 +7042,8 @@
   void set argumentList(ArgumentList argumentList2) {
     this._argumentList = becomeParentOf(argumentList2);
   }
-
-  /**
-   * Set the name of the constructor to be invoked to the given name.
-   *
-   * @param constructorName the name of the constructor to be invoked
-   */
-  void set constructorName(ConstructorName constructorName2) {
-    this._constructorName = constructorName2;
-  }
-
-  /**
-   * Set the element associated with the constructor based on propagated type information to the
-   * given element.
-   *
-   * @param element the element to be associated with the constructor
-   */
-  void set element(ConstructorElement element2) {
-    this._propagatedElement = element2;
-  }
-
-  /**
-   * Set the keyword used to indicate how an object should be created to the given keyword.
-   *
-   * @param keyword the keyword used to indicate how an object should be created
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
-
-  /**
-   * Set the element associated with the constructor based on static type information to the given
-   * element.
-   *
-   * @param element the element to be associated with the constructor
-   */
-  void set staticElement(ConstructorElement element) {
-    this._staticElement = element;
-  }
   void visitChildren(ASTVisitor visitor) {
-    safelyVisitChild(_constructorName, visitor);
+    safelyVisitChild(constructorName, visitor);
     safelyVisitChild(_argumentList, visitor);
   }
 }
@@ -8678,12 +7070,12 @@
   /**
    * The token representing the literal.
    */
-  Token _literal;
+  Token literal;
 
   /**
    * The value of the literal.
    */
-  int _value = 0;
+  int value = 0;
 
   /**
    * Initialize a newly created integer literal.
@@ -8692,8 +7084,8 @@
    * @param value the value of the literal
    */
   IntegerLiteral.full(Token literal, int value) {
-    this._literal = literal;
-    this._value = value;
+    this.literal = literal;
+    this.value = value;
   }
 
   /**
@@ -8704,40 +7096,8 @@
    */
   IntegerLiteral({Token literal, int value}) : this.full(literal, value);
   accept(ASTVisitor visitor) => visitor.visitIntegerLiteral(this);
-  Token get beginToken => _literal;
-  Token get endToken => _literal;
-
-  /**
-   * Return the token representing the literal.
-   *
-   * @return the token representing the literal
-   */
-  Token get literal => _literal;
-
-  /**
-   * Return the value of the literal.
-   *
-   * @return the value of the literal
-   */
-  int get value => _value;
-
-  /**
-   * Set the token representing the literal to the given token.
-   *
-   * @param literal the token representing the literal
-   */
-  void set literal(Token literal2) {
-    this._literal = literal2;
-  }
-
-  /**
-   * Set the value of the literal to the given value.
-   *
-   * @param value the value of the literal
-   */
-  void set value(int value2) {
-    this._value = value2;
-  }
+  Token get beginToken => literal;
+  Token get endToken => literal;
   void visitChildren(ASTVisitor visitor) {
   }
 }
@@ -8773,7 +7133,7 @@
    * The token used to introduce the interpolation expression; either '$' if the expression is a
    * simple identifier or '${' if the expression is a full expression.
    */
-  Token _leftBracket;
+  Token leftBracket;
 
   /**
    * The expression to be evaluated for the value to be converted into a string.
@@ -8783,7 +7143,7 @@
   /**
    * The right curly bracket, or `null` if the expression is an identifier without brackets.
    */
-  Token _rightBracket;
+  Token rightBracket;
 
   /**
    * Initialize a newly created interpolation expression.
@@ -8793,9 +7153,9 @@
    * @param rightBracket the right curly bracket
    */
   InterpolationExpression.full(Token leftBracket, Expression expression, Token rightBracket) {
-    this._leftBracket = leftBracket;
+    this.leftBracket = leftBracket;
     this._expression = becomeParentOf(expression);
-    this._rightBracket = rightBracket;
+    this.rightBracket = rightBracket;
   }
 
   /**
@@ -8807,10 +7167,10 @@
    */
   InterpolationExpression({Token leftBracket, Expression expression, Token rightBracket}) : this.full(leftBracket, expression, rightBracket);
   accept(ASTVisitor visitor) => visitor.visitInterpolationExpression(this);
-  Token get beginToken => _leftBracket;
+  Token get beginToken => leftBracket;
   Token get endToken {
-    if (_rightBracket != null) {
-      return _rightBracket;
+    if (rightBracket != null) {
+      return rightBracket;
     }
     return _expression.endToken;
   }
@@ -8823,20 +7183,6 @@
   Expression get expression => _expression;
 
   /**
-   * Return the left curly bracket.
-   *
-   * @return the left curly bracket
-   */
-  Token get leftBracket => _leftBracket;
-
-  /**
-   * Return the right curly bracket.
-   *
-   * @return the right curly bracket
-   */
-  Token get rightBracket => _rightBracket;
-
-  /**
    * Set the expression to be evaluated for the value to be converted into a string to the given
    * expression.
    *
@@ -8845,24 +7191,6 @@
   void set expression(Expression expression2) {
     this._expression = becomeParentOf(expression2);
   }
-
-  /**
-   * Set the left curly bracket to the given token.
-   *
-   * @param leftBracket the left curly bracket
-   */
-  void set leftBracket(Token leftBracket2) {
-    this._leftBracket = leftBracket2;
-  }
-
-  /**
-   * Set the right curly bracket to the given token.
-   *
-   * @param rightBracket the right curly bracket
-   */
-  void set rightBracket(Token rightBracket2) {
-    this._rightBracket = rightBracket2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_expression, visitor);
   }
@@ -8966,12 +7294,12 @@
   /**
    * The is operator.
    */
-  Token _isOperator;
+  Token isOperator;
 
   /**
    * The not operator, or `null` if the sense of the test is not negated.
    */
-  Token _notOperator;
+  Token notOperator;
 
   /**
    * The name of the type being tested for.
@@ -8988,8 +7316,8 @@
    */
   IsExpression.full(Expression expression, Token isOperator, Token notOperator, TypeName type) {
     this._expression = becomeParentOf(expression);
-    this._isOperator = isOperator;
-    this._notOperator = notOperator;
+    this.isOperator = isOperator;
+    this.notOperator = notOperator;
     this._type = becomeParentOf(type);
   }
 
@@ -9014,20 +7342,6 @@
   Expression get expression => _expression;
 
   /**
-   * Return the is operator being applied.
-   *
-   * @return the is operator being applied
-   */
-  Token get isOperator => _isOperator;
-
-  /**
-   * Return the not operator being applied.
-   *
-   * @return the not operator being applied
-   */
-  Token get notOperator => _notOperator;
-
-  /**
    * Return the name of the type being tested for.
    *
    * @return the name of the type being tested for
@@ -9045,24 +7359,6 @@
   }
 
   /**
-   * Set the is operator being applied to the given operator.
-   *
-   * @param isOperator the is operator being applied
-   */
-  void set isOperator(Token isOperator2) {
-    this._isOperator = isOperator2;
-  }
-
-  /**
-   * Set the not operator being applied to the given operator.
-   *
-   * @param notOperator the is operator being applied
-   */
-  void set notOperator(Token notOperator2) {
-    this._notOperator = notOperator2;
-  }
-
-  /**
    * Set the name of the type being tested for to the given name.
    *
    * @param name the name of the type being tested for
@@ -9095,7 +7391,7 @@
   /**
    * The colon that separates the label from the statement.
    */
-  Token _colon;
+  Token colon;
 
   /**
    * Initialize a newly created label.
@@ -9105,7 +7401,7 @@
    */
   Label.full(SimpleIdentifier label, Token colon) {
     this._label = becomeParentOf(label);
-    this._colon = colon;
+    this.colon = colon;
   }
 
   /**
@@ -9117,14 +7413,7 @@
   Label({SimpleIdentifier label, Token colon}) : this.full(label, colon);
   accept(ASTVisitor visitor) => visitor.visitLabel(this);
   Token get beginToken => _label.beginToken;
-
-  /**
-   * Return the colon that separates the label from the statement.
-   *
-   * @return the colon that separates the label from the statement
-   */
-  Token get colon => _colon;
-  Token get endToken => _colon;
+  Token get endToken => colon;
 
   /**
    * Return the label being associated with the statement.
@@ -9134,15 +7423,6 @@
   SimpleIdentifier get label => _label;
 
   /**
-   * Set the colon that separates the label from the statement to the given token.
-   *
-   * @param colon the colon that separates the label from the statement
-   */
-  void set colon(Token colon2) {
-    this._colon = colon2;
-  }
-
-  /**
    * Set the label being associated with the statement to the given label.
    *
    * @param label the label being associated with the statement
@@ -9170,7 +7450,7 @@
   /**
    * The labels being associated with the statement.
    */
-  NodeList<Label> _labels;
+  NodeList<Label> labels;
 
   /**
    * The statement with which the labels are being associated.
@@ -9184,8 +7464,8 @@
    * @param statement the statement with which the labels are being associated
    */
   LabeledStatement.full(List<Label> labels, Statement statement) {
-    this._labels = new NodeList<Label>(this);
-    this._labels.addAll(labels);
+    this.labels = new NodeList<Label>(this);
+    this.labels.addAll(labels);
     this._statement = becomeParentOf(statement);
   }
 
@@ -9198,21 +7478,14 @@
   LabeledStatement({List<Label> labels, Statement statement}) : this.full(labels, statement);
   accept(ASTVisitor visitor) => visitor.visitLabeledStatement(this);
   Token get beginToken {
-    if (!_labels.isEmpty) {
-      return _labels.beginToken;
+    if (!labels.isEmpty) {
+      return labels.beginToken;
     }
     return _statement.beginToken;
   }
   Token get endToken => _statement.endToken;
 
   /**
-   * Return the labels being associated with the statement.
-   *
-   * @return the labels being associated with the statement
-   */
-  NodeList<Label> get labels => _labels;
-
-  /**
    * Return the statement with which the labels are being associated.
    *
    * @return the statement with which the labels are being associated
@@ -9228,7 +7501,7 @@
     this._statement = becomeParentOf(statement2);
   }
   void visitChildren(ASTVisitor visitor) {
-    _labels.accept(visitor);
+    labels.accept(visitor);
     safelyVisitChild(_statement, visitor);
   }
 }
@@ -9247,7 +7520,7 @@
   /**
    * The token representing the 'library' token.
    */
-  Token _libraryToken;
+  Token libraryToken;
 
   /**
    * The name of the library being defined.
@@ -9257,7 +7530,7 @@
   /**
    * The semicolon terminating the directive.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created library directive.
@@ -9269,9 +7542,9 @@
    * @param semicolon the semicolon terminating the directive
    */
   LibraryDirective.full(Comment comment, List<Annotation> metadata, Token libraryToken, LibraryIdentifier name, Token semicolon) : super.full(comment, metadata) {
-    this._libraryToken = libraryToken;
+    this.libraryToken = libraryToken;
     this._name = becomeParentOf(name);
-    this._semicolon = semicolon;
+    this.semicolon = semicolon;
   }
 
   /**
@@ -9285,15 +7558,8 @@
    */
   LibraryDirective({Comment comment, List<Annotation> metadata, Token libraryToken, LibraryIdentifier name, Token semicolon}) : this.full(comment, metadata, libraryToken, name, semicolon);
   accept(ASTVisitor visitor) => visitor.visitLibraryDirective(this);
-  Token get endToken => _semicolon;
-  Token get keyword => _libraryToken;
-
-  /**
-   * Return the token representing the 'library' token.
-   *
-   * @return the token representing the 'library' token
-   */
-  Token get libraryToken => _libraryToken;
+  Token get endToken => semicolon;
+  Token get keyword => libraryToken;
 
   /**
    * Return the name of the library being defined.
@@ -9303,22 +7569,6 @@
   LibraryIdentifier get name => _name;
 
   /**
-   * Return the semicolon terminating the directive.
-   *
-   * @return the semicolon terminating the directive
-   */
-  Token get semicolon => _semicolon;
-
-  /**
-   * Set the token representing the 'library' token to the given token.
-   *
-   * @param libraryToken the token representing the 'library' token
-   */
-  void set libraryToken(Token libraryToken2) {
-    this._libraryToken = libraryToken2;
-  }
-
-  /**
    * Set the name of the library being defined to the given name.
    *
    * @param name the name of the library being defined
@@ -9326,20 +7576,11 @@
   void set name(LibraryIdentifier name2) {
     this._name = becomeParentOf(name2);
   }
-
-  /**
-   * Set the semicolon terminating the directive to the given token.
-   *
-   * @param semicolon the semicolon terminating the directive
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
   void visitChildren(ASTVisitor visitor) {
     super.visitChildren(visitor);
     safelyVisitChild(_name, visitor);
   }
-  Token get firstTokenAfterCommentAndMetadata => _libraryToken;
+  Token get firstTokenAfterCommentAndMetadata => libraryToken;
 }
 /**
  * Instances of the class `LibraryIdentifier` represent the identifier for a library.
@@ -9356,7 +7597,7 @@
   /**
    * The components of the identifier.
    */
-  NodeList<SimpleIdentifier> _components;
+  NodeList<SimpleIdentifier> components;
 
   /**
    * Initialize a newly created prefixed identifier.
@@ -9364,8 +7605,8 @@
    * @param components the components of the identifier
    */
   LibraryIdentifier.full(List<SimpleIdentifier> components) {
-    this._components = new NodeList<SimpleIdentifier>(this);
-    this._components.addAll(components);
+    this.components = new NodeList<SimpleIdentifier>(this);
+    this.components.addAll(components);
   }
 
   /**
@@ -9375,20 +7616,13 @@
    */
   LibraryIdentifier({List<SimpleIdentifier> components}) : this.full(components);
   accept(ASTVisitor visitor) => visitor.visitLibraryIdentifier(this);
-  Token get beginToken => _components.beginToken;
+  Token get beginToken => components.beginToken;
   Element get bestElement => staticElement;
-
-  /**
-   * Return the components of the identifier.
-   *
-   * @return the components of the identifier
-   */
-  NodeList<SimpleIdentifier> get components => _components;
-  Token get endToken => _components.endToken;
+  Token get endToken => components.endToken;
   String get name {
     JavaStringBuilder builder = new JavaStringBuilder();
     bool needsPeriod = false;
-    for (SimpleIdentifier identifier in _components) {
+    for (SimpleIdentifier identifier in components) {
       if (needsPeriod) {
         builder.append(".");
       } else {
@@ -9401,7 +7635,7 @@
   Element get propagatedElement => null;
   Element get staticElement => null;
   void visitChildren(ASTVisitor visitor) {
-    _components.accept(visitor);
+    components.accept(visitor);
   }
 }
 /**
@@ -9424,7 +7658,7 @@
   /**
    * The expressions used to compute the elements of the list.
    */
-  NodeList<Expression> _elements;
+  NodeList<Expression> elements;
 
   /**
    * The right square bracket.
@@ -9442,9 +7676,9 @@
    * @param rightBracket the right square bracket
    */
   ListLiteral.full(Token constKeyword, TypeArgumentList typeArguments, Token leftBracket, List<Expression> elements, Token rightBracket) : super.full(constKeyword, typeArguments) {
-    this._elements = new NodeList<Expression>(this);
+    this.elements = new NodeList<Expression>(this);
     this._leftBracket = leftBracket;
-    this._elements.addAll(elements);
+    this.elements.addAll(elements);
     this._rightBracket = rightBracket;
   }
 
@@ -9465,19 +7699,12 @@
     if (token != null) {
       return token;
     }
-    TypeArgumentList typeArguments = this.typeArguments;
-    if (typeArguments != null) {
-      return typeArguments.beginToken;
+    TypeArgumentList typeArguments2 = typeArguments;
+    if (typeArguments2 != null) {
+      return typeArguments2.beginToken;
     }
     return _leftBracket;
   }
-
-  /**
-   * Return the expressions used to compute the elements of the list.
-   *
-   * @return the expressions used to compute the elements of the list
-   */
-  NodeList<Expression> get elements => _elements;
   Token get endToken => _rightBracket;
 
   /**
@@ -9513,7 +7740,7 @@
   }
   void visitChildren(ASTVisitor visitor) {
     super.visitChildren(visitor);
-    _elements.accept(visitor);
+    elements.accept(visitor);
   }
 }
 /**
@@ -9555,7 +7782,7 @@
   /**
    * The entries in the map.
    */
-  NodeList<MapLiteralEntry> _entries;
+  NodeList<MapLiteralEntry> entries;
 
   /**
    * The right curly bracket.
@@ -9573,9 +7800,9 @@
    * @param rightBracket the right curly bracket
    */
   MapLiteral.full(Token constKeyword, TypeArgumentList typeArguments, Token leftBracket, List<MapLiteralEntry> entries, Token rightBracket) : super.full(constKeyword, typeArguments) {
-    this._entries = new NodeList<MapLiteralEntry>(this);
+    this.entries = new NodeList<MapLiteralEntry>(this);
     this._leftBracket = leftBracket;
-    this._entries.addAll(entries);
+    this.entries.addAll(entries);
     this._rightBracket = rightBracket;
   }
 
@@ -9596,22 +7823,15 @@
     if (token != null) {
       return token;
     }
-    TypeArgumentList typeArguments = this.typeArguments;
-    if (typeArguments != null) {
-      return typeArguments.beginToken;
+    TypeArgumentList typeArguments2 = typeArguments;
+    if (typeArguments2 != null) {
+      return typeArguments2.beginToken;
     }
     return _leftBracket;
   }
   Token get endToken => _rightBracket;
 
   /**
-   * Return the entries in the map.
-   *
-   * @return the entries in the map
-   */
-  NodeList<MapLiteralEntry> get entries => _entries;
-
-  /**
    * Return the left curly bracket.
    *
    * @return the left curly bracket
@@ -9644,7 +7864,7 @@
   }
   void visitChildren(ASTVisitor visitor) {
     super.visitChildren(visitor);
-    _entries.accept(visitor);
+    entries.accept(visitor);
   }
 }
 /**
@@ -9668,7 +7888,7 @@
   /**
    * The colon that separates the key from the value.
    */
-  Token _separator;
+  Token separator;
 
   /**
    * The expression computing the value that will be associated with the key.
@@ -9684,7 +7904,7 @@
    */
   MapLiteralEntry.full(Expression key, Token separator, Expression value) {
     this._key = becomeParentOf(key);
-    this._separator = separator;
+    this.separator = separator;
     this._value = becomeParentOf(value);
   }
 
@@ -9708,13 +7928,6 @@
   Expression get key => _key;
 
   /**
-   * Return the colon that separates the key from the value.
-   *
-   * @return the colon that separates the key from the value
-   */
-  Token get separator => _separator;
-
-  /**
    * Return the expression computing the value that will be associated with the key.
    *
    * @return the expression computing the value that will be associated with the key
@@ -9732,15 +7945,6 @@
   }
 
   /**
-   * Set the colon that separates the key from the value to the given token.
-   *
-   * @param separator the colon that separates the key from the value
-   */
-  void set separator(Token separator2) {
-    this._separator = separator2;
-  }
-
-  /**
    * Set the expression computing the value that will be associated with the key to the given
    * expression.
    *
@@ -9777,13 +7981,13 @@
   /**
    * The token for the 'external' keyword, or `null` if the constructor is not external.
    */
-  Token _externalKeyword;
+  Token externalKeyword;
 
   /**
    * The token representing the 'abstract' or 'static' keyword, or `null` if neither modifier
    * was specified.
    */
-  Token _modifierKeyword;
+  Token modifierKeyword;
 
   /**
    * The return type of the method, or `null` if no return type was declared.
@@ -9794,13 +7998,13 @@
    * The token representing the 'get' or 'set' keyword, or `null` if this is a method
    * declaration rather than a property declaration.
    */
-  Token _propertyKeyword;
+  Token propertyKeyword;
 
   /**
    * The token representing the 'operator' keyword, or `null` if this method does not declare
    * an operator.
    */
-  Token _operatorKeyword;
+  Token operatorKeyword;
 
   /**
    * The name of the method.
@@ -9833,11 +8037,11 @@
    * @param body the body of the method
    */
   MethodDeclaration.full(Comment comment, List<Annotation> metadata, Token externalKeyword, Token modifierKeyword, TypeName returnType, Token propertyKeyword, Token operatorKeyword, SimpleIdentifier name, FormalParameterList parameters, FunctionBody body) : super.full(comment, metadata) {
-    this._externalKeyword = externalKeyword;
-    this._modifierKeyword = modifierKeyword;
+    this.externalKeyword = externalKeyword;
+    this.modifierKeyword = modifierKeyword;
     this._returnType = becomeParentOf(returnType);
-    this._propertyKeyword = propertyKeyword;
-    this._operatorKeyword = operatorKeyword;
+    this.propertyKeyword = propertyKeyword;
+    this.operatorKeyword = operatorKeyword;
     this._name = becomeParentOf(name);
     this._parameters = becomeParentOf(parameters);
     this._body = becomeParentOf(body);
@@ -9880,22 +8084,6 @@
   Token get endToken => _body.endToken;
 
   /**
-   * Return the token for the 'external' keyword, or `null` if the constructor is not
-   * external.
-   *
-   * @return the token for the 'external' keyword
-   */
-  Token get externalKeyword => _externalKeyword;
-
-  /**
-   * Return the token representing the 'abstract' or 'static' keyword, or `null` if neither
-   * modifier was specified.
-   *
-   * @return the token representing the 'abstract' or 'static' keyword
-   */
-  Token get modifierKeyword => _modifierKeyword;
-
-  /**
    * Return the name of the method.
    *
    * @return the name of the method
@@ -9903,14 +8091,6 @@
   SimpleIdentifier get name => _name;
 
   /**
-   * Return the token representing the 'operator' keyword, or `null` if this method does not
-   * declare an operator.
-   *
-   * @return the token representing the 'operator' keyword
-   */
-  Token get operatorKeyword => _operatorKeyword;
-
-  /**
    * Return the parameters associated with the method, or `null` if this method declares a
    * getter.
    *
@@ -9919,14 +8099,6 @@
   FormalParameterList get parameters => _parameters;
 
   /**
-   * Return the token representing the 'get' or 'set' keyword, or `null` if this is a method
-   * declaration rather than a property declaration.
-   *
-   * @return the token representing the 'get' or 'set' keyword
-   */
-  Token get propertyKeyword => _propertyKeyword;
-
-  /**
    * Return the return type of the method, or `null` if no return type was declared.
    *
    * @return the return type of the method
@@ -9938,35 +8110,35 @@
    *
    * @return `true` if this method is declared to be an abstract method
    */
-  bool get isAbstract => _externalKeyword == null && (_body is EmptyFunctionBody);
+  bool get isAbstract => externalKeyword == null && (_body is EmptyFunctionBody);
 
   /**
    * Return `true` if this method declares a getter.
    *
    * @return `true` if this method declares a getter
    */
-  bool get isGetter => _propertyKeyword != null && identical(((_propertyKeyword as KeywordToken)).keyword, Keyword.GET);
+  bool get isGetter => propertyKeyword != null && identical(((propertyKeyword as KeywordToken)).keyword, Keyword.GET);
 
   /**
    * Return `true` if this method declares an operator.
    *
    * @return `true` if this method declares an operator
    */
-  bool get isOperator => _operatorKeyword != null;
+  bool get isOperator => operatorKeyword != null;
 
   /**
    * Return `true` if this method declares a setter.
    *
    * @return `true` if this method declares a setter
    */
-  bool get isSetter => _propertyKeyword != null && identical(((_propertyKeyword as KeywordToken)).keyword, Keyword.SET);
+  bool get isSetter => propertyKeyword != null && identical(((propertyKeyword as KeywordToken)).keyword, Keyword.SET);
 
   /**
    * Return `true` if this method is declared to be a static method.
    *
    * @return `true` if this method is declared to be a static method
    */
-  bool get isStatic => _modifierKeyword != null && identical(((_modifierKeyword as KeywordToken)).keyword, Keyword.STATIC);
+  bool get isStatic => modifierKeyword != null && identical(((modifierKeyword as KeywordToken)).keyword, Keyword.STATIC);
 
   /**
    * Set the body of the method to the given function body.
@@ -9978,24 +8150,6 @@
   }
 
   /**
-   * Set the token for the 'external' keyword to the given token.
-   *
-   * @param externalKeyword the token for the 'external' keyword
-   */
-  void set externalKeyword(Token externalKeyword2) {
-    this._externalKeyword = externalKeyword2;
-  }
-
-  /**
-   * Set the token representing the 'abstract' or 'static' keyword to the given token.
-   *
-   * @param modifierKeyword the token representing the 'abstract' or 'static' keyword
-   */
-  void set modifierKeyword(Token modifierKeyword2) {
-    this._modifierKeyword = modifierKeyword2;
-  }
-
-  /**
    * Set the name of the method to the given identifier.
    *
    * @param identifier the name of the method
@@ -10005,15 +8159,6 @@
   }
 
   /**
-   * Set the token representing the 'operator' keyword to the given token.
-   *
-   * @param operatorKeyword the token representing the 'operator' keyword
-   */
-  void set operatorKeyword(Token operatorKeyword2) {
-    this._operatorKeyword = operatorKeyword2;
-  }
-
-  /**
    * Set the parameters associated with the method to the given list of parameters.
    *
    * @param parameters the parameters associated with the method
@@ -10023,15 +8168,6 @@
   }
 
   /**
-   * Set the token representing the 'get' or 'set' keyword to the given token.
-   *
-   * @param propertyKeyword the token representing the 'get' or 'set' keyword
-   */
-  void set propertyKeyword(Token propertyKeyword2) {
-    this._propertyKeyword = propertyKeyword2;
-  }
-
-  /**
    * Set the return type of the method to the given type name.
    *
    * @param typeName the return type of the method
@@ -10047,14 +8183,14 @@
     safelyVisitChild(_body, visitor);
   }
   Token get firstTokenAfterCommentAndMetadata {
-    if (_modifierKeyword != null) {
-      return _modifierKeyword;
+    if (modifierKeyword != null) {
+      return modifierKeyword;
     } else if (_returnType != null) {
       return _returnType.beginToken;
-    } else if (_propertyKeyword != null) {
-      return _propertyKeyword;
-    } else if (_operatorKeyword != null) {
-      return _operatorKeyword;
+    } else if (propertyKeyword != null) {
+      return propertyKeyword;
+    } else if (operatorKeyword != null) {
+      return operatorKeyword;
     }
     return _name.beginToken;
   }
@@ -10085,7 +8221,7 @@
    * The period that separates the target from the method name, or `null` if there is no
    * target.
    */
-  Token _period;
+  Token period;
 
   /**
    * The name of the method being invoked.
@@ -10107,7 +8243,7 @@
    */
   MethodInvocation.full(Expression target, Token period, SimpleIdentifier methodName, ArgumentList argumentList) {
     this._target = becomeParentOf(target);
-    this._period = period;
+    this.period = period;
     this._methodName = becomeParentOf(methodName);
     this._argumentList = becomeParentOf(argumentList);
   }
@@ -10132,8 +8268,8 @@
   Token get beginToken {
     if (_target != null) {
       return _target.beginToken;
-    } else if (_period != null) {
-      return _period;
+    } else if (period != null) {
+      return period;
     }
     return _methodName.beginToken;
   }
@@ -10147,14 +8283,6 @@
   SimpleIdentifier get methodName => _methodName;
 
   /**
-   * Return the period that separates the target from the method name, or `null` if there is
-   * no target.
-   *
-   * @return the period that separates the target from the method name
-   */
-  Token get period => _period;
-
-  /**
    * Return the expression used to compute the receiver of the invocation. If this invocation is not
    * part of a cascade expression, then this is the same as [getTarget]. If this invocation
    * is part of a cascade expression, then the target stored with the cascade expression is
@@ -10194,7 +8322,7 @@
    *
    * @return `true` if this expression is cascaded
    */
-  bool get isCascaded => _period != null && identical(_period.type, TokenType.PERIOD_PERIOD);
+  bool get isCascaded => period != null && identical(period.type, TokenType.PERIOD_PERIOD);
 
   /**
    * Set the list of arguments to the method to the given list.
@@ -10215,15 +8343,6 @@
   }
 
   /**
-   * Set the period that separates the target from the method name to the given token.
-   *
-   * @param period the period that separates the target from the method name
-   */
-  void set period(Token period2) {
-    this._period = period2;
-  }
-
-  /**
    * Set the expression producing the object on which the method is defined to the given expression.
    *
    * @param expression the expression producing the object on which the method is defined
@@ -10355,12 +8474,12 @@
   /**
    * The combinators used to control which names are imported or exported.
    */
-  NodeList<Combinator> _combinators;
+  NodeList<Combinator> combinators;
 
   /**
    * The semicolon terminating the directive.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created namespace directive.
@@ -10373,10 +8492,10 @@
    * @param semicolon the semicolon terminating the directive
    */
   NamespaceDirective.full(Comment comment, List<Annotation> metadata, Token keyword, StringLiteral libraryUri, List<Combinator> combinators, Token semicolon) : super.full(comment, metadata, libraryUri) {
-    this._combinators = new NodeList<Combinator>(this);
+    this.combinators = new NodeList<Combinator>(this);
     this._keyword = keyword;
-    this._combinators.addAll(combinators);
-    this._semicolon = semicolon;
+    this.combinators.addAll(combinators);
+    this.semicolon = semicolon;
   }
 
   /**
@@ -10390,22 +8509,8 @@
    * @param semicolon the semicolon terminating the directive
    */
   NamespaceDirective({Comment comment, List<Annotation> metadata, Token keyword, StringLiteral libraryUri, List<Combinator> combinators, Token semicolon}) : this.full(comment, metadata, keyword, libraryUri, combinators, semicolon);
-
-  /**
-   * Return the combinators used to control how names are imported or exported.
-   *
-   * @return the combinators used to control how names are imported or exported
-   */
-  NodeList<Combinator> get combinators => _combinators;
-  Token get endToken => _semicolon;
+  Token get endToken => semicolon;
   Token get keyword => _keyword;
-
-  /**
-   * Return the semicolon terminating the directive.
-   *
-   * @return the semicolon terminating the directive
-   */
-  Token get semicolon => _semicolon;
   LibraryElement get uriElement;
 
   /**
@@ -10416,15 +8521,6 @@
   void set keyword(Token exportToken) {
     this._keyword = exportToken;
   }
-
-  /**
-   * Set the semicolon terminating the directive to the given token.
-   *
-   * @param semicolon the semicolon terminating the directive
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
   Token get firstTokenAfterCommentAndMetadata => _keyword;
 }
 /**
@@ -10443,12 +8539,12 @@
   /**
    * The token representing the 'native' keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The name of the native object that implements the class.
    */
-  StringLiteral _name;
+  StringLiteral name;
 
   /**
    * Initialize a newly created native clause.
@@ -10457,8 +8553,8 @@
    * @param name the name of the native object that implements the class.
    */
   NativeClause.full(Token keyword, StringLiteral name) {
-    this._keyword = keyword;
-    this._name = name;
+    this.keyword = keyword;
+    this.name = name;
   }
 
   /**
@@ -10469,42 +8565,10 @@
    */
   NativeClause({Token keyword, StringLiteral name}) : this.full(keyword, name);
   accept(ASTVisitor visitor) => visitor.visitNativeClause(this);
-  Token get beginToken => _keyword;
-  Token get endToken => _name.endToken;
-
-  /**
-   * Return the token representing the 'native' keyword.
-   *
-   * @return the token representing the 'native' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Return the name of the native object that implements the class.
-   *
-   * @return the name of the native object that implements the class
-   */
-  StringLiteral get name => _name;
-
-  /**
-   * Set the token representing the 'native' keyword to the given token.
-   *
-   * @param keyword the token representing the 'native' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
-
-  /**
-   * Sets the name of the native object that implements the class.
-   *
-   * @param name the name of the native object that implements the class.
-   */
-  void set name(StringLiteral name2) {
-    this._name = name2;
-  }
+  Token get beginToken => keyword;
+  Token get endToken => name.endToken;
   void visitChildren(ASTVisitor visitor) {
-    safelyVisitChild(_name, visitor);
+    safelyVisitChild(name, visitor);
   }
 }
 /**
@@ -10523,17 +8587,17 @@
   /**
    * The token representing 'native' that marks the start of the function body.
    */
-  Token _nativeToken;
+  Token nativeToken;
 
   /**
    * The string literal, after the 'native' token.
    */
-  StringLiteral _stringLiteral;
+  StringLiteral stringLiteral;
 
   /**
    * The token representing the semicolon that marks the end of the function body.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created function body consisting of the 'native' token, a string literal,
@@ -10544,9 +8608,9 @@
    * @param semicolon the token representing the semicolon that marks the end of the function body
    */
   NativeFunctionBody.full(Token nativeToken, StringLiteral stringLiteral, Token semicolon) {
-    this._nativeToken = nativeToken;
-    this._stringLiteral = becomeParentOf(stringLiteral);
-    this._semicolon = semicolon;
+    this.nativeToken = nativeToken;
+    this.stringLiteral = becomeParentOf(stringLiteral);
+    this.semicolon = semicolon;
   }
 
   /**
@@ -10559,31 +8623,10 @@
    */
   NativeFunctionBody({Token nativeToken, StringLiteral stringLiteral, Token semicolon}) : this.full(nativeToken, stringLiteral, semicolon);
   accept(ASTVisitor visitor) => visitor.visitNativeFunctionBody(this);
-  Token get beginToken => _nativeToken;
-  Token get endToken => _semicolon;
-
-  /**
-   * Return the simple identifier representing the 'native' token.
-   *
-   * @return the simple identifier representing the 'native' token
-   */
-  Token get nativeToken => _nativeToken;
-
-  /**
-   * Return the token representing the semicolon that marks the end of the function body.
-   *
-   * @return the token representing the semicolon that marks the end of the function body
-   */
-  Token get semicolon => _semicolon;
-
-  /**
-   * Return the string literal representing the string after the 'native' token.
-   *
-   * @return the string literal representing the string after the 'native' token
-   */
-  StringLiteral get stringLiteral => _stringLiteral;
+  Token get beginToken => nativeToken;
+  Token get endToken => semicolon;
   void visitChildren(ASTVisitor visitor) {
-    safelyVisitChild(_stringLiteral, visitor);
+    safelyVisitChild(stringLiteral, visitor);
   }
 }
 /**
@@ -10610,7 +8653,7 @@
   /**
    * The annotations associated with this parameter.
    */
-  NodeList<Annotation> _metadata;
+  NodeList<Annotation> metadata;
 
   /**
    * The name of the parameter being declared.
@@ -10625,9 +8668,9 @@
    * @param identifier the name of the parameter being declared
    */
   NormalFormalParameter.full(Comment comment, List<Annotation> metadata, SimpleIdentifier identifier) {
-    this._metadata = new NodeList<Annotation>(this);
+    this.metadata = new NodeList<Annotation>(this);
     this._comment = becomeParentOf(comment);
-    this._metadata.addAll(metadata);
+    this.metadata.addAll(metadata);
     this._identifier = becomeParentOf(identifier);
   }
 
@@ -10657,13 +8700,6 @@
   }
 
   /**
-   * Return the annotations associated with this parameter.
-   *
-   * @return the annotations associated with this parameter
-   */
-  NodeList<Annotation> get metadata => _metadata;
-
-  /**
    * Set the documentation comment associated with this parameter to the given comment
    *
    * @param comment the documentation comment to be associated with this parameter
@@ -10683,7 +8719,7 @@
   void visitChildren(ASTVisitor visitor) {
     if (commentIsBeforeAnnotations()) {
       safelyVisitChild(_comment, visitor);
-      _metadata.accept(visitor);
+      metadata.accept(visitor);
     } else {
       for (ASTNode child in sortedCommentAndAnnotations) {
         child.accept(visitor);
@@ -10697,10 +8733,10 @@
    * @return `true` if the comment is lexically before any annotations
    */
   bool commentIsBeforeAnnotations() {
-    if (_comment == null || _metadata.isEmpty) {
+    if (_comment == null || metadata.isEmpty) {
       return true;
     }
-    Annotation firstAnnotation = _metadata[0];
+    Annotation firstAnnotation = metadata[0];
     return _comment.offset < firstAnnotation.offset;
   }
 
@@ -10714,7 +8750,7 @@
   List<ASTNode> get sortedCommentAndAnnotations {
     List<ASTNode> childList = new List<ASTNode>();
     childList.add(_comment);
-    childList.addAll(_metadata);
+    childList.addAll(metadata);
     List<ASTNode> children = new List.from(childList);
     children.sort(ASTNode.LEXICAL_ORDER);
     return children;
@@ -10735,7 +8771,7 @@
   /**
    * The token representing the literal.
    */
-  Token _literal;
+  Token literal;
 
   /**
    * Initialize a newly created null literal.
@@ -10743,7 +8779,7 @@
    * @param token the token representing the literal
    */
   NullLiteral.full(Token token) {
-    this._literal = token;
+    this.literal = token;
   }
 
   /**
@@ -10753,24 +8789,8 @@
    */
   NullLiteral({Token token}) : this.full(token);
   accept(ASTVisitor visitor) => visitor.visitNullLiteral(this);
-  Token get beginToken => _literal;
-  Token get endToken => _literal;
-
-  /**
-   * Return the token representing the literal.
-   *
-   * @return the token representing the literal
-   */
-  Token get literal => _literal;
-
-  /**
-   * Set the token representing the literal to the given token.
-   *
-   * @param literal the token representing the literal
-   */
-  void set literal(Token literal2) {
-    this._literal = literal2;
-  }
+  Token get beginToken => literal;
+  Token get endToken => literal;
   void visitChildren(ASTVisitor visitor) {
   }
 }
@@ -10892,12 +8912,12 @@
   /**
    * The token representing the 'part' token.
    */
-  Token _partToken;
+  Token partToken;
 
   /**
    * The semicolon terminating the directive.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created part directive.
@@ -10909,8 +8929,8 @@
    * @param semicolon the semicolon terminating the directive
    */
   PartDirective.full(Comment comment, List<Annotation> metadata, Token partToken, StringLiteral partUri, Token semicolon) : super.full(comment, metadata, partUri) {
-    this._partToken = partToken;
-    this._semicolon = semicolon;
+    this.partToken = partToken;
+    this.semicolon = semicolon;
   }
 
   /**
@@ -10924,42 +8944,10 @@
    */
   PartDirective({Comment comment, List<Annotation> metadata, Token partToken, StringLiteral partUri, Token semicolon}) : this.full(comment, metadata, partToken, partUri, semicolon);
   accept(ASTVisitor visitor) => visitor.visitPartDirective(this);
-  Token get endToken => _semicolon;
-  Token get keyword => _partToken;
-
-  /**
-   * Return the token representing the 'part' token.
-   *
-   * @return the token representing the 'part' token
-   */
-  Token get partToken => _partToken;
-
-  /**
-   * Return the semicolon terminating the directive.
-   *
-   * @return the semicolon terminating the directive
-   */
-  Token get semicolon => _semicolon;
+  Token get endToken => semicolon;
+  Token get keyword => partToken;
   CompilationUnitElement get uriElement => element as CompilationUnitElement;
-
-  /**
-   * Set the token representing the 'part' token to the given token.
-   *
-   * @param partToken the token representing the 'part' token
-   */
-  void set partToken(Token partToken2) {
-    this._partToken = partToken2;
-  }
-
-  /**
-   * Set the semicolon terminating the directive to the given token.
-   *
-   * @param semicolon the semicolon terminating the directive
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
-  Token get firstTokenAfterCommentAndMetadata => _partToken;
+  Token get firstTokenAfterCommentAndMetadata => partToken;
 }
 /**
  * Instances of the class `PartOfDirective` represent a part-of directive.
@@ -10976,12 +8964,12 @@
   /**
    * The token representing the 'part' token.
    */
-  Token _partToken;
+  Token partToken;
 
   /**
    * The token representing the 'of' token.
    */
-  Token _ofToken;
+  Token ofToken;
 
   /**
    * The name of the library that the containing compilation unit is part of.
@@ -10991,7 +8979,7 @@
   /**
    * The semicolon terminating the directive.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created part-of directive.
@@ -11004,10 +8992,10 @@
    * @param semicolon the semicolon terminating the directive
    */
   PartOfDirective.full(Comment comment, List<Annotation> metadata, Token partToken, Token ofToken, LibraryIdentifier libraryName, Token semicolon) : super.full(comment, metadata) {
-    this._partToken = partToken;
-    this._ofToken = ofToken;
+    this.partToken = partToken;
+    this.ofToken = ofToken;
     this._libraryName = becomeParentOf(libraryName);
-    this._semicolon = semicolon;
+    this.semicolon = semicolon;
   }
 
   /**
@@ -11022,8 +9010,8 @@
    */
   PartOfDirective({Comment comment, List<Annotation> metadata, Token partToken, Token ofToken, LibraryIdentifier libraryName, Token semicolon}) : this.full(comment, metadata, partToken, ofToken, libraryName, semicolon);
   accept(ASTVisitor visitor) => visitor.visitPartOfDirective(this);
-  Token get endToken => _semicolon;
-  Token get keyword => _partToken;
+  Token get endToken => semicolon;
+  Token get keyword => partToken;
 
   /**
    * Return the name of the library that the containing compilation unit is part of.
@@ -11033,27 +9021,6 @@
   LibraryIdentifier get libraryName => _libraryName;
 
   /**
-   * Return the token representing the 'of' token.
-   *
-   * @return the token representing the 'of' token
-   */
-  Token get ofToken => _ofToken;
-
-  /**
-   * Return the token representing the 'part' token.
-   *
-   * @return the token representing the 'part' token
-   */
-  Token get partToken => _partToken;
-
-  /**
-   * Return the semicolon terminating the directive.
-   *
-   * @return the semicolon terminating the directive
-   */
-  Token get semicolon => _semicolon;
-
-  /**
    * Set the name of the library that the containing compilation unit is part of to the given name.
    *
    * @param libraryName the name of the library that the containing compilation unit is part of
@@ -11061,38 +9028,11 @@
   void set libraryName(LibraryIdentifier libraryName2) {
     this._libraryName = becomeParentOf(libraryName2);
   }
-
-  /**
-   * Set the token representing the 'of' token to the given token.
-   *
-   * @param ofToken the token representing the 'of' token
-   */
-  void set ofToken(Token ofToken2) {
-    this._ofToken = ofToken2;
-  }
-
-  /**
-   * Set the token representing the 'part' token to the given token.
-   *
-   * @param partToken the token representing the 'part' token
-   */
-  void set partToken(Token partToken2) {
-    this._partToken = partToken2;
-  }
-
-  /**
-   * Set the semicolon terminating the directive to the given token.
-   *
-   * @param semicolon the semicolon terminating the directive
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
   void visitChildren(ASTVisitor visitor) {
     super.visitChildren(visitor);
     safelyVisitChild(_libraryName, visitor);
   }
-  Token get firstTokenAfterCommentAndMetadata => _partToken;
+  Token get firstTokenAfterCommentAndMetadata => partToken;
 }
 /**
  * Instances of the class `PostfixExpression` represent a postfix unary expression.
@@ -11114,7 +9054,7 @@
   /**
    * The postfix operator being applied to the operand.
    */
-  Token _operator;
+  Token operator;
 
   /**
    * The element associated with this the operator based on the propagated type of the operand, or
@@ -11138,7 +9078,7 @@
    */
   PostfixExpression.full(Expression operand, Token operator) {
     this._operand = becomeParentOf(operand);
-    this._operator = operator;
+    this.operator = operator;
   }
 
   /**
@@ -11166,7 +9106,7 @@
     }
     return element;
   }
-  Token get endToken => _operator;
+  Token get endToken => operator;
 
   /**
    * Return the expression computing the operand for the operator.
@@ -11176,13 +9116,6 @@
   Expression get operand => _operand;
 
   /**
-   * Return the postfix operator being applied to the operand.
-   *
-   * @return the postfix operator being applied to the operand
-   */
-  Token get operator => _operator;
-
-  /**
    * Return the element associated with the operator based on the propagated type of the operand, or
    * `null` if the AST structure has not been resolved, if the operator is not user definable,
    * or if the operator could not be resolved. One example of the latter case is an operator that is
@@ -11212,15 +9145,6 @@
   }
 
   /**
-   * Set the postfix operator being applied to the operand to the given operator.
-   *
-   * @param operator the postfix operator being applied to the operand
-   */
-  void set operator(Token operator2) {
-    this._operator = operator2;
-  }
-
-  /**
    * Set the element associated with the operator based on the propagated type of the operand to the
    * given element.
    *
@@ -11300,7 +9224,7 @@
   /**
    * The prefix operator being applied to the operand.
    */
-  Token _operator;
+  Token operator;
 
   /**
    * The expression computing the operand for the operator.
@@ -11328,7 +9252,7 @@
    * @param operand the expression computing the operand for the operator
    */
   PrefixExpression.full(Token operator, Expression operand) {
-    this._operator = operator;
+    this.operator = operator;
     this._operand = becomeParentOf(operand);
   }
 
@@ -11340,7 +9264,7 @@
    */
   PrefixExpression({Token operator, Expression operand}) : this.full(operator, operand);
   accept(ASTVisitor visitor) => visitor.visitPrefixExpression(this);
-  Token get beginToken => _operator;
+  Token get beginToken => operator;
 
   /**
    * Return the best element available for this operator. If resolution was able to find a better
@@ -11367,13 +9291,6 @@
   Expression get operand => _operand;
 
   /**
-   * Return the prefix operator being applied to the operand.
-   *
-   * @return the prefix operator being applied to the operand
-   */
-  Token get operator => _operator;
-
-  /**
    * Return the element associated with the operator based on the propagated type of the operand, or
    * `null` if the AST structure has not been resolved, if the operator is not user definable,
    * or if the operator could not be resolved. One example of the latter case is an operator that is
@@ -11403,15 +9320,6 @@
   }
 
   /**
-   * Set the prefix operator being applied to the operand to the given operator.
-   *
-   * @param operator the prefix operator being applied to the operand
-   */
-  void set operator(Token operator2) {
-    this._operator = operator2;
-  }
-
-  /**
    * Set the element associated with the operator based on the propagated type of the operand to the
    * given element.
    *
@@ -11498,7 +9406,7 @@
   /**
    * The period used to separate the prefix from the identifier.
    */
-  Token _period;
+  Token period;
 
   /**
    * The identifier being prefixed.
@@ -11514,7 +9422,7 @@
    */
   PrefixedIdentifier.full(SimpleIdentifier prefix, Token period, SimpleIdentifier identifier) {
     this._prefix = becomeParentOf(prefix);
-    this._period = period;
+    this.period = period;
     this._identifier = becomeParentOf(identifier);
   }
 
@@ -11545,13 +9453,6 @@
   String get name => "${_prefix.name}.${_identifier.name}";
 
   /**
-   * Return the period used to separate the prefix from the identifier.
-   *
-   * @return the period used to separate the prefix from the identifier
-   */
-  Token get period => _period;
-
-  /**
    * Return the prefix associated with the library in which the identifier is defined.
    *
    * @return the prefix associated with the library in which the identifier is defined
@@ -11580,15 +9481,6 @@
   }
 
   /**
-   * Set the period used to separate the prefix from the identifier to the given token.
-   *
-   * @param period the period used to separate the prefix from the identifier
-   */
-  void set period(Token period2) {
-    this._period = period2;
-  }
-
-  /**
    * Set the prefix associated with the library in which the identifier is defined to the given
    * identifier.
    *
@@ -11626,7 +9518,7 @@
   /**
    * The property access operator.
    */
-  Token _operator;
+  Token operator;
 
   /**
    * The name of the property being accessed.
@@ -11642,7 +9534,7 @@
    */
   PropertyAccess.full(Expression target, Token operator, SimpleIdentifier propertyName) {
     this._target = becomeParentOf(target);
-    this._operator = operator;
+    this.operator = operator;
     this._propertyName = becomeParentOf(propertyName);
   }
 
@@ -11659,18 +9551,11 @@
     if (_target != null) {
       return _target.beginToken;
     }
-    return _operator;
+    return operator;
   }
   Token get endToken => _propertyName.endToken;
 
   /**
-   * Return the property access operator.
-   *
-   * @return the property access operator
-   */
-  Token get operator => _operator;
-
-  /**
    * Return the name of the property being accessed.
    *
    * @return the name of the property being accessed
@@ -11717,16 +9602,7 @@
    *
    * @return `true` if this expression is cascaded
    */
-  bool get isCascaded => _operator != null && identical(_operator.type, TokenType.PERIOD_PERIOD);
-
-  /**
-   * Set the property access operator to the given token.
-   *
-   * @param operator the property access operator
-   */
-  void set operator(Token operator2) {
-    this._operator = operator2;
-  }
+  bool get isCascaded => operator != null && identical(operator.type, TokenType.PERIOD_PERIOD);
 
   /**
    * Set the name of the property being accessed to the given identifier.
@@ -11767,13 +9643,13 @@
   /**
    * The token for the 'this' keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The token for the period before the name of the constructor that is being invoked, or
    * `null` if the unnamed constructor is being invoked.
    */
-  Token _period;
+  Token period;
 
   /**
    * The name of the constructor that is being invoked, or `null` if the unnamed constructor
@@ -11790,7 +9666,7 @@
    * The element associated with the constructor based on static type information, or `null`
    * if the AST structure has not been resolved or if the constructor could not be resolved.
    */
-  ConstructorElement _staticElement;
+  ConstructorElement staticElement;
 
   /**
    * The element associated with the constructor based on propagated type information, or
@@ -11809,8 +9685,8 @@
    * @param argumentList the list of arguments to the constructor
    */
   RedirectingConstructorInvocation.full(Token keyword, Token period, SimpleIdentifier constructorName, ArgumentList argumentList) {
-    this._keyword = keyword;
-    this._period = period;
+    this.keyword = keyword;
+    this.period = period;
     this._constructorName = becomeParentOf(constructorName);
     this._argumentList = becomeParentOf(argumentList);
   }
@@ -11833,7 +9709,7 @@
    * @return the list of arguments to the constructor
    */
   ArgumentList get argumentList => _argumentList;
-  Token get beginToken => _keyword;
+  Token get beginToken => keyword;
 
   /**
    * Return the name of the constructor that is being invoked, or `null` if the unnamed
@@ -11854,30 +9730,6 @@
   Token get endToken => _argumentList.endToken;
 
   /**
-   * Return the token for the 'this' keyword.
-   *
-   * @return the token for the 'this' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Return the token for the period before the name of the constructor that is being invoked, or
-   * `null` if the unnamed constructor is being invoked.
-   *
-   * @return the token for the period before the name of the constructor that is being invoked
-   */
-  Token get period => _period;
-
-  /**
-   * Return the element associated with the constructor based on static type information, or
-   * `null` if the AST structure has not been resolved or if the constructor could not be
-   * resolved.
-   *
-   * @return the element associated with the constructor
-   */
-  ConstructorElement get staticElement => _staticElement;
-
-  /**
    * Set the list of arguments to the constructor to the given list.
    *
    * @param argumentList the list of arguments to the constructor
@@ -11904,35 +9756,6 @@
   void set element(ConstructorElement element2) {
     _propagatedElement = element2;
   }
-
-  /**
-   * Set the token for the 'this' keyword to the given token.
-   *
-   * @param keyword the token for the 'this' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
-
-  /**
-   * Set the token for the period before the name of the constructor that is being invoked to the
-   * given token.
-   *
-   * @param period the token for the period before the name of the constructor that is being invoked
-   */
-  void set period(Token period2) {
-    this._period = period2;
-  }
-
-  /**
-   * Set the element associated with the constructor based on static type information to the given
-   * element.
-   *
-   * @param element the element to be associated with the constructor
-   */
-  void set staticElement(ConstructorElement element) {
-    this._staticElement = element;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_constructorName, visitor);
     safelyVisitChild(_argumentList, visitor);
@@ -11953,7 +9776,7 @@
   /**
    * The token representing the 'rethrow' keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * Initialize a newly created rethrow expression.
@@ -11961,7 +9784,7 @@
    * @param keyword the token representing the 'rethrow' keyword
    */
   RethrowExpression.full(Token keyword) {
-    this._keyword = keyword;
+    this.keyword = keyword;
   }
 
   /**
@@ -11971,24 +9794,8 @@
    */
   RethrowExpression({Token keyword}) : this.full(keyword);
   accept(ASTVisitor visitor) => visitor.visitRethrowExpression(this);
-  Token get beginToken => _keyword;
-  Token get endToken => _keyword;
-
-  /**
-   * Return the token representing the 'rethrow' keyword.
-   *
-   * @return the token representing the 'rethrow' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Set the token representing the 'rethrow' keyword to the given token.
-   *
-   * @param keyword the token representing the 'rethrow' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
+  Token get beginToken => keyword;
+  Token get endToken => keyword;
   void visitChildren(ASTVisitor visitor) {
   }
 }
@@ -12007,7 +9814,7 @@
   /**
    * The token representing the 'return' keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The expression computing the value to be returned, or `null` if no explicit value was
@@ -12018,7 +9825,7 @@
   /**
    * The semicolon terminating the statement.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created return statement.
@@ -12028,9 +9835,9 @@
    * @param semicolon the semicolon terminating the statement
    */
   ReturnStatement.full(Token keyword, Expression expression, Token semicolon) {
-    this._keyword = keyword;
+    this.keyword = keyword;
     this._expression = becomeParentOf(expression);
-    this._semicolon = semicolon;
+    this.semicolon = semicolon;
   }
 
   /**
@@ -12042,8 +9849,8 @@
    */
   ReturnStatement({Token keyword, Expression expression, Token semicolon}) : this.full(keyword, expression, semicolon);
   accept(ASTVisitor visitor) => visitor.visitReturnStatement(this);
-  Token get beginToken => _keyword;
-  Token get endToken => _semicolon;
+  Token get beginToken => keyword;
+  Token get endToken => semicolon;
 
   /**
    * Return the expression computing the value to be returned, or `null` if no explicit value
@@ -12054,20 +9861,6 @@
   Expression get expression => _expression;
 
   /**
-   * Return the token representing the 'return' keyword.
-   *
-   * @return the token representing the 'return' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Return the semicolon terminating the statement.
-   *
-   * @return the semicolon terminating the statement
-   */
-  Token get semicolon => _semicolon;
-
-  /**
    * Set the expression computing the value to be returned to the given expression.
    *
    * @param expression the expression computing the value to be returned
@@ -12075,24 +9868,6 @@
   void set expression(Expression expression2) {
     this._expression = becomeParentOf(expression2);
   }
-
-  /**
-   * Set the token representing the 'return' keyword to the given token.
-   *
-   * @param keyword the token representing the 'return' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
-
-  /**
-   * Set the semicolon terminating the statement to the given token.
-   *
-   * @param semicolon the semicolon terminating the statement
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_expression, visitor);
   }
@@ -12113,7 +9888,7 @@
   /**
    * The token representing this script tag.
    */
-  Token _scriptTag;
+  Token scriptTag;
 
   /**
    * Initialize a newly created script tag.
@@ -12121,7 +9896,7 @@
    * @param scriptTag the token representing this script tag
    */
   ScriptTag.full(Token scriptTag) {
-    this._scriptTag = scriptTag;
+    this.scriptTag = scriptTag;
   }
 
   /**
@@ -12131,24 +9906,8 @@
    */
   ScriptTag({Token scriptTag}) : this.full(scriptTag);
   accept(ASTVisitor visitor) => visitor.visitScriptTag(this);
-  Token get beginToken => _scriptTag;
-  Token get endToken => _scriptTag;
-
-  /**
-   * Return the token representing this script tag.
-   *
-   * @return the token representing this script tag
-   */
-  Token get scriptTag => _scriptTag;
-
-  /**
-   * Set the token representing this script tag to the given script tag.
-   *
-   * @param scriptTag the token representing this script tag
-   */
-  void set scriptTag(Token scriptTag2) {
-    this._scriptTag = scriptTag2;
-  }
+  Token get beginToken => scriptTag;
+  Token get endToken => scriptTag;
   void visitChildren(ASTVisitor visitor) {
   }
 }
@@ -12168,7 +9927,7 @@
   /**
    * The list of names from the library that are made visible by this combinator.
    */
-  NodeList<SimpleIdentifier> _shownNames;
+  NodeList<SimpleIdentifier> shownNames;
 
   /**
    * Initialize a newly created import show combinator.
@@ -12177,8 +9936,8 @@
    * @param shownNames the list of names from the library that are made visible by this combinator
    */
   ShowCombinator.full(Token keyword, List<SimpleIdentifier> shownNames) : super.full(keyword) {
-    this._shownNames = new NodeList<SimpleIdentifier>(this);
-    this._shownNames.addAll(shownNames);
+    this.shownNames = new NodeList<SimpleIdentifier>(this);
+    this.shownNames.addAll(shownNames);
   }
 
   /**
@@ -12189,16 +9948,9 @@
    */
   ShowCombinator({Token keyword, List<SimpleIdentifier> shownNames}) : this.full(keyword, shownNames);
   accept(ASTVisitor visitor) => visitor.visitShowCombinator(this);
-  Token get endToken => _shownNames.endToken;
-
-  /**
-   * Return the list of names from the library that are made visible by this combinator.
-   *
-   * @return the list of names from the library that are made visible by this combinator
-   */
-  NodeList<SimpleIdentifier> get shownNames => _shownNames;
+  Token get endToken => shownNames.endToken;
   void visitChildren(ASTVisitor visitor) {
-    _shownNames.accept(visitor);
+    shownNames.accept(visitor);
   }
 }
 /**
@@ -12217,7 +9969,7 @@
    * The token representing either the 'final', 'const' or 'var' keyword, or `null` if no
    * keyword was used.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The name of the declared type of the parameter, or `null` if the parameter does not have
@@ -12235,7 +9987,7 @@
    * @param identifier the name of the parameter being declared
    */
   SimpleFormalParameter.full(Comment comment, List<Annotation> metadata, Token keyword, TypeName type, SimpleIdentifier identifier) : super.full(comment, metadata, identifier) {
-    this._keyword = keyword;
+    this.keyword = keyword;
     this._type = becomeParentOf(type);
   }
 
@@ -12251,8 +10003,8 @@
   SimpleFormalParameter({Comment comment, List<Annotation> metadata, Token keyword, TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata, keyword, type, identifier);
   accept(ASTVisitor visitor) => visitor.visitSimpleFormalParameter(this);
   Token get beginToken {
-    if (_keyword != null) {
-      return _keyword;
+    if (keyword != null) {
+      return keyword;
     } else if (_type != null) {
       return _type.beginToken;
     }
@@ -12261,30 +10013,14 @@
   Token get endToken => identifier.endToken;
 
   /**
-   * Return the token representing either the 'final', 'const' or 'var' keyword.
-   *
-   * @return the token representing either the 'final', 'const' or 'var' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
    * Return the name of the declared type of the parameter, or `null` if the parameter does
    * not have a declared type.
    *
    * @return the name of the declared type of the parameter
    */
   TypeName get type => _type;
-  bool get isConst => (_keyword is KeywordToken) && identical(((_keyword as KeywordToken)).keyword, Keyword.CONST);
-  bool get isFinal => (_keyword is KeywordToken) && identical(((_keyword as KeywordToken)).keyword, Keyword.FINAL);
-
-  /**
-   * Set the token representing either the 'final', 'const' or 'var' keyword to the given token.
-   *
-   * @param keyword the token representing either the 'final', 'const' or 'var' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
+  bool get isConst => (keyword is KeywordToken) && identical(((keyword as KeywordToken)).keyword, Keyword.CONST);
+  bool get isFinal => (keyword is KeywordToken) && identical(((keyword as KeywordToken)).keyword, Keyword.FINAL);
 
   /**
    * Set the name of the declared type of the parameter to the given type name.
@@ -12319,7 +10055,7 @@
   /**
    * The token representing the identifier.
    */
-  Token _token;
+  Token token;
 
   /**
    * The element associated with this identifier based on static type information, or `null`
@@ -12339,7 +10075,7 @@
    * be set to hold onto the static and propagated information. The auxiliary element will hold onto
    * the elements from the getter context.
    */
-  AuxiliaryElements _auxiliaryElements = null;
+  AuxiliaryElements auxiliaryElements = null;
 
   /**
    * Initialize a newly created identifier.
@@ -12347,7 +10083,7 @@
    * @param token the token representing the identifier
    */
   SimpleIdentifier.full(Token token) {
-    this._token = token;
+    this.token = token;
   }
 
   /**
@@ -12357,32 +10093,19 @@
    */
   SimpleIdentifier({Token token}) : this.full(token);
   accept(ASTVisitor visitor) => visitor.visitSimpleIdentifier(this);
-
-  /**
-   * Get the auxiliary elements, this will be `null` if the node is not in a getter and setter
-   * context, or if it is not yet fully resolved.
-   */
-  AuxiliaryElements get auxiliaryElements => _auxiliaryElements;
-  Token get beginToken => _token;
+  Token get beginToken => token;
   Element get bestElement {
     if (_propagatedElement == null) {
       return _staticElement;
     }
     return _propagatedElement;
   }
-  Token get endToken => _token;
-  String get name => _token.lexeme;
+  Token get endToken => token;
+  String get name => token.lexeme;
   Element get propagatedElement => _propagatedElement;
   Element get staticElement => _staticElement;
 
   /**
-   * Return the token representing the identifier.
-   *
-   * @return the token representing the identifier
-   */
-  Token get token => _token;
-
-  /**
    * Return `true` if this identifier is the name being declared in a declaration.
    *
    * @return `true` if this identifier is the name being declared in a declaration
@@ -12493,14 +10216,7 @@
     }
     return false;
   }
-  bool get isSynthetic => _token.isSynthetic;
-
-  /**
-   * Set the auxiliary elements.
-   */
-  void set auxiliaryElements(AuxiliaryElements auxiliaryElements2) {
-    this._auxiliaryElements = auxiliaryElements2;
-  }
+  bool get isSynthetic => token.isSynthetic;
 
   /**
    * Set the element associated with this identifier based on propagated type information to the
@@ -12521,15 +10237,6 @@
   void set staticElement(Element element) {
     _staticElement = validateElement2(element);
   }
-
-  /**
-   * Set the token representing the identifier to the given token.
-   *
-   * @param token the token representing the literal
-   */
-  void set token(Token token2) {
-    this._token = token2;
-  }
   void visitChildren(ASTVisitor visitor) {
   }
 
@@ -12614,7 +10321,7 @@
   /**
    * The token representing the literal.
    */
-  Token _literal;
+  Token literal;
 
   /**
    * The value of the literal.
@@ -12628,7 +10335,7 @@
    * @param value the value of the literal
    */
   SimpleStringLiteral.full(Token literal, String value) {
-    this._literal = literal;
+    this.literal = literal;
     this._value = StringUtilities.intern(value);
   }
 
@@ -12640,15 +10347,8 @@
    */
   SimpleStringLiteral({Token literal, String value}) : this.full(literal, value);
   accept(ASTVisitor visitor) => visitor.visitSimpleStringLiteral(this);
-  Token get beginToken => _literal;
-  Token get endToken => _literal;
-
-  /**
-   * Return the token representing the literal.
-   *
-   * @return the token representing the literal
-   */
-  Token get literal => _literal;
+  Token get beginToken => literal;
+  Token get endToken => literal;
 
   /**
    * Return the value of the literal.
@@ -12675,16 +10375,7 @@
    * @return `true` if this string literal is a raw string
    */
   bool get isRaw => _value.codeUnitAt(0) == 0x40;
-  bool get isSynthetic => _literal.isSynthetic;
-
-  /**
-   * Set the token representing the literal to the given token.
-   *
-   * @param literal the token representing the literal
-   */
-  void set literal(Token literal2) {
-    this._literal = literal2;
-  }
+  bool get isSynthetic => literal.isSynthetic;
 
   /**
    * Set the value of the literal to the given string.
@@ -12742,7 +10433,7 @@
   /**
    * The elements that will be composed to produce the resulting string.
    */
-  NodeList<InterpolationElement> _elements;
+  NodeList<InterpolationElement> elements;
 
   /**
    * Initialize a newly created string interpolation expression.
@@ -12750,8 +10441,8 @@
    * @param elements the elements that will be composed to produce the resulting string
    */
   StringInterpolation.full(List<InterpolationElement> elements) {
-    this._elements = new NodeList<InterpolationElement>(this);
-    this._elements.addAll(elements);
+    this.elements = new NodeList<InterpolationElement>(this);
+    this.elements.addAll(elements);
   }
 
   /**
@@ -12761,17 +10452,10 @@
    */
   StringInterpolation({List<InterpolationElement> elements}) : this.full(elements);
   accept(ASTVisitor visitor) => visitor.visitStringInterpolation(this);
-  Token get beginToken => _elements.beginToken;
-
-  /**
-   * Return the elements that will be composed to produce the resulting string.
-   *
-   * @return the elements that will be composed to produce the resulting string
-   */
-  NodeList<InterpolationElement> get elements => _elements;
-  Token get endToken => _elements.endToken;
+  Token get beginToken => elements.beginToken;
+  Token get endToken => elements.endToken;
   void visitChildren(ASTVisitor visitor) {
-    _elements.accept(visitor);
+    elements.accept(visitor);
   }
   void appendStringValue(JavaStringBuilder builder) {
     throw new IllegalArgumentException();
@@ -12832,13 +10516,13 @@
   /**
    * The token for the 'super' keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The token for the period before the name of the constructor that is being invoked, or
    * `null` if the unnamed constructor is being invoked.
    */
-  Token _period;
+  Token period;
 
   /**
    * The name of the constructor that is being invoked, or `null` if the unnamed constructor
@@ -12855,7 +10539,7 @@
    * The element associated with the constructor based on static type information, or `null`
    * if the AST structure has not been resolved or if the constructor could not be resolved.
    */
-  ConstructorElement _staticElement;
+  ConstructorElement staticElement;
 
   /**
    * The element associated with the constructor based on propagated type information, or `null` if the AST structure has not been
@@ -12873,8 +10557,8 @@
    * @param argumentList the list of arguments to the constructor
    */
   SuperConstructorInvocation.full(Token keyword, Token period, SimpleIdentifier constructorName, ArgumentList argumentList) {
-    this._keyword = keyword;
-    this._period = period;
+    this.keyword = keyword;
+    this.period = period;
     this._constructorName = becomeParentOf(constructorName);
     this._argumentList = becomeParentOf(argumentList);
   }
@@ -12897,7 +10581,7 @@
    * @return the list of arguments to the constructor
    */
   ArgumentList get argumentList => _argumentList;
-  Token get beginToken => _keyword;
+  Token get beginToken => keyword;
 
   /**
    * Return the name of the constructor that is being invoked, or `null` if the unnamed
@@ -12918,30 +10602,6 @@
   Token get endToken => _argumentList.endToken;
 
   /**
-   * Return the token for the 'super' keyword.
-   *
-   * @return the token for the 'super' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Return the token for the period before the name of the constructor that is being invoked, or
-   * `null` if the unnamed constructor is being invoked.
-   *
-   * @return the token for the period before the name of the constructor that is being invoked
-   */
-  Token get period => _period;
-
-  /**
-   * Return the element associated with the constructor based on static type information, or
-   * `null` if the AST structure has not been resolved or if the constructor could not be
-   * resolved.
-   *
-   * @return the element associated with the constructor
-   */
-  ConstructorElement get staticElement => _staticElement;
-
-  /**
    * Set the list of arguments to the constructor to the given list.
    *
    * @param argumentList the list of arguments to the constructor
@@ -12968,35 +10628,6 @@
   void set element(ConstructorElement element2) {
     _propagatedElement = element2;
   }
-
-  /**
-   * Set the token for the 'super' keyword to the given token.
-   *
-   * @param keyword the token for the 'super' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
-
-  /**
-   * Set the token for the period before the name of the constructor that is being invoked to the
-   * given token.
-   *
-   * @param period the token for the period before the name of the constructor that is being invoked
-   */
-  void set period(Token period2) {
-    this._period = period2;
-  }
-
-  /**
-   * Set the element associated with the constructor based on static type information to the given
-   * element.
-   *
-   * @param element the element to be associated with the constructor
-   */
-  void set staticElement(ConstructorElement element) {
-    this._staticElement = element;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_constructorName, visitor);
     safelyVisitChild(_argumentList, visitor);
@@ -13017,7 +10648,7 @@
   /**
    * The token representing the keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * Initialize a newly created super expression.
@@ -13025,7 +10656,7 @@
    * @param keyword the token representing the keyword
    */
   SuperExpression.full(Token keyword) {
-    this._keyword = keyword;
+    this.keyword = keyword;
   }
 
   /**
@@ -13035,24 +10666,8 @@
    */
   SuperExpression({Token keyword}) : this.full(keyword);
   accept(ASTVisitor visitor) => visitor.visitSuperExpression(this);
-  Token get beginToken => _keyword;
-  Token get endToken => _keyword;
-
-  /**
-   * Return the token representing the keyword.
-   *
-   * @return the token representing the keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Set the token representing the keyword to the given token.
-   *
-   * @param keyword the token representing the keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
+  Token get beginToken => keyword;
+  Token get endToken => keyword;
   void visitChildren(ASTVisitor visitor) {
   }
 }
@@ -13173,22 +10788,22 @@
   /**
    * The labels associated with the switch member.
    */
-  NodeList<Label> _labels;
+  NodeList<Label> labels;
 
   /**
    * The token representing the 'case' or 'default' keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The colon separating the keyword or the expression from the statements.
    */
-  Token _colon;
+  Token colon;
 
   /**
    * The statements that will be executed if this switch member is selected.
    */
-  NodeList<Statement> _statements;
+  NodeList<Statement> statements;
 
   /**
    * Initialize a newly created switch member.
@@ -13199,12 +10814,12 @@
    * @param statements the statements that will be executed if this switch member is selected
    */
   SwitchMember.full(List<Label> labels, Token keyword, Token colon, List<Statement> statements) {
-    this._labels = new NodeList<Label>(this);
-    this._statements = new NodeList<Statement>(this);
-    this._labels.addAll(labels);
-    this._keyword = keyword;
-    this._colon = colon;
-    this._statements.addAll(statements);
+    this.labels = new NodeList<Label>(this);
+    this.statements = new NodeList<Statement>(this);
+    this.labels.addAll(labels);
+    this.keyword = keyword;
+    this.colon = colon;
+    this.statements.addAll(statements);
   }
 
   /**
@@ -13217,62 +10832,16 @@
    */
   SwitchMember({List<Label> labels, Token keyword, Token colon, List<Statement> statements}) : this.full(labels, keyword, colon, statements);
   Token get beginToken {
-    if (!_labels.isEmpty) {
-      return _labels.beginToken;
+    if (!labels.isEmpty) {
+      return labels.beginToken;
     }
-    return _keyword;
+    return keyword;
   }
-
-  /**
-   * Return the colon separating the keyword or the expression from the statements.
-   *
-   * @return the colon separating the keyword or the expression from the statements
-   */
-  Token get colon => _colon;
   Token get endToken {
-    if (!_statements.isEmpty) {
-      return _statements.endToken;
+    if (!statements.isEmpty) {
+      return statements.endToken;
     }
-    return _colon;
-  }
-
-  /**
-   * Return the token representing the 'case' or 'default' keyword.
-   *
-   * @return the token representing the 'case' or 'default' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Return the labels associated with the switch member.
-   *
-   * @return the labels associated with the switch member
-   */
-  NodeList<Label> get labels => _labels;
-
-  /**
-   * Return the statements that will be executed if this switch member is selected.
-   *
-   * @return the statements that will be executed if this switch member is selected
-   */
-  NodeList<Statement> get statements => _statements;
-
-  /**
-   * Set the colon separating the keyword or the expression from the statements to the given token.
-   *
-   * @param colon the colon separating the keyword or the expression from the statements
-   */
-  void set colon(Token colon2) {
-    this._colon = colon2;
-  }
-
-  /**
-   * Set the token representing the 'case' or 'default' keyword to the given token.
-   *
-   * @param keyword the token representing the 'case' or 'default' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
+    return colon;
   }
 }
 /**
@@ -13290,12 +10859,12 @@
   /**
    * The token representing the 'switch' keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The left parenthesis.
    */
-  Token _leftParenthesis;
+  Token leftParenthesis;
 
   /**
    * The expression used to determine which of the switch members will be selected.
@@ -13305,22 +10874,22 @@
   /**
    * The right parenthesis.
    */
-  Token _rightParenthesis;
+  Token rightParenthesis;
 
   /**
    * The left curly bracket.
    */
-  Token _leftBracket;
+  Token leftBracket;
 
   /**
    * The switch members that can be selected by the expression.
    */
-  NodeList<SwitchMember> _members;
+  NodeList<SwitchMember> members;
 
   /**
    * The right curly bracket.
    */
-  Token _rightBracket;
+  Token rightBracket;
 
   /**
    * Initialize a newly created switch statement.
@@ -13334,14 +10903,14 @@
    * @param rightBracket the right curly bracket
    */
   SwitchStatement.full(Token keyword, Token leftParenthesis, Expression expression, Token rightParenthesis, Token leftBracket, List<SwitchMember> members, Token rightBracket) {
-    this._members = new NodeList<SwitchMember>(this);
-    this._keyword = keyword;
-    this._leftParenthesis = leftParenthesis;
+    this.members = new NodeList<SwitchMember>(this);
+    this.keyword = keyword;
+    this.leftParenthesis = leftParenthesis;
     this._expression = becomeParentOf(expression);
-    this._rightParenthesis = rightParenthesis;
-    this._leftBracket = leftBracket;
-    this._members.addAll(members);
-    this._rightBracket = rightBracket;
+    this.rightParenthesis = rightParenthesis;
+    this.leftBracket = leftBracket;
+    this.members.addAll(members);
+    this.rightBracket = rightBracket;
   }
 
   /**
@@ -13357,8 +10926,8 @@
    */
   SwitchStatement({Token keyword, Token leftParenthesis, Expression expression, Token rightParenthesis, Token leftBracket, List<SwitchMember> members, Token rightBracket}) : this.full(keyword, leftParenthesis, expression, rightParenthesis, leftBracket, members, rightBracket);
   accept(ASTVisitor visitor) => visitor.visitSwitchStatement(this);
-  Token get beginToken => _keyword;
-  Token get endToken => _rightBracket;
+  Token get beginToken => keyword;
+  Token get endToken => rightBracket;
 
   /**
    * Return the expression used to determine which of the switch members will be selected.
@@ -13368,48 +10937,6 @@
   Expression get expression => _expression;
 
   /**
-   * Return the token representing the 'switch' keyword.
-   *
-   * @return the token representing the 'switch' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Return the left curly bracket.
-   *
-   * @return the left curly bracket
-   */
-  Token get leftBracket => _leftBracket;
-
-  /**
-   * Return the left parenthesis.
-   *
-   * @return the left parenthesis
-   */
-  Token get leftParenthesis => _leftParenthesis;
-
-  /**
-   * Return the switch members that can be selected by the expression.
-   *
-   * @return the switch members that can be selected by the expression
-   */
-  NodeList<SwitchMember> get members => _members;
-
-  /**
-   * Return the right curly bracket.
-   *
-   * @return the right curly bracket
-   */
-  Token get rightBracket => _rightBracket;
-
-  /**
-   * Return the right parenthesis.
-   *
-   * @return the right parenthesis
-   */
-  Token get rightParenthesis => _rightParenthesis;
-
-  /**
    * Set the expression used to determine which of the switch members will be selected to the given
    * expression.
    *
@@ -13418,54 +10945,9 @@
   void set expression(Expression expression2) {
     this._expression = becomeParentOf(expression2);
   }
-
-  /**
-   * Set the token representing the 'switch' keyword to the given token.
-   *
-   * @param keyword the token representing the 'switch' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
-
-  /**
-   * Set the left curly bracket to the given token.
-   *
-   * @param leftBracket the left curly bracket
-   */
-  void set leftBracket(Token leftBracket2) {
-    this._leftBracket = leftBracket2;
-  }
-
-  /**
-   * Set the left parenthesis to the given token.
-   *
-   * @param leftParenthesis the left parenthesis
-   */
-  void set leftParenthesis(Token leftParenthesis2) {
-    this._leftParenthesis = leftParenthesis2;
-  }
-
-  /**
-   * Set the right curly bracket to the given token.
-   *
-   * @param rightBracket the right curly bracket
-   */
-  void set rightBracket(Token rightBracket2) {
-    this._rightBracket = rightBracket2;
-  }
-
-  /**
-   * Set the right parenthesis to the given token.
-   *
-   * @param rightParenthesis the right parenthesis
-   */
-  void set rightParenthesis(Token rightParenthesis2) {
-    this._rightParenthesis = rightParenthesis2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_expression, visitor);
-    _members.accept(visitor);
+    members.accept(visitor);
   }
 }
 /**
@@ -13483,12 +10965,12 @@
   /**
    * The token introducing the literal.
    */
-  Token _poundSign;
+  Token poundSign;
 
   /**
    * The components of the literal.
    */
-  List<Token> _components;
+  List<Token> components;
 
   /**
    * Initialize a newly created symbol literal.
@@ -13497,8 +10979,8 @@
    * @param components the components of the literal
    */
   SymbolLiteral.full(Token poundSign, List<Token> components) {
-    this._poundSign = poundSign;
-    this._components = components;
+    this.poundSign = poundSign;
+    this.components = components;
   }
 
   /**
@@ -13509,31 +10991,8 @@
    */
   SymbolLiteral({Token poundSign, List<Token> components}) : this.full(poundSign, components);
   accept(ASTVisitor visitor) => visitor.visitSymbolLiteral(this);
-  Token get beginToken => _poundSign;
-
-  /**
-   * Return the components of the literal.
-   *
-   * @return the components of the literal
-   */
-  List<Token> get components => _components;
-  Token get endToken => _components[_components.length - 1];
-
-  /**
-   * Return the token introducing the literal.
-   *
-   * @return the token introducing the literal
-   */
-  Token get poundSign => _poundSign;
-
-  /**
-   * Set the token introducing the literal to the given token.
-   *
-   * @param poundSign the token introducing the literal
-   */
-  void set poundSign(Token poundSign2) {
-    this._poundSign = poundSign2;
-  }
+  Token get beginToken => poundSign;
+  Token get endToken => components[components.length - 1];
   void visitChildren(ASTVisitor visitor) {
   }
 }
@@ -13552,7 +11011,7 @@
   /**
    * The token representing the keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * Initialize a newly created this expression.
@@ -13560,7 +11019,7 @@
    * @param keyword the token representing the keyword
    */
   ThisExpression.full(Token keyword) {
-    this._keyword = keyword;
+    this.keyword = keyword;
   }
 
   /**
@@ -13570,24 +11029,8 @@
    */
   ThisExpression({Token keyword}) : this.full(keyword);
   accept(ASTVisitor visitor) => visitor.visitThisExpression(this);
-  Token get beginToken => _keyword;
-  Token get endToken => _keyword;
-
-  /**
-   * Return the token representing the keyword.
-   *
-   * @return the token representing the keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Set the token representing the keyword to the given token.
-   *
-   * @param keyword the token representing the keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
+  Token get beginToken => keyword;
+  Token get endToken => keyword;
   void visitChildren(ASTVisitor visitor) {
   }
 }
@@ -13606,7 +11049,7 @@
   /**
    * The token representing the 'throw' keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The expression computing the exception to be thrown.
@@ -13620,7 +11063,7 @@
    * @param expression the expression computing the exception to be thrown
    */
   ThrowExpression.full(Token keyword, Expression expression) {
-    this._keyword = keyword;
+    this.keyword = keyword;
     this._expression = becomeParentOf(expression);
   }
 
@@ -13632,12 +11075,12 @@
    */
   ThrowExpression({Token keyword, Expression expression}) : this.full(keyword, expression);
   accept(ASTVisitor visitor) => visitor.visitThrowExpression(this);
-  Token get beginToken => _keyword;
+  Token get beginToken => keyword;
   Token get endToken {
     if (_expression != null) {
       return _expression.endToken;
     }
-    return _keyword;
+    return keyword;
   }
 
   /**
@@ -13648,13 +11091,6 @@
   Expression get expression => _expression;
 
   /**
-   * Return the token representing the 'throw' keyword.
-   *
-   * @return the token representing the 'throw' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
    * Set the expression computing the exception to be thrown to the given expression.
    *
    * @param expression the expression computing the exception to be thrown
@@ -13662,15 +11098,6 @@
   void set expression(Expression expression2) {
     this._expression = becomeParentOf(expression2);
   }
-
-  /**
-   * Set the token representing the 'throw' keyword to the given token.
-   *
-   * @param keyword the token representing the 'throw' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_expression, visitor);
   }
@@ -13697,7 +11124,7 @@
   /**
    * The semicolon terminating the declaration.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created top-level variable declaration.
@@ -13709,7 +11136,7 @@
    */
   TopLevelVariableDeclaration.full(Comment comment, List<Annotation> metadata, VariableDeclarationList variableList, Token semicolon) : super.full(comment, metadata) {
     this._variableList = becomeParentOf(variableList);
-    this._semicolon = semicolon;
+    this.semicolon = semicolon;
   }
 
   /**
@@ -13723,14 +11150,7 @@
   TopLevelVariableDeclaration({Comment comment, List<Annotation> metadata, VariableDeclarationList variableList, Token semicolon}) : this.full(comment, metadata, variableList, semicolon);
   accept(ASTVisitor visitor) => visitor.visitTopLevelVariableDeclaration(this);
   Element get element => null;
-  Token get endToken => _semicolon;
-
-  /**
-   * Return the semicolon terminating the declaration.
-   *
-   * @return the semicolon terminating the declaration
-   */
-  Token get semicolon => _semicolon;
+  Token get endToken => semicolon;
 
   /**
    * Return the top-level variables being declared.
@@ -13740,15 +11160,6 @@
   VariableDeclarationList get variables => _variableList;
 
   /**
-   * Set the semicolon terminating the declaration to the given token.
-   *
-   * @param semicolon the semicolon terminating the declaration
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
-
-  /**
    * Set the top-level variables being declared to the given list of variables.
    *
    * @param variableList the top-level variables being declared
@@ -13780,7 +11191,7 @@
   /**
    * The token representing the 'try' keyword.
    */
-  Token _tryKeyword;
+  Token tryKeyword;
 
   /**
    * The body of the statement.
@@ -13790,13 +11201,13 @@
   /**
    * The catch clauses contained in the try statement.
    */
-  NodeList<CatchClause> _catchClauses;
+  NodeList<CatchClause> catchClauses;
 
   /**
    * The token representing the 'finally' keyword, or `null` if the statement does not contain
    * a finally clause.
    */
-  Token _finallyKeyword;
+  Token finallyKeyword;
 
   /**
    * The finally block contained in the try statement, or `null` if the statement does not
@@ -13814,11 +11225,11 @@
    * @param finallyBlock the finally block contained in the try statement
    */
   TryStatement.full(Token tryKeyword, Block body, List<CatchClause> catchClauses, Token finallyKeyword, Block finallyBlock) {
-    this._catchClauses = new NodeList<CatchClause>(this);
-    this._tryKeyword = tryKeyword;
+    this.catchClauses = new NodeList<CatchClause>(this);
+    this.tryKeyword = tryKeyword;
     this._body = becomeParentOf(body);
-    this._catchClauses.addAll(catchClauses);
-    this._finallyKeyword = finallyKeyword;
+    this.catchClauses.addAll(catchClauses);
+    this.finallyKeyword = finallyKeyword;
     this._finallyBlock = becomeParentOf(finallyBlock);
   }
 
@@ -13833,7 +11244,7 @@
    */
   TryStatement({Token tryKeyword, Block body, List<CatchClause> catchClauses, Token finallyKeyword, Block finallyBlock}) : this.full(tryKeyword, body, catchClauses, finallyKeyword, finallyBlock);
   accept(ASTVisitor visitor) => visitor.visitTryStatement(this);
-  Token get beginToken => _tryKeyword;
+  Token get beginToken => tryKeyword;
 
   /**
    * Return the body of the statement.
@@ -13841,20 +11252,13 @@
    * @return the body of the statement
    */
   Block get body => _body;
-
-  /**
-   * Return the catch clauses contained in the try statement.
-   *
-   * @return the catch clauses contained in the try statement
-   */
-  NodeList<CatchClause> get catchClauses => _catchClauses;
   Token get endToken {
     if (_finallyBlock != null) {
       return _finallyBlock.endToken;
-    } else if (_finallyKeyword != null) {
-      return _finallyKeyword;
-    } else if (!_catchClauses.isEmpty) {
-      return _catchClauses.endToken;
+    } else if (finallyKeyword != null) {
+      return finallyKeyword;
+    } else if (!catchClauses.isEmpty) {
+      return catchClauses.endToken;
     }
     return _body.endToken;
   }
@@ -13868,21 +11272,6 @@
   Block get finallyBlock => _finallyBlock;
 
   /**
-   * Return the token representing the 'finally' keyword, or `null` if the statement does not
-   * contain a finally clause.
-   *
-   * @return the token representing the 'finally' keyword
-   */
-  Token get finallyKeyword => _finallyKeyword;
-
-  /**
-   * Return the token representing the 'try' keyword.
-   *
-   * @return the token representing the 'try' keyword
-   */
-  Token get tryKeyword => _tryKeyword;
-
-  /**
    * Set the body of the statement to the given block.
    *
    * @param block the body of the statement
@@ -13899,27 +11288,9 @@
   void set finallyBlock(Block block) {
     _finallyBlock = becomeParentOf(block);
   }
-
-  /**
-   * Set the token representing the 'finally' keyword to the given token.
-   *
-   * @param finallyKeyword the token representing the 'finally' keyword
-   */
-  void set finallyKeyword(Token finallyKeyword2) {
-    this._finallyKeyword = finallyKeyword2;
-  }
-
-  /**
-   * Set the token representing the 'try' keyword to the given token.
-   *
-   * @param tryKeyword the token representing the 'try' keyword
-   */
-  void set tryKeyword(Token tryKeyword2) {
-    this._tryKeyword = tryKeyword2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_body, visitor);
-    _catchClauses.accept(visitor);
+    catchClauses.accept(visitor);
     safelyVisitChild(_finallyBlock, visitor);
   }
 }
@@ -13942,12 +11313,12 @@
   /**
    * The token representing the 'typedef' keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The semicolon terminating the declaration.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created type alias.
@@ -13958,8 +11329,8 @@
    * @param semicolon the semicolon terminating the declaration
    */
   TypeAlias.full(Comment comment, List<Annotation> metadata, Token keyword, Token semicolon) : super.full(comment, metadata) {
-    this._keyword = keyword;
-    this._semicolon = semicolon;
+    this.keyword = keyword;
+    this.semicolon = semicolon;
   }
 
   /**
@@ -13971,40 +11342,8 @@
    * @param semicolon the semicolon terminating the declaration
    */
   TypeAlias({Comment comment, List<Annotation> metadata, Token keyword, Token semicolon}) : this.full(comment, metadata, keyword, semicolon);
-  Token get endToken => _semicolon;
-
-  /**
-   * Return the token representing the 'typedef' keyword.
-   *
-   * @return the token representing the 'typedef' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Return the semicolon terminating the declaration.
-   *
-   * @return the semicolon terminating the declaration
-   */
-  Token get semicolon => _semicolon;
-
-  /**
-   * Set the token representing the 'typedef' keyword to the given token.
-   *
-   * @param keyword the token representing the 'typedef' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
-
-  /**
-   * Set the semicolon terminating the declaration to the given token.
-   *
-   * @param semicolon the semicolon terminating the declaration
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
-  Token get firstTokenAfterCommentAndMetadata => _keyword;
+  Token get endToken => semicolon;
+  Token get firstTokenAfterCommentAndMetadata => keyword;
 }
 /**
  * Instances of the class `TypeArgumentList` represent a list of type arguments.
@@ -14021,17 +11360,17 @@
   /**
    * The left bracket.
    */
-  Token _leftBracket;
+  Token leftBracket;
 
   /**
    * The type arguments associated with the type.
    */
-  NodeList<TypeName> _arguments;
+  NodeList<TypeName> arguments;
 
   /**
    * The right bracket.
    */
-  Token _rightBracket;
+  Token rightBracket;
 
   /**
    * Initialize a newly created list of type arguments.
@@ -14041,10 +11380,10 @@
    * @param rightBracket the right bracket
    */
   TypeArgumentList.full(Token leftBracket, List<TypeName> arguments, Token rightBracket) {
-    this._arguments = new NodeList<TypeName>(this);
-    this._leftBracket = leftBracket;
-    this._arguments.addAll(arguments);
-    this._rightBracket = rightBracket;
+    this.arguments = new NodeList<TypeName>(this);
+    this.leftBracket = leftBracket;
+    this.arguments.addAll(arguments);
+    this.rightBracket = rightBracket;
   }
 
   /**
@@ -14056,49 +11395,10 @@
    */
   TypeArgumentList({Token leftBracket, List<TypeName> arguments, Token rightBracket}) : this.full(leftBracket, arguments, rightBracket);
   accept(ASTVisitor visitor) => visitor.visitTypeArgumentList(this);
-
-  /**
-   * Return the type arguments associated with the type.
-   *
-   * @return the type arguments associated with the type
-   */
-  NodeList<TypeName> get arguments => _arguments;
-  Token get beginToken => _leftBracket;
-  Token get endToken => _rightBracket;
-
-  /**
-   * Return the left bracket.
-   *
-   * @return the left bracket
-   */
-  Token get leftBracket => _leftBracket;
-
-  /**
-   * Return the right bracket.
-   *
-   * @return the right bracket
-   */
-  Token get rightBracket => _rightBracket;
-
-  /**
-   * Set the left bracket to the given token.
-   *
-   * @param leftBracket the left bracket
-   */
-  void set leftBracket(Token leftBracket2) {
-    this._leftBracket = leftBracket2;
-  }
-
-  /**
-   * Set the right bracket to the given token.
-   *
-   * @param rightBracket the right bracket
-   */
-  void set rightBracket(Token rightBracket2) {
-    this._rightBracket = rightBracket2;
-  }
+  Token get beginToken => leftBracket;
+  Token get endToken => rightBracket;
   void visitChildren(ASTVisitor visitor) {
-    _arguments.accept(visitor);
+    arguments.accept(visitor);
   }
 }
 /**
@@ -14127,7 +11427,7 @@
   /**
    * The type being named, or `null` if the AST structure has not been resolved.
    */
-  Type2 _type;
+  Type2 type;
 
   /**
    * Initialize a newly created type name.
@@ -14166,13 +11466,6 @@
   Identifier get name => _name;
 
   /**
-   * Return the type being named, or `null` if the AST structure has not been resolved.
-   *
-   * @return the type being named
-   */
-  Type2 get type => _type;
-
-  /**
    * Return the type arguments associated with the type, or `null` if there are no type
    * arguments.
    *
@@ -14191,15 +11484,6 @@
   }
 
   /**
-   * Set the type being named to the given type.
-   *
-   * @param type the type being named
-   */
-  void set type(Type2 type2) {
-    this._type = type2;
-  }
-
-  /**
    * Set the type arguments associated with the type to the given type arguments.
    *
    * @param typeArguments the type arguments associated with the type
@@ -14233,7 +11517,7 @@
    * The token representing the 'extends' keyword, or `null` if there was no explicit upper
    * bound.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The name of the upper bound for legal arguments, or `null` if there was no explicit upper
@@ -14252,7 +11536,7 @@
    */
   TypeParameter.full(Comment comment, List<Annotation> metadata, SimpleIdentifier name, Token keyword, TypeName bound) : super.full(comment, metadata) {
     this._name = becomeParentOf(name);
-    this._keyword = keyword;
+    this.keyword = keyword;
     this._bound = becomeParentOf(bound);
   }
 
@@ -14284,14 +11568,6 @@
   }
 
   /**
-   * Return the token representing the 'extends' keyword, or `null` if there was no explicit
-   * upper bound.
-   *
-   * @return the token representing the 'extends' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
    * Return the name of the type parameter.
    *
    * @return the name of the type parameter
@@ -14308,15 +11584,6 @@
   }
 
   /**
-   * Set the token representing the 'extends' keyword to the given token.
-   *
-   * @param keyword the token representing the 'extends' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
-
-  /**
    * Set the name of the type parameter to the given identifier.
    *
    * @param identifier the name of the type parameter
@@ -14346,17 +11613,17 @@
   /**
    * The left angle bracket.
    */
-  Token _leftBracket;
+  Token leftBracket;
 
   /**
    * The type parameters in the list.
    */
-  NodeList<TypeParameter> _typeParameters;
+  NodeList<TypeParameter> typeParameters;
 
   /**
    * The right angle bracket.
    */
-  Token _rightBracket;
+  Token rightBracket;
 
   /**
    * Initialize a newly created list of type parameters.
@@ -14366,10 +11633,10 @@
    * @param rightBracket the right angle bracket
    */
   TypeParameterList.full(Token leftBracket, List<TypeParameter> typeParameters, Token rightBracket) {
-    this._typeParameters = new NodeList<TypeParameter>(this);
-    this._leftBracket = leftBracket;
-    this._typeParameters.addAll(typeParameters);
-    this._rightBracket = rightBracket;
+    this.typeParameters = new NodeList<TypeParameter>(this);
+    this.leftBracket = leftBracket;
+    this.typeParameters.addAll(typeParameters);
+    this.rightBracket = rightBracket;
   }
 
   /**
@@ -14381,31 +11648,10 @@
    */
   TypeParameterList({Token leftBracket, List<TypeParameter> typeParameters, Token rightBracket}) : this.full(leftBracket, typeParameters, rightBracket);
   accept(ASTVisitor visitor) => visitor.visitTypeParameterList(this);
-  Token get beginToken => _leftBracket;
-  Token get endToken => _rightBracket;
-
-  /**
-   * Return the left angle bracket.
-   *
-   * @return the left angle bracket
-   */
-  Token get leftBracket => _leftBracket;
-
-  /**
-   * Return the right angle bracket.
-   *
-   * @return the right angle bracket
-   */
-  Token get rightBracket => _rightBracket;
-
-  /**
-   * Return the type parameters for the type.
-   *
-   * @return the type parameters for the type
-   */
-  NodeList<TypeParameter> get typeParameters => _typeParameters;
+  Token get beginToken => leftBracket;
+  Token get endToken => rightBracket;
   void visitChildren(ASTVisitor visitor) {
-    _typeParameters.accept(visitor);
+    typeParameters.accept(visitor);
   }
 }
 /**
@@ -14425,13 +11671,13 @@
   /**
    * The token representing the 'const' keyword, or `null` if the literal is not a constant.
    */
-  Token _constKeyword;
+  Token constKeyword;
 
   /**
    * The type argument associated with this literal, or `null` if no type arguments were
    * declared.
    */
-  TypeArgumentList _typeArguments;
+  TypeArgumentList typeArguments;
 
   /**
    * Initialize a newly created typed literal.
@@ -14441,8 +11687,8 @@
    *          arguments were declared
    */
   TypedLiteral.full(Token constKeyword, TypeArgumentList typeArguments) {
-    this._constKeyword = constKeyword;
-    this._typeArguments = becomeParentOf(typeArguments);
+    this.constKeyword = constKeyword;
+    this.typeArguments = becomeParentOf(typeArguments);
   }
 
   /**
@@ -14453,41 +11699,8 @@
    *          arguments were declared
    */
   TypedLiteral({Token constKeyword, TypeArgumentList typeArguments}) : this.full(constKeyword, typeArguments);
-
-  /**
-   * Return the token representing the 'const' keyword.
-   *
-   * @return the token representing the 'const' keyword
-   */
-  Token get constKeyword => _constKeyword;
-
-  /**
-   * Return the type argument associated with this literal, or `null` if no type arguments
-   * were declared.
-   *
-   * @return the type argument associated with this literal
-   */
-  TypeArgumentList get typeArguments => _typeArguments;
-
-  /**
-   * Set the token representing the 'const' keyword to the given keyword.
-   *
-   * @param keyword the token representing the 'const' keyword
-   */
-  void set constKeyword(Token keyword) {
-    this._constKeyword = keyword;
-  }
-
-  /**
-   * Set the type argument associated with this literal to the given arguments.
-   *
-   * @param typeArguments the type argument associated with this literal
-   */
-  void set typeArguments(TypeArgumentList typeArguments2) {
-    this._typeArguments = typeArguments2;
-  }
   void visitChildren(ASTVisitor visitor) {
-    safelyVisitChild(_typeArguments, visitor);
+    safelyVisitChild(typeArguments, visitor);
   }
 }
 /**
@@ -14582,7 +11795,7 @@
    * The equal sign separating the variable name from the initial value, or `null` if the
    * initial value was not specified.
    */
-  Token _equals;
+  Token equals;
 
   /**
    * The expression used to compute the initial value for the variable, or `null` if the
@@ -14601,7 +11814,7 @@
    */
   VariableDeclaration.full(Comment comment, List<Annotation> metadata, SimpleIdentifier name, Token equals, Expression initializer) : super.full(comment, metadata) {
     this._name = becomeParentOf(name);
-    this._equals = equals;
+    this.equals = equals;
     this._initializer = becomeParentOf(initializer);
   }
 
@@ -14642,14 +11855,6 @@
   }
 
   /**
-   * Return the equal sign separating the variable name from the initial value, or `null` if
-   * the initial value was not specified.
-   *
-   * @return the equal sign separating the variable name from the initial value
-   */
-  Token get equals => _equals;
-
-  /**
    * Return the expression used to compute the initial value for the variable, or `null` if
    * the initial value was not specified.
    *
@@ -14687,15 +11892,6 @@
   }
 
   /**
-   * Set the equal sign separating the variable name from the initial value to the given token.
-   *
-   * @param equals the equal sign separating the variable name from the initial value
-   */
-  void set equals(Token equals2) {
-    this._equals = equals2;
-  }
-
-  /**
    * Set the expression used to compute the initial value for the variable to the given expression.
    *
    * @param initializer the expression used to compute the initial value for the variable
@@ -14742,7 +11938,7 @@
    * The token representing the 'final', 'const' or 'var' keyword, or `null` if no keyword was
    * included.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The type of the variables being declared, or `null` if no type was provided.
@@ -14752,7 +11948,7 @@
   /**
    * A list containing the individual variables being declared.
    */
-  NodeList<VariableDeclaration> _variables;
+  NodeList<VariableDeclaration> variables;
 
   /**
    * Initialize a newly created variable declaration list.
@@ -14764,10 +11960,10 @@
    * @param variables a list containing the individual variables being declared
    */
   VariableDeclarationList.full(Comment comment, List<Annotation> metadata, Token keyword, TypeName type, List<VariableDeclaration> variables) : super.full(comment, metadata) {
-    this._variables = new NodeList<VariableDeclaration>(this);
-    this._keyword = keyword;
+    this.variables = new NodeList<VariableDeclaration>(this);
+    this.keyword = keyword;
     this._type = becomeParentOf(type);
-    this._variables.addAll(variables);
+    this.variables.addAll(variables);
   }
 
   /**
@@ -14781,15 +11977,7 @@
    */
   VariableDeclarationList({Comment comment, List<Annotation> metadata, Token keyword, TypeName type, List<VariableDeclaration> variables}) : this.full(comment, metadata, keyword, type, variables);
   accept(ASTVisitor visitor) => visitor.visitVariableDeclarationList(this);
-  Token get endToken => _variables.endToken;
-
-  /**
-   * Return the token representing the 'final', 'const' or 'var' keyword, or `null` if no
-   * keyword was included.
-   *
-   * @return the token representing the 'final', 'const' or 'var' keyword
-   */
-  Token get keyword => _keyword;
+  Token get endToken => variables.endToken;
 
   /**
    * Return the type of the variables being declared, or `null` if no type was provided.
@@ -14799,18 +11987,11 @@
   TypeName get type => _type;
 
   /**
-   * Return a list containing the individual variables being declared.
-   *
-   * @return a list containing the individual variables being declared
-   */
-  NodeList<VariableDeclaration> get variables => _variables;
-
-  /**
    * Return `true` if the variables in this list were declared with the 'const' modifier.
    *
    * @return `true` if the variables in this list were declared with the 'const' modifier
    */
-  bool get isConst => _keyword is KeywordToken && identical(((_keyword as KeywordToken)).keyword, Keyword.CONST);
+  bool get isConst => keyword is KeywordToken && identical(((keyword as KeywordToken)).keyword, Keyword.CONST);
 
   /**
    * Return `true` if the variables in this list were declared with the 'final' modifier.
@@ -14819,16 +12000,7 @@
    *
    * @return `true` if the variables in this list were declared with the 'final' modifier
    */
-  bool get isFinal => _keyword is KeywordToken && identical(((_keyword as KeywordToken)).keyword, Keyword.FINAL);
-
-  /**
-   * Set the token representing the 'final', 'const' or 'var' keyword to the given token.
-   *
-   * @param keyword the token representing the 'final', 'const' or 'var' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
+  bool get isFinal => keyword is KeywordToken && identical(((keyword as KeywordToken)).keyword, Keyword.FINAL);
 
   /**
    * Set the type of the variables being declared to the given type name.
@@ -14840,15 +12012,15 @@
   }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_type, visitor);
-    _variables.accept(visitor);
+    variables.accept(visitor);
   }
   Token get firstTokenAfterCommentAndMetadata {
-    if (_keyword != null) {
-      return _keyword;
+    if (keyword != null) {
+      return keyword;
     } else if (_type != null) {
       return _type.beginToken;
     }
-    return _variables.beginToken;
+    return variables.beginToken;
   }
 }
 /**
@@ -14872,7 +12044,7 @@
   /**
    * The semicolon terminating the statement.
    */
-  Token _semicolon;
+  Token semicolon;
 
   /**
    * Initialize a newly created variable declaration statement.
@@ -14882,7 +12054,7 @@
    */
   VariableDeclarationStatement.full(VariableDeclarationList variableList, Token semicolon) {
     this._variableList = becomeParentOf(variableList);
-    this._semicolon = semicolon;
+    this.semicolon = semicolon;
   }
 
   /**
@@ -14894,14 +12066,7 @@
   VariableDeclarationStatement({VariableDeclarationList variableList, Token semicolon}) : this.full(variableList, semicolon);
   accept(ASTVisitor visitor) => visitor.visitVariableDeclarationStatement(this);
   Token get beginToken => _variableList.beginToken;
-  Token get endToken => _semicolon;
-
-  /**
-   * Return the semicolon terminating the statement.
-   *
-   * @return the semicolon terminating the statement
-   */
-  Token get semicolon => _semicolon;
+  Token get endToken => semicolon;
 
   /**
    * Return the variables being declared.
@@ -14911,15 +12076,6 @@
   VariableDeclarationList get variables => _variableList;
 
   /**
-   * Set the semicolon terminating the statement to the given token.
-   *
-   * @param semicolon the semicolon terminating the statement
-   */
-  void set semicolon(Token semicolon2) {
-    this._semicolon = semicolon2;
-  }
-
-  /**
    * Set the variables being declared to the given list of variables.
    *
    * @param variableList the variables being declared
@@ -14946,12 +12102,12 @@
   /**
    * The token representing the 'while' keyword.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The left parenthesis.
    */
-  Token _leftParenthesis;
+  Token leftParenthesis;
 
   /**
    * The expression used to determine whether to execute the body of the loop.
@@ -14961,7 +12117,7 @@
   /**
    * The right parenthesis.
    */
-  Token _rightParenthesis;
+  Token rightParenthesis;
 
   /**
    * The body of the loop.
@@ -14978,10 +12134,10 @@
    * @param body the body of the loop
    */
   WhileStatement.full(Token keyword, Token leftParenthesis, Expression condition, Token rightParenthesis, Statement body) {
-    this._keyword = keyword;
-    this._leftParenthesis = leftParenthesis;
+    this.keyword = keyword;
+    this.leftParenthesis = leftParenthesis;
     this._condition = becomeParentOf(condition);
-    this._rightParenthesis = rightParenthesis;
+    this.rightParenthesis = rightParenthesis;
     this._body = becomeParentOf(body);
   }
 
@@ -14996,7 +12152,7 @@
    */
   WhileStatement({Token keyword, Token leftParenthesis, Expression condition, Token rightParenthesis, Statement body}) : this.full(keyword, leftParenthesis, condition, rightParenthesis, body);
   accept(ASTVisitor visitor) => visitor.visitWhileStatement(this);
-  Token get beginToken => _keyword;
+  Token get beginToken => keyword;
 
   /**
    * Return the body of the loop.
@@ -15014,27 +12170,6 @@
   Token get endToken => _body.endToken;
 
   /**
-   * Return the token representing the 'while' keyword.
-   *
-   * @return the token representing the 'while' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Return the left parenthesis.
-   *
-   * @return the left parenthesis
-   */
-  Token get leftParenthesis => _leftParenthesis;
-
-  /**
-   * Return the right parenthesis.
-   *
-   * @return the right parenthesis
-   */
-  Token get rightParenthesis => _rightParenthesis;
-
-  /**
    * Set the body of the loop to the given statement.
    *
    * @param statement the body of the loop
@@ -15052,33 +12187,6 @@
   void set condition(Expression expression) {
     _condition = becomeParentOf(expression);
   }
-
-  /**
-   * Set the token representing the 'while' keyword to the given token.
-   *
-   * @param keyword the token representing the 'while' keyword
-   */
-  void set keyword(Token keyword2) {
-    this._keyword = keyword2;
-  }
-
-  /**
-   * Set the left parenthesis to the given token.
-   *
-   * @param leftParenthesis the left parenthesis
-   */
-  void set leftParenthesis(Token leftParenthesis2) {
-    this._leftParenthesis = leftParenthesis2;
-  }
-
-  /**
-   * Set the right parenthesis to the given token.
-   *
-   * @param rightParenthesis the right parenthesis
-   */
-  void set rightParenthesis(Token rightParenthesis2) {
-    this._rightParenthesis = rightParenthesis2;
-  }
   void visitChildren(ASTVisitor visitor) {
     safelyVisitChild(_condition, visitor);
     safelyVisitChild(_body, visitor);
@@ -15099,12 +12207,12 @@
   /**
    * The token representing the 'with' keyword.
    */
-  Token _withKeyword;
+  Token withKeyword;
 
   /**
    * The names of the mixins that were specified.
    */
-  NodeList<TypeName> _mixinTypes;
+  NodeList<TypeName> mixinTypes;
 
   /**
    * Initialize a newly created with clause.
@@ -15113,9 +12221,9 @@
    * @param mixinTypes the names of the mixins that were specified
    */
   WithClause.full(Token withKeyword, List<TypeName> mixinTypes) {
-    this._mixinTypes = new NodeList<TypeName>(this);
-    this._withKeyword = withKeyword;
-    this._mixinTypes.addAll(mixinTypes);
+    this.mixinTypes = new NodeList<TypeName>(this);
+    this.withKeyword = withKeyword;
+    this.mixinTypes.addAll(mixinTypes);
   }
 
   /**
@@ -15126,22 +12234,8 @@
    */
   WithClause({Token withKeyword, List<TypeName> mixinTypes}) : this.full(withKeyword, mixinTypes);
   accept(ASTVisitor visitor) => visitor.visitWithClause(this);
-  Token get beginToken => _withKeyword;
-  Token get endToken => _mixinTypes.endToken;
-
-  /**
-   * Return the names of the mixins that were specified.
-   *
-   * @return the names of the mixins that were specified
-   */
-  NodeList<TypeName> get mixinTypes => _mixinTypes;
-
-  /**
-   * Return the token representing the 'with' keyword.
-   *
-   * @return the token representing the 'with' keyword
-   */
-  Token get withKeyword => _withKeyword;
+  Token get beginToken => withKeyword;
+  Token get endToken => mixinTypes.endToken;
 
   /**
    * Set the token representing the 'with' keyword to the given token.
@@ -15149,10 +12243,10 @@
    * @param withKeyword the token representing the 'with' keyword
    */
   void set mixinKeyword(Token withKeyword2) {
-    this._withKeyword = withKeyword2;
+    this.withKeyword = withKeyword2;
   }
   void visitChildren(ASTVisitor visitor) {
-    _mixinTypes.accept(visitor);
+    mixinTypes.accept(visitor);
   }
 }
 /**
@@ -15762,7 +12856,7 @@
    * The element that was found that corresponds to the given source range, or `null` if there
    * is no such element.
    */
-  ASTNode _foundNode;
+  ASTNode foundNode;
 
   /**
    * Initialize a newly created locator to locate one or more [ASTNode] by locating
@@ -15786,14 +12880,6 @@
   }
 
   /**
-   * Return the node that was found that corresponds to the given source range, or `null` if
-   * there is no such node.
-   *
-   * @return the node that was found
-   */
-  ASTNode get foundNode => _foundNode;
-
-  /**
    * Search within the given AST node for an identifier representing a [DartElement] in the specified source range. Return the element that was found, or `null` if
    * no element was found.
    *
@@ -15811,7 +12897,7 @@
       AnalysisEngine.instance.logger.logInformation2("Unable to locate element at offset (${_startOffset} - ${_endOffset})", exception);
       return null;
     }
-    return _foundNode;
+    return foundNode;
   }
   Object visitNode(ASTNode node) {
     int start = node.offset;
@@ -15830,7 +12916,7 @@
       AnalysisEngine.instance.logger.logInformation2("Exception caught while traversing an AST structure.", exception);
     }
     if (start <= _startOffset && _endOffset <= end) {
-      _foundNode = node;
+      foundNode = node;
       throw new NodeLocator_NodeFoundException();
     }
     return null;
@@ -17397,16 +14483,14 @@
  * @coverage com.google.dart.engine.services.completion
  */
 class ScopedNameFinder extends GeneralizingASTVisitor<Object> {
-  Declaration _declarationNode;
+  Declaration declaration;
   ASTNode _immediateChild;
-  Map<String, SimpleIdentifier> _locals = new Map<String, SimpleIdentifier>();
+  final Map<String, SimpleIdentifier> locals = new Map<String, SimpleIdentifier>();
   int _position = 0;
   bool _referenceIsWithinLocalFunction = false;
   ScopedNameFinder(int position) {
     this._position = position;
   }
-  Declaration get declaration => _declarationNode;
-  Map<String, SimpleIdentifier> get locals => _locals;
   Object visitBlock(Block node) {
     checkStatements(node.statements);
     return super.visitBlock(node);
@@ -17420,11 +14504,11 @@
     if (_immediateChild != node.parameters) {
       addParameters(node.parameters.parameters);
     }
-    _declarationNode = node;
+    declaration = node;
     return null;
   }
   Object visitFieldDeclaration(FieldDeclaration node) {
-    _declarationNode = node;
+    declaration = node;
     return null;
   }
   Object visitForEachStatement(ForEachStatement node) {
@@ -17439,7 +14523,7 @@
   }
   Object visitFunctionDeclaration(FunctionDeclaration node) {
     if (node.parent is! FunctionDeclarationStatement) {
-      _declarationNode = node;
+      declaration = node;
       return null;
     }
     return super.visitFunctionDeclaration(node);
@@ -17461,7 +14545,7 @@
     if (_immediateChild != node.parameters) {
       addParameters(node.parameters.parameters);
     }
-    _declarationNode = node;
+    declaration = node;
     return null;
   }
   Object visitNode(ASTNode node) {
@@ -17477,11 +14561,11 @@
     return super.visitSwitchMember(node);
   }
   Object visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
-    _declarationNode = node;
+    declaration = node;
     return null;
   }
   Object visitTypeAlias(TypeAlias node) {
-    _declarationNode = node;
+    declaration = node;
     return null;
   }
   void addParameters(NodeList<FormalParameter> vars) {
@@ -17492,8 +14576,8 @@
   void addToScope(SimpleIdentifier identifier) {
     if (identifier != null && isInRange(identifier)) {
       String name = identifier.name;
-      if (!_locals.containsKey(name)) {
-        _locals[name] = identifier;
+      if (!locals.containsKey(name)) {
+        locals[name] = identifier;
       }
     }
   }
diff --git a/pkg/analyzer_experimental/lib/src/generated/constant.dart b/pkg/analyzer_experimental/lib/src/generated/constant.dart
index 176f8b3..0901fdd 100644
--- a/pkg/analyzer_experimental/lib/src/generated/constant.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/constant.dart
@@ -102,7 +102,7 @@
   /**
    * The value of the expression.
    */
-  Object _value;
+  Object value;
 
   /**
    * The errors that should be reported for the expression(s) that were evaluated.
@@ -117,7 +117,7 @@
    * @param errors the errors that should be reported for the expression(s) that were evaluated
    */
   EvaluationResult(Object value, List<AnalysisError> errors) {
-    this._value = value;
+    this.value = value;
     this._errors = errors;
   }
 
@@ -130,15 +130,6 @@
   List<AnalysisError> get errors => _errors == null ? AnalysisError.NO_ERRORS : _errors;
 
   /**
-   * Return the value of the expression, or `null` if the expression evaluated to `null`
-   * or if the expression could not be evaluated, either because it was not a compile-time constant
-   * expression or because it would throw an exception when evaluated.
-   *
-   * @return the value of the expression
-   */
-  Object get value => _value;
-
-  /**
    * Return `true` if the expression is a compile-time constant expression that would not
    * throw an exception when evaluated.
    *
@@ -156,21 +147,14 @@
   /**
    * A table mapping constant variable elements to the declarations of those variables.
    */
-  Map<VariableElement, VariableDeclaration> _variableMap = new Map<VariableElement, VariableDeclaration>();
-
-  /**
-   * Return a table mapping constant variable elements to the declarations of those variables.
-   *
-   * @return a table mapping constant variable elements to the declarations of those variables
-   */
-  Map<VariableElement, VariableDeclaration> get variableMap => _variableMap;
+  final Map<VariableElement, VariableDeclaration> variableMap = new Map<VariableElement, VariableDeclaration>();
   Object visitVariableDeclaration(VariableDeclaration node) {
     super.visitVariableDeclaration(node);
     Expression initializer = node.initializer;
     if (initializer != null && node.isConst) {
       VariableElement element = node.element;
       if (element != null) {
-        _variableMap[element] = node;
+        variableMap[element] = node;
       }
     }
     return null;
@@ -710,7 +694,7 @@
   /**
    * The errors that prevent the expression from being a valid compile time constant.
    */
-  List<ErrorResult_ErrorData> _errors = new List<ErrorResult_ErrorData>();
+  final List<ErrorResult_ErrorData> errorData = new List<ErrorResult_ErrorData>();
 
   /**
    * Initialize a newly created result representing the error with the given code reported against
@@ -720,7 +704,7 @@
    * @param errorCode the error code for the error to be generated
    */
   ErrorResult.con1(ASTNode node, ErrorCode errorCode) {
-    _errors.add(new ErrorResult_ErrorData(node, errorCode));
+    errorData.add(new ErrorResult_ErrorData(node, errorCode));
   }
 
   /**
@@ -731,8 +715,8 @@
    * @param secondResult the second set of results being merged
    */
   ErrorResult.con2(ErrorResult firstResult, ErrorResult secondResult) {
-    _errors.addAll(firstResult._errors);
-    _errors.addAll(secondResult._errors);
+    errorData.addAll(firstResult.errorData);
+    errorData.addAll(secondResult.errorData);
   }
   EvaluationResultImpl add(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.addToError(node, this);
   EvaluationResultImpl bitAnd(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.bitAndError(node, this);
@@ -743,7 +727,6 @@
   EvaluationResultImpl divide(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.divideError(node, this);
   EvaluationResultImpl equalEqual(Expression node, EvaluationResultImpl rightOperand) => rightOperand.equalEqualError(node, this);
   bool equalValues(EvaluationResultImpl result) => false;
-  List<ErrorResult_ErrorData> get errorData => _errors;
   EvaluationResultImpl greaterThan(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.greaterThanError(node, this);
   EvaluationResultImpl greaterThanOrEqual(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.greaterThanOrEqualError(node, this);
   EvaluationResultImpl integerDivide(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.integerDivideError(node, this);
@@ -806,12 +789,12 @@
   /**
    * The node against which the error should be reported.
    */
-  ASTNode _node;
+  ASTNode node;
 
   /**
    * The error code for the error to be generated.
    */
-  ErrorCode _errorCode;
+  ErrorCode errorCode;
 
   /**
    * Initialize a newly created data holder to represent the error with the given code reported
@@ -821,23 +804,9 @@
    * @param errorCode the error code for the error to be generated
    */
   ErrorResult_ErrorData(ASTNode node, ErrorCode errorCode) {
-    this._node = node;
-    this._errorCode = errorCode;
+    this.node = node;
+    this.errorCode = errorCode;
   }
-
-  /**
-   * Return the error code for the error to be generated.
-   *
-   * @return the error code for the error to be generated
-   */
-  ErrorCode get errorCode => _errorCode;
-
-  /**
-   * Return the node against which the error should be reported.
-   *
-   * @return the node against which the error should be reported
-   */
-  ASTNode get node => _node;
 }
 /**
  * Instances of the class `InternalResult` represent the result of attempting to evaluate a
@@ -1013,7 +982,7 @@
   /**
    * The value of the expression.
    */
-  Object _value;
+  Object value;
 
   /**
    * Initialize a newly created result to represent the given value.
@@ -1021,7 +990,7 @@
    * @param value the value of the expression
    */
   ValidResult(Object value) {
-    this._value = value;
+    this.value = value;
   }
   EvaluationResultImpl add(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.addToValid(node, this);
   EvaluationResultImpl bitAnd(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.bitAndValid(node, this);
@@ -1029,10 +998,10 @@
     if (isSomeInt) {
       return RESULT_INT;
     }
-    if (_value == null) {
+    if (value == null) {
       return error(node);
-    } else if (_value is int) {
-      return valueOf(~((_value as int)));
+    } else if (value is int) {
+      return valueOf(~((value as int)));
     }
     return error(node);
   }
@@ -1042,7 +1011,6 @@
   EvaluationResultImpl divide(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.divideValid(node, this);
   EvaluationResultImpl equalEqual(Expression node, EvaluationResultImpl rightOperand) => rightOperand.equalEqualValid(node, this);
   bool equalValues(EvaluationResultImpl result) => identical(equalEqual(null, result), RESULT_TRUE);
-  Object get value => _value;
   EvaluationResultImpl greaterThan(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.greaterThanValid(node, this);
   EvaluationResultImpl greaterThanOrEqual(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.greaterThanOrEqualValid(node, this);
   EvaluationResultImpl integerDivide(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.integerDivideValid(node, this);
@@ -1053,10 +1021,10 @@
     if (isSomeBool) {
       return RESULT_BOOL;
     }
-    if (_value == null) {
+    if (value == null) {
       return RESULT_TRUE;
-    } else if (_value is bool) {
-      return ((_value as bool)) ? RESULT_FALSE : RESULT_TRUE;
+    } else if (value is bool) {
+      return ((value as bool)) ? RESULT_FALSE : RESULT_TRUE;
     }
     return error(node);
   }
@@ -1066,26 +1034,26 @@
     if (isSomeNum) {
       return RESULT_INT;
     }
-    if (_value == null) {
+    if (value == null) {
       return error(node);
-    } else if (_value is int) {
-      return valueOf(-((_value as int)));
-    } else if (_value is double) {
-      return valueOf3(-((_value as double)));
+    } else if (value is int) {
+      return valueOf(-((value as int)));
+    } else if (value is double) {
+      return valueOf3(-((value as double)));
     }
     return error(node);
   }
   EvaluationResultImpl notEqual(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.notEqualValid(node, this);
   EvaluationResultImpl performToString(ASTNode node) {
-    if (_value == null) {
+    if (value == null) {
       return valueOf4("null");
-    } else if (_value is bool) {
-      return valueOf4(((_value as bool)).toString());
-    } else if (_value is int) {
-      return valueOf4(((_value as int)).toString());
-    } else if (_value is double) {
-      return valueOf4(((_value as double)).toString());
-    } else if (_value is String) {
+    } else if (value is bool) {
+      return valueOf4(((value as bool)).toString());
+    } else if (value is int) {
+      return valueOf4(((value as int)).toString());
+    } else if (value is double) {
+      return valueOf4(((value as double)).toString());
+    } else if (value is String) {
       return this;
     }
     return error(node);
@@ -1095,10 +1063,10 @@
   EvaluationResultImpl shiftRight(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.shiftRightValid(node, this);
   EvaluationResultImpl times(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.timesValid(node, this);
   String toString() {
-    if (_value == null) {
+    if (value == null) {
       return "null";
     }
-    return _value.toString();
+    return value.toString();
   }
   EvaluationResultImpl addToError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
   EvaluationResultImpl addToValid(BinaryExpression node, ValidResult leftOperand2) {
@@ -1113,23 +1081,23 @@
     Object leftValue = leftOperand2.value;
     if (leftValue == null) {
       return error(node.leftOperand);
-    } else if (_value == null) {
+    } else if (value == null) {
       return error(node.rightOperand);
     } else if (leftValue is int) {
-      if (_value is int) {
-        return valueOf(((leftValue as int)) + (_value as int));
-      } else if (_value is double) {
-        return valueOf3(((leftValue as int)).toDouble() + ((_value as double)));
+      if (value is int) {
+        return valueOf(((leftValue as int)) + (value as int));
+      } else if (value is double) {
+        return valueOf3(((leftValue as int)).toDouble() + ((value as double)));
       }
     } else if (leftValue is double) {
-      if (_value is int) {
-        return valueOf3(((leftValue as double)) + ((_value as int)).toDouble());
-      } else if (_value is double) {
-        return valueOf3(((leftValue as double)) + ((_value as double)));
+      if (value is int) {
+        return valueOf3(((leftValue as double)) + ((value as int)).toDouble());
+      } else if (value is double) {
+        return valueOf3(((leftValue as double)) + ((value as double)));
       }
     } else if (leftValue is String) {
-      if (_value is String) {
-        return valueOf4("${((leftValue as String))}${((_value as String))}");
+      if (value is String) {
+        return valueOf4("${((leftValue as String))}${((value as String))}");
       }
     }
     return error(node);
@@ -1145,15 +1113,15 @@
     Object leftValue = leftOperand2.value;
     if (leftValue == null) {
       return error(node.leftOperand);
-    } else if (_value == null) {
+    } else if (value == null) {
       return error(node.rightOperand);
     } else if (leftValue is int) {
-      if (_value is int) {
-        return valueOf(((leftValue as int)) & (_value as int));
+      if (value is int) {
+        return valueOf(((leftValue as int)) & (value as int));
       }
       return error(node.leftOperand);
     }
-    if (_value is int) {
+    if (value is int) {
       return error(node.rightOperand);
     }
     return union(error(node.leftOperand), error(node.rightOperand));
@@ -1169,15 +1137,15 @@
     Object leftValue = leftOperand2.value;
     if (leftValue == null) {
       return error(node.leftOperand);
-    } else if (_value == null) {
+    } else if (value == null) {
       return error(node.rightOperand);
     } else if (leftValue is int) {
-      if (_value is int) {
-        return valueOf(((leftValue as int)) | (_value as int));
+      if (value is int) {
+        return valueOf(((leftValue as int)) | (value as int));
       }
       return error(node.leftOperand);
     }
-    if (_value is int) {
+    if (value is int) {
       return error(node.rightOperand);
     }
     return union(error(node.leftOperand), error(node.rightOperand));
@@ -1193,15 +1161,15 @@
     Object leftValue = leftOperand2.value;
     if (leftValue == null) {
       return error(node.leftOperand);
-    } else if (_value == null) {
+    } else if (value == null) {
       return error(node.rightOperand);
     } else if (leftValue is int) {
-      if (_value is int) {
-        return valueOf(((leftValue as int)) ^ (_value as int));
+      if (value is int) {
+        return valueOf(((leftValue as int)) ^ (value as int));
       }
       return error(node.leftOperand);
     }
-    if (_value is int) {
+    if (value is int) {
       return error(node.rightOperand);
     }
     return union(error(node.leftOperand), error(node.rightOperand));
@@ -1209,8 +1177,8 @@
   EvaluationResultImpl concatenateError(Expression node, ErrorResult leftOperand) => leftOperand;
   EvaluationResultImpl concatenateValid(Expression node, ValidResult leftOperand) {
     Object leftValue = leftOperand.value;
-    if (leftValue is String && _value is String) {
-      return valueOf4("${((leftValue as String))}${((_value as String))}");
+    if (leftValue is String && value is String) {
+      return valueOf4("${((leftValue as String))}${((value as String))}");
     }
     return error(node);
   }
@@ -1225,22 +1193,22 @@
     Object leftValue = leftOperand2.value;
     if (leftValue == null) {
       return error(node.leftOperand);
-    } else if (_value == null) {
+    } else if (value == null) {
       return error(node.rightOperand);
     } else if (leftValue is int) {
-      if (_value is int) {
-        if (((_value as int)) == 0) {
-          return valueOf3(((leftValue as int)).toDouble() / ((_value as int)).toDouble());
+      if (value is int) {
+        if (((value as int)) == 0) {
+          return valueOf3(((leftValue as int)).toDouble() / ((value as int)).toDouble());
         }
-        return valueOf(((leftValue as int)) ~/ (_value as int));
-      } else if (_value is double) {
-        return valueOf3(((leftValue as int)).toDouble() / ((_value as double)));
+        return valueOf(((leftValue as int)) ~/ (value as int));
+      } else if (value is double) {
+        return valueOf3(((leftValue as int)).toDouble() / ((value as double)));
       }
     } else if (leftValue is double) {
-      if (_value is int) {
-        return valueOf3(((leftValue as double)) / ((_value as int)).toDouble());
-      } else if (_value is double) {
-        return valueOf3(((leftValue as double)) / ((_value as double)));
+      if (value is int) {
+        return valueOf3(((leftValue as double)) / ((value as int)).toDouble());
+      } else if (value is double) {
+        return valueOf3(((leftValue as double)) / ((value as double)));
       }
     }
     return error(node);
@@ -1254,29 +1222,29 @@
     }
     Object leftValue = leftOperand.value;
     if (leftValue == null) {
-      return valueOf2(_value == null);
+      return valueOf2(value == null);
     } else if (leftValue is bool) {
-      if (_value is bool) {
-        return valueOf2(identical(leftValue as bool, _value as bool));
+      if (value is bool) {
+        return valueOf2(identical(leftValue as bool, value as bool));
       }
       return RESULT_FALSE;
     } else if (leftValue is int) {
-      if (_value is int) {
-        return valueOf2(((leftValue as int)) == _value);
-      } else if (_value is double) {
-        return valueOf2(toDouble(leftValue as int) == _value);
+      if (value is int) {
+        return valueOf2(((leftValue as int)) == value);
+      } else if (value is double) {
+        return valueOf2(toDouble(leftValue as int) == value);
       }
       return RESULT_FALSE;
     } else if (leftValue is double) {
-      if (_value is int) {
-        return valueOf2(((leftValue as double)) == toDouble(_value as int));
-      } else if (_value is double) {
-        return valueOf2(((leftValue as double)) == _value);
+      if (value is int) {
+        return valueOf2(((leftValue as double)) == toDouble(value as int));
+      } else if (value is double) {
+        return valueOf2(((leftValue as double)) == value);
       }
       return RESULT_FALSE;
     } else if (leftValue is String) {
-      if (_value is String) {
-        return valueOf2(((leftValue as String)) == _value);
+      if (value is String) {
+        return valueOf2(((leftValue as String)) == value);
       }
       return RESULT_FALSE;
     }
@@ -1294,19 +1262,19 @@
     Object leftValue = leftOperand2.value;
     if (leftValue == null) {
       return error(node.leftOperand);
-    } else if (_value == null) {
+    } else if (value == null) {
       return error(node.rightOperand);
     } else if (leftValue is int) {
-      if (_value is int) {
-        return valueOf2(((leftValue as int)).compareTo(_value as int) >= 0);
-      } else if (_value is double) {
-        return valueOf2(((leftValue as int)).toDouble() >= ((_value as double)));
+      if (value is int) {
+        return valueOf2(((leftValue as int)).compareTo(value as int) >= 0);
+      } else if (value is double) {
+        return valueOf2(((leftValue as int)).toDouble() >= ((value as double)));
       }
     } else if (leftValue is double) {
-      if (_value is int) {
-        return valueOf2(((leftValue as double)) >= ((_value as int)).toDouble());
-      } else if (_value is double) {
-        return valueOf2(((leftValue as double)) >= ((_value as double)));
+      if (value is int) {
+        return valueOf2(((leftValue as double)) >= ((value as int)).toDouble());
+      } else if (value is double) {
+        return valueOf2(((leftValue as double)) >= ((value as double)));
       }
     }
     return error(node);
@@ -1321,19 +1289,19 @@
     Object leftValue = leftOperand2.value;
     if (leftValue == null) {
       return error(node.leftOperand);
-    } else if (_value == null) {
+    } else if (value == null) {
       return error(node.rightOperand);
     } else if (leftValue is int) {
-      if (_value is int) {
-        return valueOf2(((leftValue as int)).compareTo(_value as int) > 0);
-      } else if (_value is double) {
-        return valueOf2(((leftValue as int)).toDouble() > ((_value as double)));
+      if (value is int) {
+        return valueOf2(((leftValue as int)).compareTo(value as int) > 0);
+      } else if (value is double) {
+        return valueOf2(((leftValue as int)).toDouble() > ((value as double)));
       }
     } else if (leftValue is double) {
-      if (_value is int) {
-        return valueOf2(((leftValue as double)) > ((_value as int)).toDouble());
-      } else if (_value is double) {
-        return valueOf2(((leftValue as double)) > ((_value as double)));
+      if (value is int) {
+        return valueOf2(((leftValue as double)) > ((value as int)).toDouble());
+      } else if (value is double) {
+        return valueOf2(((leftValue as double)) > ((value as double)));
       }
     }
     return error(node);
@@ -1349,24 +1317,24 @@
     Object leftValue = leftOperand2.value;
     if (leftValue == null) {
       return error(node.leftOperand);
-    } else if (_value == null) {
+    } else if (value == null) {
       return error(node.rightOperand);
     } else if (leftValue is int) {
-      if (_value is int) {
-        if (((_value as int)) == 0) {
+      if (value is int) {
+        if (((value as int)) == 0) {
           return error2(node, CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE);
         }
-        return valueOf(((leftValue as int)) ~/ (_value as int));
-      } else if (_value is double) {
-        double result = ((leftValue as int)).toDouble() / ((_value as double));
+        return valueOf(((leftValue as int)) ~/ (value as int));
+      } else if (value is double) {
+        double result = ((leftValue as int)).toDouble() / ((value as double));
         return valueOf(result.toInt());
       }
     } else if (leftValue is double) {
-      if (_value is int) {
-        double result = ((leftValue as double)) / ((_value as int)).toDouble();
+      if (value is int) {
+        double result = ((leftValue as double)) / ((value as int)).toDouble();
         return valueOf(result.toInt());
-      } else if (_value is double) {
-        double result = ((leftValue as double)) / ((_value as double));
+      } else if (value is double) {
+        double result = ((leftValue as double)) / ((value as double));
         return valueOf(result.toInt());
       }
     }
@@ -1384,19 +1352,19 @@
     Object leftValue = leftOperand2.value;
     if (leftValue == null) {
       return error(node.leftOperand);
-    } else if (_value == null) {
+    } else if (value == null) {
       return error(node.rightOperand);
     } else if (leftValue is int) {
-      if (_value is int) {
-        return valueOf2(((leftValue as int)).compareTo(_value as int) <= 0);
-      } else if (_value is double) {
-        return valueOf2(((leftValue as int)).toDouble() <= ((_value as double)));
+      if (value is int) {
+        return valueOf2(((leftValue as int)).compareTo(value as int) <= 0);
+      } else if (value is double) {
+        return valueOf2(((leftValue as int)).toDouble() <= ((value as double)));
       }
     } else if (leftValue is double) {
-      if (_value is int) {
-        return valueOf2(((leftValue as double)) <= ((_value as int)).toDouble());
-      } else if (_value is double) {
-        return valueOf2(((leftValue as double)) <= ((_value as double)));
+      if (value is int) {
+        return valueOf2(((leftValue as double)) <= ((value as int)).toDouble());
+      } else if (value is double) {
+        return valueOf2(((leftValue as double)) <= ((value as double)));
       }
     }
     return error(node);
@@ -1411,19 +1379,19 @@
     Object leftValue = leftOperand2.value;
     if (leftValue == null) {
       return error(node.leftOperand);
-    } else if (_value == null) {
+    } else if (value == null) {
       return error(node.rightOperand);
     } else if (leftValue is int) {
-      if (_value is int) {
-        return valueOf2(((leftValue as int)).compareTo(_value as int) < 0);
-      } else if (_value is double) {
-        return valueOf2(((leftValue as int)).toDouble() < ((_value as double)));
+      if (value is int) {
+        return valueOf2(((leftValue as int)).compareTo(value as int) < 0);
+      } else if (value is double) {
+        return valueOf2(((leftValue as int)).toDouble() < ((value as double)));
       }
     } else if (leftValue is double) {
-      if (_value is int) {
-        return valueOf2(((leftValue as double)) < ((_value as int)).toDouble());
-      } else if (_value is double) {
-        return valueOf2(((leftValue as double)) < ((_value as double)));
+      if (value is int) {
+        return valueOf2(((leftValue as double)) < ((value as int)).toDouble());
+      } else if (value is double) {
+        return valueOf2(((leftValue as double)) < ((value as double)));
       }
     }
     return error(node);
@@ -1439,7 +1407,7 @@
     Object leftValue = leftOperand.value;
     if (leftValue is bool) {
       if (((leftValue as bool))) {
-        return booleanConversion(node.rightOperand, _value);
+        return booleanConversion(node.rightOperand, value);
       }
       return RESULT_FALSE;
     }
@@ -1457,7 +1425,7 @@
     if (leftValue is bool && ((leftValue as bool))) {
       return RESULT_TRUE;
     }
-    return booleanConversion(node.rightOperand, _value);
+    return booleanConversion(node.rightOperand, value);
   }
   EvaluationResultImpl minusError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
   EvaluationResultImpl minusValid(BinaryExpression node, ValidResult leftOperand2) {
@@ -1472,19 +1440,19 @@
     Object leftValue = leftOperand2.value;
     if (leftValue == null) {
       return error(node.leftOperand);
-    } else if (_value == null) {
+    } else if (value == null) {
       return error(node.rightOperand);
     } else if (leftValue is int) {
-      if (_value is int) {
-        return valueOf(((leftValue as int)) - (_value as int));
-      } else if (_value is double) {
-        return valueOf3(((leftValue as int)).toDouble() - ((_value as double)));
+      if (value is int) {
+        return valueOf(((leftValue as int)) - (value as int));
+      } else if (value is double) {
+        return valueOf3(((leftValue as int)).toDouble() - ((value as double)));
       }
     } else if (leftValue is double) {
-      if (_value is int) {
-        return valueOf3(((leftValue as double)) - ((_value as int)).toDouble());
-      } else if (_value is double) {
-        return valueOf3(((leftValue as double)) - ((_value as double)));
+      if (value is int) {
+        return valueOf3(((leftValue as double)) - ((value as int)).toDouble());
+      } else if (value is double) {
+        return valueOf3(((leftValue as double)) - ((value as double)));
       }
     }
     return error(node);
@@ -1496,29 +1464,29 @@
     }
     Object leftValue = leftOperand.value;
     if (leftValue == null) {
-      return valueOf2(_value != null);
+      return valueOf2(value != null);
     } else if (leftValue is bool) {
-      if (_value is bool) {
-        return valueOf2(((leftValue as bool)) != ((_value as bool)));
+      if (value is bool) {
+        return valueOf2(((leftValue as bool)) != ((value as bool)));
       }
       return RESULT_TRUE;
     } else if (leftValue is int) {
-      if (_value is int) {
-        return valueOf2(((leftValue as int)) != _value);
-      } else if (_value is double) {
-        return valueOf2(toDouble(leftValue as int) != _value);
+      if (value is int) {
+        return valueOf2(((leftValue as int)) != value);
+      } else if (value is double) {
+        return valueOf2(toDouble(leftValue as int) != value);
       }
       return RESULT_TRUE;
     } else if (leftValue is double) {
-      if (_value is int) {
-        return valueOf2(((leftValue as double)) != toDouble(_value as int));
-      } else if (_value is double) {
-        return valueOf2(((leftValue as double)) != _value);
+      if (value is int) {
+        return valueOf2(((leftValue as double)) != toDouble(value as int));
+      } else if (value is double) {
+        return valueOf2(((leftValue as double)) != value);
       }
       return RESULT_TRUE;
     } else if (leftValue is String) {
-      if (_value is String) {
-        return valueOf2(((leftValue as String)) != _value);
+      if (value is String) {
+        return valueOf2(((leftValue as String)) != value);
       }
       return RESULT_TRUE;
     }
@@ -1537,22 +1505,22 @@
     Object leftValue = leftOperand2.value;
     if (leftValue == null) {
       return error(node.leftOperand);
-    } else if (_value == null) {
+    } else if (value == null) {
       return error(node.rightOperand);
     } else if (leftValue is int) {
-      if (_value is int) {
-        if (((_value as int)) == 0) {
-          return valueOf3(((leftValue as int)).toDouble() % ((_value as int)).toDouble());
+      if (value is int) {
+        if (((value as int)) == 0) {
+          return valueOf3(((leftValue as int)).toDouble() % ((value as int)).toDouble());
         }
-        return valueOf(((leftValue as int)).remainder(_value as int));
-      } else if (_value is double) {
-        return valueOf3(((leftValue as int)).toDouble() % ((_value as double)));
+        return valueOf(((leftValue as int)).remainder(value as int));
+      } else if (value is double) {
+        return valueOf3(((leftValue as int)).toDouble() % ((value as double)));
       }
     } else if (leftValue is double) {
-      if (_value is int) {
-        return valueOf3(((leftValue as double)) % ((_value as int)).toDouble());
-      } else if (_value is double) {
-        return valueOf3(((leftValue as double)) % ((_value as double)));
+      if (value is int) {
+        return valueOf3(((leftValue as double)) % ((value as int)).toDouble());
+      } else if (value is double) {
+        return valueOf3(((leftValue as double)) % ((value as double)));
       }
     }
     return error(node);
@@ -1568,15 +1536,15 @@
     Object leftValue = leftOperand2.value;
     if (leftValue == null) {
       return error(node.leftOperand);
-    } else if (_value == null) {
+    } else if (value == null) {
       return error(node.rightOperand);
     } else if (leftValue is int) {
-      if (_value is int) {
-        return valueOf(((leftValue as int)) << ((_value as int)));
+      if (value is int) {
+        return valueOf(((leftValue as int)) << ((value as int)));
       }
       return error(node.rightOperand);
     }
-    if (_value is int) {
+    if (value is int) {
       return error(node.leftOperand);
     }
     return union(error(node.leftOperand), error(node.rightOperand));
@@ -1592,15 +1560,15 @@
     Object leftValue = leftOperand2.value;
     if (leftValue == null) {
       return error(node.leftOperand);
-    } else if (_value == null) {
+    } else if (value == null) {
       return error(node.rightOperand);
     } else if (leftValue is int) {
-      if (_value is int) {
-        return valueOf(((leftValue as int)) >> ((_value as int)));
+      if (value is int) {
+        return valueOf(((leftValue as int)) >> ((value as int)));
       }
       return error(node.rightOperand);
     }
-    if (_value is int) {
+    if (value is int) {
       return error(node.leftOperand);
     }
     return union(error(node.leftOperand), error(node.rightOperand));
@@ -1618,19 +1586,19 @@
     Object leftValue = leftOperand2.value;
     if (leftValue == null) {
       return error(node.leftOperand);
-    } else if (_value == null) {
+    } else if (value == null) {
       return error(node.rightOperand);
     } else if (leftValue is int) {
-      if (_value is int) {
-        return valueOf(((leftValue as int)) * (_value as int));
-      } else if (_value is double) {
-        return valueOf3(((leftValue as int)).toDouble() * ((_value as double)));
+      if (value is int) {
+        return valueOf(((leftValue as int)) * (value as int));
+      } else if (value is double) {
+        return valueOf3(((leftValue as int)).toDouble() * ((value as double)));
       }
     } else if (leftValue is double) {
-      if (_value is int) {
-        return valueOf3(((leftValue as double)) * ((_value as int)).toDouble());
-      } else if (_value is double) {
-        return valueOf3(((leftValue as double)) * ((_value as double)));
+      if (value is int) {
+        return valueOf3(((leftValue as double)) * ((value as int)).toDouble());
+      } else if (value is double) {
+        return valueOf3(((leftValue as double)) * ((value as double)));
       }
     }
     return error(node);
@@ -1673,17 +1641,17 @@
   /**
    * Checks if this result has type "int", with known or unknown value.
    */
-  bool get isAnyInt => identical(this, RESULT_INT) || _value is int;
+  bool get isAnyInt => identical(this, RESULT_INT) || value is int;
 
   /**
    * Checks if this result has one of the types - "bool", "num" or "string"; or may be `null`.
    */
-  bool get isAnyNullBoolNumString => isNull || isAnyBool || isAnyNum || _value is String;
+  bool get isAnyNullBoolNumString => isNull || isAnyBool || isAnyNum || value is String;
 
   /**
    * Checks if this result has type "num", with known or unknown value.
    */
-  bool get isAnyNum => isSomeNum || _value is num;
+  bool get isAnyNum => isSomeNum || value is num;
 
   /**
    * Checks if this result has type "bool", exact value of which we don't know.
diff --git a/pkg/analyzer_experimental/lib/src/generated/element.dart b/pkg/analyzer_experimental/lib/src/generated/element.dart
index 254fdbd..031dc2a 100644
--- a/pkg/analyzer_experimental/lib/src/generated/element.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/element.dart
@@ -640,7 +640,7 @@
   /**
    * The name displayed in the UI for this kind of element.
    */
-  String _displayName;
+  String displayName;
 
   /**
    * Initialize a newly created element kind to have the given display name.
@@ -648,15 +648,8 @@
    * @param displayName the name displayed in the UI for this kind of element
    */
   ElementKind(String name, int ordinal, String displayName) : super(name, ordinal) {
-    this._displayName = displayName;
+    this.displayName = displayName;
   }
-
-  /**
-   * Return the name displayed in the UI for this kind of element.
-   *
-   * @return the name of this [ElementKind] to display in UI.
-   */
-  String get displayName => _displayName;
 }
 /**
  * The interface `ElementLocation` defines the behavior of objects that represent the location
@@ -1722,13 +1715,13 @@
    * The element based on propagated type information, or `null` if the AST structure has not
    * been resolved or if this identifier could not be resolved.
    */
-  ExecutableElement _propagatedElement;
+  ExecutableElement propagatedElement;
 
   /**
    * The element associated with this identifier based on static type information, or `null`
    * if the AST structure has not been resolved or if this identifier could not be resolved.
    */
-  ExecutableElement _staticElement;
+  ExecutableElement staticElement;
 
   /**
    * Create the [AuxiliaryElements] with a static and propagated [ExecutableElement].
@@ -1737,19 +1730,9 @@
    * @param propagatedElement the propagated element
    */
   AuxiliaryElements(ExecutableElement staticElement, ExecutableElement propagatedElement) {
-    this._staticElement = staticElement;
-    this._propagatedElement = propagatedElement;
+    this.staticElement = staticElement;
+    this.propagatedElement = propagatedElement;
   }
-
-  /**
-   * Get the propagated element.
-   */
-  ExecutableElement get propagatedElement => _propagatedElement;
-
-  /**
-   * Get the static element.
-   */
-  ExecutableElement get staticElement => _staticElement;
 }
 /**
  * Instances of the class `ClassElementImpl` implement a `ClassElement`.
@@ -2631,7 +2614,7 @@
   /**
    * The type defined by this element.
    */
-  DynamicTypeImpl _type;
+  DynamicTypeImpl type;
 
   /**
    * Initialize a newly created instance of this class. Instances of this class should <b>not</b> be
@@ -2643,22 +2626,6 @@
   }
   accept(ElementVisitor visitor) => null;
   ElementKind get kind => ElementKind.DYNAMIC;
-
-  /**
-   * Return the type defined by this element.
-   *
-   * @return the type defined by this element
-   */
-  DynamicTypeImpl get type => _type;
-
-  /**
-   * Set the type defined by this element to the given type.
-   *
-   * @param type the type defined by this element
-   */
-  void set type(DynamicTypeImpl type2) {
-    this._type = type2;
-  }
 }
 /**
  * Instances of the class `ElementAnnotationImpl` implement an [ElementAnnotation].
@@ -2927,7 +2894,7 @@
   /**
    * The path to the element whose location is represented by this object.
    */
-  List<String> _components;
+  List<String> components;
 
   /**
    * The character used to separate components in the encoded form.
@@ -2946,7 +2913,7 @@
       components.insert(0, ((ancestor as ElementImpl)).identifier);
       ancestor = ancestor.enclosingElement;
     }
-    this._components = new List.from(components);
+    this.components = new List.from(components);
   }
 
   /**
@@ -2955,53 +2922,46 @@
    * @param encoding the encoded form of a location
    */
   ElementLocationImpl.con2(String encoding) {
-    this._components = decode(encoding);
+    this.components = decode(encoding);
   }
   bool operator ==(Object object) {
     if (object is! ElementLocationImpl) {
       return false;
     }
     ElementLocationImpl location = object as ElementLocationImpl;
-    List<String> otherComponents = location._components;
-    int length = _components.length;
+    List<String> otherComponents = location.components;
+    int length = components.length;
     if (otherComponents.length != length) {
       return false;
     }
-    if (length > 0 && !equalSourceComponents(_components[0], otherComponents[0])) {
+    if (length > 0 && !equalSourceComponents(components[0], otherComponents[0])) {
       return false;
     }
-    if (length > 1 && !equalSourceComponents(_components[1], otherComponents[1])) {
+    if (length > 1 && !equalSourceComponents(components[1], otherComponents[1])) {
       return false;
     }
     for (int i = 2; i < length; i++) {
-      if (_components[i] != otherComponents[i]) {
+      if (components[i] != otherComponents[i]) {
         return false;
       }
     }
     return true;
   }
-
-  /**
-   * Return the path to the element whose location is represented by this object.
-   *
-   * @return the path to the element whose location is represented by this object
-   */
-  List<String> get components => _components;
   String get encoding {
     JavaStringBuilder builder = new JavaStringBuilder();
-    int length = _components.length;
+    int length = components.length;
     for (int i = 0; i < length; i++) {
       if (i > 0) {
         builder.appendChar(_SEPARATOR_CHAR);
       }
-      encode(builder, _components[i]);
+      encode(builder, components[i]);
     }
     return builder.toString();
   }
   int get hashCode {
     int result = 1;
-    for (int i = 0; i < _components.length; i++) {
-      String component = _components[i];
+    for (int i = 0; i < components.length; i++) {
+      String component = components[i];
       int componentHash;
       if (i <= 1) {
         componentHash = hashSourceComponent(component);
@@ -3948,13 +3908,13 @@
   /**
    * A flag indicating whether this label is associated with a `switch` statement.
    */
-  bool _onSwitchStatement = false;
+  bool isOnSwitchStatement = false;
 
   /**
    * A flag indicating whether this label is associated with a `switch` member (`case`
    * or `default`).
    */
-  bool _onSwitchMember = false;
+  bool isOnSwitchMember = false;
 
   /**
    * An empty array of label elements.
@@ -3970,27 +3930,12 @@
    * @param onSwitchMember `true` if this label is associated with a `switch` member
    */
   LabelElementImpl(Identifier name, bool onSwitchStatement, bool onSwitchMember) : super.con1(name) {
-    this._onSwitchStatement = onSwitchStatement;
-    this._onSwitchMember = onSwitchMember;
+    this.isOnSwitchStatement = onSwitchStatement;
+    this.isOnSwitchMember = onSwitchMember;
   }
   accept(ElementVisitor visitor) => visitor.visitLabelElement(this);
   ExecutableElement get enclosingElement => super.enclosingElement as ExecutableElement;
   ElementKind get kind => ElementKind.LABEL;
-
-  /**
-   * Return `true` if this label is associated with a `switch` member (`case` or
-   * `default`).
-   *
-   * @return `true` if this label is associated with a `switch` member
-   */
-  bool get isOnSwitchMember => _onSwitchMember;
-
-  /**
-   * Return `true` if this label is associated with a `switch` statement.
-   *
-   * @return `true` if this label is associated with a `switch` statement
-   */
-  bool get isOnSwitchStatement => _onSwitchStatement;
 }
 /**
  * Instances of the class `LibraryElementImpl` implement a `LibraryElement`.
@@ -5705,14 +5650,7 @@
   /**
    * The unique instance of this class.
    */
-  static BottomTypeImpl _INSTANCE = new BottomTypeImpl();
-
-  /**
-   * Return the unique instance of this class.
-   *
-   * @return the unique instance of this class
-   */
-  static BottomTypeImpl get instance => _INSTANCE;
+  static final BottomTypeImpl instance = new BottomTypeImpl();
 
   /**
    * Prevent the creation of instances of this class.
@@ -5734,14 +5672,7 @@
   /**
    * The unique instance of this class.
    */
-  static DynamicTypeImpl _INSTANCE = new DynamicTypeImpl();
-
-  /**
-   * Return the unique instance of this class.
-   *
-   * @return the unique instance of this class
-   */
-  static DynamicTypeImpl get instance => _INSTANCE;
+  static final DynamicTypeImpl instance = new DynamicTypeImpl();
 
   /**
    * Prevent the creation of instances of this class.
@@ -6937,14 +6868,7 @@
   /**
    * The unique instance of this class.
    */
-  static VoidTypeImpl _INSTANCE = new VoidTypeImpl();
-
-  /**
-   * Return the unique instance of this class.
-   *
-   * @return the unique instance of this class
-   */
-  static VoidTypeImpl get instance => _INSTANCE;
+  static final VoidTypeImpl instance = new VoidTypeImpl();
 
   /**
    * Prevent the creation of instances of this class.
diff --git a/pkg/analyzer_experimental/lib/src/generated/engine.dart b/pkg/analyzer_experimental/lib/src/generated/engine.dart
index 909e4f7..eb510b8 100644
--- a/pkg/analyzer_experimental/lib/src/generated/engine.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/engine.dart
@@ -40,14 +40,7 @@
   /**
    * The unique instance of this class.
    */
-  static AnalysisEngine _UniqueInstance = new AnalysisEngine();
-
-  /**
-   * Return the unique instance of this class.
-   *
-   * @return the unique instance of this class
-   */
-  static AnalysisEngine get instance => _UniqueInstance;
+  static final AnalysisEngine instance = new AnalysisEngine();
 
   /**
    * Return `true` if the given file name is assumed to contain Dart source code.
@@ -82,16 +75,26 @@
   Logger _logger = Logger.NULL;
 
   /**
+   * A flag indicating whether the new analysis context should be created.
+   */
+  bool _useExperimentalContext = false;
+
+  /**
    * Create a new context in which analysis can be performed.
    *
    * @return the analysis context that was created
    */
   AnalysisContext createAnalysisContext() {
     if (Instrumentation.isNullLogger) {
+      if (_useExperimentalContext) {
+        return new DelegatingAnalysisContextImpl2();
+      }
       return new DelegatingAnalysisContextImpl();
-    } else {
-      return new InstrumentedAnalysisContextImpl.con1(new DelegatingAnalysisContextImpl());
     }
+    if (_useExperimentalContext) {
+      return new InstrumentedAnalysisContextImpl.con1(new DelegatingAnalysisContextImpl2());
+    }
+    return new InstrumentedAnalysisContextImpl.con1(new DelegatingAnalysisContextImpl());
   }
 
   /**
@@ -102,6 +105,13 @@
   Logger get logger => _logger;
 
   /**
+   * Return `true` if the new analysis context should be created.
+   *
+   * @return `true` if the new analysis context should be created
+   */
+  bool get useExperimentalContext => _useExperimentalContext;
+
+  /**
    * Set the logger that should receive information about errors within the analysis engine to the
    * given logger.
    *
@@ -111,6 +121,15 @@
   void set logger(Logger logger2) {
     this._logger = logger2 == null ? Logger.NULL : logger2;
   }
+
+  /**
+   * Set whether the new analysis context should be created to the given flag.
+   *
+   * @param use `true` if the new analysis context should be created
+   */
+  void set useExperimentalContext(bool use) {
+    _useExperimentalContext = use;
+  }
 }
 /**
  * Container with statistics about the [AnalysisContext].
@@ -523,6 +542,8 @@
 
   /**
    * Parse and resolve a single source within the given context to produce a fully resolved AST.
+   * Return the resolved AST structure, or `null` if the source could not be either parsed or
+   * resolved.
    *
    * @param unitSource the source to be parsed and resolved
    * @param librarySource the source of the defining compilation unit of the library containing the
@@ -705,22 +726,22 @@
   /**
    * A list containing the sources that have been added.
    */
-  List<Source> _added2 = new List<Source>();
+  final List<Source> added3 = new List<Source>();
 
   /**
    * A list containing the sources that have been changed.
    */
-  List<Source> _changed2 = new List<Source>();
+  final List<Source> changed3 = new List<Source>();
 
   /**
    * A list containing the sources that have been removed.
    */
-  List<Source> _removed2 = new List<Source>();
+  final List<Source> removed3 = new List<Source>();
 
   /**
    * A list containing the source containers specifying additional sources that have been removed.
    */
-  List<SourceContainer> _removedContainers = new List<SourceContainer>();
+  final List<SourceContainer> removedContainers = new List<SourceContainer>();
 
   /**
    * Record that the specified source has been added and that it's content is the default contents
@@ -729,7 +750,7 @@
    * @param source the source that was added
    */
   void added(Source source) {
-    _added2.add(source);
+    added3.add(source);
   }
 
   /**
@@ -739,52 +760,24 @@
    * @param source the source that was changed
    */
   void changed(Source source) {
-    _changed2.add(source);
+    changed3.add(source);
   }
 
   /**
-   * Return a collection of the sources that have been added.
-   *
-   * @return a collection of the sources that have been added
-   */
-  List<Source> get added3 => _added2;
-
-  /**
-   * Return a collection of sources that have been changed.
-   *
-   * @return a collection of sources that have been changed
-   */
-  List<Source> get changed3 => _changed2;
-
-  /**
-   * Return a list containing the sources that were removed.
-   *
-   * @return a list containing the sources that were removed
-   */
-  List<Source> get removed => _removed2;
-
-  /**
-   * Return a list containing the source containers that were removed.
-   *
-   * @return a list containing the source containers that were removed
-   */
-  List<SourceContainer> get removedContainers => _removedContainers;
-
-  /**
    * Return `true` if this change set does not contain any changes.
    *
    * @return `true` if this change set does not contain any changes
    */
-  bool get isEmpty => _added2.isEmpty && _changed2.isEmpty && _removed2.isEmpty && _removedContainers.isEmpty;
+  bool get isEmpty => added3.isEmpty && changed3.isEmpty && removed3.isEmpty && removedContainers.isEmpty;
 
   /**
    * Record that the specified source has been removed.
    *
    * @param source the source that was removed
    */
-  void removed3(Source source) {
+  void removed(Source source) {
     if (source != null) {
-      _removed2.add(source);
+      removed3.add(source);
     }
   }
 
@@ -795,7 +788,7 @@
    */
   void removedContainer(SourceContainer container) {
     if (container != null) {
-      _removedContainers.add(container);
+      removedContainers.add(container);
     }
   }
 }
@@ -917,6 +910,15 @@
   }
 
   /**
+   * Remove all information related to the given source from this cache.
+   *
+   * @param source the source to be removed
+   */
+  void remove(Source source) {
+    _sourceMap.remove(source);
+  }
+
+  /**
    * Set the sources for which data should not be flushed to the given array.
    *
    * @param sources the sources for which data should not be flushed
@@ -975,6 +977,68 @@
   }
 }
 /**
+ * The enumeration `CacheState` defines the possible states of cached data.
+ */
+class CacheState extends Enum<CacheState> {
+
+  /**
+   * The data is not in the cache and the last time an attempt was made to compute the data an
+   * exception occurred, making it pointless to attempt.
+   *
+   * Valid Transitions:
+   *
+   * * [INVALID] if a source was modified that might cause the data to be computable
+   *
+   */
+  static final CacheState ERROR = new CacheState('ERROR', 0);
+
+  /**
+   * The data is not in the cache because it was flushed from the cache in order to control memory
+   * usage. If the data is recomputed, results do not need to be reported.
+   *
+   * Valid Transitions:
+   *
+   * * [IN_PROCESS] if the data is being recomputed
+   * * [INVALID] if a source was modified that causes the data to need to be recomputed
+   *
+   */
+  static final CacheState FLUSHED = new CacheState('FLUSHED', 1);
+
+  /**
+   * The data might or might not be in the cache but is in the process of being recomputed.
+   *
+   * Valid Transitions:
+   *
+   * * [ERROR] if an exception occurred while trying to compute the data
+   * * [VALID] if the data was successfully computed and stored in the cache
+   *
+   */
+  static final CacheState IN_PROCESS = new CacheState('IN_PROCESS', 2);
+
+  /**
+   * The data is not in the cache and needs to be recomputed so that results can be reported.
+   *
+   * Valid Transitions:
+   *
+   * * [IN_PROCESS] if an attempt is being made to recompute the data
+   *
+   */
+  static final CacheState INVALID = new CacheState('INVALID', 3);
+
+  /**
+   * The data is in the cache and up-to-date.
+   *
+   * Valid Transitions:
+   *
+   * * [FLUSHED] if the data is removed in order to manage memory usage
+   * * [INVALID] if a source was modified in such a way as to invalidate the previous data
+   *
+   */
+  static final CacheState VALID = new CacheState('VALID', 4);
+  static final List<CacheState> values = [ERROR, FLUSHED, IN_PROCESS, INVALID, VALID];
+  CacheState(String name, int ordinal) : super(name, ordinal);
+}
+/**
  * The interface `DartEntry` defines the behavior of objects that maintain the information
  * cached by an analysis context about an individual Dart file.
  *
@@ -1501,6 +1565,34 @@
   }
 
   /**
+   * Record that an in-process parse has stopped without recording results because the results were
+   * invalidated before they could be recorded.
+   */
+  void recordParseNotInProcess() {
+    if (identical(getState(SourceEntry.LINE_INFO), CacheState.IN_PROCESS)) {
+      setState(SourceEntry.LINE_INFO, CacheState.INVALID);
+    }
+    if (identical(_sourceKindState, CacheState.IN_PROCESS)) {
+      _sourceKindState = CacheState.INVALID;
+    }
+    if (identical(_parseErrorsState, CacheState.IN_PROCESS)) {
+      _parseErrorsState = CacheState.INVALID;
+    }
+    if (identical(_parsedUnitState, CacheState.IN_PROCESS)) {
+      _parsedUnitState = CacheState.INVALID;
+    }
+    if (identical(_exportedLibrariesState, CacheState.IN_PROCESS)) {
+      _exportedLibrariesState = CacheState.INVALID;
+    }
+    if (identical(_importedLibrariesState, CacheState.IN_PROCESS)) {
+      _importedLibrariesState = CacheState.INVALID;
+    }
+    if (identical(_includedPartsState, CacheState.IN_PROCESS)) {
+      _includedPartsState = CacheState.INVALID;
+    }
+  }
+
+  /**
    * Record that an error occurred while attempting to scan or parse the entry represented by this
    * entry. This will set the state of all resolution-based information as being in error, but will
    * not change the state of any parse results.
@@ -1517,6 +1609,26 @@
   }
 
   /**
+   * Record that an in-process parse has stopped without recording results because the results were
+   * invalidated before they could be recorded.
+   */
+  void recordResolutionNotInProcess() {
+    if (identical(_elementState, CacheState.IN_PROCESS)) {
+      _elementState = CacheState.INVALID;
+    }
+    if (identical(_clientServerState, CacheState.IN_PROCESS)) {
+      _clientServerState = CacheState.INVALID;
+    }
+    if (identical(_launchableState, CacheState.IN_PROCESS)) {
+      _launchableState = CacheState.INVALID;
+    }
+    if (identical(_publicNamespaceState, CacheState.IN_PROCESS)) {
+      _publicNamespaceState = CacheState.INVALID;
+    }
+    _resolutionState.recordResolutionNotInProcess();
+  }
+
+  /**
    * Remove any resolution information associated with this compilation unit being part of the given
    * library, presumably because it is no longer part of the library.
    *
@@ -1910,6 +2022,25 @@
   }
 
   /**
+   * Record that an in-process parse has stopped without recording results because the results
+   * were invalidated before they could be recorded.
+   */
+  void recordResolutionNotInProcess() {
+    if (identical(_resolvedUnitState, CacheState.IN_PROCESS)) {
+      _resolvedUnitState = CacheState.INVALID;
+    }
+    if (identical(_resolutionErrorsState, CacheState.IN_PROCESS)) {
+      _resolutionErrorsState = CacheState.INVALID;
+    }
+    if (identical(_hintsState, CacheState.IN_PROCESS)) {
+      _hintsState = CacheState.INVALID;
+    }
+    if (_nextState != null) {
+      _nextState.recordResolutionNotInProcess();
+    }
+  }
+
+  /**
    * Write a textual representation of this state to the given builder. The result will only be
    * used for debugging purposes.
    *
@@ -2099,7 +2230,19 @@
   }
 
   /**
-   * Invalidate all of the resolution information associated with the compilation unit.
+   * Invalidate all of the information associated with the HTML file.
+   */
+  void invalidateAllInformation() {
+    setState(SourceEntry.LINE_INFO, CacheState.INVALID);
+    _parsedUnit = null;
+    _parsedUnitState = CacheState.INVALID;
+    _referencedLibraries = Source.EMPTY_ARRAY;
+    _referencedLibrariesState = CacheState.INVALID;
+    invalidateAllResolutionInformation();
+  }
+
+  /**
+   * Invalidate all of the resolution information associated with the HTML file.
    */
   void invalidateAllResolutionInformation() {
     _element = null;
@@ -2109,6 +2252,15 @@
     _hints = AnalysisError.NO_ERRORS;
     _hintsState = CacheState.INVALID;
   }
+
+  /**
+   * Record that an error was encountered while attempting to resolve the source associated with
+   * this entry.
+   */
+  void recordResolutionError() {
+    setState(HtmlEntry.ELEMENT, CacheState.ERROR);
+    setState(HtmlEntry.RESOLUTION_ERRORS, CacheState.ERROR);
+  }
   void setState(DataDescriptor descriptor, CacheState state) {
     if (identical(descriptor, HtmlEntry.ELEMENT)) {
       _element = updatedValue(state, _element, null);
@@ -2368,7 +2520,13 @@
     Iterable<AnalysisContentStatistics_CacheRow> items = _dataMap.values;
     return new List.from(items);
   }
-  void putCacheItem(DataDescriptor rowDesc, CacheState state) {
+  void putCacheItem(DartEntry dartEntry, DataDescriptor descriptor) {
+    putCacheItem3(descriptor, dartEntry.getState(descriptor));
+  }
+  void putCacheItem2(DartEntry dartEntry, Source librarySource, DataDescriptor descriptor) {
+    putCacheItem3(descriptor, dartEntry.getState2(descriptor, librarySource));
+  }
+  void putCacheItem3(DataDescriptor rowDesc, CacheState state) {
     String rowName = rowDesc.toString();
     AnalysisContentStatisticsImpl_CacheRowImpl row = _dataMap[rowName] as AnalysisContentStatisticsImpl_CacheRowImpl;
     if (row == null) {
@@ -2426,7 +2584,7 @@
    * object.
    */
   static void putStatCacheItem(AnalysisContentStatisticsImpl statistics, DartEntry dartEntry, Source librarySource, DataDescriptor key) {
-    statistics.putCacheItem(key, dartEntry.getState2(key, librarySource));
+    statistics.putCacheItem3(key, dartEntry.getState2(key, librarySource));
   }
 
   /**
@@ -2434,7 +2592,7 @@
    * statistics object.
    */
   static void putStatCacheItem2(AnalysisContentStatisticsImpl statistics, SourceEntry entry, DataDescriptor key) {
-    statistics.putCacheItem(key, entry.getState(key));
+    statistics.putCacheItem3(key, entry.getState(key));
   }
 
   /**
@@ -2515,6 +2673,15 @@
    * in Dart.
    */
   static String _TYPE_DART = "application/dart";
+
+  /**
+   * Initialize a newly created analysis context.
+   */
+  AnalysisContextImpl() : super() {
+    if (AnalysisEngine.instance.useExperimentalContext) {
+      throw new RuntimeException("Should not be creating an instance of AnalysisContextImpl");
+    }
+  }
   void addSourceInfo(Source source, SourceEntry info) {
     _sourceMap[source] = info;
   }
@@ -2523,7 +2690,7 @@
       return;
     }
     {
-      List<Source> removedSources = new List<Source>.from(changeSet.removed);
+      List<Source> removedSources = new List<Source>.from(changeSet.removed3);
       for (SourceContainer container in changeSet.removedContainers) {
         addSourcesInContainer(removedSources, container);
       }
@@ -2686,6 +2853,18 @@
       internalParseDart(source);
     }
   }
+  ResolvableHtmlUnit computeResolvableHtmlUnit(Source source) {
+    HtmlEntry htmlEntry = getReadableHtmlEntry(source);
+    if (htmlEntry == null) {
+      throw new AnalysisException.con1("computeResolvableHtmlUnit invoked for non-HTML file: ${source.fullName}");
+    }
+    htmlEntry = internalCacheHtmlParseData(source, htmlEntry, [HtmlEntry.PARSED_UNIT]);
+    HtmlUnit unit = htmlEntry.getValue(HtmlEntry.PARSED_UNIT);
+    if (unit == null) {
+      throw new AnalysisException.con1("Internal error: computeResolvableHtmlUnit could not parse ${source.fullName}");
+    }
+    return new ResolvableHtmlUnit(htmlEntry.modificationTime, unit);
+  }
   AnalysisContext extractContext(SourceContainer container) => extractContextInto(container, AnalysisEngine.instance.createAnalysisContext() as InternalAnalysisContext);
   InternalAnalysisContext extractContextInto(SourceContainer container, InternalAnalysisContext newContext) {
     List<Source> sourcesToRemove = new List<Source>();
@@ -4750,7 +4929,7 @@
   /**
    * The time at which the contents of the source were last modified.
    */
-  int _modificationTime = 0;
+  int modificationTime = 0;
 
   /**
    * The first token in the token stream.
@@ -4761,13 +4940,6 @@
    * The line start information that was produced.
    */
   List<int> _lineStarts;
-
-  /**
-   * Return the time at which the contents of the source were last modified.
-   *
-   * @return the time at which the contents of the source were last modified
-   */
-  int get modificationTime => _modificationTime;
 }
 class RecursiveXmlVisitor_6 extends RecursiveXmlVisitor<Object> {
   final AnalysisContextImpl AnalysisContextImpl_this;
@@ -4814,18 +4986,1771 @@
   Source_ContentReceiver_7(this.source, this.errorListener, this.result);
   void accept(CharBuffer contents, int modificationTime2) {
     CharBufferScanner scanner = new CharBufferScanner(source, contents, errorListener);
-    result._modificationTime = modificationTime2;
+    result.modificationTime = modificationTime2;
     result._token = scanner.tokenize();
     result._lineStarts = scanner.lineStarts;
   }
   void accept2(String contents, int modificationTime2) {
     StringScanner scanner = new StringScanner(source, contents, errorListener);
-    result._modificationTime = modificationTime2;
+    result.modificationTime = modificationTime2;
     result._token = scanner.tokenize();
     result._lineStarts = scanner.lineStarts;
   }
 }
 /**
+ * Instances of the class `AnalysisContextImpl` implement an [AnalysisContext].
+ *
+ * @coverage dart.engine
+ */
+class AnalysisContextImpl2 implements InternalAnalysisContext {
+
+  /**
+   * The set of analysis options controlling the behavior of this context.
+   */
+  AnalysisOptions _options = new AnalysisOptionsImpl();
+
+  /**
+   * The source factory used to create the sources that can be analyzed in this context.
+   */
+  SourceFactory _sourceFactory;
+
+  /**
+   * A table mapping the sources known to the context to the information known about the source.
+   */
+  AnalysisCache _cache = new AnalysisCache(_MAX_CACHE_SIZE);
+
+  /**
+   * A table mapping sources to the change notices that are waiting to be returned related to that
+   * source.
+   */
+  Map<Source, ChangeNoticeImpl> _pendingNotices = new Map<Source, ChangeNoticeImpl>();
+
+  /**
+   * The object used to synchronize access to all of the caches. The rules related to the use of
+   * this lock object are
+   *
+   * * no analysis work is done while holding the lock, and
+   * * no analysis results can be recorded unless we have obtained the lock and validated that the
+   * results are for the same version (modification time) of the source as our current cache
+   * content.
+   *
+   */
+  Object _cacheLock = new Object();
+
+  /**
+   * The object used to record the results of performing an analysis task.
+   */
+  AnalysisContextImpl2_AnalysisTaskResultRecorder _resultRecorder;
+
+  /**
+   * The maximum number of sources for which data should be kept in the cache.
+   */
+  static int _MAX_CACHE_SIZE = 64;
+
+  /**
+   * The maximum number of sources that can be on the priority list. This <b>must</b> be less than
+   * the [MAX_CACHE_SIZE] in order to prevent an infinite loop in performAnalysisTask().
+   *
+   * @see #setAnalysisPriorityOrder(List)
+   */
+  static int _MAX_PRIORITY_LIST_SIZE = _MAX_CACHE_SIZE - 4;
+
+  /**
+   * Initialize a newly created analysis context.
+   */
+  AnalysisContextImpl2() : super() {
+    _resultRecorder = new AnalysisContextImpl2_AnalysisTaskResultRecorder(this);
+  }
+  void addSourceInfo(Source source, SourceEntry info) {
+    _cache.put(source, info);
+  }
+  void applyChanges(ChangeSet changeSet) {
+    if (changeSet.isEmpty) {
+      return;
+    }
+    {
+      List<Source> removedSources = new List<Source>.from(changeSet.removed3);
+      for (SourceContainer container in changeSet.removedContainers) {
+        addSourcesInContainer(removedSources, container);
+      }
+      bool addedDartSource = false;
+      for (Source source in changeSet.added3) {
+        if (sourceAvailable(source)) {
+          addedDartSource = true;
+        }
+      }
+      for (Source source in changeSet.changed3) {
+        sourceChanged(source);
+      }
+      for (Source source in removedSources) {
+        sourceRemoved(source);
+      }
+      if (addedDartSource) {
+        for (MapEntry<Source, SourceEntry> mapEntry in _cache.entrySet()) {
+          if (!mapEntry.getKey().isInSystemLibrary && mapEntry.getValue() is DartEntry) {
+            DartEntryImpl dartCopy = ((mapEntry.getValue() as DartEntry)).writableCopy;
+            dartCopy.invalidateAllResolutionInformation();
+            mapEntry.setValue(dartCopy);
+          }
+        }
+      }
+    }
+  }
+  String computeDocumentationComment(Element element) {
+    if (element == null) {
+      return null;
+    }
+    Source source = element.source;
+    if (source == null) {
+      return null;
+    }
+    CompilationUnit unit = parseCompilationUnit(source);
+    if (unit == null) {
+      return null;
+    }
+    NodeLocator locator = new NodeLocator.con1(element.nameOffset);
+    ASTNode nameNode = locator.searchWithin(unit);
+    while (nameNode != null) {
+      if (nameNode is AnnotatedNode) {
+        Comment comment = ((nameNode as AnnotatedNode)).documentationComment;
+        if (comment == null) {
+          return null;
+        }
+        JavaStringBuilder builder = new JavaStringBuilder();
+        List<Token> tokens = comment.tokens;
+        for (int i = 0; i < tokens.length; i++) {
+          if (i > 0) {
+            builder.append('\n');
+          }
+          builder.append(tokens[i].lexeme);
+        }
+        return builder.toString();
+      }
+      nameNode = nameNode.parent;
+    }
+    return null;
+  }
+  List<AnalysisError> computeErrors(Source source) {
+    SourceEntry sourceEntry = getReadableSourceEntry(source);
+    if (sourceEntry is DartEntry) {
+      List<AnalysisError> errors = new List<AnalysisError>();
+      DartEntry dartEntry = sourceEntry as DartEntry;
+      ListUtilities.addAll(errors, getDartParseData(source, dartEntry, DartEntry.PARSE_ERRORS));
+      dartEntry = getReadableDartEntry(source);
+      if (identical(dartEntry.getValue(DartEntry.SOURCE_KIND), SourceKind.LIBRARY)) {
+        ListUtilities.addAll(errors, getDartResolutionData(source, source, dartEntry, DartEntry.RESOLUTION_ERRORS));
+      } else {
+        List<Source> libraries = getLibrariesContaining(source);
+        for (Source librarySource in libraries) {
+          ListUtilities.addAll(errors, getDartResolutionData(source, librarySource, dartEntry, DartEntry.RESOLUTION_ERRORS));
+        }
+      }
+      if (errors.isEmpty) {
+        return AnalysisError.NO_ERRORS;
+      }
+      return new List.from(errors);
+    } else if (sourceEntry is HtmlEntry) {
+      HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
+      return getHtmlResolutionData2(source, htmlEntry, HtmlEntry.RESOLUTION_ERRORS);
+    }
+    return AnalysisError.NO_ERRORS;
+  }
+  List<Source> computeExportedLibraries(Source source) => getDartParseData2(source, DartEntry.EXPORTED_LIBRARIES, Source.EMPTY_ARRAY);
+  HtmlElement computeHtmlElement(Source source) => getHtmlResolutionData(source, HtmlEntry.ELEMENT, null);
+  List<Source> computeImportedLibraries(Source source) => getDartParseData2(source, DartEntry.IMPORTED_LIBRARIES, Source.EMPTY_ARRAY);
+  SourceKind computeKindOf(Source source) {
+    SourceEntry sourceEntry = getReadableSourceEntry(source);
+    if (sourceEntry == null) {
+      return SourceKind.UNKNOWN;
+    } else if (sourceEntry is DartEntry) {
+      try {
+        return getDartParseData(source, sourceEntry as DartEntry, DartEntry.SOURCE_KIND);
+      } on AnalysisException catch (exception) {
+        return SourceKind.UNKNOWN;
+      }
+    }
+    return sourceEntry.kind;
+  }
+  LibraryElement computeLibraryElement(Source source) => getDartResolutionData2(source, source, DartEntry.ELEMENT, null);
+  LineInfo computeLineInfo(Source source) {
+    SourceEntry sourceEntry = getReadableSourceEntry(source);
+    if (sourceEntry is HtmlEntry) {
+      return getHtmlParseData(source, SourceEntry.LINE_INFO, null);
+    } else if (sourceEntry is DartEntry) {
+      return getDartParseData2(source, SourceEntry.LINE_INFO, null);
+    }
+    return null;
+  }
+  ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) {
+    while (true) {
+      {
+        DartEntry dartEntry = getReadableDartEntry(source);
+        if (dartEntry == null) {
+          throw new AnalysisException.con1("computeResolvableCompilationUnit for non-Dart: ${source.fullName}");
+        }
+        if (identical(dartEntry.getState(DartEntry.PARSED_UNIT), CacheState.ERROR)) {
+          throw new AnalysisException.con1("Internal error: computeResolvableCompilationUnit could not parse ${source.fullName}");
+        }
+        DartEntryImpl dartCopy = dartEntry.writableCopy;
+        CompilationUnit unit = dartCopy.resolvableCompilationUnit;
+        if (unit != null) {
+          _cache.put(source, dartCopy);
+          return new ResolvableCompilationUnit(dartCopy.modificationTime, unit);
+        }
+      }
+      cacheDartParseData(source, getReadableDartEntry(source), DartEntry.PARSED_UNIT);
+    }
+  }
+  ResolvableHtmlUnit computeResolvableHtmlUnit(Source source) {
+    HtmlEntry htmlEntry = getReadableHtmlEntry(source);
+    if (htmlEntry == null) {
+      throw new AnalysisException.con1("computeResolvableHtmlUnit invoked for non-HTML file: ${source.fullName}");
+    }
+    htmlEntry = cacheHtmlParseData(source, htmlEntry, HtmlEntry.PARSED_UNIT);
+    HtmlUnit unit = htmlEntry.getValue(HtmlEntry.PARSED_UNIT);
+    if (unit == null) {
+      throw new AnalysisException.con1("Internal error: computeResolvableHtmlUnit could not parse ${source.fullName}");
+    }
+    return new ResolvableHtmlUnit(htmlEntry.modificationTime, unit);
+  }
+  AnalysisContext extractContext(SourceContainer container) => extractContextInto(container, AnalysisEngine.instance.createAnalysisContext() as InternalAnalysisContext);
+  InternalAnalysisContext extractContextInto(SourceContainer container, InternalAnalysisContext newContext) {
+    List<Source> sourcesToRemove = new List<Source>();
+    {
+      for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) {
+        Source source = entry.getKey();
+        if (container.contains(source)) {
+          sourcesToRemove.add(source);
+          newContext.addSourceInfo(source, entry.getValue().writableCopy);
+        }
+      }
+    }
+    return newContext;
+  }
+  AnalysisOptions get analysisOptions => _options;
+  Element getElement(ElementLocation location) {
+    try {
+      List<String> components = ((location as ElementLocationImpl)).components;
+      Source librarySource = computeSourceFromEncoding(components[0]);
+      ElementImpl element = computeLibraryElement(librarySource) as ElementImpl;
+      for (int i = 1; i < components.length; i++) {
+        if (element == null) {
+          return null;
+        }
+        element = element.getChild(components[i]);
+      }
+      return element;
+    } on AnalysisException catch (exception) {
+      return null;
+    }
+  }
+  AnalysisErrorInfo getErrors(Source source) {
+    SourceEntry sourceEntry = getReadableSourceEntry(source);
+    if (sourceEntry is DartEntry) {
+      DartEntry dartEntry = sourceEntry as DartEntry;
+      return new AnalysisErrorInfoImpl(dartEntry.allErrors, dartEntry.getValue(SourceEntry.LINE_INFO));
+    } else if (sourceEntry is HtmlEntry) {
+      HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
+      return new AnalysisErrorInfoImpl(htmlEntry.allErrors, htmlEntry.getValue(SourceEntry.LINE_INFO));
+    }
+    return new AnalysisErrorInfoImpl(AnalysisError.NO_ERRORS, null);
+  }
+  HtmlElement getHtmlElement(Source source) {
+    SourceEntry sourceEntry = getReadableSourceEntry(source);
+    if (sourceEntry is HtmlEntry) {
+      return ((sourceEntry as HtmlEntry)).getValue(HtmlEntry.ELEMENT);
+    }
+    return null;
+  }
+  List<Source> getHtmlFilesReferencing(Source source) {
+    SourceKind sourceKind = getKindOf(source);
+    if (sourceKind == null) {
+      return Source.EMPTY_ARRAY;
+    }
+    {
+      List<Source> htmlSources = new List<Source>();
+      while (true) {
+        if (sourceKind == SourceKind.LIBRARY) {
+        } else if (sourceKind == SourceKind.PART) {
+          List<Source> librarySources = getLibrariesContaining(source);
+          for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) {
+            SourceEntry sourceEntry = entry.getValue();
+            if (identical(sourceEntry.kind, SourceKind.HTML)) {
+              List<Source> referencedLibraries = ((sourceEntry as HtmlEntry)).getValue(HtmlEntry.REFERENCED_LIBRARIES);
+              if (containsAny(referencedLibraries, librarySources)) {
+                htmlSources.add(entry.getKey());
+              }
+            }
+          }
+        }
+        break;
+      }
+      if (htmlSources.isEmpty) {
+        return Source.EMPTY_ARRAY;
+      }
+      return new List.from(htmlSources);
+    }
+  }
+  List<Source> get htmlSources => getSources(SourceKind.HTML);
+  SourceKind getKindOf(Source source) {
+    SourceEntry sourceEntry = getReadableSourceEntry(source);
+    if (sourceEntry == null) {
+      return SourceKind.UNKNOWN;
+    }
+    return sourceEntry.kind;
+  }
+  List<Source> get launchableClientLibrarySources {
+    List<Source> sources = new List<Source>();
+    {
+      for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) {
+        Source source = entry.getKey();
+        SourceEntry sourceEntry = entry.getValue();
+        if (identical(sourceEntry.kind, SourceKind.LIBRARY) && !source.isInSystemLibrary) {
+          sources.add(source);
+        }
+      }
+    }
+    return new List.from(sources);
+  }
+  List<Source> get launchableServerLibrarySources {
+    List<Source> sources = new List<Source>();
+    {
+      for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) {
+        Source source = entry.getKey();
+        SourceEntry sourceEntry = entry.getValue();
+        if (identical(sourceEntry.kind, SourceKind.LIBRARY) && !source.isInSystemLibrary) {
+          sources.add(source);
+        }
+      }
+    }
+    return new List.from(sources);
+  }
+  List<Source> getLibrariesContaining(Source source) {
+    {
+      SourceEntry sourceEntry = _cache.get(source);
+      if (sourceEntry == null || sourceEntry.kind != SourceKind.PART) {
+        return <Source> [source];
+      }
+      List<Source> librarySources = new List<Source>();
+      for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) {
+        sourceEntry = entry.getValue();
+        if (identical(sourceEntry.kind, SourceKind.LIBRARY)) {
+          if (contains(((sourceEntry as DartEntry)).getValue(DartEntry.INCLUDED_PARTS), source)) {
+            librarySources.add(entry.getKey());
+          }
+        }
+      }
+      if (librarySources.isEmpty) {
+        return Source.EMPTY_ARRAY;
+      }
+      return new List.from(librarySources);
+    }
+  }
+  List<Source> getLibrariesDependingOn(Source librarySource) {
+    {
+      List<Source> dependentLibraries = new List<Source>();
+      for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) {
+        SourceEntry sourceEntry = entry.getValue();
+        if (identical(sourceEntry.kind, SourceKind.LIBRARY)) {
+          if (contains(((sourceEntry as DartEntry)).getValue(DartEntry.EXPORTED_LIBRARIES), librarySource)) {
+            dependentLibraries.add(entry.getKey());
+          }
+          if (contains(((sourceEntry as DartEntry)).getValue(DartEntry.IMPORTED_LIBRARIES), librarySource)) {
+            dependentLibraries.add(entry.getKey());
+          }
+        }
+      }
+      if (dependentLibraries.isEmpty) {
+        return Source.EMPTY_ARRAY;
+      }
+      return new List.from(dependentLibraries);
+    }
+  }
+  LibraryElement getLibraryElement(Source source) {
+    SourceEntry sourceEntry = getReadableSourceEntry(source);
+    if (sourceEntry is DartEntry) {
+      return ((sourceEntry as DartEntry)).getValue(DartEntry.ELEMENT);
+    }
+    return null;
+  }
+  List<Source> get librarySources => getSources(SourceKind.LIBRARY);
+  LineInfo getLineInfo(Source source) {
+    SourceEntry sourceEntry = getReadableSourceEntry(source);
+    if (sourceEntry != null) {
+      return sourceEntry.getValue(SourceEntry.LINE_INFO);
+    }
+    return null;
+  }
+  Namespace getPublicNamespace(LibraryElement library) {
+    Source source = library.definingCompilationUnit.source;
+    DartEntry dartEntry = getReadableDartEntry(source);
+    if (dartEntry == null) {
+      return null;
+    }
+    Namespace namespace = null;
+    if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) {
+      namespace = dartEntry.getValue(DartEntry.PUBLIC_NAMESPACE);
+    }
+    if (namespace == null) {
+      NamespaceBuilder builder = new NamespaceBuilder();
+      namespace = builder.createPublicNamespace(library);
+      {
+        dartEntry = getReadableDartEntry(source);
+        if (dartEntry == null) {
+          AnalysisEngine.instance.logger.logError3(new AnalysisException.con1("A Dart file became a non-Dart file: ${source.fullName}"));
+          return null;
+        }
+        if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) {
+          DartEntryImpl dartCopy = getReadableDartEntry(source).writableCopy;
+          dartCopy.setValue(DartEntry.PUBLIC_NAMESPACE, namespace);
+          _cache.put(source, dartCopy);
+        }
+      }
+    }
+    return namespace;
+  }
+  Namespace getPublicNamespace2(Source source) {
+    DartEntry dartEntry = getReadableDartEntry(source);
+    if (dartEntry == null) {
+      return null;
+    }
+    Namespace namespace = dartEntry.getValue(DartEntry.PUBLIC_NAMESPACE);
+    if (namespace == null) {
+      LibraryElement library = computeLibraryElement(source);
+      if (library == null) {
+        return null;
+      }
+      NamespaceBuilder builder = new NamespaceBuilder();
+      namespace = builder.createPublicNamespace(library);
+      {
+        dartEntry = getReadableDartEntry(source);
+        if (dartEntry == null) {
+          throw new AnalysisException.con1("A Dart file became a non-Dart file: ${source.fullName}");
+        }
+        if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) {
+          DartEntryImpl dartCopy = getReadableDartEntry(source).writableCopy;
+          dartCopy.setValue(DartEntry.PUBLIC_NAMESPACE, namespace);
+          _cache.put(source, dartCopy);
+        }
+      }
+    }
+    return namespace;
+  }
+  CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement library) {
+    if (library == null) {
+      return null;
+    }
+    return getResolvedCompilationUnit2(unitSource, library.source);
+  }
+  CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source librarySource) {
+    SourceEntry sourceEntry = getReadableSourceEntry(unitSource);
+    if (sourceEntry is DartEntry) {
+      return ((sourceEntry as DartEntry)).getValue2(DartEntry.RESOLVED_UNIT, librarySource);
+    }
+    return null;
+  }
+  SourceFactory get sourceFactory => _sourceFactory;
+
+  /**
+   * Return a list of the sources that would be processed by [performAnalysisTask]. This
+   * method duplicates, and must therefore be kept in sync with, [getNextTaskAnalysisTask].
+   * This method is intended to be used for testing purposes only.
+   *
+   * @return a list of the sources that would be processed by [performAnalysisTask]
+   */
+  List<Source> get sourcesNeedingProcessing {
+    Set<Source> sources = new Set<Source>();
+    {
+      for (Source source in _cache.priorityOrder) {
+        SourceEntry sourceEntry = _cache.get(source);
+        if (sourceEntry is DartEntry) {
+          DartEntry dartEntry = sourceEntry as DartEntry;
+          CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS);
+          if (identical(parseErrorsState, CacheState.INVALID) || identical(parseErrorsState, CacheState.FLUSHED)) {
+            javaSetAdd(sources, source);
+          }
+          CacheState parseUnitState = dartEntry.getState(DartEntry.PARSED_UNIT);
+          if (identical(parseUnitState, CacheState.INVALID) || identical(parseUnitState, CacheState.FLUSHED)) {
+            javaSetAdd(sources, source);
+          }
+          for (Source librarySource in getLibrariesContaining(source)) {
+            SourceEntry libraryEntry = _cache.get(librarySource);
+            if (libraryEntry is DartEntry) {
+              CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT);
+              if (identical(elementState, CacheState.INVALID) || identical(elementState, CacheState.FLUSHED)) {
+                javaSetAdd(sources, source);
+              }
+              CacheState resolvedUnitState = dartEntry.getState2(DartEntry.RESOLVED_UNIT, librarySource);
+              if (identical(resolvedUnitState, CacheState.INVALID) || identical(resolvedUnitState, CacheState.FLUSHED)) {
+                LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEMENT);
+                if (libraryElement != null) {
+                  javaSetAdd(sources, source);
+                }
+              }
+            }
+          }
+        } else if (sourceEntry is HtmlEntry) {
+          HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
+          CacheState parsedUnitState = htmlEntry.getState(HtmlEntry.PARSED_UNIT);
+          if (identical(parsedUnitState, CacheState.INVALID) || identical(parsedUnitState, CacheState.FLUSHED)) {
+            javaSetAdd(sources, source);
+          }
+          CacheState elementState = htmlEntry.getState(HtmlEntry.ELEMENT);
+          if (identical(elementState, CacheState.INVALID) || identical(elementState, CacheState.FLUSHED)) {
+            javaSetAdd(sources, source);
+          }
+        }
+      }
+      for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) {
+        SourceEntry sourceEntry = entry.getValue();
+        if (sourceEntry is DartEntry) {
+          DartEntry dartEntry = sourceEntry as DartEntry;
+          if (identical(dartEntry.getState(DartEntry.PARSED_UNIT), CacheState.INVALID)) {
+            javaSetAdd(sources, entry.getKey());
+          }
+        } else if (sourceEntry is HtmlEntry) {
+          HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
+          if (identical(htmlEntry.getState(HtmlEntry.PARSED_UNIT), CacheState.INVALID)) {
+            javaSetAdd(sources, entry.getKey());
+          }
+        }
+      }
+      for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) {
+        SourceEntry sourceEntry = entry.getValue();
+        if (sourceEntry is DartEntry && identical(sourceEntry.kind, SourceKind.LIBRARY)) {
+          DartEntry dartEntry = sourceEntry as DartEntry;
+          if (identical(dartEntry.getState(DartEntry.ELEMENT), CacheState.INVALID)) {
+            javaSetAdd(sources, entry.getKey());
+          }
+        } else if (sourceEntry is HtmlEntry) {
+          HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
+          if (identical(htmlEntry.getState(HtmlEntry.ELEMENT), CacheState.INVALID)) {
+            javaSetAdd(sources, entry.getKey());
+          }
+        }
+      }
+    }
+    return new List<Source>.from(sources);
+  }
+  AnalysisContentStatistics get statistics {
+    AnalysisContentStatisticsImpl statistics = new AnalysisContentStatisticsImpl();
+    {
+      for (MapEntry<Source, SourceEntry> mapEntry in _cache.entrySet()) {
+        SourceEntry entry = mapEntry.getValue();
+        if (entry is DartEntry) {
+          Source source = mapEntry.getKey();
+          DartEntry dartEntry = entry as DartEntry;
+          SourceKind kind = dartEntry.getValue(DartEntry.SOURCE_KIND);
+          statistics.putCacheItem(dartEntry, DartEntry.PARSE_ERRORS);
+          statistics.putCacheItem(dartEntry, DartEntry.PARSED_UNIT);
+          statistics.putCacheItem(dartEntry, DartEntry.SOURCE_KIND);
+          statistics.putCacheItem(dartEntry, DartEntry.LINE_INFO);
+          if (identical(kind, SourceKind.LIBRARY)) {
+            statistics.putCacheItem(dartEntry, DartEntry.ELEMENT);
+            statistics.putCacheItem(dartEntry, DartEntry.EXPORTED_LIBRARIES);
+            statistics.putCacheItem(dartEntry, DartEntry.IMPORTED_LIBRARIES);
+            statistics.putCacheItem(dartEntry, DartEntry.INCLUDED_PARTS);
+            statistics.putCacheItem(dartEntry, DartEntry.IS_CLIENT);
+            statistics.putCacheItem(dartEntry, DartEntry.IS_LAUNCHABLE);
+          }
+          List<Source> librarySources = getLibrariesContaining(source);
+          for (Source librarySource in librarySources) {
+            statistics.putCacheItem2(dartEntry, librarySource, DartEntry.RESOLUTION_ERRORS);
+            statistics.putCacheItem2(dartEntry, librarySource, DartEntry.RESOLVED_UNIT);
+          }
+        }
+      }
+    }
+    return statistics;
+  }
+  bool isClientLibrary(Source librarySource) {
+    SourceEntry sourceEntry = getReadableSourceEntry(librarySource);
+    if (sourceEntry is DartEntry) {
+      DartEntry dartEntry = sourceEntry as DartEntry;
+      return dartEntry.getValue(DartEntry.IS_CLIENT) && dartEntry.getValue(DartEntry.IS_LAUNCHABLE);
+    }
+    return false;
+  }
+  bool isServerLibrary(Source librarySource) {
+    SourceEntry sourceEntry = getReadableSourceEntry(librarySource);
+    if (sourceEntry is DartEntry) {
+      DartEntry dartEntry = sourceEntry as DartEntry;
+      return !dartEntry.getValue(DartEntry.IS_CLIENT) && dartEntry.getValue(DartEntry.IS_LAUNCHABLE);
+    }
+    return false;
+  }
+  void mergeContext(AnalysisContext context) {
+    if (context is InstrumentedAnalysisContextImpl) {
+      context = ((context as InstrumentedAnalysisContextImpl)).basis;
+    }
+    if (context is! AnalysisContextImpl2) {
+      return;
+    }
+    {
+      for (MapEntry<Source, SourceEntry> entry in ((context as AnalysisContextImpl2))._cache.entrySet()) {
+        Source newSource = entry.getKey();
+        SourceEntry existingEntry = getReadableSourceEntry(newSource);
+        if (existingEntry == null) {
+          _cache.put(newSource, entry.getValue().writableCopy);
+        } else {
+        }
+      }
+    }
+  }
+  CompilationUnit parseCompilationUnit(Source source) => getDartParseData2(source, DartEntry.PARSED_UNIT, null);
+  HtmlUnit parseHtmlUnit(Source source) => getHtmlParseData(source, HtmlEntry.PARSED_UNIT, null);
+  List<ChangeNotice> performAnalysisTask() {
+    AnalysisTask task = nextTaskAnalysisTask;
+    if (task == null) {
+      return getChangeNotices(true);
+    }
+    try {
+      task.perform(_resultRecorder);
+    } on AnalysisException catch (exception) {
+      if (exception.cause is! JavaIOException) {
+        AnalysisEngine.instance.logger.logError2("Internal error while performing the task: ${task}", exception);
+      }
+    }
+    return getChangeNotices(false);
+  }
+  void recordLibraryElements(Map<Source, LibraryElement> elementMap) {
+    {
+      Source htmlSource = _sourceFactory.forUri(DartSdk.DART_HTML);
+      for (MapEntry<Source, LibraryElement> entry in getMapEntrySet(elementMap)) {
+        Source librarySource = entry.getKey();
+        LibraryElement library = entry.getValue();
+        DartEntry dartEntry = getReadableDartEntry(librarySource);
+        if (dartEntry != null) {
+          DartEntryImpl dartCopy = dartEntry.writableCopy;
+          recordElementData(dartCopy, library, htmlSource);
+          _cache.put(librarySource, dartCopy);
+        }
+      }
+    }
+  }
+  CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement library) {
+    if (library == null) {
+      return null;
+    }
+    return resolveCompilationUnit2(unitSource, library.source);
+  }
+  CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySource) => getDartResolutionData2(unitSource, librarySource, DartEntry.RESOLVED_UNIT, null);
+  HtmlUnit resolveHtmlUnit(Source htmlSource) => parseHtmlUnit(htmlSource);
+  void set analysisOptions(AnalysisOptions options2) {
+    {
+      this._options = options2;
+      invalidateAllResolutionInformation();
+    }
+  }
+  void set analysisPriorityOrder(List<Source> sources) {
+    {
+      if (sources == null || sources.isEmpty) {
+        _cache.priorityOrder = Source.EMPTY_ARRAY;
+      } else {
+        while (sources.remove(null)) {
+        }
+        if (sources.isEmpty) {
+          _cache.priorityOrder = Source.EMPTY_ARRAY;
+        }
+        int count = Math.min(sources.length, _MAX_PRIORITY_LIST_SIZE);
+        List<Source> priorityOrder = new List<Source>(count);
+        for (int i = 0; i < count; i++) {
+          priorityOrder[i] = sources[i];
+        }
+        _cache.priorityOrder = priorityOrder;
+      }
+    }
+  }
+  void setContents(Source source, String contents) {
+    {
+      if (_sourceFactory.setContents(source, contents)) {
+        sourceChanged(source);
+      }
+    }
+  }
+  void set sourceFactory(SourceFactory factory) {
+    {
+      if (identical(_sourceFactory, factory)) {
+        return;
+      } else if (factory.context != null) {
+        throw new IllegalStateException("Source factories cannot be shared between contexts");
+      }
+      if (_sourceFactory != null) {
+        _sourceFactory.context = null;
+      }
+      factory.context = this;
+      _sourceFactory = factory;
+      invalidateAllResolutionInformation();
+    }
+  }
+  Iterable<Source> sourcesToResolve(List<Source> changedSources) {
+    List<Source> librarySources = new List<Source>();
+    for (Source source in changedSources) {
+      if (identical(computeKindOf(source), SourceKind.LIBRARY)) {
+        librarySources.add(source);
+      }
+    }
+    return librarySources;
+  }
+
+  /**
+   * Add all of the sources contained in the given source container to the given list of sources.
+   *
+   * Note: This method must only be invoked while we are synchronized on [cacheLock].
+   *
+   * @param sources the list to which sources are to be added
+   * @param container the source container containing the sources to be added to the list
+   */
+  void addSourcesInContainer(List<Source> sources, SourceContainer container) {
+    for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) {
+      Source source = entry.getKey();
+      if (container.contains(source)) {
+        sources.add(source);
+      }
+    }
+  }
+
+  /**
+   * Return `true` if the modification times of the sources used by the given library resolver
+   * to resolve one or more libraries are consistent with the modification times in the cache.
+   *
+   * @param resolver the library resolver used to resolve one or more libraries
+   * @return `true` if we should record the results of the resolution
+   * @throws AnalysisException if any of the modification times could not be determined (this should
+   *           not happen)
+   */
+  bool allModificationTimesMatch(LibraryResolver resolver) {
+    bool allTimesMatch = true;
+    for (Library library in resolver.resolvedLibraries) {
+      for (Source source in library.compilationUnitSources) {
+        DartEntry dartEntry = getReadableDartEntry(source);
+        if (dartEntry == null) {
+          throw new AnalysisException.con1("Internal error: attempting to reolve non-Dart file as a Dart file: ${source.fullName}");
+        }
+        int sourceTime = source.modificationStamp;
+        int resultTime = library.getModificationTime(source);
+        if (sourceTime != resultTime) {
+          sourceChanged(source);
+          allTimesMatch = false;
+        }
+      }
+    }
+    return allTimesMatch;
+  }
+
+  /**
+   * Given a source for a Dart file, return a cache entry in which the data represented by the given
+   * descriptor is available. This method assumes that the data can be produced by parsing the
+   * source if it is not already cached.
+   *
+   * @param source the source representing the Dart file
+   * @param dartEntry the cache entry associated with the Dart file
+   * @param descriptor the descriptor representing the data to be returned
+   * @return a cache entry containing the required data
+   * @throws AnalysisException if data could not be returned because the source could not be
+   *           resolved
+   */
+  DartEntry cacheDartParseData(Source source, DartEntry dartEntry, DataDescriptor descriptor) {
+    if (identical(descriptor, DartEntry.PARSED_UNIT)) {
+      CompilationUnit unit = dartEntry.anyParsedCompilationUnit;
+      if (unit != null) {
+        return dartEntry;
+      }
+    }
+    CacheState state = dartEntry.getState(descriptor);
+    while (state != CacheState.ERROR && state != CacheState.VALID) {
+      dartEntry = new ParseDartTask(this, source).perform(_resultRecorder) as DartEntry;
+      state = dartEntry.getState(descriptor);
+    }
+    return dartEntry;
+  }
+
+  /**
+   * Given a source for a Dart file and the library that contains it, return a cache entry in which
+   * the data represented by the given descriptor is available. This method assumes that the data
+   * can be produced by resolving the source in the context of the library if it is not already
+   * cached.
+   *
+   * @param unitSource the source representing the Dart file
+   * @param librarySource the source representing the library containing the Dart file
+   * @param dartEntry the cache entry associated with the Dart file
+   * @param descriptor the descriptor representing the data to be returned
+   * @return a cache entry containing the required data
+   * @throws AnalysisException if data could not be returned because the source could not be parsed
+   */
+  DartEntry cacheDartResolutionData(Source unitSource, Source librarySource, DartEntry dartEntry, DataDescriptor descriptor) {
+    CacheState state = (identical(descriptor, DartEntry.ELEMENT)) ? dartEntry.getState(descriptor) : dartEntry.getState2(descriptor, librarySource);
+    while (state != CacheState.ERROR && state != CacheState.VALID) {
+      dartEntry = new ResolveDartLibraryTask(this, unitSource, librarySource).perform(_resultRecorder) as DartEntry;
+      state = (identical(descriptor, DartEntry.ELEMENT)) ? dartEntry.getState(descriptor) : dartEntry.getState2(descriptor, librarySource);
+    }
+    return dartEntry;
+  }
+
+  /**
+   * Given a source for an HTML file, return a cache entry in which all of the data represented by
+   * the given descriptors is available. This method assumes that the data can be produced by
+   * parsing the source if it is not already cached.
+   *
+   * @param source the source representing the HTML file
+   * @param htmlEntry the cache entry associated with the HTML file
+   * @param descriptor the descriptor representing the data to be returned
+   * @return a cache entry containing the required data
+   * @throws AnalysisException if data could not be returned because the source could not be
+   *           resolved
+   */
+  HtmlEntry cacheHtmlParseData(Source source, HtmlEntry htmlEntry, DataDescriptor descriptor) {
+    CacheState state = htmlEntry.getState(descriptor);
+    while (state != CacheState.ERROR && state != CacheState.VALID) {
+      htmlEntry = new ParseHtmlTask(this, source).perform(_resultRecorder) as HtmlEntry;
+      state = htmlEntry.getState(descriptor);
+    }
+    return htmlEntry;
+  }
+
+  /**
+   * Given a source for an HTML file, return a cache entry in which the the data represented by the
+   * given descriptor is available. This method assumes that the data can be produced by resolving
+   * the source if it is not already cached.
+   *
+   * @param source the source representing the HTML file
+   * @param dartEntry the cache entry associated with the HTML file
+   * @param descriptor the descriptor representing the data to be returned
+   * @return a cache entry containing the required data
+   * @throws AnalysisException if data could not be returned because the source could not be
+   *           resolved
+   */
+  HtmlEntry cacheHtmlResolutionData(Source source, HtmlEntry htmlEntry, DataDescriptor descriptor) {
+    CacheState state = htmlEntry.getState(descriptor);
+    while (state != CacheState.ERROR && state != CacheState.VALID) {
+      htmlEntry = new ResolveHtmlTask(this, source).perform(_resultRecorder) as HtmlEntry;
+      state = htmlEntry.getState(descriptor);
+    }
+    return htmlEntry;
+  }
+
+  /**
+   * Given the encoded form of a source, use the source factory to reconstitute the original source.
+   *
+   * @param encoding the encoded form of a source
+   * @return the source represented by the encoding
+   */
+  Source computeSourceFromEncoding(String encoding) {
+    {
+      return _sourceFactory.fromEncoding(encoding);
+    }
+  }
+
+  /**
+   * Return `true` if the given array of sources contains the given source.
+   *
+   * @param sources the sources being searched
+   * @param targetSource the source being searched for
+   * @return `true` if the given source is in the array
+   */
+  bool contains(List<Source> sources, Source targetSource) {
+    for (Source source in sources) {
+      if (source == targetSource) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
+   * Return `true` if the given array of sources contains any of the given target sources.
+   *
+   * @param sources the sources being searched
+   * @param targetSources the sources being searched for
+   * @return `true` if any of the given target sources are in the array
+   */
+  bool containsAny(List<Source> sources, List<Source> targetSources) {
+    for (Source targetSource in targetSources) {
+      if (contains(sources, targetSource)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
+   * Create a source information object suitable for the given source. Return the source information
+   * object that was created, or `null` if the source should not be tracked by this context.
+   *
+   * @param source the source for which an information object is being created
+   * @return the source information object that was created
+   */
+  SourceEntry createSourceEntry(Source source) {
+    String name = source.shortName;
+    if (AnalysisEngine.isHtmlFileName(name)) {
+      HtmlEntryImpl htmlEntry = new HtmlEntryImpl();
+      htmlEntry.modificationTime = source.modificationStamp;
+      _cache.put(source, htmlEntry);
+      return htmlEntry;
+    } else {
+      DartEntryImpl dartEntry = new DartEntryImpl();
+      dartEntry.modificationTime = source.modificationStamp;
+      _cache.put(source, dartEntry);
+      return dartEntry;
+    }
+  }
+
+  /**
+   * Return an array containing all of the change notices that are waiting to be returned. If there
+   * are no notices, then return either `null` or an empty array, depending on the value of
+   * the argument.
+   *
+   * @param nullIfEmpty `true` if `null` should be returned when there are no notices
+   * @return the change notices that are waiting to be returned
+   */
+  List<ChangeNotice> getChangeNotices(bool nullIfEmpty) {
+    {
+      if (_pendingNotices.isEmpty) {
+        if (nullIfEmpty) {
+          return null;
+        }
+        return ChangeNoticeImpl.EMPTY_ARRAY;
+      }
+      List<ChangeNotice> notices = new List.from(_pendingNotices.values);
+      _pendingNotices.clear();
+      return notices;
+    }
+  }
+
+  /**
+   * Given a source for a Dart file, return the data represented by the given descriptor that is
+   * associated with that source. This method assumes that the data can be produced by parsing the
+   * source if it is not already cached.
+   *
+   * @param source the source representing the Dart file
+   * @param dartEntry the cache entry associated with the Dart file
+   * @param descriptor the descriptor representing the data to be returned
+   * @return the requested data about the given source
+   * @throws AnalysisException if data could not be returned because the source could not be parsed
+   */
+  Object getDartParseData(Source source, DartEntry dartEntry, DataDescriptor descriptor) {
+    dartEntry = cacheDartParseData(source, dartEntry, descriptor);
+    if (identical(descriptor, DartEntry.PARSED_UNIT)) {
+      return dartEntry.anyParsedCompilationUnit as Object;
+    }
+    return dartEntry.getValue(descriptor);
+  }
+
+  /**
+   * Given a source for a Dart file, return the data represented by the given descriptor that is
+   * associated with that source, or the given default value if the source is not a Dart file. This
+   * method assumes that the data can be produced by parsing the source if it is not already cached.
+   *
+   * @param source the source representing the Dart file
+   * @param descriptor the descriptor representing the data to be returned
+   * @param defaultValue the value to be returned if the source is not a Dart file
+   * @return the requested data about the given source
+   * @throws AnalysisException if data could not be returned because the source could not be parsed
+   */
+  Object getDartParseData2(Source source, DataDescriptor descriptor, Object defaultValue) {
+    DartEntry dartEntry = getReadableDartEntry(source);
+    if (dartEntry == null) {
+      return defaultValue;
+    }
+    return getDartParseData(source, dartEntry, descriptor);
+  }
+
+  /**
+   * Given a source for a Dart file and the library that contains it, return the data represented by
+   * the given descriptor that is associated with that source. This method assumes that the data can
+   * be produced by resolving the source in the context of the library if it is not already cached.
+   *
+   * @param unitSource the source representing the Dart file
+   * @param librarySource the source representing the library containing the Dart file
+   * @param dartEntry the entry representing the Dart file
+   * @param descriptor the descriptor representing the data to be returned
+   * @return the requested data about the given source
+   * @throws AnalysisException if data could not be returned because the source could not be
+   *           resolved
+   */
+  Object getDartResolutionData(Source unitSource, Source librarySource, DartEntry dartEntry, DataDescriptor descriptor) {
+    dartEntry = cacheDartResolutionData(unitSource, librarySource, dartEntry, descriptor);
+    if (identical(descriptor, DartEntry.ELEMENT)) {
+      return dartEntry.getValue(descriptor);
+    }
+    return dartEntry.getValue2(descriptor, librarySource);
+  }
+
+  /**
+   * Given a source for a Dart file and the library that contains it, return the data represented by
+   * the given descriptor that is associated with that source, or the given default value if the
+   * source is not a Dart file. This method assumes that the data can be produced by resolving the
+   * source in the context of the library if it is not already cached.
+   *
+   * @param unitSource the source representing the Dart file
+   * @param librarySource the source representing the library containing the Dart file
+   * @param descriptor the descriptor representing the data to be returned
+   * @param defaultValue the value to be returned if the source is not a Dart file
+   * @return the requested data about the given source
+   * @throws AnalysisException if data could not be returned because the source could not be
+   *           resolved
+   */
+  Object getDartResolutionData2(Source unitSource, Source librarySource, DataDescriptor descriptor, Object defaultValue) {
+    DartEntry dartEntry = getReadableDartEntry(unitSource);
+    if (dartEntry == null) {
+      return defaultValue;
+    }
+    return getDartResolutionData(unitSource, librarySource, dartEntry, descriptor);
+  }
+
+  /**
+   * Given a source for an HTML file, return the data represented by the given descriptor that is
+   * associated with that source, or the given default value if the source is not an HTML file. This
+   * method assumes that the data can be produced by parsing the source if it is not already cached.
+   *
+   * @param source the source representing the Dart file
+   * @param descriptor the descriptor representing the data to be returned
+   * @param defaultValue the value to be returned if the source is not an HTML file
+   * @return the requested data about the given source
+   * @throws AnalysisException if data could not be returned because the source could not be parsed
+   */
+  Object getHtmlParseData(Source source, DataDescriptor descriptor, Object defaultValue) {
+    HtmlEntry htmlEntry = getReadableHtmlEntry(source);
+    if (htmlEntry == null) {
+      return defaultValue;
+    }
+    htmlEntry = cacheHtmlParseData(source, htmlEntry, descriptor);
+    return htmlEntry.getValue(descriptor);
+  }
+
+  /**
+   * Given a source for an HTML file, return the data represented by the given descriptor that is
+   * associated with that source, or the given default value if the source is not an HTML file. This
+   * method assumes that the data can be produced by resolving the source if it is not already
+   * cached.
+   *
+   * @param source the source representing the HTML file
+   * @param descriptor the descriptor representing the data to be returned
+   * @param defaultValue the value to be returned if the source is not an HTML file
+   * @return the requested data about the given source
+   * @throws AnalysisException if data could not be returned because the source could not be
+   *           resolved
+   */
+  Object getHtmlResolutionData(Source source, DataDescriptor descriptor, Object defaultValue) {
+    HtmlEntry htmlEntry = getReadableHtmlEntry(source);
+    if (htmlEntry == null) {
+      return defaultValue;
+    }
+    return getHtmlResolutionData2(source, htmlEntry, descriptor);
+  }
+
+  /**
+   * Given a source for an HTML file, return the data represented by the given descriptor that is
+   * associated with that source. This method assumes that the data can be produced by resolving the
+   * source if it is not already cached.
+   *
+   * @param source the source representing the HTML file
+   * @param htmlEntry the entry representing the HTML file
+   * @param descriptor the descriptor representing the data to be returned
+   * @return the requested data about the given source
+   * @throws AnalysisException if data could not be returned because the source could not be
+   *           resolved
+   */
+  Object getHtmlResolutionData2(Source source, HtmlEntry htmlEntry, DataDescriptor descriptor) {
+    htmlEntry = cacheHtmlResolutionData(source, htmlEntry, descriptor);
+    return htmlEntry.getValue(descriptor);
+  }
+
+  /**
+   * Look through the cache for a task that needs to be performed. Return the task that was found,
+   * or `null` if there is no more work to be done.
+   *
+   * @return the next task that needs to be performed
+   */
+  AnalysisTask get nextTaskAnalysisTask {
+    {
+      for (Source source in _cache.priorityOrder) {
+        SourceEntry sourceEntry = _cache.get(source);
+        if (sourceEntry is DartEntry) {
+          DartEntry dartEntry = sourceEntry as DartEntry;
+          CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS);
+          if (identical(parseErrorsState, CacheState.INVALID) || identical(parseErrorsState, CacheState.FLUSHED)) {
+            DartEntryImpl dartCopy = dartEntry.writableCopy;
+            dartCopy.setState(DartEntry.PARSE_ERRORS, CacheState.IN_PROCESS);
+            _cache.put(source, dartCopy);
+            return new ParseDartTask(this, source);
+          }
+          CacheState parseUnitState = dartEntry.getState(DartEntry.PARSED_UNIT);
+          if (identical(parseUnitState, CacheState.INVALID) || identical(parseUnitState, CacheState.FLUSHED)) {
+            DartEntryImpl dartCopy = dartEntry.writableCopy;
+            dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.IN_PROCESS);
+            _cache.put(source, dartCopy);
+            return new ParseDartTask(this, source);
+          }
+          for (Source librarySource in getLibrariesContaining(source)) {
+            SourceEntry libraryEntry = _cache.get(librarySource);
+            if (libraryEntry is DartEntry) {
+              CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT);
+              if (identical(elementState, CacheState.INVALID) || identical(elementState, CacheState.FLUSHED)) {
+                DartEntryImpl libraryCopy = ((libraryEntry as DartEntry)).writableCopy;
+                libraryCopy.setState(DartEntry.ELEMENT, CacheState.IN_PROCESS);
+                _cache.put(librarySource, libraryCopy);
+                return new ResolveDartLibraryTask(this, source, librarySource);
+              }
+              CacheState resolvedUnitState = dartEntry.getState2(DartEntry.RESOLVED_UNIT, librarySource);
+              if (identical(resolvedUnitState, CacheState.INVALID) || identical(resolvedUnitState, CacheState.FLUSHED)) {
+                LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEMENT);
+                if (libraryElement != null) {
+                  DartEntryImpl dartCopy = dartEntry.writableCopy;
+                  dartCopy.setState2(DartEntry.RESOLVED_UNIT, librarySource, CacheState.IN_PROCESS);
+                  _cache.put(source, dartCopy);
+                  return new ResolveDartUnitTask(this, source, libraryElement);
+                }
+              }
+            }
+          }
+        } else if (sourceEntry is HtmlEntry) {
+          HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
+          CacheState parsedUnitState = htmlEntry.getState(HtmlEntry.PARSED_UNIT);
+          if (identical(parsedUnitState, CacheState.INVALID) || identical(parsedUnitState, CacheState.FLUSHED)) {
+            HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
+            htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.IN_PROCESS);
+            _cache.put(source, htmlCopy);
+            return new ParseHtmlTask(this, source);
+          }
+          CacheState elementState = htmlEntry.getState(HtmlEntry.ELEMENT);
+          if (identical(elementState, CacheState.INVALID) || identical(elementState, CacheState.FLUSHED)) {
+            HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
+            htmlCopy.setState(HtmlEntry.ELEMENT, CacheState.IN_PROCESS);
+            _cache.put(source, htmlCopy);
+            return new ResolveHtmlTask(this, source);
+          }
+        }
+      }
+      for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) {
+        SourceEntry sourceEntry = entry.getValue();
+        if (sourceEntry is DartEntry) {
+          DartEntry dartEntry = sourceEntry as DartEntry;
+          if (identical(dartEntry.getState(DartEntry.PARSED_UNIT), CacheState.INVALID)) {
+            Source source = entry.getKey();
+            DartEntryImpl dartCopy = dartEntry.writableCopy;
+            dartCopy.setState(DartEntry.PARSE_ERRORS, CacheState.IN_PROCESS);
+            _cache.put(source, dartCopy);
+            return new ParseDartTask(this, source);
+          }
+        } else if (sourceEntry is HtmlEntry) {
+          HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
+          if (identical(htmlEntry.getState(HtmlEntry.PARSED_UNIT), CacheState.INVALID)) {
+            Source source = entry.getKey();
+            HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
+            htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.IN_PROCESS);
+            _cache.put(source, htmlCopy);
+            return new ParseHtmlTask(this, source);
+          }
+        }
+      }
+      for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) {
+        SourceEntry sourceEntry = entry.getValue();
+        if (sourceEntry is DartEntry && identical(sourceEntry.kind, SourceKind.LIBRARY)) {
+          DartEntry dartEntry = sourceEntry as DartEntry;
+          if (identical(dartEntry.getState(DartEntry.ELEMENT), CacheState.INVALID)) {
+            Source source = entry.getKey();
+            DartEntryImpl dartCopy = dartEntry.writableCopy;
+            dartCopy.setState(DartEntry.ELEMENT, CacheState.IN_PROCESS);
+            _cache.put(source, dartCopy);
+            return new ResolveDartLibraryTask(this, source, source);
+          }
+        } else if (sourceEntry is HtmlEntry) {
+          HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
+          if (identical(htmlEntry.getState(HtmlEntry.ELEMENT), CacheState.INVALID)) {
+            Source source = entry.getKey();
+            HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
+            htmlCopy.setState(HtmlEntry.ELEMENT, CacheState.IN_PROCESS);
+            _cache.put(source, htmlCopy);
+            return new ResolveHtmlTask(this, source);
+          }
+        }
+      }
+      return null;
+    }
+  }
+
+  /**
+   * Return a change notice for the given source, creating one if one does not already exist.
+   *
+   * @param source the source for which changes are being reported
+   * @return a change notice for the given source
+   */
+  ChangeNoticeImpl getNotice(Source source) {
+    ChangeNoticeImpl notice = _pendingNotices[source];
+    if (notice == null) {
+      notice = new ChangeNoticeImpl(source);
+      _pendingNotices[source] = notice;
+    }
+    return notice;
+  }
+
+  /**
+   * Return the cache entry associated with the given source, or `null` if the source is not a
+   * Dart file.
+   *
+   * @param source the source for which a cache entry is being sought
+   * @return the source cache entry associated with the given source
+   */
+  DartEntry getReadableDartEntry(Source source) {
+    {
+      SourceEntry sourceEntry = _cache.get(source);
+      if (sourceEntry == null) {
+        sourceEntry = createSourceEntry(source);
+      }
+      if (sourceEntry is DartEntry) {
+        _cache.accessed(source);
+        return sourceEntry as DartEntry;
+      }
+      return null;
+    }
+  }
+
+  /**
+   * Return the cache entry associated with the given source, or `null` if the source is not
+   * an HTML file.
+   *
+   * @param source the source for which a cache entry is being sought
+   * @return the source cache entry associated with the given source
+   */
+  HtmlEntry getReadableHtmlEntry(Source source) {
+    {
+      SourceEntry sourceEntry = _cache.get(source);
+      if (sourceEntry == null) {
+        sourceEntry = createSourceEntry(source);
+      }
+      if (sourceEntry is HtmlEntry) {
+        _cache.accessed(source);
+        return sourceEntry as HtmlEntry;
+      }
+      return null;
+    }
+  }
+
+  /**
+   * Return the cache entry associated with the given source, or `null` if there is no entry
+   * associated with the source.
+   *
+   * @param source the source for which a cache entry is being sought
+   * @return the source cache entry associated with the given source
+   */
+  SourceEntry getReadableSourceEntry(Source source) {
+    {
+      SourceEntry sourceEntry = _cache.get(source);
+      if (sourceEntry == null) {
+        sourceEntry = createSourceEntry(source);
+      }
+      if (sourceEntry != null) {
+        _cache.accessed(source);
+      }
+      return sourceEntry;
+    }
+  }
+
+  /**
+   * Return an array containing all of the sources known to this context that have the given kind.
+   *
+   * @param kind the kind of sources to be returned
+   * @return all of the sources known to this context that have the given kind
+   */
+  List<Source> getSources(SourceKind kind2) {
+    List<Source> sources = new List<Source>();
+    {
+      for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) {
+        if (identical(entry.getValue().kind, kind2)) {
+          sources.add(entry.getKey());
+        }
+      }
+    }
+    return new List.from(sources);
+  }
+
+  /**
+   * Invalidate all of the resolution results computed by this context.
+   *
+   * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
+   */
+  void invalidateAllResolutionInformation() {
+    for (MapEntry<Source, SourceEntry> mapEntry in _cache.entrySet()) {
+      SourceEntry sourceEntry = mapEntry.getValue();
+      if (sourceEntry is HtmlEntry) {
+        HtmlEntryImpl htmlCopy = ((sourceEntry as HtmlEntry)).writableCopy;
+        htmlCopy.invalidateAllResolutionInformation();
+        mapEntry.setValue(htmlCopy);
+      } else if (sourceEntry is DartEntry) {
+        DartEntryImpl dartCopy = ((sourceEntry as DartEntry)).writableCopy;
+        dartCopy.invalidateAllResolutionInformation();
+        mapEntry.setValue(dartCopy);
+      }
+    }
+  }
+
+  /**
+   * In response to a change to at least one of the compilation units in the given library,
+   * invalidate any results that are dependent on the result of resolving that library.
+   *
+   * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
+   *
+   * @param librarySource the source of the library being invalidated
+   */
+  void invalidateLibraryResolution(Source librarySource) {
+    DartEntry libraryEntry = getReadableDartEntry(librarySource);
+    if (libraryEntry != null) {
+      List<Source> includedParts = libraryEntry.getValue(DartEntry.INCLUDED_PARTS);
+      DartEntryImpl libraryCopy = libraryEntry.writableCopy;
+      libraryCopy.invalidateAllResolutionInformation();
+      libraryCopy.setState(DartEntry.INCLUDED_PARTS, CacheState.INVALID);
+      _cache.put(librarySource, libraryCopy);
+      for (Source partSource in includedParts) {
+        DartEntry partEntry = getReadableDartEntry(partSource);
+        if (partEntry != null) {
+          DartEntryImpl partCopy = partEntry.writableCopy;
+          partCopy.invalidateAllResolutionInformation();
+          _cache.put(partSource, partCopy);
+        }
+      }
+    }
+  }
+
+  /**
+   * Return `true` if this library is, or depends on, dart:html.
+   *
+   * @param library the library being tested
+   * @param visitedLibraries a collection of the libraries that have been visited, used to prevent
+   *          infinite recursion
+   * @return `true` if this library is, or depends on, dart:html
+   */
+  bool isClient(LibraryElement library, Source htmlSource, Set<LibraryElement> visitedLibraries) {
+    if (visitedLibraries.contains(library)) {
+      return false;
+    }
+    if (library.source == htmlSource) {
+      return true;
+    }
+    javaSetAdd(visitedLibraries, library);
+    for (LibraryElement imported in library.importedLibraries) {
+      if (isClient(imported, htmlSource, visitedLibraries)) {
+        return true;
+      }
+    }
+    for (LibraryElement exported in library.exportedLibraries) {
+      if (isClient(exported, htmlSource, visitedLibraries)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
+   * Given a cache entry and a library element, record the library element and other information
+   * gleaned from the element in the cache entry.
+   *
+   * @param dartCopy the cache entry in which data is to be recorded
+   * @param library the library element used to record information
+   * @param htmlSource the source for the HTML library
+   */
+  void recordElementData(DartEntryImpl dartCopy, LibraryElement library, Source htmlSource) {
+    dartCopy.setValue(DartEntry.ELEMENT, library);
+    dartCopy.setValue(DartEntry.IS_LAUNCHABLE, library.entryPoint != null);
+    dartCopy.setValue(DartEntry.IS_CLIENT, isClient(library, htmlSource, new Set<LibraryElement>()));
+    List<Source> unitSources = new List<Source>();
+    unitSources.add(library.definingCompilationUnit.source);
+    for (CompilationUnitElement part in library.parts) {
+      Source partSource = part.source;
+      unitSources.add(partSource);
+    }
+    dartCopy.setValue(DartEntry.INCLUDED_PARTS, new List.from(unitSources));
+  }
+
+  /**
+   * Record the results produced by performing a [ParseDartTask]. If the results were computed
+   * from data that is now out-of-date, then the results will not be recorded.
+   *
+   * @param task the task that was performed
+   * @return an entry containing the computed results
+   * @throws AnalysisException if the results could not be recorded
+   */
+  DartEntry recordParseDartTaskResults(ParseDartTask task) {
+    Source source = task.source;
+    AnalysisException thrownException = task.exception;
+    DartEntry dartEntry = null;
+    {
+      SourceEntry sourceEntry = _cache.get(source);
+      if (sourceEntry is! DartEntry) {
+        throw new AnalysisException.con1("Internal error: attempting to parse non-Dart file as a Dart file: ${source.fullName}");
+      }
+      dartEntry = sourceEntry as DartEntry;
+      _cache.accessed(source);
+      int sourceTime = source.modificationStamp;
+      int resultTime = task.modificationTime;
+      if (sourceTime == resultTime) {
+        if (dartEntry.modificationTime != sourceTime) {
+          sourceChanged(source);
+          dartEntry = getReadableDartEntry(source);
+          if (dartEntry == null) {
+            throw new AnalysisException.con1("A Dart file became a non-Dart file: ${source.fullName}");
+          }
+        }
+        DartEntryImpl dartCopy = dartEntry.writableCopy;
+        if (thrownException == null) {
+          LineInfo lineInfo = task.lineInfo;
+          dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo);
+          if (task.hasPartOfDirective() && !task.hasLibraryDirective()) {
+            dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.PART);
+          } else {
+            dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY);
+          }
+          dartCopy.setValue(DartEntry.PARSED_UNIT, task.compilationUnit);
+          dartCopy.setValue(DartEntry.PARSE_ERRORS, task.errors);
+          dartCopy.setValue(DartEntry.EXPORTED_LIBRARIES, task.exportedSources);
+          dartCopy.setValue(DartEntry.IMPORTED_LIBRARIES, task.importedSources);
+          dartCopy.setValue(DartEntry.INCLUDED_PARTS, task.includedSources);
+        } else {
+          dartCopy.recordParseError();
+        }
+        _cache.put(source, dartCopy);
+        dartEntry = dartCopy;
+      } else {
+        DartEntryImpl dartCopy = dartEntry.writableCopy;
+        dartCopy.recordParseNotInProcess();
+        _cache.put(source, dartCopy);
+        dartEntry = dartCopy;
+      }
+    }
+    if (thrownException != null) {
+      throw thrownException;
+    }
+    return dartEntry;
+  }
+
+  /**
+   * Record the results produced by performing a [ParseHtmlTask]. If the results were computed
+   * from data that is now out-of-date, then the results will not be recorded.
+   *
+   * @param task the task that was performed
+   * @return an entry containing the computed results
+   * @throws AnalysisException if the results could not be recorded
+   */
+  HtmlEntry recordParseHtmlTaskResults(ParseHtmlTask task) {
+    Source source = task.source;
+    AnalysisException thrownException = task.exception;
+    HtmlEntry htmlEntry = null;
+    {
+      SourceEntry sourceEntry = _cache.get(source);
+      if (sourceEntry is! HtmlEntry) {
+        throw new AnalysisException.con1("Internal error: attempting to parse non-HTML file as a HTML file: ${source.fullName}");
+      }
+      htmlEntry = sourceEntry as HtmlEntry;
+      _cache.accessed(source);
+      int sourceTime = source.modificationStamp;
+      int resultTime = task.modificationTime;
+      if (sourceTime == resultTime) {
+        if (htmlEntry.modificationTime != sourceTime) {
+          sourceChanged(source);
+          htmlEntry = getReadableHtmlEntry(source);
+          if (htmlEntry == null) {
+            throw new AnalysisException.con1("An HTML file became a non-HTML file: ${source.fullName}");
+          }
+        }
+        HtmlEntryImpl htmlCopy = ((sourceEntry as HtmlEntry)).writableCopy;
+        if (thrownException == null) {
+          LineInfo lineInfo = task.lineInfo;
+          HtmlUnit unit = task.htmlUnit;
+          htmlCopy.setValue(SourceEntry.LINE_INFO, lineInfo);
+          htmlCopy.setValue(HtmlEntry.PARSED_UNIT, unit);
+          htmlCopy.setValue(HtmlEntry.REFERENCED_LIBRARIES, task.referencedLibraries);
+          ChangeNoticeImpl notice = getNotice(source);
+          notice.setErrors(htmlEntry.allErrors, lineInfo);
+        } else {
+          htmlCopy.setState(SourceEntry.LINE_INFO, CacheState.ERROR);
+          htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.ERROR);
+          htmlCopy.setState(HtmlEntry.REFERENCED_LIBRARIES, CacheState.ERROR);
+        }
+        _cache.put(source, htmlCopy);
+        htmlEntry = htmlCopy;
+      } else {
+        HtmlEntryImpl htmlCopy = ((sourceEntry as HtmlEntry)).writableCopy;
+        if (identical(htmlCopy.getState(SourceEntry.LINE_INFO), CacheState.IN_PROCESS)) {
+          htmlCopy.setState(SourceEntry.LINE_INFO, CacheState.INVALID);
+        }
+        if (identical(htmlCopy.getState(HtmlEntry.PARSED_UNIT), CacheState.IN_PROCESS)) {
+          htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.INVALID);
+        }
+        if (identical(htmlCopy.getState(HtmlEntry.REFERENCED_LIBRARIES), CacheState.IN_PROCESS)) {
+          htmlCopy.setState(HtmlEntry.REFERENCED_LIBRARIES, CacheState.INVALID);
+        }
+        _cache.put(source, htmlCopy);
+        htmlEntry = htmlCopy;
+      }
+    }
+    if (thrownException != null) {
+      throw thrownException;
+    }
+    return htmlEntry;
+  }
+
+  /**
+   * Record the results produced by performing a [ResolveDartLibraryTask]. If the results were
+   * computed from data that is now out-of-date, then the results will not be recorded.
+   *
+   * @param task the task that was performed
+   * @return an entry containing the computed results
+   * @throws AnalysisException if the results could not be recorded
+   */
+  DartEntry recordResolveDartLibraryTaskResults(ResolveDartLibraryTask task) {
+    LibraryResolver resolver = task.libraryResolver;
+    AnalysisException thrownException = task.exception;
+    DartEntry unitEntry = null;
+    {
+      if (allModificationTimesMatch(resolver)) {
+        Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML);
+        Source unitSource = task.unitSource;
+        RecordingErrorListener errorListener = resolver.errorListener;
+        for (Library library in resolver.resolvedLibraries) {
+          Source librarySource = library.librarySource;
+          for (Source source in library.compilationUnitSources) {
+            CompilationUnit unit = library.getAST(source);
+            List<AnalysisError> errors = errorListener.getErrors2(source);
+            unit.resolutionErrors = errors;
+            LineInfo lineInfo = unit.lineInfo;
+            DartEntry dartEntry = _cache.get(source) as DartEntry;
+            int sourceTime = source.modificationStamp;
+            if (dartEntry.modificationTime != sourceTime) {
+              sourceChanged(source);
+              dartEntry = getReadableDartEntry(source);
+              if (dartEntry == null) {
+                throw new AnalysisException.con1("A Dart file became a non-Dart file: ${source.fullName}");
+              }
+            }
+            DartEntryImpl dartCopy = dartEntry.writableCopy;
+            if (thrownException == null) {
+              dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo);
+              dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED);
+              dartCopy.setValue2(DartEntry.RESOLVED_UNIT, librarySource, unit);
+              dartCopy.setValue2(DartEntry.RESOLUTION_ERRORS, librarySource, errors);
+              if (identical(source, librarySource)) {
+                recordElementData(dartCopy, library.libraryElement, htmlSource);
+              }
+            } else {
+              dartCopy.recordResolutionError();
+            }
+            _cache.put(source, dartCopy);
+            if (source == unitSource) {
+              unitEntry = dartCopy;
+            }
+            ChangeNoticeImpl notice = getNotice(source);
+            notice.compilationUnit = unit;
+            notice.setErrors(dartCopy.allErrors, lineInfo);
+          }
+        }
+      } else {
+        for (Library library in resolver.resolvedLibraries) {
+          for (Source source in library.compilationUnitSources) {
+            DartEntry dartEntry = getReadableDartEntry(source);
+            if (dartEntry != null) {
+              DartEntryImpl dartCopy = dartEntry.writableCopy;
+              dartCopy.recordResolutionNotInProcess();
+              _cache.put(source, dartCopy);
+            }
+          }
+        }
+      }
+    }
+    if (thrownException != null) {
+      throw thrownException;
+    }
+    return unitEntry;
+  }
+
+  /**
+   * Record the results produced by performing a [ResolveDartUnitTask]. If the results were
+   * computed from data that is now out-of-date, then the results will not be recorded.
+   *
+   * @param task the task that was performed
+   * @return an entry containing the computed results
+   * @throws AnalysisException if the results could not be recorded
+   */
+  SourceEntry recordResolveDartUnitTaskResults(ResolveDartUnitTask task) {
+    Source source = task.source;
+    AnalysisException thrownException = task.exception;
+    DartEntry dartEntry = null;
+    {
+      SourceEntry sourceEntry = _cache.get(source);
+      if (sourceEntry is! DartEntry) {
+        throw new AnalysisException.con1("Internal error: attempting to reolve non-Dart file as a Dart file: ${source.fullName}");
+      }
+      dartEntry = sourceEntry as DartEntry;
+      _cache.accessed(source);
+      int sourceTime = source.modificationStamp;
+      int resultTime = task.modificationTime;
+      if (sourceTime == resultTime) {
+        if (dartEntry.modificationTime != sourceTime) {
+          sourceChanged(source);
+          dartEntry = getReadableDartEntry(source);
+          if (dartEntry == null) {
+            throw new AnalysisException.con1("A Dart file became a non-Dart file: ${source.fullName}");
+          }
+        }
+        DartEntryImpl dartCopy = dartEntry.writableCopy;
+        if (thrownException == null) {
+          dartCopy.setValue2(DartEntry.RESOLVED_UNIT, task.librarySource, task.resolvedUnit);
+        } else {
+          dartCopy.setState(DartEntry.RESOLVED_UNIT, CacheState.ERROR);
+        }
+        _cache.put(source, dartCopy);
+        dartEntry = dartCopy;
+      } else {
+        DartEntryImpl dartCopy = dartEntry.writableCopy;
+        if (identical(dartCopy.getState(DartEntry.RESOLVED_UNIT), CacheState.IN_PROCESS)) {
+          dartCopy.setState(DartEntry.RESOLVED_UNIT, CacheState.INVALID);
+        }
+        _cache.put(source, dartCopy);
+        dartEntry = dartCopy;
+      }
+    }
+    if (thrownException != null) {
+      throw thrownException;
+    }
+    return dartEntry;
+  }
+
+  /**
+   * Record the results produced by performing a [ResolveHtmlTask]. If the results were
+   * computed from data that is now out-of-date, then the results will not be recorded.
+   *
+   * @param task the task that was performed
+   * @return an entry containing the computed results
+   * @throws AnalysisException if the results could not be recorded
+   */
+  SourceEntry recordResolveHtmlTaskResults(ResolveHtmlTask task) {
+    Source source = task.source;
+    AnalysisException thrownException = task.exception;
+    HtmlEntry htmlEntry = null;
+    {
+      SourceEntry sourceEntry = _cache.get(source);
+      if (sourceEntry is! HtmlEntry) {
+        throw new AnalysisException.con1("Internal error: attempting to reolve non-HTML file as an HTML file: ${source.fullName}");
+      }
+      htmlEntry = sourceEntry as HtmlEntry;
+      _cache.accessed(source);
+      int sourceTime = source.modificationStamp;
+      int resultTime = task.modificationTime;
+      if (sourceTime == resultTime) {
+        if (htmlEntry.modificationTime != sourceTime) {
+          sourceChanged(source);
+          htmlEntry = getReadableHtmlEntry(source);
+          if (htmlEntry == null) {
+            throw new AnalysisException.con1("An HTML file became a non-HTML file: ${source.fullName}");
+          }
+        }
+        HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
+        if (thrownException == null) {
+          htmlCopy.setValue(HtmlEntry.ELEMENT, task.element);
+          htmlCopy.setValue(HtmlEntry.RESOLUTION_ERRORS, task.resolutionErrors);
+        } else {
+          htmlCopy.recordResolutionError();
+        }
+        _cache.put(source, htmlCopy);
+        htmlEntry = htmlCopy;
+      } else {
+        HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
+        if (identical(htmlCopy.getState(HtmlEntry.ELEMENT), CacheState.IN_PROCESS)) {
+          htmlCopy.setState(HtmlEntry.ELEMENT, CacheState.INVALID);
+        }
+        if (identical(htmlCopy.getState(HtmlEntry.RESOLUTION_ERRORS), CacheState.IN_PROCESS)) {
+          htmlCopy.setState(HtmlEntry.RESOLUTION_ERRORS, CacheState.INVALID);
+        }
+        _cache.put(source, htmlCopy);
+        htmlEntry = htmlCopy;
+      }
+    }
+    if (thrownException != null) {
+      throw thrownException;
+    }
+    return htmlEntry;
+  }
+
+  /**
+   * Create an entry for the newly added source. Return `true` if the new source is a Dart
+   * file.
+   *
+   * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
+   *
+   * @param source the source that has been added
+   * @return `true` if the new source is a Dart file
+   */
+  bool sourceAvailable(Source source) {
+    SourceEntry sourceEntry = _cache.get(source);
+    if (sourceEntry == null) {
+      sourceEntry = createSourceEntry(source);
+    } else {
+      SourceEntryImpl sourceCopy = sourceEntry.writableCopy;
+      sourceCopy.modificationTime = source.modificationStamp;
+      _cache.put(source, sourceCopy);
+    }
+    return sourceEntry is DartEntry;
+  }
+
+  /**
+   * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
+   *
+   * @param source the source that has been changed
+   */
+  void sourceChanged(Source source) {
+    SourceEntry sourceEntry = _cache.get(source);
+    if (sourceEntry is HtmlEntry) {
+      HtmlEntryImpl htmlCopy = ((sourceEntry as HtmlEntry)).writableCopy;
+      htmlCopy.modificationTime = source.modificationStamp;
+      htmlCopy.invalidateAllInformation();
+      _cache.put(source, htmlCopy);
+    } else if (sourceEntry is DartEntry) {
+      List<Source> containingLibraries = getLibrariesContaining(source);
+      for (Source library in containingLibraries) {
+        invalidateLibraryResolution(library);
+      }
+      DartEntryImpl dartCopy = ((sourceEntry as DartEntry)).writableCopy;
+      dartCopy.modificationTime = source.modificationStamp;
+      dartCopy.invalidateAllInformation();
+      _cache.put(source, dartCopy);
+    }
+  }
+
+  /**
+   * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
+   *
+   * @param source the source that has been deleted
+   */
+  void sourceRemoved(Source source) {
+    SourceEntry sourceEntry = _cache.get(source);
+    if (sourceEntry is DartEntry) {
+      Set<Source> libraries = new Set<Source>();
+      for (Source librarySource in getLibrariesContaining(source)) {
+        javaSetAdd(libraries, librarySource);
+        for (Source dependentLibrary in getLibrariesDependingOn(librarySource)) {
+          javaSetAdd(libraries, dependentLibrary);
+        }
+      }
+      for (Source librarySource in libraries) {
+        invalidateLibraryResolution(librarySource);
+      }
+    }
+    _cache.remove(source);
+  }
+}
+/**
+ * Instances of the class `AnalysisTaskResultRecorder` are used by an analysis context to
+ * record the results of a task.
+ */
+class AnalysisContextImpl2_AnalysisTaskResultRecorder implements AnalysisTaskVisitor<SourceEntry> {
+  final AnalysisContextImpl2 AnalysisContextImpl2_this;
+  AnalysisContextImpl2_AnalysisTaskResultRecorder(this.AnalysisContextImpl2_this);
+  DartEntry visitParseDartTask(ParseDartTask task) => AnalysisContextImpl2_this.recordParseDartTaskResults(task);
+  HtmlEntry visitParseHtmlTask(ParseHtmlTask task) => AnalysisContextImpl2_this.recordParseHtmlTaskResults(task);
+  DartEntry visitResolveDartLibraryTask(ResolveDartLibraryTask task) => AnalysisContextImpl2_this.recordResolveDartLibraryTaskResults(task);
+  SourceEntry visitResolveDartUnitTask(ResolveDartUnitTask task) => AnalysisContextImpl2_this.recordResolveDartUnitTaskResults(task);
+  SourceEntry visitResolveHtmlTask(ResolveHtmlTask task) => AnalysisContextImpl2_this.recordResolveHtmlTaskResults(task);
+}
+/**
  * Instances of the class `AnalysisErrorInfoImpl` represent the analysis errors and line info
  * associated with a source.
  */
@@ -4915,68 +6840,6 @@
   }
 }
 /**
- * The enumeration `CacheState` defines the possible states of cached data.
- */
-class CacheState extends Enum<CacheState> {
-
-  /**
-   * The data is not in the cache and the last time an attempt was made to compute the data an
-   * exception occurred, making it pointless to attempt.
-   *
-   * Valid Transitions:
-   *
-   * * [INVALID] if a source was modified that might cause the data to be computable
-   *
-   */
-  static final CacheState ERROR = new CacheState('ERROR', 0);
-
-  /**
-   * The data is not in the cache because it was flushed from the cache in order to control memory
-   * usage. If the data is recomputed, results do not need to be reported.
-   *
-   * Valid Transitions:
-   *
-   * * [IN_PROCESS] if the data is being recomputed
-   * * [INVALID] if a source was modified that causes the data to need to be recomputed
-   *
-   */
-  static final CacheState FLUSHED = new CacheState('FLUSHED', 1);
-
-  /**
-   * The data might or might not be in the cache but is in the process of being recomputed.
-   *
-   * Valid Transitions:
-   *
-   * * [ERROR] if an exception occurred while trying to compute the data
-   * * [VALID] if the data was successfully computed and stored in the cache
-   *
-   */
-  static final CacheState IN_PROCESS = new CacheState('IN_PROCESS', 2);
-
-  /**
-   * The data is not in the cache and needs to be recomputed so that results can be reported.
-   *
-   * Valid Transitions:
-   *
-   * * [IN_PROCESS] if an attempt is being made to recompute the data
-   *
-   */
-  static final CacheState INVALID = new CacheState('INVALID', 3);
-
-  /**
-   * The data is in the cache and up-to-date.
-   *
-   * Valid Transitions:
-   *
-   * * [FLUSHED] if the data is removed in order to manage memory usage
-   * * [INVALID] if a source was modified in such a way as to invalidate the previous data
-   *
-   */
-  static final CacheState VALID = new CacheState('VALID', 4);
-  static final List<CacheState> values = [ERROR, FLUSHED, IN_PROCESS, INVALID, VALID];
-  CacheState(String name, int ordinal) : super(name, ordinal);
-}
-/**
  * Instances of the class `ChangeNoticeImpl` represent a change to the analysis results
  * associated with a given source.
  *
@@ -5320,6 +7183,253 @@
   }
 }
 /**
+ * Instances of the class `DelegatingAnalysisContextImpl` extend [AnalysisContextImpl
+ ] to delegate sources to the appropriate analysis context. For instance, if the
+ * source is in a system library then the analysis context from the [DartSdk] is used.
+ *
+ * @coverage dart.engine
+ */
+class DelegatingAnalysisContextImpl2 extends AnalysisContextImpl2 {
+
+  /**
+   * This references the [InternalAnalysisContext] held onto by the [DartSdk] which is
+   * used (instead of this [AnalysisContext]) for SDK sources. This field is set when
+   * #setSourceFactory(SourceFactory) is called, and references the analysis context in the
+   * [DartUriResolver] in the [SourceFactory], this analysis context assumes that there
+   * will be such a resolver.
+   */
+  InternalAnalysisContext _sdkAnalysisContext;
+  void addSourceInfo(Source source, SourceEntry info) {
+    if (source.isInSystemLibrary) {
+      _sdkAnalysisContext.addSourceInfo(source, info);
+    } else {
+      super.addSourceInfo(source, info);
+    }
+  }
+  List<AnalysisError> computeErrors(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.computeErrors(source);
+    } else {
+      return super.computeErrors(source);
+    }
+  }
+  List<Source> computeExportedLibraries(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.computeExportedLibraries(source);
+    } else {
+      return super.computeExportedLibraries(source);
+    }
+  }
+  HtmlElement computeHtmlElement(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.computeHtmlElement(source);
+    } else {
+      return super.computeHtmlElement(source);
+    }
+  }
+  List<Source> computeImportedLibraries(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.computeImportedLibraries(source);
+    } else {
+      return super.computeImportedLibraries(source);
+    }
+  }
+  SourceKind computeKindOf(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.computeKindOf(source);
+    } else {
+      return super.computeKindOf(source);
+    }
+  }
+  LibraryElement computeLibraryElement(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.computeLibraryElement(source);
+    } else {
+      return super.computeLibraryElement(source);
+    }
+  }
+  LineInfo computeLineInfo(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.computeLineInfo(source);
+    } else {
+      return super.computeLineInfo(source);
+    }
+  }
+  ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.computeResolvableCompilationUnit(source);
+    } else {
+      return super.computeResolvableCompilationUnit(source);
+    }
+  }
+  AnalysisErrorInfo getErrors(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.getErrors(source);
+    } else {
+      return super.getErrors(source);
+    }
+  }
+  HtmlElement getHtmlElement(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.getHtmlElement(source);
+    } else {
+      return super.getHtmlElement(source);
+    }
+  }
+  List<Source> getHtmlFilesReferencing(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.getHtmlFilesReferencing(source);
+    } else {
+      return super.getHtmlFilesReferencing(source);
+    }
+  }
+  SourceKind getKindOf(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.getKindOf(source);
+    } else {
+      return super.getKindOf(source);
+    }
+  }
+  List<Source> getLibrariesContaining(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.getLibrariesContaining(source);
+    } else {
+      return super.getLibrariesContaining(source);
+    }
+  }
+  List<Source> getLibrariesDependingOn(Source librarySource) {
+    if (librarySource.isInSystemLibrary) {
+      return _sdkAnalysisContext.getLibrariesDependingOn(librarySource);
+    } else {
+      return super.getLibrariesDependingOn(librarySource);
+    }
+  }
+  LibraryElement getLibraryElement(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.getLibraryElement(source);
+    } else {
+      return super.getLibraryElement(source);
+    }
+  }
+  List<Source> get librarySources => ArrayUtils.addAll(super.librarySources, _sdkAnalysisContext.librarySources);
+  LineInfo getLineInfo(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.getLineInfo(source);
+    } else {
+      return super.getLineInfo(source);
+    }
+  }
+  Namespace getPublicNamespace(LibraryElement library) {
+    Source source = library.source;
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.getPublicNamespace(library);
+    } else {
+      return super.getPublicNamespace(library);
+    }
+  }
+  Namespace getPublicNamespace2(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.getPublicNamespace2(source);
+    } else {
+      return super.getPublicNamespace2(source);
+    }
+  }
+  CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement library) {
+    if (unitSource.isInSystemLibrary) {
+      return _sdkAnalysisContext.getResolvedCompilationUnit(unitSource, library);
+    } else {
+      return super.getResolvedCompilationUnit(unitSource, library);
+    }
+  }
+  CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source librarySource) {
+    if (unitSource.isInSystemLibrary) {
+      return _sdkAnalysisContext.getResolvedCompilationUnit2(unitSource, librarySource);
+    } else {
+      return super.getResolvedCompilationUnit2(unitSource, librarySource);
+    }
+  }
+  bool isClientLibrary(Source librarySource) {
+    if (librarySource.isInSystemLibrary) {
+      return _sdkAnalysisContext.isClientLibrary(librarySource);
+    } else {
+      return super.isClientLibrary(librarySource);
+    }
+  }
+  bool isServerLibrary(Source librarySource) {
+    if (librarySource.isInSystemLibrary) {
+      return _sdkAnalysisContext.isServerLibrary(librarySource);
+    } else {
+      return super.isServerLibrary(librarySource);
+    }
+  }
+  CompilationUnit parseCompilationUnit(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.parseCompilationUnit(source);
+    } else {
+      return super.parseCompilationUnit(source);
+    }
+  }
+  HtmlUnit parseHtmlUnit(Source source) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.parseHtmlUnit(source);
+    } else {
+      return super.parseHtmlUnit(source);
+    }
+  }
+  void recordLibraryElements(Map<Source, LibraryElement> elementMap) {
+    if (elementMap.isEmpty) {
+      return;
+    }
+    Source source = new JavaIterator(elementMap.keys.toSet()).next();
+    if (source.isInSystemLibrary) {
+      _sdkAnalysisContext.recordLibraryElements(elementMap);
+    } else {
+      super.recordLibraryElements(elementMap);
+    }
+  }
+  CompilationUnit resolveCompilationUnit(Source source, LibraryElement library) {
+    if (source.isInSystemLibrary) {
+      return _sdkAnalysisContext.resolveCompilationUnit(source, library);
+    } else {
+      return super.resolveCompilationUnit(source, library);
+    }
+  }
+  CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySource) {
+    if (unitSource.isInSystemLibrary) {
+      return _sdkAnalysisContext.resolveCompilationUnit2(unitSource, librarySource);
+    } else {
+      return super.resolveCompilationUnit2(unitSource, librarySource);
+    }
+  }
+  HtmlUnit resolveHtmlUnit(Source unitSource) {
+    if (unitSource.isInSystemLibrary) {
+      return _sdkAnalysisContext.resolveHtmlUnit(unitSource);
+    } else {
+      return super.resolveHtmlUnit(unitSource);
+    }
+  }
+  void setContents(Source source, String contents) {
+    if (source.isInSystemLibrary) {
+      _sdkAnalysisContext.setContents(source, contents);
+    } else {
+      super.setContents(source, contents);
+    }
+  }
+  void set sourceFactory(SourceFactory factory) {
+    super.sourceFactory = factory;
+    DartSdk sdk = factory.dartSdk;
+    if (sdk != null) {
+      _sdkAnalysisContext = sdk.context as InternalAnalysisContext;
+      if (_sdkAnalysisContext is DelegatingAnalysisContextImpl2) {
+        _sdkAnalysisContext = null;
+        throw new IllegalStateException("The context provided by an SDK cannot itself be a delegating analysis context");
+      }
+    } else {
+      throw new IllegalStateException("SourceFactorys provided to DelegatingAnalysisContextImpls must have a DartSdk associated with the provided SourceFactory.");
+    }
+  }
+}
+/**
  * Instances of the class `InstrumentedAnalysisContextImpl` implement an
  * [AnalysisContext] by recording instrumentation data and delegating to
  * another analysis context to do the non-instrumentation work.
@@ -5346,13 +7456,13 @@
   /**
    * The analysis context to which all of the non-instrumentation work is delegated.
    */
-  InternalAnalysisContext _basis;
+  InternalAnalysisContext basis;
 
   /**
    * Create a new [InstrumentedAnalysisContextImpl] which wraps a new
    * [AnalysisContextImpl] as the basis context.
    */
-  InstrumentedAnalysisContextImpl() : this.con1(new AnalysisContextImpl());
+  InstrumentedAnalysisContextImpl() : this.con1(AnalysisEngine.instance.useExperimentalContext ? new DelegatingAnalysisContextImpl2() : new DelegatingAnalysisContextImpl());
 
   /**
    * Create a new [InstrumentedAnalysisContextImpl] with a specified basis context, aka the
@@ -5361,16 +7471,16 @@
    * @param context some [InstrumentedAnalysisContext] to wrap and instrument
    */
   InstrumentedAnalysisContextImpl.con1(InternalAnalysisContext context) {
-    _basis = context;
+    basis = context;
   }
   void addSourceInfo(Source source, SourceEntry info) {
-    _basis.addSourceInfo(source, info);
+    basis.addSourceInfo(source, info);
   }
   void applyChanges(ChangeSet changeSet) {
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-applyChanges");
     try {
       instrumentation.metric3("contextId", _contextId);
-      _basis.applyChanges(changeSet);
+      basis.applyChanges(changeSet);
     } finally {
       instrumentation.log();
     }
@@ -5379,7 +7489,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-computeDocumentationComment");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.computeDocumentationComment(element);
+      return basis.computeDocumentationComment(element);
     } finally {
       instrumentation.log();
     }
@@ -5388,7 +7498,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-computeErrors");
     try {
       instrumentation.metric3("contextId", _contextId);
-      List<AnalysisError> errors = _basis.computeErrors(source);
+      List<AnalysisError> errors = basis.computeErrors(source);
       instrumentation.metric2("Errors-count", errors.length);
       return errors;
     } finally {
@@ -5399,7 +7509,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-computeExportedLibraries");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.computeExportedLibraries(source);
+      return basis.computeExportedLibraries(source);
     } finally {
       instrumentation.log();
     }
@@ -5408,7 +7518,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-computeHtmlElement");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.computeHtmlElement(source);
+      return basis.computeHtmlElement(source);
     } on AnalysisException catch (e) {
       recordAnalysisException(instrumentation, e);
       throw e;
@@ -5420,7 +7530,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-computeImportedLibraries");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.computeImportedLibraries(source);
+      return basis.computeImportedLibraries(source);
     } finally {
       instrumentation.log();
     }
@@ -5429,7 +7539,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-computeKindOf");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.computeKindOf(source);
+      return basis.computeKindOf(source);
     } finally {
       instrumentation.log();
     }
@@ -5438,7 +7548,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-computeLibraryElement");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.computeLibraryElement(source);
+      return basis.computeLibraryElement(source);
     } on AnalysisException catch (e) {
       recordAnalysisException(instrumentation, e);
       throw e;
@@ -5450,7 +7560,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-computeLineInfo");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.computeLineInfo(source);
+      return basis.computeLineInfo(source);
     } on AnalysisException catch (e) {
       recordAnalysisException(instrumentation, e);
       throw e;
@@ -5458,38 +7568,34 @@
       instrumentation.log();
     }
   }
-  ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) => _basis.computeResolvableCompilationUnit(source);
+  ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) => basis.computeResolvableCompilationUnit(source);
+  ResolvableHtmlUnit computeResolvableHtmlUnit(Source source) => basis.computeResolvableHtmlUnit(source);
   AnalysisContext extractContext(SourceContainer container) {
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-extractContext");
     try {
       instrumentation.metric3("contextId", _contextId);
       InstrumentedAnalysisContextImpl newContext = new InstrumentedAnalysisContextImpl();
-      _basis.extractContextInto(container, newContext._basis);
+      basis.extractContextInto(container, newContext.basis);
       return newContext;
     } finally {
       instrumentation.log();
     }
   }
-  InternalAnalysisContext extractContextInto(SourceContainer container, InternalAnalysisContext newContext) => _basis.extractContextInto(container, newContext);
+  InternalAnalysisContext extractContextInto(SourceContainer container, InternalAnalysisContext newContext) => basis.extractContextInto(container, newContext);
   AnalysisOptions get analysisOptions {
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getAnalysisOptions");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.analysisOptions;
+      return basis.analysisOptions;
     } finally {
       instrumentation.log();
     }
   }
-
-  /**
-   * @return the underlying [AnalysisContext].
-   */
-  AnalysisContext get basis => _basis;
   Element getElement(ElementLocation location) {
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getElement");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.getElement(location);
+      return basis.getElement(location);
     } finally {
       instrumentation.log();
     }
@@ -5498,7 +7604,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getErrors");
     try {
       instrumentation.metric3("contextId", _contextId);
-      AnalysisErrorInfo ret = _basis.getErrors(source);
+      AnalysisErrorInfo ret = basis.getErrors(source);
       if (ret != null) {
         instrumentation.metric2("Errors-count", ret.errors.length);
       }
@@ -5511,7 +7617,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getHtmlElement");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.getHtmlElement(source);
+      return basis.getHtmlElement(source);
     } finally {
       instrumentation.log();
     }
@@ -5520,7 +7626,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getHtmlFilesReferencing");
     try {
       instrumentation.metric3("contextId", _contextId);
-      List<Source> ret = _basis.getHtmlFilesReferencing(source);
+      List<Source> ret = basis.getHtmlFilesReferencing(source);
       if (ret != null) {
         instrumentation.metric2("Source-count", ret.length);
       }
@@ -5533,7 +7639,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getHtmlSources");
     try {
       instrumentation.metric3("contextId", _contextId);
-      List<Source> ret = _basis.htmlSources;
+      List<Source> ret = basis.htmlSources;
       if (ret != null) {
         instrumentation.metric2("Source-count", ret.length);
       }
@@ -5546,7 +7652,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getKindOf");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.getKindOf(source);
+      return basis.getKindOf(source);
     } finally {
       instrumentation.log();
     }
@@ -5555,7 +7661,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getLaunchableClientLibrarySources");
     try {
       instrumentation.metric3("contextId", _contextId);
-      List<Source> ret = _basis.launchableClientLibrarySources;
+      List<Source> ret = basis.launchableClientLibrarySources;
       if (ret != null) {
         instrumentation.metric2("Source-count", ret.length);
       }
@@ -5568,7 +7674,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getLaunchableServerLibrarySources");
     try {
       instrumentation.metric3("contextId", _contextId);
-      List<Source> ret = _basis.launchableServerLibrarySources;
+      List<Source> ret = basis.launchableServerLibrarySources;
       if (ret != null) {
         instrumentation.metric2("Source-count", ret.length);
       }
@@ -5581,7 +7687,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getLibrariesContaining");
     try {
       instrumentation.metric3("contextId", _contextId);
-      List<Source> ret = _basis.getLibrariesContaining(source);
+      List<Source> ret = basis.getLibrariesContaining(source);
       if (ret != null) {
         instrumentation.metric2("Source-count", ret.length);
       }
@@ -5594,7 +7700,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getLibrariesDependingOn");
     try {
       instrumentation.metric3("contextId", _contextId);
-      List<Source> ret = _basis.getLibrariesDependingOn(librarySource);
+      List<Source> ret = basis.getLibrariesDependingOn(librarySource);
       if (ret != null) {
         instrumentation.metric2("Source-count", ret.length);
       }
@@ -5607,7 +7713,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getLibraryElement");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.getLibraryElement(source);
+      return basis.getLibraryElement(source);
     } finally {
       instrumentation.log();
     }
@@ -5616,7 +7722,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getLibrarySources");
     try {
       instrumentation.metric3("contextId", _contextId);
-      List<Source> ret = _basis.librarySources;
+      List<Source> ret = basis.librarySources;
       if (ret != null) {
         instrumentation.metric2("Source-count", ret.length);
       }
@@ -5629,18 +7735,18 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getLineInfo");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.getLineInfo(source);
+      return basis.getLineInfo(source);
     } finally {
       instrumentation.log();
     }
   }
-  Namespace getPublicNamespace(LibraryElement library) => _basis.getPublicNamespace(library);
-  Namespace getPublicNamespace2(Source source) => _basis.getPublicNamespace2(source);
+  Namespace getPublicNamespace(LibraryElement library) => basis.getPublicNamespace(library);
+  Namespace getPublicNamespace2(Source source) => basis.getPublicNamespace2(source);
   CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement library) {
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getResolvedCompilationUnit");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.getResolvedCompilationUnit(unitSource, library);
+      return basis.getResolvedCompilationUnit(unitSource, library);
     } finally {
       instrumentation.log();
     }
@@ -5649,7 +7755,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getResolvedCompilationUnit");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.getResolvedCompilationUnit2(unitSource, librarySource);
+      return basis.getResolvedCompilationUnit2(unitSource, librarySource);
     } finally {
       instrumentation.log2(2);
     }
@@ -5658,17 +7764,17 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getSourceFactory");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.sourceFactory;
+      return basis.sourceFactory;
     } finally {
       instrumentation.log2(2);
     }
   }
-  AnalysisContentStatistics get statistics => _basis.statistics;
+  AnalysisContentStatistics get statistics => basis.statistics;
   bool isClientLibrary(Source librarySource) {
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-isClientLibrary");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.isClientLibrary(librarySource);
+      return basis.isClientLibrary(librarySource);
     } finally {
       instrumentation.log();
     }
@@ -5677,7 +7783,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-isServerLibrary");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.isServerLibrary(librarySource);
+      return basis.isServerLibrary(librarySource);
     } finally {
       instrumentation.log();
     }
@@ -5687,9 +7793,9 @@
     try {
       instrumentation.metric3("contextId", _contextId);
       if (context is InstrumentedAnalysisContextImpl) {
-        context = ((context as InstrumentedAnalysisContextImpl))._basis;
+        context = ((context as InstrumentedAnalysisContextImpl)).basis;
       }
-      _basis.mergeContext(context);
+      basis.mergeContext(context);
     } finally {
       instrumentation.log();
     }
@@ -5698,7 +7804,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-parseCompilationUnit");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.parseCompilationUnit(source);
+      return basis.parseCompilationUnit(source);
     } on AnalysisException catch (e) {
       recordAnalysisException(instrumentation, e);
       throw e;
@@ -5710,7 +7816,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-parseHtmlUnit");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.parseHtmlUnit(source);
+      return basis.parseHtmlUnit(source);
     } on AnalysisException catch (e) {
       recordAnalysisException(instrumentation, e);
       throw e;
@@ -5722,7 +7828,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-performAnalysisTask");
     try {
       instrumentation.metric3("contextId", _contextId);
-      List<ChangeNotice> ret = _basis.performAnalysisTask();
+      List<ChangeNotice> ret = basis.performAnalysisTask();
       if (ret != null) {
         instrumentation.metric2("ChangeNotice-count", ret.length);
       }
@@ -5732,13 +7838,13 @@
     }
   }
   void recordLibraryElements(Map<Source, LibraryElement> elementMap) {
-    _basis.recordLibraryElements(elementMap);
+    basis.recordLibraryElements(elementMap);
   }
   CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement library) {
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-resolveCompilationUnit");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.resolveCompilationUnit(unitSource, library);
+      return basis.resolveCompilationUnit(unitSource, library);
     } on AnalysisException catch (e) {
       recordAnalysisException(instrumentation, e);
       throw e;
@@ -5750,7 +7856,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-resolveCompilationUnit");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.resolveCompilationUnit2(unitSource, librarySource);
+      return basis.resolveCompilationUnit2(unitSource, librarySource);
     } on AnalysisException catch (e) {
       recordAnalysisException(instrumentation, e);
       throw e;
@@ -5762,7 +7868,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-resolveHtmlUnit");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.resolveHtmlUnit(htmlSource);
+      return basis.resolveHtmlUnit(htmlSource);
     } on AnalysisException catch (e) {
       recordAnalysisException(instrumentation, e);
       throw e;
@@ -5774,7 +7880,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-setAnalysisOptions");
     try {
       instrumentation.metric3("contextId", _contextId);
-      _basis.analysisOptions = options;
+      basis.analysisOptions = options;
     } finally {
       instrumentation.log();
     }
@@ -5783,7 +7889,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-setAnalysisPriorityOrder");
     try {
       instrumentation.metric3("contextId", _contextId);
-      _basis.analysisPriorityOrder = sources;
+      basis.analysisPriorityOrder = sources;
     } finally {
       instrumentation.log();
     }
@@ -5792,7 +7898,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-setContents");
     try {
       instrumentation.metric3("contextId", _contextId);
-      _basis.setContents(source, contents);
+      basis.setContents(source, contents);
     } finally {
       instrumentation.log();
     }
@@ -5801,7 +7907,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-setSourceFactory");
     try {
       instrumentation.metric3("contextId", _contextId);
-      _basis.sourceFactory = factory;
+      basis.sourceFactory = factory;
     } finally {
       instrumentation.log();
     }
@@ -5810,7 +7916,7 @@
     InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-sourcesToResolve");
     try {
       instrumentation.metric3("contextId", _contextId);
-      return _basis.sourcesToResolve(changedSources);
+      return basis.sourcesToResolve(changedSources);
     } finally {
       instrumentation.log();
     }
@@ -5864,6 +7970,16 @@
   ResolvableCompilationUnit computeResolvableCompilationUnit(Source source);
 
   /**
+   * Return an AST structure corresponding to the given source, but ensure that the structure has
+   * not already been resolved and will not be resolved by any other threads.
+   *
+   * @param source the compilation unit for which an AST structure should be returned
+   * @return the AST structure representing the content of the source
+   * @throws AnalysisException if the analysis could not be performed
+   */
+  ResolvableHtmlUnit computeResolvableHtmlUnit(Source source);
+
+  /**
    * Initialize the specified context by removing the specified sources from the receiver and adding
    * them to the specified context.
    *
@@ -6067,37 +8183,698 @@
   /**
    * The modification time of the source from which the AST was created.
    */
-  int _modificationStamp = 0;
+  int modificationTime = 0;
 
   /**
    * The AST that was created from the source.
    */
-  CompilationUnit _unit;
+  CompilationUnit compilationUnit;
 
   /**
    * Initialize a newly created holder to hold the given values.
    *
-   * @param modificationStamp the modification time of the source from which the AST was created
+   * @param modificationTime the modification time of the source from which the AST was created
    * @param unit the AST that was created from the source
    */
-  ResolvableCompilationUnit(int modificationStamp, CompilationUnit unit) {
-    this._modificationStamp = modificationStamp;
-    this._unit = unit;
+  ResolvableCompilationUnit(int modificationTime, CompilationUnit unit) {
+    this.modificationTime = modificationTime;
+    this.compilationUnit = unit;
+  }
+}
+/**
+ * Instances of the class `ResolvableHtmlUnit` represent an HTML unit that is not referenced
+ * by any other objects and for which we have modification stamp information. It is used by the
+ * [ResolveHtmlTask] to resolve an HTML source.
+ */
+class ResolvableHtmlUnit {
+
+  /**
+   * The modification time of the source from which the AST was created.
+   */
+  int modificationTime = 0;
+
+  /**
+   * The AST that was created from the source.
+   */
+  HtmlUnit compilationUnit;
+
+  /**
+   * Initialize a newly created holder to hold the given values.
+   *
+   * @param modificationTime the modification time of the source from which the AST was created
+   * @param unit the AST that was created from the source
+   */
+  ResolvableHtmlUnit(int modificationTime, HtmlUnit unit) {
+    this.modificationTime = modificationTime;
+    this.compilationUnit = unit;
+  }
+}
+/**
+ * The abstract class `AnalysisTask` defines the behavior of objects used to perform an
+ * analysis task.
+ */
+abstract class AnalysisTask {
+
+  /**
+   * The context in which the task is to be performed.
+   */
+  InternalAnalysisContext context;
+
+  /**
+   * The exception that was thrown while performing this task, or `null` if the task completed
+   * successfully.
+   */
+  AnalysisException exception;
+
+  /**
+   * Initialize a newly created task to perform analysis within the given context.
+   *
+   * @param context the context in which the task is to be performed
+   */
+  AnalysisTask(InternalAnalysisContext context) {
+    this.context = context;
   }
 
   /**
-   * Return the AST that was created from the source.
+   * Use the given visitor to visit this task.
    *
-   * @return the AST that was created from the source
+   * @param visitor the visitor that should be used to visit this task
+   * @return the value returned by the visitor
+   * @throws AnalysisException if the visitor throws the exception
    */
-  CompilationUnit get compilationUnit => _unit;
+  accept(AnalysisTaskVisitor visitor);
 
   /**
-   * Return the modification time of the source from which the AST was created.
+   * Perform this analysis task and use the given visitor to visit this task after it has completed.
    *
-   * @return the modification time of the source from which the AST was created
+   * @param visitor the visitor used to visit this task after it has completed
+   * @return the value returned by the visitor
+   * @throws AnalysisException if the visitor throws the exception
    */
-  int get modificationStamp => _modificationStamp;
+  Object perform(AnalysisTaskVisitor visitor) {
+    try {
+      safelyPerform();
+    } on AnalysisException catch (exception) {
+      exception = exception;
+      AnalysisEngine.instance.logger.logInformation2("Task failed: ${taskDescription}", exception);
+    }
+    return accept(visitor);
+  }
+  String toString() => taskDescription;
+
+  /**
+   * Return a textual description of this task.
+   *
+   * @return a textual description of this task
+   */
+  String get taskDescription;
+
+  /**
+   * Perform this analysis task, protected by an exception handler.
+   *
+   * @throws AnalysisException if an exception occurs while performing the task
+   */
+  void internalPerform();
+
+  /**
+   * Perform this analysis task, ensuring that all exceptions are wrapped in an
+   * [AnalysisException].
+   *
+   * @throws AnalysisException if any exception occurs while performing the task
+   */
+  void safelyPerform() {
+    try {
+      internalPerform();
+    } on AnalysisException catch (exception) {
+      throw exception;
+    } catch (exception) {
+      throw new AnalysisException.con3(exception);
+    }
+  }
+}
+/**
+ * The interface `AnalysisTaskVisitor` defines the behavior of objects that can visit tasks.
+ * While tasks are not structured in any interesting way, this class provides the ability to
+ * dispatch to an appropriate method.
+ */
+abstract class AnalysisTaskVisitor<E> {
+
+  /**
+   * Visit a [ParseDartTask].
+   *
+   * @param task the task to be visited
+   * @return the result of visiting the task
+   * @throws AnalysisException if the visitor throws an exception for some reason
+   */
+  E visitParseDartTask(ParseDartTask task);
+
+  /**
+   * Visit a [ParseHtmlTask].
+   *
+   * @param task the task to be visited
+   * @return the result of visiting the task
+   * @throws AnalysisException if the visitor throws an exception for some reason
+   */
+  E visitParseHtmlTask(ParseHtmlTask task);
+
+  /**
+   * Visit a [ResolveDartLibraryTask].
+   *
+   * @param task the task to be visited
+   * @return the result of visiting the task
+   * @throws AnalysisException if the visitor throws an exception for some reason
+   */
+  E visitResolveDartLibraryTask(ResolveDartLibraryTask task);
+
+  /**
+   * Visit a [ResolveDartUnitTask].
+   *
+   * @param task the task to be visited
+   * @return the result of visiting the task
+   * @throws AnalysisException if the visitor throws an exception for some reason
+   */
+  E visitResolveDartUnitTask(ResolveDartUnitTask task);
+
+  /**
+   * Visit a [ResolveHtmlTask].
+   *
+   * @param task the task to be visited
+   * @return the result of visiting the task
+   * @throws AnalysisException if the visitor throws an exception for some reason
+   */
+  E visitResolveHtmlTask(ResolveHtmlTask task);
+}
+/**
+ * Instances of the class `ParseDartTask` parse a specific source as a Dart file.
+ */
+class ParseDartTask extends AnalysisTask {
+
+  /**
+   * The source to be parsed.
+   */
+  Source source;
+
+  /**
+   * The time at which the contents of the source were last modified.
+   */
+  int modificationTime = -1;
+
+  /**
+   * The line information that was produced.
+   */
+  LineInfo lineInfo;
+
+  /**
+   * The compilation unit that was produced by parsing the source.
+   */
+  CompilationUnit compilationUnit;
+
+  /**
+   * The errors that were produced by scanning and parsing the source.
+   */
+  List<AnalysisError> errors = AnalysisError.NO_ERRORS;
+
+  /**
+   * A flag indicating whether the source contains a 'part of' directive.
+   */
+  bool _hasPartOfDirective2 = false;
+
+  /**
+   * A flag indicating whether the source contains a 'library' directive.
+   */
+  bool _hasLibraryDirective2 = false;
+
+  /**
+   * A set containing the sources referenced by 'export' directives.
+   */
+  Set<Source> _exportedSources = new Set<Source>();
+
+  /**
+   * A set containing the sources referenced by 'import' directives.
+   */
+  Set<Source> _importedSources = new Set<Source>();
+
+  /**
+   * A set containing the sources referenced by 'part' directives.
+   */
+  Set<Source> _includedSources = new Set<Source>();
+
+  /**
+   * Initialize a newly created task to perform analysis within the given context.
+   *
+   * @param context the context in which the task is to be performed
+   * @param source the source to be parsed
+   */
+  ParseDartTask(InternalAnalysisContext context, Source source) : super(context) {
+    this.source = source;
+  }
+  accept(AnalysisTaskVisitor visitor) => visitor.visitParseDartTask(this);
+
+  /**
+   * Return an array containing the sources referenced by 'export' directives, or an empty array if
+   * the task has not yet been performed or if an exception occurred.
+   *
+   * @return an array containing the sources referenced by 'export' directives
+   */
+  List<Source> get exportedSources => toArray(_exportedSources);
+
+  /**
+   * Return an array containing the sources referenced by 'import' directives, or an empty array if
+   * the task has not yet been performed or if an exception occurred.
+   *
+   * @return an array containing the sources referenced by 'import' directives
+   */
+  List<Source> get importedSources => toArray(_importedSources);
+
+  /**
+   * Return an array containing the sources referenced by 'part' directives, or an empty array if
+   * the task has not yet been performed or if an exception occurred.
+   *
+   * @return an array containing the sources referenced by 'part' directives
+   */
+  List<Source> get includedSources => toArray(_includedSources);
+
+  /**
+   * Return `true` if the source contains a 'library' directive, or `false` if the task
+   * has not yet been performed or if an exception occurred.
+   *
+   * @return `true` if the source contains a 'library' directive
+   */
+  bool hasLibraryDirective() => _hasLibraryDirective2;
+
+  /**
+   * Return `true` if the source contains a 'part of' directive, or `false` if the task
+   * has not yet been performed or if an exception occurred.
+   *
+   * @return `true` if the source contains a 'part of' directive
+   */
+  bool hasPartOfDirective() => _hasPartOfDirective2;
+  String get taskDescription => "parse as dart ${source.fullName}";
+  void internalPerform() {
+    RecordingErrorListener errorListener = new RecordingErrorListener();
+    List<Token> token = [null];
+    Source_ContentReceiver receiver = new Source_ContentReceiver_10(this, errorListener, token);
+    try {
+      source.getContents(receiver);
+    } catch (exception) {
+      modificationTime = source.modificationStamp;
+      throw new AnalysisException.con3(exception);
+    }
+    Parser parser = new Parser(source, errorListener);
+    compilationUnit = parser.parseCompilationUnit(token[0]);
+    errors = errorListener.getErrors2(source);
+    for (Directive directive in compilationUnit.directives) {
+      if (directive is ExportDirective) {
+        Source exportSource = resolveSource(source, directive as ExportDirective);
+        if (exportSource != null) {
+          javaSetAdd(_exportedSources, exportSource);
+        }
+      } else if (directive is ImportDirective) {
+        Source importSource = resolveSource(source, directive as ImportDirective);
+        if (importSource != null) {
+          javaSetAdd(_importedSources, importSource);
+        }
+      } else if (directive is LibraryDirective) {
+        _hasLibraryDirective2 = true;
+      } else if (directive is PartDirective) {
+        Source partSource = resolveSource(source, directive as PartDirective);
+        if (partSource != null) {
+          javaSetAdd(_includedSources, partSource);
+        }
+      } else if (directive is PartOfDirective) {
+        _hasPartOfDirective2 = true;
+      }
+    }
+    compilationUnit.parsingErrors = errors;
+    compilationUnit.lineInfo = lineInfo;
+  }
+
+  /**
+   * Return the result of resolving the URI of the given URI-based directive against the URI of the
+   * given library, or `null` if the URI is not valid.
+   *
+   * @param librarySource the source representing the library containing the directive
+   * @param directive the directive which URI should be resolved
+   * @return the result of resolving the URI against the URI of the library
+   */
+  Source resolveSource(Source librarySource, UriBasedDirective directive) {
+    StringLiteral uriLiteral = directive.uri;
+    if (uriLiteral is StringInterpolation) {
+      return null;
+    }
+    String uriContent = uriLiteral.stringValue.trim();
+    if (uriContent == null) {
+      return null;
+    }
+    uriContent = Uri.encodeFull(uriContent);
+    try {
+      parseUriWithException(uriContent);
+      return context.sourceFactory.resolveUri(librarySource, uriContent);
+    } on URISyntaxException catch (exception) {
+      return null;
+    }
+  }
+
+  /**
+   * Efficiently convert the given set of sources to an array.
+   *
+   * @param sources the set to be converted
+   * @return an array containing all of the sources in the given set
+   */
+  List<Source> toArray(Set<Source> sources) {
+    int size = sources.length;
+    if (size == 0) {
+      return Source.EMPTY_ARRAY;
+    }
+    return new List.from(sources);
+  }
+}
+class Source_ContentReceiver_10 implements Source_ContentReceiver {
+  final ParseDartTask ParseDartTask_this;
+  RecordingErrorListener errorListener;
+  List<Token> token;
+  Source_ContentReceiver_10(this.ParseDartTask_this, this.errorListener, this.token);
+  void accept(CharBuffer contents, int modificationTime2) {
+    ParseDartTask_this.modificationTime = modificationTime2;
+    CharBufferScanner scanner = new CharBufferScanner(ParseDartTask_this.source, contents, errorListener);
+    token[0] = scanner.tokenize();
+    ParseDartTask_this.lineInfo = new LineInfo(scanner.lineStarts);
+  }
+  void accept2(String contents, int modificationTime2) {
+    ParseDartTask_this.modificationTime = modificationTime2;
+    StringScanner scanner = new StringScanner(ParseDartTask_this.source, contents, errorListener);
+    token[0] = scanner.tokenize();
+    ParseDartTask_this.lineInfo = new LineInfo(scanner.lineStarts);
+  }
+}
+/**
+ * Instances of the class `ParseHtmlTask` parse a specific source as an HTML file.
+ */
+class ParseHtmlTask extends AnalysisTask {
+
+  /**
+   * The source to be parsed.
+   */
+  Source source;
+
+  /**
+   * The time at which the contents of the source were last modified.
+   */
+  int modificationTime = -1;
+
+  /**
+   * The line information that was produced.
+   */
+  LineInfo lineInfo;
+
+  /**
+   * The HTML unit that was produced by parsing the source.
+   */
+  HtmlUnit htmlUnit;
+
+  /**
+   * An array containing the sources of the libraries that are referenced within the HTML.
+   */
+  List<Source> referencedLibraries = Source.EMPTY_ARRAY;
+
+  /**
+   * The name of the 'src' attribute in a HTML tag.
+   */
+  static String _ATTRIBUTE_SRC = "src";
+
+  /**
+   * The name of the 'type' attribute in a HTML tag.
+   */
+  static String _ATTRIBUTE_TYPE = "type";
+
+  /**
+   * The name of the 'script' tag in an HTML file.
+   */
+  static String _TAG_SCRIPT = "script";
+
+  /**
+   * The value of the 'type' attribute of a 'script' tag that indicates that the script is written
+   * in Dart.
+   */
+  static String _TYPE_DART = "application/dart";
+
+  /**
+   * Initialize a newly created task to perform analysis within the given context.
+   *
+   * @param context the context in which the task is to be performed
+   * @param source the source to be parsed
+   */
+  ParseHtmlTask(InternalAnalysisContext context, Source source) : super(context) {
+    this.source = source;
+  }
+  accept(AnalysisTaskVisitor visitor) => visitor.visitParseHtmlTask(this);
+  String get taskDescription => "parse as html ${source.fullName}";
+  void internalPerform() {
+    HtmlScanner scanner = new HtmlScanner(source);
+    try {
+      source.getContents(scanner);
+    } catch (exception) {
+      throw new AnalysisException.con3(exception);
+    }
+    HtmlScanResult scannerResult = scanner.result;
+    modificationTime = scannerResult.modificationTime;
+    lineInfo = new LineInfo(scannerResult.lineStarts);
+    HtmlParseResult result = new HtmlParser(source).parse(scannerResult);
+    htmlUnit = result.htmlUnit;
+    referencedLibraries = librarySources;
+  }
+
+  /**
+   * Return the sources of libraries that are referenced in the specified HTML file.
+   *
+   * @return the sources of libraries that are referenced in the HTML file
+   */
+  List<Source> get librarySources {
+    List<Source> libraries = new List<Source>();
+    htmlUnit.accept(new RecursiveXmlVisitor_11(this, libraries));
+    if (libraries.isEmpty) {
+      return Source.EMPTY_ARRAY;
+    }
+    return new List.from(libraries);
+  }
+}
+class RecursiveXmlVisitor_11 extends RecursiveXmlVisitor<Object> {
+  final ParseHtmlTask ParseHtmlTask_this;
+  List<Source> libraries;
+  RecursiveXmlVisitor_11(this.ParseHtmlTask_this, this.libraries) : super();
+  Object visitXmlTagNode(XmlTagNode node) {
+    if (javaStringEqualsIgnoreCase(node.tag.lexeme, ParseHtmlTask._TAG_SCRIPT)) {
+      bool isDartScript = false;
+      XmlAttributeNode scriptAttribute = null;
+      for (XmlAttributeNode attribute in node.attributes) {
+        if (javaStringEqualsIgnoreCase(attribute.name.lexeme, ParseHtmlTask._ATTRIBUTE_SRC)) {
+          scriptAttribute = attribute;
+        } else if (javaStringEqualsIgnoreCase(attribute.name.lexeme, ParseHtmlTask._ATTRIBUTE_TYPE)) {
+          if (javaStringEqualsIgnoreCase(attribute.text, ParseHtmlTask._TYPE_DART)) {
+            isDartScript = true;
+          }
+        }
+      }
+      if (isDartScript && scriptAttribute != null) {
+        try {
+          Uri uri = new Uri(path: scriptAttribute.text);
+          String fileName = uri.path;
+          Source librarySource = ParseHtmlTask_this.context.sourceFactory.resolveUri(ParseHtmlTask_this.source, fileName);
+          if (librarySource.exists()) {
+            libraries.add(librarySource);
+          }
+        } catch (exception) {
+          AnalysisEngine.instance.logger.logInformation2("Invalid URL ('${scriptAttribute.text}') in script tag in '${ParseHtmlTask_this.source.fullName}'", exception);
+        }
+      }
+    }
+    return super.visitXmlTagNode(node);
+  }
+}
+/**
+ * Instances of the class `ResolveDartLibraryTask` parse a specific Dart library.
+ */
+class ResolveDartLibraryTask extends AnalysisTask {
+
+  /**
+   * The source representing the file whose compilation unit is to be returned.
+   */
+  Source unitSource;
+
+  /**
+   * The source representing the library to be resolved.
+   */
+  Source librarySource;
+
+  /**
+   * The library resolver holding information about the libraries that were resolved.
+   */
+  LibraryResolver libraryResolver;
+
+  /**
+   * Initialize a newly created task to perform analysis within the given context.
+   *
+   * @param context the context in which the task is to be performed
+   * @param unitSource the source representing the file whose compilation unit is to be returned
+   * @param librarySource the source representing the library to be resolved
+   */
+  ResolveDartLibraryTask(InternalAnalysisContext context, Source unitSource, Source librarySource) : super(context) {
+    this.unitSource = unitSource;
+    this.librarySource = librarySource;
+  }
+  accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartLibraryTask(this);
+  String get taskDescription => "resolve library ${librarySource.fullName}";
+  void internalPerform() {
+    libraryResolver = new LibraryResolver(context);
+    libraryResolver.resolveLibrary(librarySource, true);
+  }
+}
+/**
+ * Instances of the class `ResolveDartUnitTask` resolve a single Dart file based on a existing
+ * element model.
+ */
+class ResolveDartUnitTask extends AnalysisTask {
+
+  /**
+   * The source that is to be resolved.
+   */
+  Source source;
+
+  /**
+   * The element model for the library containing the source.
+   */
+  LibraryElement _libraryElement;
+
+  /**
+   * The time at which the contents of the source were last modified.
+   */
+  int modificationTime = -1;
+
+  /**
+   * The compilation unit that was resolved by this task.
+   */
+  CompilationUnit resolvedUnit;
+
+  /**
+   * Initialize a newly created task to perform analysis within the given context.
+   *
+   * @param context the context in which the task is to be performed
+   * @param source the source to be parsed
+   * @param libraryElement the element model for the library containing the source
+   */
+  ResolveDartUnitTask(InternalAnalysisContext context, Source source, LibraryElement libraryElement) : super(context) {
+    this.source = source;
+    this._libraryElement = libraryElement;
+  }
+  accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartUnitTask(this);
+
+  /**
+   * Return the source for the library containing the source that is to be resolved.
+   *
+   * @return the source for the library containing the source that is to be resolved
+   */
+  Source get librarySource => _libraryElement.source;
+  String get taskDescription => "resolve unit ${_libraryElement.source.fullName}";
+  void internalPerform() {
+    Source coreLibrarySource = _libraryElement.context.sourceFactory.forUri(DartSdk.DART_CORE);
+    LibraryElement coreElement = context.computeLibraryElement(coreLibrarySource);
+    TypeProvider typeProvider = new TypeProviderImpl(coreElement);
+    ResolvableCompilationUnit resolvableUnit = context.computeResolvableCompilationUnit(source);
+    modificationTime = resolvableUnit.modificationTime;
+    CompilationUnit unit = resolvableUnit.compilationUnit;
+    if (unit == null) {
+      throw new AnalysisException.con1("Internal error: computeResolvableCompilationUnit returned a value without a parsed Dart unit");
+    }
+    new DeclarationResolver().resolve(unit, find(_libraryElement, source));
+    RecordingErrorListener errorListener = new RecordingErrorListener();
+    TypeResolverVisitor typeResolverVisitor = new TypeResolverVisitor.con2(_libraryElement, source, typeProvider, errorListener);
+    unit.accept(typeResolverVisitor);
+    InheritanceManager inheritanceManager = new InheritanceManager(_libraryElement);
+    ResolverVisitor resolverVisitor = new ResolverVisitor.con2(_libraryElement, source, typeProvider, inheritanceManager, errorListener);
+    unit.accept(resolverVisitor);
+    for (ProxyConditionalAnalysisError conditionalCode in resolverVisitor.proxyConditionalAnalysisErrors) {
+      if (conditionalCode.shouldIncludeErrorCode()) {
+        resolverVisitor.reportError(conditionalCode.analysisError);
+      }
+    }
+    ErrorReporter errorReporter = new ErrorReporter(errorListener, source);
+    ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, _libraryElement, typeProvider, inheritanceManager);
+    unit.accept(errorVerifier);
+    ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, typeProvider);
+    unit.accept(constantVerifier);
+    unit.resolutionErrors = errorListener.errors;
+    resolvedUnit = unit;
+  }
+
+  /**
+   * Search the compilation units that are part of the given library and return the element
+   * representing the compilation unit with the given source. Return `null` if there is no
+   * such compilation unit.
+   *
+   * @param libraryElement the element representing the library being searched through
+   * @param unitSource the source for the compilation unit whose element is to be returned
+   * @return the element representing the compilation unit
+   */
+  CompilationUnitElement find(LibraryElement libraryElement, Source unitSource) {
+    CompilationUnitElement element = libraryElement.definingCompilationUnit;
+    if (element.source == unitSource) {
+      return element;
+    }
+    for (CompilationUnitElement partElement in libraryElement.parts) {
+      if (partElement.source == unitSource) {
+        return partElement;
+      }
+    }
+    return null;
+  }
+}
+/**
+ * Instances of the class `ResolveHtmlTask` resolve a specific source as an HTML file.
+ */
+class ResolveHtmlTask extends AnalysisTask {
+
+  /**
+   * The source to be resolved.
+   */
+  Source source;
+
+  /**
+   * The time at which the contents of the source were last modified.
+   */
+  int modificationTime = -1;
+
+  /**
+   * The element produced by resolving the source.
+   */
+  HtmlElement element = null;
+
+  /**
+   * The resolution errors that were discovered while resolving the source.
+   */
+  List<AnalysisError> resolutionErrors = AnalysisError.NO_ERRORS;
+
+  /**
+   * Initialize a newly created task to perform analysis within the given context.
+   *
+   * @param context the context in which the task is to be performed
+   * @param source the source to be resolved
+   */
+  ResolveHtmlTask(InternalAnalysisContext context, Source source) : super(context) {
+    this.source = source;
+  }
+  accept(AnalysisTaskVisitor visitor) => visitor.visitResolveHtmlTask(this);
+  String get taskDescription => "resolve as html ${source.fullName}";
+  void internalPerform() {
+    ResolvableHtmlUnit resolvableHtmlUnit = context.computeResolvableHtmlUnit(source);
+    HtmlUnit unit = resolvableHtmlUnit.compilationUnit;
+    if (unit == null) {
+      throw new AnalysisException.con1("Internal error: computeResolvableHtmlUnit returned a value without a parsed HTML unit");
+    }
+    modificationTime = resolvableHtmlUnit.modificationTime;
+    HtmlUnitBuilder builder = new HtmlUnitBuilder(context);
+    element = builder.buildHtmlElement2(source, modificationTime, unit);
+    resolutionErrors = builder.errorListener.getErrors2(source);
+  }
 }
 /**
  * The interface `Logger` defines the behavior of objects that can be used to receive
diff --git a/pkg/analyzer_experimental/lib/src/generated/error.dart b/pkg/analyzer_experimental/lib/src/generated/error.dart
index 5dfba2f..0cd73fa 100644
--- a/pkg/analyzer_experimental/lib/src/generated/error.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/error.dart
@@ -40,12 +40,12 @@
   /**
    * The name of the severity used when producing machine output.
    */
-  String _machineCode;
+  String machineCode;
 
   /**
    * The name of the severity used when producing readable output.
    */
-  String _displayName;
+  String displayName;
 
   /**
    * Initialize a newly created severity with the given names.
@@ -54,25 +54,11 @@
    * @param displayName the name of the severity used when producing readable output
    */
   ErrorSeverity(String name, int ordinal, String machineCode, String displayName) : super(name, ordinal) {
-    this._machineCode = machineCode;
-    this._displayName = displayName;
+    this.machineCode = machineCode;
+    this.displayName = displayName;
   }
 
   /**
-   * Return the name of the severity used when producing readable output.
-   *
-   * @return the name of the severity used when producing readable output
-   */
-  String get displayName => _displayName;
-
-  /**
-   * Return the name of the severity used when producing machine output.
-   *
-   * @return the name of the severity used when producing machine output
-   */
-  String get machineCode => _machineCode;
-
-  /**
    * Return the severity constant that represents the greatest severity.
    *
    * @param severity the severity being compared against
@@ -266,40 +252,40 @@
   /**
    * The error code associated with the error.
    */
-  ErrorCode _errorCode;
+  ErrorCode errorCode;
 
   /**
    * The localized error message.
    */
-  String _message;
+  String message;
 
   /**
    * The correction to be displayed for this error, or `null` if there is no correction
    * information for this error.
    */
-  String _correction;
+  String correction;
 
   /**
    * The source in which the error occurred, or `null` if unknown.
    */
-  Source _source;
+  Source source;
 
   /**
    * The character offset from the beginning of the source (zero based) where the error occurred.
    */
-  int _offset = 0;
+  int offset = 0;
 
   /**
    * The number of characters from the offset to the end of the source which encompasses the
    * compilation error.
    */
-  int _length = 0;
+  int length = 0;
 
   /**
    * A flag indicating whether this error can be shown to be a non-issue because of the result of
    * type propagation.
    */
-  bool _isStaticOnly2 = false;
+  bool isStaticOnly = false;
 
   /**
    * Initialize a newly created analysis error for the specified source. The error has no location
@@ -310,9 +296,9 @@
    * @param arguments the arguments used to build the error message
    */
   AnalysisError.con1(Source source, ErrorCode errorCode, List<Object> arguments) {
-    this._source = source;
-    this._errorCode = errorCode;
-    this._message = JavaString.format(errorCode.message, arguments);
+    this.source = source;
+    this.errorCode = errorCode;
+    this.message = JavaString.format(errorCode.message, arguments);
   }
 
   /**
@@ -325,57 +311,18 @@
    * @param arguments the arguments used to build the error message
    */
   AnalysisError.con2(Source source, int offset, int length, ErrorCode errorCode, List<Object> arguments) {
-    this._source = source;
-    this._offset = offset;
-    this._length = length;
-    this._errorCode = errorCode;
-    this._message = JavaString.format(errorCode.message, arguments);
+    this.source = source;
+    this.offset = offset;
+    this.length = length;
+    this.errorCode = errorCode;
+    this.message = JavaString.format(errorCode.message, arguments);
     String correctionTemplate = errorCode.correction;
     if (correctionTemplate != null) {
-      this._correction = JavaString.format(correctionTemplate, arguments);
+      this.correction = JavaString.format(correctionTemplate, arguments);
     }
   }
 
   /**
-   * Return the correction to be displayed for this error, or `null` if there is no correction
-   * information for this error. The correction should indicate how the user can fix the error.
-   *
-   * @return the template used to create the correction to be displayed for this error
-   */
-  String get correction => _correction;
-
-  /**
-   * Return the error code associated with the error.
-   *
-   * @return the error code associated with the error
-   */
-  ErrorCode get errorCode => _errorCode;
-
-  /**
-   * Return the number of characters from the offset to the end of the source which encompasses the
-   * compilation error.
-   *
-   * @return the length of the error location
-   */
-  int get length => _length;
-
-  /**
-   * Return the message to be displayed for this error. The message should indicate what is wrong
-   * and why it is wrong.
-   *
-   * @return the message to be displayed for this error
-   */
-  String get message => _message;
-
-  /**
-   * Return the character offset from the beginning of the source (zero based) where the error
-   * occurred.
-   *
-   * @return the offset to the start of the error location
-   */
-  int get offset => _offset;
-
-  /**
    * Return the value of the given property, or `null` if the given property is not defined
    * for this error.
    *
@@ -383,55 +330,21 @@
    * @return the value of the given property
    */
   Object getProperty(ErrorProperty property) => null;
-
-  /**
-   * Return the source in which the error occurred, or `null` if unknown.
-   *
-   * @return the source in which the error occurred
-   */
-  Source get source => _source;
   int get hashCode {
-    int hashCode = _offset;
-    hashCode ^= (_message != null) ? _message.hashCode : 0;
-    hashCode ^= (_source != null) ? _source.hashCode : 0;
+    int hashCode = offset;
+    hashCode ^= (message != null) ? message.hashCode : 0;
+    hashCode ^= (source != null) ? source.hashCode : 0;
     return hashCode;
   }
-
-  /**
-   * Return `true` if this error can be shown to be a non-issue because of the result of type
-   * propagation.
-   *
-   * @return `true` if this error can be shown to be a non-issue
-   */
-  bool get isStaticOnly => _isStaticOnly2;
-
-  /**
-   * Set whether this error can be shown to be a non-issue because of the result of type propagation
-   * to the given value.
-   *
-   * @param isStaticOnly `true` if this error can be shown to be a non-issue
-   */
-  void set isStaticOnly(bool isStaticOnly2) {
-    this._isStaticOnly2 = isStaticOnly2;
-  }
-
-  /**
-   * Set the source in which the error occurred to the given source.
-   *
-   * @param source the source in which the error occurred
-   */
-  void set source(Source source2) {
-    this._source = source2;
-  }
   String toString() {
     JavaStringBuilder builder = new JavaStringBuilder();
-    builder.append((_source != null) ? _source.fullName : "<unknown source>");
+    builder.append((source != null) ? source.fullName : "<unknown source>");
     builder.append("(");
-    builder.append(_offset);
+    builder.append(offset);
     builder.append("..");
-    builder.append(_offset + _length - 1);
+    builder.append(offset + length - 1);
     builder.append("): ");
-    builder.append(_message);
+    builder.append(message);
     return builder.toString();
   }
 }
@@ -616,7 +529,7 @@
   /**
    * The severity of this type of error.
    */
-  ErrorSeverity _severity;
+  ErrorSeverity severity;
 
   /**
    * Initialize a newly created error type to have the given severity.
@@ -624,15 +537,8 @@
    * @param severity the severity of this type of error
    */
   ErrorType(String name, int ordinal, ErrorSeverity severity) : super(name, ordinal) {
-    this._severity = severity;
+    this.severity = severity;
   }
-
-  /**
-   * Return the severity of this type of error.
-   *
-   * @return the severity of this type of error
-   */
-  ErrorSeverity get severity => _severity;
 }
 /**
  * The enumeration `CompileTimeErrorCode` defines the error codes used for compile time
diff --git a/pkg/analyzer_experimental/lib/src/generated/html.dart b/pkg/analyzer_experimental/lib/src/generated/html.dart
index d8e191f..a6c4a4e 100644
--- a/pkg/analyzer_experimental/lib/src/generated/html.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/html.dart
@@ -18,27 +18,27 @@
   /**
    * The offset from the beginning of the file to the first character in the token.
    */
-  int _offset = 0;
+  int offset = 0;
 
   /**
    * The previous token in the token stream.
    */
-  Token _previous;
+  Token previous;
 
   /**
    * The next token in the token stream.
    */
-  Token _next;
+  Token next;
 
   /**
    * The type of the token.
    */
-  TokenType _type;
+  TokenType type;
 
   /**
    * The lexeme represented by this token.
    */
-  String _value;
+  String lexeme;
 
   /**
    * Initialize a newly created token.
@@ -56,9 +56,9 @@
    * @param value the lexeme represented by this token (not `null`)
    */
   Token.con2(TokenType type, int offset, String value) {
-    this._type = type;
-    this._value = StringUtilities.intern(value);
-    this._offset = offset;
+    this.type = type;
+    this.lexeme = StringUtilities.intern(value);
+    this.offset = offset;
   }
 
   /**
@@ -68,7 +68,7 @@
    * @return the offset from the beginning of the file to the first character after last character
    *         of the token
    */
-  int get end => _offset + length;
+  int get end => offset + length;
 
   /**
    * Return the number of characters in the node's source range.
@@ -78,41 +78,6 @@
   int get length => lexeme.length;
 
   /**
-   * Return the lexeme that represents this token.
-   *
-   * @return the lexeme (not `null`)
-   */
-  String get lexeme => _value;
-
-  /**
-   * Return the next token in the token stream.
-   *
-   * @return the next token in the token stream
-   */
-  Token get next => _next;
-
-  /**
-   * Return the offset from the beginning of the file to the first character in the token.
-   *
-   * @return the offset from the beginning of the file to the first character in the token
-   */
-  int get offset => _offset;
-
-  /**
-   * Return the previous token in the token stream.
-   *
-   * @return the previous token in the token stream
-   */
-  Token get previous => _previous;
-
-  /**
-   * Answer the token type for the receiver.
-   *
-   * @return the token type (not `null`)
-   */
-  TokenType get type => _type;
-
-  /**
    * Return `true` if this token is a synthetic token. A synthetic token is a token that was
    * introduced by the parser in order to recover from an error in the code. Synthetic tokens always
    * have a length of zero (`0`).
@@ -129,20 +94,11 @@
    * @return the token that was passed in
    */
   Token setNext(Token token) {
-    _next = token;
+    next = token;
     token.previous = this;
     return token;
   }
   String toString() => lexeme;
-
-  /**
-   * Set the previous token in the token stream to the given token.
-   *
-   * @param previous the previous token in the token stream
-   */
-  void set previous(Token previous2) {
-    this._previous = previous2;
-  }
 }
 /**
  * Instances of `HtmlParseResult` hold the result of parsing an HTML file.
@@ -154,17 +110,10 @@
   /**
    * The unit containing the parsed information (not `null`).
    */
-  HtmlUnit _unit;
+  HtmlUnit htmlUnit;
   HtmlParseResult(int modificationTime, Token token, List<int> lineStarts, HtmlUnit unit) : super(modificationTime, token, lineStarts) {
-    this._unit = unit;
+    this.htmlUnit = unit;
   }
-
-  /**
-   * Answer the unit generated by parsing the source
-   *
-   * @return the unit (not `null`)
-   */
-  HtmlUnit get htmlUnit => _unit;
 }
 /**
  * Instances of the class `RecursiveXmlVisitor` implement an XML visitor that will recursively
@@ -394,7 +343,7 @@
   /**
    * The source being scanned.
    */
-  Source _source;
+  Source source;
 
   /**
    * The token pointing to the head of the linked list of tokens.
@@ -422,7 +371,7 @@
    * @param source the source being scanned
    */
   AbstractScanner(Source source) {
-    this._source = source;
+    this.source = source;
     _tokens = new Token.con1(TokenType.EOF, -1);
     _tokens.setNext(_tokens);
     _tail = _tokens;
@@ -446,13 +395,6 @@
   int get offset;
 
   /**
-   * Answer the source being scanned.
-   *
-   * @return the source or `null` if undefined
-   */
-  Source get source => _source;
-
-  /**
    * Set array of element tags for which the content between tags should be consider a single token.
    */
   void set passThroughElements(List<String> passThroughElements2) {
@@ -700,43 +642,22 @@
   /**
    * The time at which the contents of the source were last set.
    */
-  int _modificationTime = 0;
+  int modificationTime = 0;
 
   /**
    * The first token in the token stream (not `null`).
    */
-  Token _token;
+  Token token;
 
   /**
    * The line start information that was produced.
    */
-  List<int> _lineStarts;
+  List<int> lineStarts;
   HtmlScanResult(int modificationTime, Token token, List<int> lineStarts) {
-    this._modificationTime = modificationTime;
-    this._token = token;
-    this._lineStarts = lineStarts;
+    this.modificationTime = modificationTime;
+    this.token = token;
+    this.lineStarts = lineStarts;
   }
-
-  /**
-   * Answer the line start information that was produced.
-   *
-   * @return an array of line starts (not `null`)
-   */
-  List<int> get lineStarts => _lineStarts;
-
-  /**
-   * Return the time at which the contents of the source were last set.
-   *
-   * @return the time at which the contents of the source were last set
-   */
-  int get modificationTime => _modificationTime;
-
-  /**
-   * Answer the first token in the token stream.
-   *
-   * @return the token (not `null`)
-   */
-  Token get token => _token;
 }
 /**
  * Instances of the class `StringScanner` implement a scanner that reads from a string. The
@@ -957,18 +878,10 @@
    * The lexeme that defines this type of token, or `null` if there is more than one possible
    * lexeme for this type of token.
    */
-  String _lexeme;
+  String lexeme;
   TokenType(String name, int ordinal, String lexeme) : super(name, ordinal) {
-    this._lexeme = lexeme;
+    this.lexeme = lexeme;
   }
-
-  /**
-   * Return the lexeme that defines this type of token, or `null` if there is more than one
-   * possible lexeme for this type of token.
-   *
-   * @return the lexeme that defines this type of token
-   */
-  String get lexeme => _lexeme;
 }
 class TokenType_EOF extends TokenType {
   TokenType_EOF(String name, int ordinal, String arg0) : super(name, ordinal, arg0);
@@ -980,9 +893,9 @@
  * @coverage dart.engine.html
  */
 class XmlAttributeNode extends XmlNode {
-  Token _name;
-  Token _equals;
-  Token _value;
+  Token name;
+  Token equals;
+  Token value;
 
   /**
    * Construct a new instance representing an XML attribute.
@@ -993,28 +906,13 @@
    * @param value the value token (not `null`)
    */
   XmlAttributeNode(Token name, Token equals, Token value) {
-    this._name = name;
-    this._equals = equals;
-    this._value = value;
+    this.name = name;
+    this.equals = equals;
+    this.value = value;
   }
   accept(XmlVisitor visitor) => visitor.visitXmlAttributeNode(this);
-  Token get beginToken => _name;
-  Token get endToken => _value;
-
-  /**
-   * Answer the equals sign token that appears between the name and value tokens. This may be
-   * `null` if the attribute is badly formed.
-   *
-   * @return the token or `null` if there is no equals sign between the name and value
-   */
-  Token get equals => _equals;
-
-  /**
-   * Answer the attribute name. This may be a zero length token if the attribute is badly formed.
-   *
-   * @return the name (not `null`)
-   */
-  Token get name => _name;
+  Token get beginToken => name;
+  Token get endToken => value;
 
   /**
    * Answer the lexeme for the value token without the leading and trailing quotes.
@@ -1022,10 +920,10 @@
    * @return the text or `null` if the value is not specified
    */
   String get text {
-    if (_value == null) {
+    if (value == null) {
       return null;
     }
-    String text = _value.lexeme;
+    String text = value.lexeme;
     int len = text.length;
     if (len > 0) {
       if (text.codeUnitAt(0) == 0x22) {
@@ -1044,14 +942,6 @@
     }
     return text;
   }
-
-  /**
-   * Answer the attribute value. A properly formed value will start and end with matching quote
-   * characters, but the value returned may not be properly formed.
-   *
-   * @return the value or `null` if this represents a badly formed attribute
-   */
-  Token get value => _value;
   void visitChildren(XmlVisitor visitor) {
   }
 }
@@ -1140,12 +1030,12 @@
   /**
    * The source being parsed.
    */
-  Source _source;
+  Source source;
 
   /**
    * The next token to be parsed.
    */
-  Token _currentToken;
+  Token currentToken;
 
   /**
    * Construct a parser for the specified source.
@@ -1153,17 +1043,10 @@
    * @param source the source being parsed
    */
   XmlParser(Source source) {
-    this._source = source;
+    this.source = source;
   }
 
   /**
-   * Answer the source being parsed.
-   *
-   * @return the source
-   */
-  Source get source => _source;
-
-  /**
    * Answer `true` if the specified tag is self closing and thus should never have content or
    * child tag nodes.
    *
@@ -1179,19 +1062,19 @@
    * @return the list of tag nodes found (not `null`, contains no `null`)
    */
   List<XmlTagNode> parseTopTagNodes(Token firstToken) {
-    _currentToken = firstToken;
+    currentToken = firstToken;
     List<XmlTagNode> tagNodes = new List<XmlTagNode>();
     while (true) {
       while (true) {
-        if (_currentToken.type == TokenType.LT) {
+        if (currentToken.type == TokenType.LT) {
           tagNodes.add(parseTagNode());
-        } else if (_currentToken.type == TokenType.DECLARATION || _currentToken.type == TokenType.DIRECTIVE || _currentToken.type == TokenType.COMMENT) {
-          _currentToken = _currentToken.next;
-        } else if (_currentToken.type == TokenType.EOF) {
+        } else if (currentToken.type == TokenType.DECLARATION || currentToken.type == TokenType.DIRECTIVE || currentToken.type == TokenType.COMMENT) {
+          currentToken = currentToken.next;
+        } else if (currentToken.type == TokenType.EOF) {
           return tagNodes;
         } else {
           reportUnexpectedToken();
-          _currentToken = _currentToken.next;
+          currentToken = currentToken.next;
         }
         break;
       }
@@ -1199,22 +1082,15 @@
   }
 
   /**
-   * Answer the current token.
-   *
-   * @return the current token
-   */
-  Token get currentToken => _currentToken;
-
-  /**
    * Insert a synthetic token of the specified type before the current token
    *
    * @param type the type of token to be inserted (not `null`)
    * @return the synthetic token that was inserted (not `null`)
    */
   Token insertSyntheticToken(TokenType type) {
-    Token token = new Token.con2(type, _currentToken.offset, "");
-    _currentToken.previous.setNext(token);
-    token.setNext(_currentToken);
+    Token token = new Token.con2(type, currentToken.offset, "");
+    currentToken.previous.setNext(token);
+    token.setNext(currentToken);
     return token;
   }
 
@@ -1225,20 +1101,20 @@
    * @return the attribute (not `null`)
    */
   XmlAttributeNode parseAttribute() {
-    Token name = _currentToken;
-    _currentToken = _currentToken.next;
+    Token name = currentToken;
+    currentToken = currentToken.next;
     Token equals;
-    if (identical(_currentToken.type, TokenType.EQ)) {
-      equals = _currentToken;
-      _currentToken = _currentToken.next;
+    if (identical(currentToken.type, TokenType.EQ)) {
+      equals = currentToken;
+      currentToken = currentToken.next;
     } else {
       reportUnexpectedToken();
       equals = insertSyntheticToken(TokenType.EQ);
     }
     Token value;
-    if (identical(_currentToken.type, TokenType.STRING)) {
-      value = _currentToken;
-      _currentToken = _currentToken.next;
+    if (identical(currentToken.type, TokenType.STRING)) {
+      value = currentToken;
+      currentToken = currentToken.next;
     } else {
       reportUnexpectedToken();
       value = insertSyntheticToken(TokenType.STRING);
@@ -1253,20 +1129,20 @@
    * @return a collection of zero or more attributes (not `null`, contains no `null`s)
    */
   List<XmlAttributeNode> parseAttributes() {
-    TokenType type = _currentToken.type;
+    TokenType type = currentToken.type;
     if (identical(type, TokenType.GT) || identical(type, TokenType.SLASH_GT) || identical(type, TokenType.EOF)) {
       return XmlTagNode.NO_ATTRIBUTES;
     }
     List<XmlAttributeNode> attributes = new List<XmlAttributeNode>();
     while (true) {
       while (true) {
-        if (_currentToken.type == TokenType.GT || _currentToken.type == TokenType.SLASH_GT || _currentToken.type == TokenType.EOF) {
+        if (currentToken.type == TokenType.GT || currentToken.type == TokenType.SLASH_GT || currentToken.type == TokenType.EOF) {
           return attributes;
-        } else if (_currentToken.type == TokenType.TAG) {
+        } else if (currentToken.type == TokenType.TAG) {
           attributes.add(parseAttribute());
         } else {
           reportUnexpectedToken();
-          _currentToken = _currentToken.next;
+          currentToken = currentToken.next;
         }
         break;
       }
@@ -1280,22 +1156,22 @@
    * @return a list of nodes (not `null`, contains no `null`s)
    */
   List<XmlTagNode> parseChildTagNodes() {
-    TokenType type = _currentToken.type;
+    TokenType type = currentToken.type;
     if (identical(type, TokenType.LT_SLASH) || identical(type, TokenType.EOF)) {
       return XmlTagNode.NO_TAG_NODES;
     }
     List<XmlTagNode> nodes = new List<XmlTagNode>();
     while (true) {
       while (true) {
-        if (_currentToken.type == TokenType.LT) {
+        if (currentToken.type == TokenType.LT) {
           nodes.add(parseTagNode());
-        } else if (_currentToken.type == TokenType.LT_SLASH || _currentToken.type == TokenType.EOF) {
+        } else if (currentToken.type == TokenType.LT_SLASH || currentToken.type == TokenType.EOF) {
           return nodes;
-        } else if (_currentToken.type == TokenType.COMMENT) {
-          _currentToken = _currentToken.next;
+        } else if (currentToken.type == TokenType.COMMENT) {
+          currentToken = currentToken.next;
         } else {
           reportUnexpectedToken();
-          _currentToken = _currentToken.next;
+          currentToken = currentToken.next;
         }
         break;
       }
@@ -1309,49 +1185,49 @@
    * @return the tag node or `null` if none found
    */
   XmlTagNode parseTagNode() {
-    Token nodeStart = _currentToken;
-    _currentToken = _currentToken.next;
+    Token nodeStart = currentToken;
+    currentToken = currentToken.next;
     Token tag;
-    if (identical(_currentToken.type, TokenType.TAG)) {
-      tag = _currentToken;
-      _currentToken = _currentToken.next;
+    if (identical(currentToken.type, TokenType.TAG)) {
+      tag = currentToken;
+      currentToken = currentToken.next;
     } else {
       reportUnexpectedToken();
       tag = insertSyntheticToken(TokenType.TAG);
     }
     List<XmlAttributeNode> attributes = parseAttributes();
     Token attributeEnd;
-    if (identical(_currentToken.type, TokenType.GT) || identical(_currentToken.type, TokenType.SLASH_GT)) {
-      attributeEnd = _currentToken;
-      _currentToken = _currentToken.next;
+    if (identical(currentToken.type, TokenType.GT) || identical(currentToken.type, TokenType.SLASH_GT)) {
+      attributeEnd = currentToken;
+      currentToken = currentToken.next;
     } else {
       reportUnexpectedToken();
       attributeEnd = insertSyntheticToken(TokenType.SLASH_GT);
     }
     if (identical(attributeEnd.type, TokenType.SLASH_GT) || isSelfClosing(tag)) {
-      return new XmlTagNode(nodeStart, tag, attributes, attributeEnd, XmlTagNode.NO_TAG_NODES, _currentToken, null, attributeEnd);
+      return new XmlTagNode(nodeStart, tag, attributes, attributeEnd, XmlTagNode.NO_TAG_NODES, currentToken, null, attributeEnd);
     }
     List<XmlTagNode> tagNodes = parseChildTagNodes();
     Token contentEnd;
-    if (identical(_currentToken.type, TokenType.LT_SLASH)) {
-      contentEnd = _currentToken;
-      _currentToken = _currentToken.next;
+    if (identical(currentToken.type, TokenType.LT_SLASH)) {
+      contentEnd = currentToken;
+      currentToken = currentToken.next;
     } else {
       reportUnexpectedToken();
       contentEnd = insertSyntheticToken(TokenType.LT_SLASH);
     }
     Token closingTag;
-    if (identical(_currentToken.type, TokenType.TAG)) {
-      closingTag = _currentToken;
-      _currentToken = _currentToken.next;
+    if (identical(currentToken.type, TokenType.TAG)) {
+      closingTag = currentToken;
+      currentToken = currentToken.next;
     } else {
       reportUnexpectedToken();
       closingTag = insertSyntheticToken(TokenType.TAG);
     }
     Token nodeEnd;
-    if (identical(_currentToken.type, TokenType.GT)) {
-      nodeEnd = _currentToken;
-      _currentToken = _currentToken.next;
+    if (identical(currentToken.type, TokenType.GT)) {
+      nodeEnd = currentToken;
+      currentToken = currentToken.next;
     } else {
       reportUnexpectedToken();
       nodeEnd = insertSyntheticToken(TokenType.GT);
@@ -1386,29 +1262,29 @@
   /**
    * The starting [TokenType#LT] token (not `null`).
    */
-  Token _nodeStart;
+  Token nodeStart;
 
   /**
    * The [TokenType#TAG] token after the starting '&lt;' (not `null`).
    */
-  Token _tag;
+  Token tag;
 
   /**
    * The attributes contained by the receiver (not `null`, contains no `null`s).
    */
-  List<XmlAttributeNode> _attributes;
+  List<XmlAttributeNode> attributes;
 
   /**
    * The [TokenType#GT] or [TokenType#SLASH_GT] token after the attributes (not
    * `null`). The token may be the same token as [nodeEnd] if there are no child
    * [tagNodes].
    */
-  Token _attributeEnd;
+  Token attributeEnd;
 
   /**
    * The tag nodes contained in the receiver (not `null`, contains no `null`s).
    */
-  List<XmlTagNode> _tagNodes;
+  List<XmlTagNode> tagNodes;
 
   /**
    * The token (not `null`) after the content, which may be
@@ -1421,18 +1297,18 @@
    * content and the attributes ended with [TokenType#SLASH_GT].
    *
    */
-  Token _contentEnd;
+  Token contentEnd;
 
   /**
    * The closing [TokenType#TAG] after the child elements or `null` if there is no
    * content and the attributes ended with [TokenType#SLASH_GT]
    */
-  Token _closingTag;
+  Token closingTag;
 
   /**
    * The ending [TokenType#GT] or [TokenType#SLASH_GT] token (not `null`).
    */
-  Token _nodeEnd;
+  Token nodeEnd;
 
   /**
    * Construct a new instance representing an XML or HTML element
@@ -1461,14 +1337,14 @@
    *          `null`)
    */
   XmlTagNode(Token nodeStart, Token tag, List<XmlAttributeNode> attributes, Token attributeEnd, List<XmlTagNode> tagNodes, Token contentEnd, Token closingTag, Token nodeEnd) {
-    this._nodeStart = nodeStart;
-    this._tag = tag;
-    this._attributes = becomeParentOfEmpty(attributes, NO_ATTRIBUTES);
-    this._attributeEnd = attributeEnd;
-    this._tagNodes = becomeParentOfEmpty(tagNodes, NO_TAG_NODES);
-    this._contentEnd = contentEnd;
-    this._closingTag = closingTag;
-    this._nodeEnd = nodeEnd;
+    this.nodeStart = nodeStart;
+    this.tag = tag;
+    this.attributes = becomeParentOfEmpty(attributes, NO_ATTRIBUTES);
+    this.attributeEnd = attributeEnd;
+    this.tagNodes = becomeParentOfEmpty(tagNodes, NO_TAG_NODES);
+    this.contentEnd = contentEnd;
+    this.closingTag = closingTag;
+    this.nodeEnd = nodeEnd;
   }
   accept(XmlVisitor visitor) => visitor.visitXmlTagNode(this);
 
@@ -1479,7 +1355,7 @@
    * @return the attribute or `null` if no matching attribute is found
    */
   XmlAttributeNode getAttribute(String name2) {
-    for (XmlAttributeNode attribute in _attributes) {
+    for (XmlAttributeNode attribute in attributes) {
       if (attribute.name.lexeme == name2) {
         return attribute;
       }
@@ -1488,23 +1364,6 @@
   }
 
   /**
-   * The [TokenType#GT] or [TokenType#SLASH_GT] token after the attributes (not
-   * `null`). The token may be the same token as [nodeEnd] if there are no child
-   * [tagNodes].
-   *
-   * @return the token (not `null`)
-   */
-  Token get attributeEnd => _attributeEnd;
-
-  /**
-   * Answer the receiver's attributes. Callers should not manipulate the returned list to edit the
-   * AST structure.
-   *
-   * @return the attributes (not `null`, contains no `null`s)
-   */
-  List<XmlAttributeNode> get attributes => _attributes;
-
-  /**
    * Find the attribute with the given name (see [getAttribute] and answer the lexeme
    * for the attribute's value token without the leading and trailing quotes (see
    * [XmlAttributeNode#getText]).
@@ -1516,15 +1375,7 @@
     XmlAttributeNode attribute = getAttribute(name);
     return attribute != null ? attribute.text : null;
   }
-  Token get beginToken => _nodeStart;
-
-  /**
-   * The the closing [TokenType#TAG] after the child elements or `null` if there is no
-   * content and the attributes ended with [TokenType#SLASH_GT]
-   *
-   * @return the closing tag or `null`
-   */
-  Token get closingTag => _closingTag;
+  Token get beginToken => nodeStart;
 
   /**
    * Answer a string representing the content contained in the receiver. This includes the textual
@@ -1534,92 +1385,48 @@
    * @return the content (not `null`)
    */
   String get content {
-    Token token = _attributeEnd.next;
-    if (identical(token, _contentEnd)) {
+    Token token = attributeEnd.next;
+    if (identical(token, contentEnd)) {
       return "";
     }
     String content = token.lexeme;
     token = token.next;
-    if (identical(token, _contentEnd)) {
+    if (identical(token, contentEnd)) {
       return content;
     }
     JavaStringBuilder buffer = new JavaStringBuilder();
-    while (token != _contentEnd) {
+    while (token != contentEnd) {
       buffer.append(token.lexeme);
       token = token.next;
     }
     return buffer.toString();
   }
-
-  /**
-   * Answer the token (not `null`) after the content, which may be
-   *
-   * * (1) [TokenType#LT_SLASH] for nodes with open and close tags, or
-   * * (2) the [TokenType#LT] nodeStart of the next sibling node if this node is self
-   * closing or the attributeEnd is [TokenType#SLASH_GT], or
-   * * (3) [TokenType#EOF] if the node does not have a closing tag and is the last node in
-   * the stream [TokenType#LT_SLASH] token after the content, or `null` if there is no
-   * content and the attributes ended with [TokenType#SLASH_GT].
-   *
-   *
-   * @return the token (not `null`)
-   */
-  Token get contentEnd => _contentEnd;
   Token get endToken {
-    if (_nodeEnd != null) {
-      return _nodeEnd;
+    if (nodeEnd != null) {
+      return nodeEnd;
     }
-    if (_closingTag != null) {
-      return _closingTag;
+    if (closingTag != null) {
+      return closingTag;
     }
-    if (_contentEnd != null) {
-      return _contentEnd;
+    if (contentEnd != null) {
+      return contentEnd;
     }
-    if (!_tagNodes.isEmpty) {
-      return _tagNodes[_tagNodes.length - 1].endToken;
+    if (!tagNodes.isEmpty) {
+      return tagNodes[tagNodes.length - 1].endToken;
     }
-    if (_attributeEnd != null) {
-      return _attributeEnd;
+    if (attributeEnd != null) {
+      return attributeEnd;
     }
-    if (!_attributes.isEmpty) {
-      return _attributes[_attributes.length - 1].endToken;
+    if (!attributes.isEmpty) {
+      return attributes[attributes.length - 1].endToken;
     }
-    return _tag;
+    return tag;
   }
-
-  /**
-   * Answer the ending [TokenType#GT] or [TokenType#SLASH_GT] token.
-   *
-   * @return the token (not `null`)
-   */
-  Token get nodeEnd => _nodeEnd;
-
-  /**
-   * Answer the starting [TokenType#LT] token.
-   *
-   * @return the token (not `null`)
-   */
-  Token get nodeStart => _nodeStart;
-
-  /**
-   * Answer the [TokenType#TAG] token after the starting '&lt;'.
-   *
-   * @return the token (not `null`)
-   */
-  Token get tag => _tag;
-
-  /**
-   * Answer the tag nodes contained in the receiver. Callers should not manipulate the returned list
-   * to edit the AST structure.
-   *
-   * @return the children (not `null`, contains no `null`s)
-   */
-  List<XmlTagNode> get tagNodes => _tagNodes;
   void visitChildren(XmlVisitor visitor) {
-    for (XmlAttributeNode node in _attributes) {
+    for (XmlAttributeNode node in attributes) {
       node.accept(visitor);
     }
-    for (XmlTagNode node in _tagNodes) {
+    for (XmlTagNode node in tagNodes) {
       node.accept(visitor);
     }
   }
@@ -1697,12 +1504,12 @@
   /**
    * The tag nodes contained in the receiver (not `null`, contains no `null`s).
    */
-  List<XmlTagNode> _tagNodes;
+  List<XmlTagNode> tagNodes;
 
   /**
    * The element associated with this HTML unit or `null` if the receiver is not resolved.
    */
-  HtmlElementImpl _element;
+  HtmlElementImpl element;
 
   /**
    * Construct a new instance representing the content of an HTML file.
@@ -1714,38 +1521,14 @@
    */
   HtmlUnit(Token beginToken, List<XmlTagNode> tagNodes, Token endToken) {
     this._beginToken = beginToken;
-    this._tagNodes = becomeParentOf(tagNodes);
+    this.tagNodes = becomeParentOf(tagNodes);
     this._endToken = endToken;
   }
   accept(XmlVisitor visitor) => visitor.visitHtmlUnit(this);
   Token get beginToken => _beginToken;
-
-  /**
-   * Return the element associated with this HTML unit.
-   *
-   * @return the element or `null` if the receiver is not resolved
-   */
-  HtmlElementImpl get element => _element;
   Token get endToken => _endToken;
-
-  /**
-   * Answer the tag nodes contained in the receiver. Callers should not manipulate the returned list
-   * to edit the AST structure.
-   *
-   * @return the children (not `null`, contains no `null`s)
-   */
-  List<XmlTagNode> get tagNodes => _tagNodes;
-
-  /**
-   * Set the element associated with this HTML unit.
-   *
-   * @param element the element
-   */
-  void set element(HtmlElementImpl element2) {
-    this._element = element2;
-  }
   void visitChildren(XmlVisitor visitor) {
-    for (XmlTagNode node in _tagNodes) {
+    for (XmlTagNode node in tagNodes) {
       node.accept(visitor);
     }
   }
diff --git a/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart b/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
index 7752811..d297da4 100644
--- a/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
@@ -38,13 +38,13 @@
   /**
    * A builder that will silently ignore all data and logging requests.
    */
-  static InstrumentationBuilder _NULL_INSTRUMENTATION_BUILDER = new InstrumentationBuilder_14();
+  static final InstrumentationBuilder nullBuilder = new InstrumentationBuilder_16();
 
   /**
    * An instrumentation logger that can be used when no other instrumentation logger has been
    * configured. This logger will silently ignore all data and logging requests.
    */
-  static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_15();
+  static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_17();
 
   /**
    * The current instrumentation logger.
@@ -73,13 +73,6 @@
   static InstrumentationLogger get logger => _CURRENT_LOGGER;
 
   /**
-   * Return a builder that will silently ignore all data and logging requests.
-   *
-   * @return the builder (not `null`)
-   */
-  static InstrumentationBuilder get nullBuilder => _NULL_INSTRUMENTATION_BUILDER;
-
-  /**
    * Is this instrumentation system currently configured to drop instrumentation data provided to
    * it?
    *
@@ -96,7 +89,7 @@
     _CURRENT_LOGGER = logger2 == null ? _NULL_LOGGER : logger2;
   }
 }
-class InstrumentationBuilder_14 implements InstrumentationBuilder {
+class InstrumentationBuilder_16 implements InstrumentationBuilder {
   InstrumentationBuilder data(String name, bool value) => this;
   InstrumentationBuilder data2(String name, int value) => this;
   InstrumentationBuilder data3(String name, String value) => this;
@@ -112,8 +105,8 @@
   InstrumentationBuilder metric4(String name, List<String> value) => this;
   InstrumentationBuilder record(Exception exception) => this;
 }
-class InstrumentationLogger_15 implements InstrumentationLogger {
-  InstrumentationBuilder createBuilder(String name) => Instrumentation._NULL_INSTRUMENTATION_BUILDER;
+class InstrumentationLogger_17 implements InstrumentationLogger {
+  InstrumentationBuilder createBuilder(String name) => Instrumentation.nullBuilder;
 }
 /**
  * The interface `InstrumentationBuilder` defines the behavior of objects used to collect data
diff --git a/pkg/analyzer_experimental/lib/src/generated/java_core.dart b/pkg/analyzer_experimental/lib/src/generated/java_core.dart
index c3dadd0..d13bb3d 100644
--- a/pkg/analyzer_experimental/lib/src/generated/java_core.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/java_core.dart
@@ -274,8 +274,9 @@
   static num min(num a, num b) => math.min(a, b);
 }
 
-class RuntimeException implements Exception {
-  String toString() => "RuntimeException";
+class RuntimeException extends JavaException {
+  RuntimeException([String message = "", Exception cause = null]) :
+    super(message, cause);
 }
 
 class JavaException implements Exception {
@@ -283,7 +284,7 @@
   final Exception cause;
   JavaException([this.message = "", this.cause = null]);
   JavaException.withCause(this.cause) : message = null;
-  String toString() => "JavaException: $message $cause";
+  String toString() => "${runtimeType}: $message $cause";
 }
 
 class JavaIOException extends JavaException {
diff --git a/pkg/analyzer_experimental/lib/src/generated/parser.dart b/pkg/analyzer_experimental/lib/src/generated/parser.dart
index ed3c416..4ab24aa 100644
--- a/pkg/analyzer_experimental/lib/src/generated/parser.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/parser.dart
@@ -21,12 +21,12 @@
   /**
    * The documentation comment that was parsed, or `null` if none was given.
    */
-  Comment _comment;
+  Comment comment;
 
   /**
    * The metadata that was parsed.
    */
-  List<Annotation> _metadata;
+  List<Annotation> metadata;
 
   /**
    * Initialize a newly created holder with the given data.
@@ -35,23 +35,9 @@
    * @param metadata the metadata that was parsed
    */
   CommentAndMetadata(Comment comment, List<Annotation> metadata) {
-    this._comment = comment;
-    this._metadata = metadata;
+    this.comment = comment;
+    this.metadata = metadata;
   }
-
-  /**
-   * Return the documentation comment that was parsed, or `null` if none was given.
-   *
-   * @return the documentation comment that was parsed
-   */
-  Comment get comment => _comment;
-
-  /**
-   * Return the metadata that was parsed. If there was no metadata, then the list will be empty.
-   *
-   * @return the metadata that was parsed
-   */
-  List<Annotation> get metadata => _metadata;
 }
 /**
  * Instances of the class `FinalConstVarOrType` implement a simple data-holder for a method
@@ -64,12 +50,12 @@
   /**
    * The 'final', 'const' or 'var' keyword, or `null` if none was given.
    */
-  Token _keyword;
+  Token keyword;
 
   /**
    * The type, of `null` if no type was specified.
    */
-  TypeName _type;
+  TypeName type;
 
   /**
    * Initialize a newly created holder with the given data.
@@ -78,23 +64,9 @@
    * @param type the type
    */
   FinalConstVarOrType(Token keyword, TypeName type) {
-    this._keyword = keyword;
-    this._type = type;
+    this.keyword = keyword;
+    this.type = type;
   }
-
-  /**
-   * Return the 'final', 'const' or 'var' keyword, or `null` if none was given.
-   *
-   * @return the 'final', 'const' or 'var' keyword
-   */
-  Token get keyword => _keyword;
-
-  /**
-   * Return the type, of `null` if no type was specified.
-   *
-   * @return the type
-   */
-  TypeName get type => _type;
 }
 /**
  * Instances of the class `Modifiers` implement a simple data-holder for a method that needs
@@ -107,164 +79,46 @@
   /**
    * The token representing the keyword 'abstract', or `null` if the keyword was not found.
    */
-  Token _abstractKeyword;
+  Token abstractKeyword;
 
   /**
    * The token representing the keyword 'const', or `null` if the keyword was not found.
    */
-  Token _constKeyword;
+  Token constKeyword;
 
   /**
    * The token representing the keyword 'external', or `null` if the keyword was not found.
    */
-  Token _externalKeyword;
+  Token externalKeyword;
 
   /**
    * The token representing the keyword 'factory', or `null` if the keyword was not found.
    */
-  Token _factoryKeyword;
+  Token factoryKeyword;
 
   /**
    * The token representing the keyword 'final', or `null` if the keyword was not found.
    */
-  Token _finalKeyword;
+  Token finalKeyword;
 
   /**
    * The token representing the keyword 'static', or `null` if the keyword was not found.
    */
-  Token _staticKeyword;
+  Token staticKeyword;
 
   /**
    * The token representing the keyword 'var', or `null` if the keyword was not found.
    */
-  Token _varKeyword;
-
-  /**
-   * Return the token representing the keyword 'abstract', or `null` if the keyword was not
-   * found.
-   *
-   * @return the token representing the keyword 'abstract'
-   */
-  Token get abstractKeyword => _abstractKeyword;
-
-  /**
-   * Return the token representing the keyword 'const', or `null` if the keyword was not
-   * found.
-   *
-   * @return the token representing the keyword 'const'
-   */
-  Token get constKeyword => _constKeyword;
-
-  /**
-   * Return the token representing the keyword 'external', or `null` if the keyword was not
-   * found.
-   *
-   * @return the token representing the keyword 'external'
-   */
-  Token get externalKeyword => _externalKeyword;
-
-  /**
-   * Return the token representing the keyword 'factory', or `null` if the keyword was not
-   * found.
-   *
-   * @return the token representing the keyword 'factory'
-   */
-  Token get factoryKeyword => _factoryKeyword;
-
-  /**
-   * Return the token representing the keyword 'final', or `null` if the keyword was not
-   * found.
-   *
-   * @return the token representing the keyword 'final'
-   */
-  Token get finalKeyword => _finalKeyword;
-
-  /**
-   * Return the token representing the keyword 'static', or `null` if the keyword was not
-   * found.
-   *
-   * @return the token representing the keyword 'static'
-   */
-  Token get staticKeyword => _staticKeyword;
-
-  /**
-   * Return the token representing the keyword 'var', or `null` if the keyword was not found.
-   *
-   * @return the token representing the keyword 'var'
-   */
-  Token get varKeyword => _varKeyword;
-
-  /**
-   * Set the token representing the keyword 'abstract' to the given token.
-   *
-   * @param abstractKeyword the token representing the keyword 'abstract'
-   */
-  void set abstractKeyword(Token abstractKeyword2) {
-    this._abstractKeyword = abstractKeyword2;
-  }
-
-  /**
-   * Set the token representing the keyword 'const' to the given token.
-   *
-   * @param constKeyword the token representing the keyword 'const'
-   */
-  void set constKeyword(Token constKeyword2) {
-    this._constKeyword = constKeyword2;
-  }
-
-  /**
-   * Set the token representing the keyword 'external' to the given token.
-   *
-   * @param externalKeyword the token representing the keyword 'external'
-   */
-  void set externalKeyword(Token externalKeyword2) {
-    this._externalKeyword = externalKeyword2;
-  }
-
-  /**
-   * Set the token representing the keyword 'factory' to the given token.
-   *
-   * @param factoryKeyword the token representing the keyword 'factory'
-   */
-  void set factoryKeyword(Token factoryKeyword2) {
-    this._factoryKeyword = factoryKeyword2;
-  }
-
-  /**
-   * Set the token representing the keyword 'final' to the given token.
-   *
-   * @param finalKeyword the token representing the keyword 'final'
-   */
-  void set finalKeyword(Token finalKeyword2) {
-    this._finalKeyword = finalKeyword2;
-  }
-
-  /**
-   * Set the token representing the keyword 'static' to the given token.
-   *
-   * @param staticKeyword the token representing the keyword 'static'
-   */
-  void set staticKeyword(Token staticKeyword2) {
-    this._staticKeyword = staticKeyword2;
-  }
-
-  /**
-   * Set the token representing the keyword 'var' to the given token.
-   *
-   * @param varKeyword the token representing the keyword 'var'
-   */
-  void set varKeyword(Token varKeyword2) {
-    this._varKeyword = varKeyword2;
-  }
+  Token varKeyword;
   String toString() {
     JavaStringBuilder builder = new JavaStringBuilder();
-    bool needsSpace = appendKeyword(builder, false, _abstractKeyword);
-    needsSpace = appendKeyword(builder, needsSpace, _constKeyword);
-    needsSpace = appendKeyword(builder, needsSpace, _externalKeyword);
-    needsSpace = appendKeyword(builder, needsSpace, _factoryKeyword);
-    needsSpace = appendKeyword(builder, needsSpace, _finalKeyword);
-    needsSpace = appendKeyword(builder, needsSpace, _staticKeyword);
-    appendKeyword(builder, needsSpace, _varKeyword);
+    bool needsSpace = appendKeyword(builder, false, abstractKeyword);
+    needsSpace = appendKeyword(builder, needsSpace, constKeyword);
+    needsSpace = appendKeyword(builder, needsSpace, externalKeyword);
+    needsSpace = appendKeyword(builder, needsSpace, factoryKeyword);
+    needsSpace = appendKeyword(builder, needsSpace, finalKeyword);
+    needsSpace = appendKeyword(builder, needsSpace, staticKeyword);
+    appendKeyword(builder, needsSpace, varKeyword);
     return builder.toString();
   }
 
@@ -543,7 +397,7 @@
    *
    * @return the synthetic token that was created
    */
-  Token createSyntheticToken(Keyword keyword) => new KeywordToken_12(keyword, _currentToken.offset);
+  Token createSyntheticToken(Keyword keyword) => new KeywordToken_14(keyword, _currentToken.offset);
 
   /**
    * Create a synthetic token with the given type.
@@ -1830,7 +1684,7 @@
     }
     try {
       List<bool> errorFound = [false];
-      AnalysisErrorListener listener = new AnalysisErrorListener_13(errorFound);
+      AnalysisErrorListener listener = new AnalysisErrorListener_15(errorFound);
       StringScanner scanner = new StringScanner(null, referenceSource, listener);
       scanner.setSourceStart(1, 1, sourceOffset);
       Token firstToken = scanner.tokenize();
@@ -5726,13 +5580,13 @@
     }
   }
 }
-class KeywordToken_12 extends KeywordToken {
-  KeywordToken_12(Keyword arg0, int arg1) : super(arg0, arg1);
+class KeywordToken_14 extends KeywordToken {
+  KeywordToken_14(Keyword arg0, int arg1) : super(arg0, arg1);
   int get length => 0;
 }
-class AnalysisErrorListener_13 implements AnalysisErrorListener {
+class AnalysisErrorListener_15 implements AnalysisErrorListener {
   List<bool> errorFound;
-  AnalysisErrorListener_13(this.errorFound);
+  AnalysisErrorListener_15(this.errorFound);
   void onError(AnalysisError error) {
     errorFound[0] = true;
   }
diff --git a/pkg/analyzer_experimental/lib/src/generated/resolver.dart b/pkg/analyzer_experimental/lib/src/generated/resolver.dart
index d11f9b2..06238d0 100644
--- a/pkg/analyzer_experimental/lib/src/generated/resolver.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/resolver.dart
@@ -1028,7 +1028,7 @@
   /**
    * The error listener to which errors will be reported.
    */
-  RecordingErrorListener _errorListener;
+  RecordingErrorListener errorListener;
 
   /**
    * The modification time of the source for which an element is being built.
@@ -1059,7 +1059,7 @@
   /**
    * A set of the libraries that were resolved while resolving the HTML unit.
    */
-  Set<Library> _resolvedLibraries = new Set<Library>();
+  final Set<Library> resolvedLibraries = new Set<Library>();
 
   /**
    * Initialize a newly created HTML unit builder.
@@ -1068,7 +1068,7 @@
    */
   HtmlUnitBuilder(InternalAnalysisContext context) {
     this._context = context;
-    this._errorListener = new RecordingErrorListener();
+    this.errorListener = new RecordingErrorListener();
   }
 
   /**
@@ -1100,20 +1100,6 @@
     unit.element = result;
     return result;
   }
-
-  /**
-   * Return the listener to which analysis errors will be reported.
-   *
-   * @return the listener to which analysis errors will be reported
-   */
-  RecordingErrorListener get errorListener => _errorListener;
-
-  /**
-   * Return an array containing information about all of the libraries that were resolved.
-   *
-   * @return an array containing the libraries that were resolved
-   */
-  Set<Library> get resolvedLibraries => _resolvedLibraries;
   Object visitHtmlUnit(ht.HtmlUnit node) {
     _parentNodes = new List<ht.XmlTagNode>();
     _scripts = new List<HtmlScriptElement>();
@@ -1161,19 +1147,19 @@
           String contents = node.content;
           int attributeEnd = node.attributeEnd.end;
           LineInfo_Location location = _lineInfo.getLocation(attributeEnd);
-          sc.StringScanner scanner = new sc.StringScanner(htmlSource, contents, _errorListener);
+          sc.StringScanner scanner = new sc.StringScanner(htmlSource, contents, errorListener);
           scanner.setSourceStart(location.lineNumber, location.columnNumber, attributeEnd);
           sc.Token firstToken = scanner.tokenize();
           List<int> lineStarts = scanner.lineStarts;
-          Parser parser = new Parser(htmlSource, _errorListener);
+          Parser parser = new Parser(htmlSource, errorListener);
           CompilationUnit unit = parser.parseCompilationUnit(firstToken);
           unit.lineInfo = new LineInfo(lineStarts);
           try {
             LibraryResolver resolver = new LibraryResolver(_context);
             LibraryElementImpl library = resolver.resolveEmbeddedLibrary(htmlSource, _modificationStamp, unit, true) as LibraryElementImpl;
             script.scriptLibrary = library;
-            _resolvedLibraries.addAll(resolver.resolvedLibraries);
-            _errorListener.addAll(resolver.errorListener);
+            resolvedLibraries.addAll(resolver.resolvedLibraries);
+            errorListener.addAll(resolver.errorListener);
           } on AnalysisException catch (exception) {
             AnalysisEngine.instance.logger.logError3(exception);
           }
@@ -1253,7 +1239,7 @@
    * @param arguments the arguments used to compose the error message
    */
   void reportError(ErrorCode errorCode, int offset, int length, List<Object> arguments) {
-    _errorListener.onError(new AnalysisError.con2(_htmlElement.source, offset, length, errorCode, arguments));
+    errorListener.onError(new AnalysisError.con2(_htmlElement.source, offset, length, errorCode, arguments));
   }
 
   /**
@@ -4815,7 +4801,7 @@
   /**
    * The source specifying the defining compilation unit of this library.
    */
-  Source _librarySource;
+  Source librarySource;
 
   /**
    * The library element representing this library.
@@ -4825,7 +4811,7 @@
   /**
    * A list containing all of the libraries that are imported into this library.
    */
-  List<Library> _importedLibraries = _EMPTY_ARRAY;
+  List<Library> imports = _EMPTY_ARRAY;
 
   /**
    * A table mapping URI-based directive to the actual URI value.
@@ -4835,12 +4821,12 @@
   /**
    * A flag indicating whether this library explicitly imports core.
    */
-  bool _explicitlyImportsCore = false;
+  bool explicitlyImportsCore = false;
 
   /**
    * A list containing all of the libraries that are exported from this library.
    */
-  List<Library> _exportedLibraries = _EMPTY_ARRAY;
+  List<Library> exports = _EMPTY_ARRAY;
 
   /**
    * A table mapping the sources for the compilation units in this library to their corresponding
@@ -4868,7 +4854,7 @@
   Library(InternalAnalysisContext analysisContext, AnalysisErrorListener errorListener, Source librarySource) {
     this._analysisContext = analysisContext;
     this._errorListener = errorListener;
-    this._librarySource = librarySource;
+    this.librarySource = librarySource;
     this._libraryElement = analysisContext.getLibraryElement(librarySource) as LibraryElementImpl;
   }
 
@@ -4899,7 +4885,7 @@
     List<CompilationUnit> unitArrayList = new List<CompilationUnit>();
     unitArrayList.add(definingCompilationUnit);
     for (Source source in _astMap.keys.toSet()) {
-      if (_librarySource != source) {
+      if (librarySource != source) {
         unitArrayList.add(getAST(source));
       }
     }
@@ -4921,28 +4907,7 @@
    * @throws AnalysisException if an AST structure could not be created for the defining compilation
    *           unit
    */
-  CompilationUnit get definingCompilationUnit => getAST(_librarySource);
-
-  /**
-   * Return `true` if this library explicitly imports core.
-   *
-   * @return `true` if this library explicitly imports core
-   */
-  bool get explicitlyImportsCore => _explicitlyImportsCore;
-
-  /**
-   * Return an array containing the libraries that are exported from this library.
-   *
-   * @return an array containing the libraries that are exported from this library
-   */
-  List<Library> get exports => _exportedLibraries;
-
-  /**
-   * Return an array containing the libraries that are imported into this library.
-   *
-   * @return an array containing the libraries that are imported into this library
-   */
-  List<Library> get imports => _importedLibraries;
+  CompilationUnit get definingCompilationUnit => getAST(librarySource);
 
   /**
    * Return an array containing the libraries that are either imported or exported from this
@@ -4952,10 +4917,10 @@
    */
   List<Library> get importsAndExports {
     Set<Library> libraries = new Set<Library>();
-    for (Library library in _importedLibraries) {
+    for (Library library in imports) {
       javaSetAdd(libraries, library);
     }
-    for (Library library in _exportedLibraries) {
+    for (Library library in exports) {
       javaSetAdd(libraries, library);
     }
     return new List.from(libraries);
@@ -4981,9 +4946,9 @@
   LibraryElementImpl get libraryElement {
     if (_libraryElement == null) {
       try {
-        _libraryElement = _analysisContext.computeLibraryElement(_librarySource) as LibraryElementImpl;
+        _libraryElement = _analysisContext.computeLibraryElement(librarySource) as LibraryElementImpl;
       } on AnalysisException catch (exception) {
-        AnalysisEngine.instance.logger.logError2("Could not compute ilbrary element for ${_librarySource.fullName}", exception);
+        AnalysisEngine.instance.logger.logError2("Could not compute ilbrary element for ${librarySource.fullName}", exception);
       }
     }
     return _libraryElement;
@@ -5002,26 +4967,20 @@
   }
 
   /**
-   * Return the source specifying the defining compilation unit of this library.
+   * Return the modification time associated with the given source.
    *
-   * @return the source specifying the defining compilation unit of this library
-   */
-  Source get librarySource => _librarySource;
-
-  /**
-   * Return the modification stamp associated with the given source.
-   *
-   * @param source the source representing the compilation unit whose AST is to be returned
-   * @return the AST structure associated with the given source
+   * @param source the source representing the compilation unit whose modification time is to be
+   *          returned
+   * @return the modification time associated with the given source
    * @throws AnalysisException if an AST structure could not be created for the compilation unit
    */
-  int getModificationStamp(Source source) {
+  int getModificationTime(Source source) {
     ResolvableCompilationUnit holder = _astMap[source];
     if (holder == null) {
       holder = _analysisContext.computeResolvableCompilationUnit(source);
       _astMap[source] = holder;
     }
-    return holder.modificationStamp;
+    return holder.modificationTime;
   }
 
   /**
@@ -5034,7 +4993,7 @@
   Source getSource(UriBasedDirective directive) {
     StringLiteral uriLiteral = directive.uri;
     if (uriLiteral is StringInterpolation) {
-      _errorListener.onError(new AnalysisError.con2(_librarySource, uriLiteral.offset, uriLiteral.length, CompileTimeErrorCode.URI_WITH_INTERPOLATION, []));
+      _errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.offset, uriLiteral.length, CompileTimeErrorCode.URI_WITH_INTERPOLATION, []));
       return null;
     }
     String uriContent = uriLiteral.stringValue.trim();
@@ -5042,13 +5001,13 @@
     uriContent = Uri.encodeFull(uriContent);
     try {
       parseUriWithException(uriContent);
-      Source source = _analysisContext.sourceFactory.resolveUri(_librarySource, uriContent);
+      Source source = _analysisContext.sourceFactory.resolveUri(librarySource, uriContent);
       if (source == null || !source.exists()) {
-        _errorListener.onError(new AnalysisError.con2(_librarySource, uriLiteral.offset, uriLiteral.length, CompileTimeErrorCode.URI_DOES_NOT_EXIST, [uriContent]));
+        _errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.offset, uriLiteral.length, CompileTimeErrorCode.URI_DOES_NOT_EXIST, [uriContent]));
       }
       return source;
     } on URISyntaxException catch (exception) {
-      _errorListener.onError(new AnalysisError.con2(_librarySource, uriLiteral.offset, uriLiteral.length, CompileTimeErrorCode.INVALID_URI, [uriContent]));
+      _errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.offset, uriLiteral.length, CompileTimeErrorCode.INVALID_URI, [uriContent]));
     }
     return null;
   }
@@ -5067,16 +5026,7 @@
    * @param unit the AST structure associated with the defining compilation unit for this library
    */
   void setDefiningCompilationUnit(int modificationStamp, CompilationUnit unit) {
-    _astMap[_librarySource] = new ResolvableCompilationUnit(modificationStamp, unit);
-  }
-
-  /**
-   * Set whether this library explicitly imports core to match the given value.
-   *
-   * @param explicitlyImportsCore `true` if this library explicitly imports core
-   */
-  void set explicitlyImportsCore(bool explicitlyImportsCore2) {
-    this._explicitlyImportsCore = explicitlyImportsCore2;
+    _astMap[librarySource] = new ResolvableCompilationUnit(modificationStamp, unit);
   }
 
   /**
@@ -5085,7 +5035,7 @@
    * @param exportedLibraries the libraries that are exported by this library
    */
   void set exportedLibraries(List<Library> exportedLibraries2) {
-    this._exportedLibraries = exportedLibraries2;
+    this.exports = exportedLibraries2;
   }
 
   /**
@@ -5094,7 +5044,7 @@
    * @param importedLibraries the libraries that are imported into this library
    */
   void set importedLibraries(List<Library> importedLibraries2) {
-    this._importedLibraries = importedLibraries2;
+    this.imports = importedLibraries2;
   }
 
   /**
@@ -5108,7 +5058,7 @@
       _inheritanceManager.libraryElement = libraryElement2;
     }
   }
-  String toString() => _librarySource.shortName;
+  String toString() => librarySource.shortName;
 }
 /**
  * Instances of the class `LibraryElementBuilder` build an element model for a single library.
@@ -5309,7 +5259,7 @@
   /**
    * The analysis context in which the libraries are being analyzed.
    */
-  InternalAnalysisContext _analysisContext;
+  InternalAnalysisContext analysisContext;
 
   /**
    * A flag indicating whether analysis is to generate hint results (e.g. type inference based
@@ -5322,7 +5272,7 @@
    * references [recordingErrorListener], or it unions the passed
    * [AnalysisErrorListener] with the [recordingErrorListener].
    */
-  RecordingErrorListener _errorListener;
+  RecordingErrorListener errorListener;
 
   /**
    * A source object representing the core library (dart:core).
@@ -5347,7 +5297,7 @@
   /**
    * A collection containing the libraries that are being resolved together.
    */
-  Set<Library> _librariesInCycles;
+  Set<Library> resolvedLibraries;
 
   /**
    * Initialize a newly created library resolver to resolve libraries within the given context.
@@ -5355,34 +5305,13 @@
    * @param analysisContext the analysis context in which the library is being analyzed
    */
   LibraryResolver(InternalAnalysisContext analysisContext) {
-    this._analysisContext = analysisContext;
-    this._errorListener = new RecordingErrorListener();
+    this.analysisContext = analysisContext;
+    this.errorListener = new RecordingErrorListener();
     _coreLibrarySource = analysisContext.sourceFactory.forUri(DartSdk.DART_CORE);
     _enableHints = analysisContext.analysisOptions.hint;
   }
 
   /**
-   * Return the analysis context in which the libraries are being analyzed.
-   *
-   * @return the analysis context in which the libraries are being analyzed
-   */
-  InternalAnalysisContext get analysisContext => _analysisContext;
-
-  /**
-   * Return the listener to which analysis errors will be reported.
-   *
-   * @return the listener to which analysis errors will be reported
-   */
-  RecordingErrorListener get errorListener => _errorListener;
-
-  /**
-   * Return an array containing information about all of the libraries that were resolved.
-   *
-   * @return an array containing the libraries that were resolved
-   */
-  Set<Library> get resolvedLibraries => _librariesInCycles;
-
-  /**
    * Resolve the library specified by the given source in the given context. The library is assumed
    * to be embedded in the given source.
    *
@@ -5407,7 +5336,7 @@
       }
       instrumentation.metric3("createLibrary", "complete");
       computeLibraryDependencies2(targetLibrary, unit);
-      _librariesInCycles = computeLibrariesInCycles(targetLibrary);
+      resolvedLibraries = computeLibrariesInCycles(targetLibrary);
       buildElementModels();
       instrumentation.metric3("buildElementModels", "complete");
       LibraryElement coreElement = _coreLibrary.libraryElement;
@@ -5458,7 +5387,7 @@
       }
       instrumentation.metric3("createLibrary", "complete");
       computeLibraryDependencies(targetLibrary);
-      _librariesInCycles = computeLibrariesInCycles(targetLibrary);
+      resolvedLibraries = computeLibrariesInCycles(targetLibrary);
       buildElementModels();
       instrumentation.metric3("buildElementModels", "complete");
       LibraryElement coreElement = _coreLibrary.libraryElement;
@@ -5478,8 +5407,8 @@
         runAdditionalAnalyses();
         instrumentation.metric3("runAdditionalAnalyses", "complete");
       }
-      instrumentation.metric2("librariesInCycles", _librariesInCycles.length);
-      for (Library lib in _librariesInCycles) {
+      instrumentation.metric2("librariesInCycles", resolvedLibraries.length);
+      for (Library lib in resolvedLibraries) {
         instrumentation.metric2("librariesInCycles-CompilationUnitSources-Size", lib.compilationUnitSources.length);
       }
       return targetLibrary.libraryElement;
@@ -5576,7 +5505,7 @@
    *           be accessed
    */
   void buildDirectiveModels() {
-    for (Library library in _librariesInCycles) {
+    for (Library library in resolvedLibraries) {
       Map<String, PrefixElementImpl> nameToPrefixMap = new Map<String, PrefixElementImpl>();
       List<ImportElement> imports = new List<ImportElement>();
       List<ExportElement> exports = new List<ExportElement>();
@@ -5609,7 +5538,7 @@
               imports.add(importElement);
               if (doesCompilationUnitHavePartOfDirective(importedLibrary.getAST(importedSource))) {
                 StringLiteral uriLiteral = importDirective.uri;
-                _errorListener.onError(new AnalysisError.con2(library.librarySource, uriLiteral.offset, uriLiteral.length, CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY, [uriLiteral.toSource()]));
+                errorListener.onError(new AnalysisError.con2(library.librarySource, uriLiteral.offset, uriLiteral.length, CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY, [uriLiteral.toSource()]));
               }
             }
           }
@@ -5630,7 +5559,7 @@
               exports.add(exportElement);
               if (doesCompilationUnitHavePartOfDirective(exportedLibrary.getAST(exportedSource))) {
                 StringLiteral uriLiteral = exportDirective.uri;
-                _errorListener.onError(new AnalysisError.con2(library.librarySource, uriLiteral.offset, uriLiteral.length, CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY, [uriLiteral.toSource()]));
+                errorListener.onError(new AnalysisError.con2(library.librarySource, uriLiteral.offset, uriLiteral.length, CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY, [uriLiteral.toSource()]));
               }
             }
           }
@@ -5655,7 +5584,7 @@
    * @throws AnalysisException if any of the element models cannot be built
    */
   void buildElementModels() {
-    for (Library library in _librariesInCycles) {
+    for (Library library in resolvedLibraries) {
       LibraryElementBuilder builder = new LibraryElementBuilder(this);
       LibraryElementImpl libraryElement = builder.buildLibrary(library);
       library.libraryElement = libraryElement;
@@ -5669,7 +5598,7 @@
    * @throws AnalysisException if any of the type hierarchies could not be resolved
    */
   void buildTypeHierarchies() {
-    for (Library library in _librariesInCycles) {
+    for (Library library in resolvedLibraries) {
       for (Source source in library.compilationUnitSources) {
         TypeResolverVisitor visitor = new TypeResolverVisitor.con1(library, source, _typeProvider);
         library.getAST(source).accept(visitor);
@@ -5718,7 +5647,7 @@
    */
   void computeLibraryDependencies(Library library) {
     Source librarySource = library.librarySource;
-    computeLibraryDependencies3(library, _analysisContext.computeImportedLibraries(librarySource), _analysisContext.computeExportedLibraries(librarySource));
+    computeLibraryDependencies3(library, analysisContext.computeImportedLibraries(librarySource), analysisContext.computeExportedLibraries(librarySource));
   }
 
   /**
@@ -5811,7 +5740,7 @@
    * @throws AnalysisException if the library source is not valid
    */
   Library createLibrary(Source librarySource) {
-    Library library = new Library(_analysisContext, _errorListener, librarySource);
+    Library library = new Library(analysisContext, errorListener, librarySource);
     library.definingCompilationUnit;
     _libraryMap[librarySource] = library;
     return library;
@@ -5829,7 +5758,7 @@
    * @throws AnalysisException if the library source is not valid
    */
   Library createLibrary2(Source librarySource, int modificationStamp, CompilationUnit unit) {
-    Library library = new Library(_analysisContext, _errorListener, librarySource);
+    Library library = new Library(analysisContext, errorListener, librarySource);
     library.setDefiningCompilationUnit(modificationStamp, unit);
     _libraryMap[librarySource] = library;
     return library;
@@ -5847,7 +5776,7 @@
     if (!librarySource.exists()) {
       return null;
     }
-    Library library = new Library(_analysisContext, _errorListener, librarySource);
+    Library library = new Library(analysisContext, errorListener, librarySource);
     _libraryMap[librarySource] = library;
     return library;
   }
@@ -5888,7 +5817,7 @@
    */
   void performConstantEvaluation() {
     ConstantValueComputer computer = new ConstantValueComputer();
-    for (Library library in _librariesInCycles) {
+    for (Library library in resolvedLibraries) {
       for (Source source in library.compilationUnitSources) {
         try {
           CompilationUnit unit = library.getAST(source);
@@ -5910,7 +5839,7 @@
    *           libraries could not have their types analyzed
    */
   void resolveReferencesAndTypes() {
-    for (Library library in _librariesInCycles) {
+    for (Library library in resolvedLibraries) {
       resolveReferencesAndTypes2(library);
     }
   }
@@ -5952,7 +5881,7 @@
       return null;
     }
     uriContent = Uri.encodeFull(uriContent);
-    return _analysisContext.sourceFactory.resolveUri(librarySource, uriContent);
+    return analysisContext.sourceFactory.resolveUri(librarySource, uriContent);
   }
 
   /**
@@ -5963,7 +5892,7 @@
    *           the library cannot be analyzed
    */
   void runAdditionalAnalyses() {
-    for (Library library in _librariesInCycles) {
+    for (Library library in resolvedLibraries) {
       runAdditionalAnalyses2(library);
     }
   }
@@ -5978,7 +5907,7 @@
    */
   void runAdditionalAnalyses2(Library library) {
     for (Source source in library.compilationUnitSources) {
-      ErrorReporter errorReporter = new ErrorReporter(_errorListener, source);
+      ErrorReporter errorReporter = new ErrorReporter(errorListener, source);
       CompilationUnit unit = library.getAST(source);
       ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, _typeProvider);
       unit.accept(constantVerifier);
@@ -5986,7 +5915,7 @@
       unit.accept(errorVerifier);
     }
     if (_enableHints) {
-      HintGenerator hintGenerator = new HintGenerator(library.compilationUnits, _analysisContext, _errorListener);
+      HintGenerator hintGenerator = new HintGenerator(library.compilationUnits, analysisContext, errorListener);
       hintGenerator.generateForLibrary();
     }
   }
@@ -6044,7 +5973,7 @@
   /**
    * The conditional analysis error.
    */
-  AnalysisError _analysisError;
+  AnalysisError analysisError;
 
   /**
    * Instantiate a new ProxyConditionalErrorCode with some enclosing element and the conditional
@@ -6055,17 +5984,10 @@
    */
   ProxyConditionalAnalysisError(Element enclosingElement, AnalysisError analysisError) {
     this._enclosingElement = enclosingElement;
-    this._analysisError = analysisError;
+    this.analysisError = analysisError;
   }
 
   /**
-   * Return the analysis error.
-   *
-   * @return the analysis error
-   */
-  AnalysisError get analysisError => _analysisError;
-
-  /**
    * Return `true` iff the enclosing class has the proxy annotation.
    *
    * @return `true` iff the enclosing class has the proxy annotation
@@ -6099,23 +6021,23 @@
    * The class element representing the class containing the current node, or `null` if the
    * current node is not contained in a class.
    */
-  ClassElement _enclosingClass = null;
+  ClassElement enclosingClass = null;
 
   /**
    * The element representing the function containing the current node, or `null` if the
    * current node is not contained in a function.
    */
-  ExecutableElement _enclosingFunction = null;
+  ExecutableElement enclosingFunction = null;
 
   /**
    * The object keeping track of which elements have had their types overridden.
    */
-  TypeOverrideManager _overrideManager = new TypeOverrideManager();
+  final TypeOverrideManager overrideManager = new TypeOverrideManager();
 
   /**
    * Proxy conditional error codes.
    */
-  List<ProxyConditionalAnalysisError> _proxyConditionalAnalysisErrors = new List<ProxyConditionalAnalysisError>();
+  final List<ProxyConditionalAnalysisError> proxyConditionalAnalysisErrors = new List<ProxyConditionalAnalysisError>();
 
   /**
    * Initialize a newly created visitor to resolve the nodes in a compilation unit.
@@ -6145,14 +6067,6 @@
     this._elementResolver = new ElementResolver(this);
     this._typeAnalyzer = new StaticTypeAnalyzer(this);
   }
-
-  /**
-   * Return the object keeping track of which elements have had their types overridden.
-   *
-   * @return the object keeping track of which elements have had their types overridden
-   */
-  TypeOverrideManager get overrideManager => _overrideManager;
-  List<ProxyConditionalAnalysisError> get proxyConditionalAnalysisErrors => _proxyConditionalAnalysisErrors;
   Object visitAsExpression(AsExpression node) {
     super.visitAsExpression(node);
     override(node.expression, node.type.type);
@@ -6171,22 +6085,22 @@
       safelyVisit(leftOperand);
       if (rightOperand != null) {
         try {
-          _overrideManager.enterScope();
+          overrideManager.enterScope();
           propagateTrueState(leftOperand);
           rightOperand.accept(this);
         } finally {
-          _overrideManager.exitScope();
+          overrideManager.exitScope();
         }
       }
     } else if (identical(operatorType, sc.TokenType.BAR_BAR)) {
       safelyVisit(leftOperand);
       if (rightOperand != null) {
         try {
-          _overrideManager.enterScope();
+          overrideManager.enterScope();
           propagateFalseState(leftOperand);
           rightOperand.accept(this);
         } finally {
-          _overrideManager.exitScope();
+          overrideManager.exitScope();
         }
       }
     } else {
@@ -6203,14 +6117,14 @@
     return null;
   }
   Object visitClassDeclaration(ClassDeclaration node) {
-    ClassElement outerType = _enclosingClass;
+    ClassElement outerType = enclosingClass;
     try {
-      _enclosingClass = node.element;
-      _typeAnalyzer.thisType = _enclosingClass == null ? null : _enclosingClass.type;
+      enclosingClass = node.element;
+      _typeAnalyzer.thisType = enclosingClass == null ? null : enclosingClass.type;
       super.visitClassDeclaration(node);
     } finally {
       _typeAnalyzer.thisType = outerType == null ? null : outerType.type;
-      _enclosingClass = outerType;
+      enclosingClass = outerType;
     }
     return null;
   }
@@ -6221,7 +6135,7 @@
   }
   Object visitCompilationUnit(CompilationUnit node) {
     try {
-      _overrideManager.enterScope();
+      overrideManager.enterScope();
       for (Directive directive in node.directives) {
         directive.accept(this);
       }
@@ -6237,7 +6151,7 @@
         declaration.accept(this);
       }
     } finally {
-      _overrideManager.exitScope();
+      overrideManager.exitScope();
     }
     node.accept(_elementResolver);
     node.accept(_typeAnalyzer);
@@ -6249,21 +6163,21 @@
     Expression thenExpression = node.thenExpression;
     if (thenExpression != null) {
       try {
-        _overrideManager.enterScope();
+        overrideManager.enterScope();
         propagateTrueState(condition);
         thenExpression.accept(this);
       } finally {
-        _overrideManager.exitScope();
+        overrideManager.exitScope();
       }
     }
     Expression elseExpression = node.elseExpression;
     if (elseExpression != null) {
       try {
-        _overrideManager.enterScope();
+        overrideManager.enterScope();
         propagateFalseState(condition);
         elseExpression.accept(this);
       } finally {
-        _overrideManager.exitScope();
+        overrideManager.exitScope();
       }
     }
     node.accept(_elementResolver);
@@ -6280,12 +6194,12 @@
     return null;
   }
   Object visitConstructorDeclaration(ConstructorDeclaration node) {
-    ExecutableElement outerFunction = _enclosingFunction;
+    ExecutableElement outerFunction = enclosingFunction;
     try {
-      _enclosingFunction = node.element;
+      enclosingFunction = node.element;
       super.visitConstructorDeclaration(node);
     } finally {
-      _enclosingFunction = outerFunction;
+      enclosingFunction = outerFunction;
     }
     return null;
   }
@@ -6307,71 +6221,71 @@
   }
   Object visitDoStatement(DoStatement node) {
     try {
-      _overrideManager.enterScope();
+      overrideManager.enterScope();
       super.visitDoStatement(node);
     } finally {
-      _overrideManager.exitScope();
+      overrideManager.exitScope();
     }
     return null;
   }
   Object visitFieldDeclaration(FieldDeclaration node) {
     try {
-      _overrideManager.enterScope();
+      overrideManager.enterScope();
       super.visitFieldDeclaration(node);
     } finally {
-      Map<Element, Type2> overrides = _overrideManager.captureOverrides(node.fields);
-      _overrideManager.exitScope();
-      _overrideManager.applyOverrides(overrides);
+      Map<Element, Type2> overrides = overrideManager.captureOverrides(node.fields);
+      overrideManager.exitScope();
+      overrideManager.applyOverrides(overrides);
     }
     return null;
   }
   Object visitForEachStatement(ForEachStatement node) {
     try {
-      _overrideManager.enterScope();
+      overrideManager.enterScope();
       super.visitForEachStatement(node);
     } finally {
-      _overrideManager.exitScope();
+      overrideManager.exitScope();
     }
     return null;
   }
   Object visitForStatement(ForStatement node) {
     try {
-      _overrideManager.enterScope();
+      overrideManager.enterScope();
       super.visitForStatement(node);
     } finally {
-      _overrideManager.exitScope();
+      overrideManager.exitScope();
     }
     return null;
   }
   Object visitFunctionBody(FunctionBody node) {
     try {
-      _overrideManager.enterScope();
+      overrideManager.enterScope();
       super.visitFunctionBody(node);
     } finally {
-      _overrideManager.exitScope();
+      overrideManager.exitScope();
     }
     return null;
   }
   Object visitFunctionDeclaration(FunctionDeclaration node) {
-    ExecutableElement outerFunction = _enclosingFunction;
+    ExecutableElement outerFunction = enclosingFunction;
     try {
       SimpleIdentifier functionName = node.name;
-      _enclosingFunction = functionName.staticElement as ExecutableElement;
+      enclosingFunction = functionName.staticElement as ExecutableElement;
       super.visitFunctionDeclaration(node);
     } finally {
-      _enclosingFunction = outerFunction;
+      enclosingFunction = outerFunction;
     }
     return null;
   }
   Object visitFunctionExpression(FunctionExpression node) {
-    ExecutableElement outerFunction = _enclosingFunction;
+    ExecutableElement outerFunction = enclosingFunction;
     try {
-      _enclosingFunction = node.element;
-      _overrideManager.enterScope();
+      enclosingFunction = node.element;
+      overrideManager.enterScope();
       super.visitFunctionExpression(node);
     } finally {
-      _overrideManager.exitScope();
-      _enclosingFunction = outerFunction;
+      overrideManager.exitScope();
+      enclosingFunction = outerFunction;
     }
     return null;
   }
@@ -6391,24 +6305,24 @@
     Statement thenStatement = node.thenStatement;
     if (thenStatement != null) {
       try {
-        _overrideManager.enterScope();
+        overrideManager.enterScope();
         propagateTrueState(condition);
         visitStatementInScope(thenStatement);
       } finally {
-        thenOverrides = _overrideManager.captureLocalOverrides();
-        _overrideManager.exitScope();
+        thenOverrides = overrideManager.captureLocalOverrides();
+        overrideManager.exitScope();
       }
     }
     Map<Element, Type2> elseOverrides = null;
     Statement elseStatement = node.elseStatement;
     if (elseStatement != null) {
       try {
-        _overrideManager.enterScope();
+        overrideManager.enterScope();
         propagateFalseState(condition);
         visitStatementInScope(elseStatement);
       } finally {
-        elseOverrides = _overrideManager.captureLocalOverrides();
-        _overrideManager.exitScope();
+        elseOverrides = overrideManager.captureLocalOverrides();
+        overrideManager.exitScope();
       }
     }
     node.accept(_elementResolver);
@@ -6418,12 +6332,12 @@
     if (elseIsAbrupt && !thenIsAbrupt) {
       propagateTrueState(condition);
       if (thenOverrides != null) {
-        _overrideManager.applyOverrides(thenOverrides);
+        overrideManager.applyOverrides(thenOverrides);
       }
     } else if (thenIsAbrupt && !elseIsAbrupt) {
       propagateFalseState(condition);
       if (elseOverrides != null) {
-        _overrideManager.applyOverrides(elseOverrides);
+        overrideManager.applyOverrides(elseOverrides);
       }
     }
     return null;
@@ -6431,12 +6345,12 @@
   Object visitLabel(Label node) => null;
   Object visitLibraryIdentifier(LibraryIdentifier node) => null;
   Object visitMethodDeclaration(MethodDeclaration node) {
-    ExecutableElement outerFunction = _enclosingFunction;
+    ExecutableElement outerFunction = enclosingFunction;
     try {
-      _enclosingFunction = node.element;
+      enclosingFunction = node.element;
       super.visitMethodDeclaration(node);
     } finally {
-      _enclosingFunction = outerFunction;
+      enclosingFunction = outerFunction;
     }
     return null;
   }
@@ -6481,30 +6395,30 @@
   }
   Object visitSwitchCase(SwitchCase node) {
     try {
-      _overrideManager.enterScope();
+      overrideManager.enterScope();
       super.visitSwitchCase(node);
     } finally {
-      _overrideManager.exitScope();
+      overrideManager.exitScope();
     }
     return null;
   }
   Object visitSwitchDefault(SwitchDefault node) {
     try {
-      _overrideManager.enterScope();
+      overrideManager.enterScope();
       super.visitSwitchDefault(node);
     } finally {
-      _overrideManager.exitScope();
+      overrideManager.exitScope();
     }
     return null;
   }
   Object visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
     try {
-      _overrideManager.enterScope();
+      overrideManager.enterScope();
       super.visitTopLevelVariableDeclaration(node);
     } finally {
-      Map<Element, Type2> overrides = _overrideManager.captureOverrides(node.variables);
-      _overrideManager.exitScope();
-      _overrideManager.applyOverrides(overrides);
+      Map<Element, Type2> overrides = overrideManager.captureOverrides(node.variables);
+      overrideManager.exitScope();
+      overrideManager.applyOverrides(overrides);
     }
     return null;
   }
@@ -6515,11 +6429,11 @@
     Statement body = node.body;
     if (body != null) {
       try {
-        _overrideManager.enterScope();
+        overrideManager.enterScope();
         propagateTrueState(condition);
         visitStatementInScope(body);
       } finally {
-        _overrideManager.exitScope();
+        overrideManager.exitScope();
       }
     }
     node.accept(_elementResolver);
@@ -6528,22 +6442,6 @@
   }
 
   /**
-   * Return the class element representing the class containing the current node, or `null` if
-   * the current node is not contained in a class.
-   *
-   * @return the class element representing the class containing the current node
-   */
-  ClassElement get enclosingClass => _enclosingClass;
-
-  /**
-   * Return the element representing the function containing the current node, or `null` if
-   * the current node is not contained in a function.
-   *
-   * @return the element representing the function containing the current node
-   */
-  ExecutableElement get enclosingFunction => _enclosingFunction;
-
-  /**
    * Return the propagated element associated with the given expression whose type can be
    * overridden, or `null` if there is no element whose type can be overridden.
    *
@@ -6627,7 +6525,7 @@
     }
     Type2 currentType = getBestType(element);
     if (currentType == null || !currentType.isMoreSpecificThan(potentialType)) {
-      _overrideManager.setType(element, potentialType);
+      overrideManager.setType(element, potentialType);
     }
   }
 
@@ -6640,7 +6538,7 @@
    * @param arguments the arguments to the error, used to compose the error message
    */
   void reportErrorProxyConditionalAnalysisError(Element enclosingElement, ErrorCode errorCode, ASTNode node, List<Object> arguments) {
-    _proxyConditionalAnalysisErrors.add(new ProxyConditionalAnalysisError(enclosingElement, new AnalysisError.con2(source, node.offset, node.length, errorCode, arguments)));
+    proxyConditionalAnalysisErrors.add(new ProxyConditionalAnalysisError(enclosingElement, new AnalysisError.con2(source, node.offset, node.length, errorCode, arguments)));
   }
 
   /**
@@ -6653,7 +6551,7 @@
    * @param arguments the arguments to the error, used to compose the error message
    */
   void reportErrorProxyConditionalAnalysisError2(Element enclosingElement, ErrorCode errorCode, int offset, int length, List<Object> arguments) {
-    _proxyConditionalAnalysisErrors.add(new ProxyConditionalAnalysisError(enclosingElement, new AnalysisError.con2(source, offset, length, errorCode, arguments)));
+    proxyConditionalAnalysisErrors.add(new ProxyConditionalAnalysisError(enclosingElement, new AnalysisError.con2(source, offset, length, errorCode, arguments)));
   }
 
   /**
@@ -6665,7 +6563,7 @@
    * @param arguments the arguments to the error, used to compose the error message
    */
   void reportErrorProxyConditionalAnalysisError3(Element enclosingElement, ErrorCode errorCode, sc.Token token, List<Object> arguments) {
-    _proxyConditionalAnalysisErrors.add(new ProxyConditionalAnalysisError(enclosingElement, new AnalysisError.con2(source, token.offset, token.length, errorCode, arguments)));
+    proxyConditionalAnalysisErrors.add(new ProxyConditionalAnalysisError(enclosingElement, new AnalysisError.con2(source, token.offset, token.length, errorCode, arguments)));
   }
   void visitForEachStatementInScope(ForEachStatement node) {
     Expression iterator = node.iterator;
@@ -6675,7 +6573,7 @@
     Statement body = node.body;
     if (body != null) {
       try {
-        _overrideManager.enterScope();
+        overrideManager.enterScope();
         if (loopVariable != null && iterator != null) {
           LocalVariableElement loopElement = loopVariable.element;
           if (loopElement != null) {
@@ -6686,7 +6584,7 @@
         }
         visitStatementInScope(body);
       } finally {
-        _overrideManager.exitScope();
+        overrideManager.exitScope();
       }
     }
     node.accept(_elementResolver);
@@ -6696,13 +6594,13 @@
     safelyVisit(node.variables);
     safelyVisit(node.initialization);
     safelyVisit(node.condition);
-    _overrideManager.enterScope();
+    overrideManager.enterScope();
     try {
       propagateTrueState(node.condition);
       visitStatementInScope(node.body);
       node.updaters.accept(this);
     } finally {
-      _overrideManager.exitScope();
+      overrideManager.exitScope();
     }
   }
 
@@ -6714,7 +6612,7 @@
    * @return the best type information available for the given element
    */
   Type2 getBestType(Element element) {
-    Type2 bestType = _overrideManager.getType(element);
+    Type2 bestType = overrideManager.getType(element);
     if (bestType == null) {
       if (element is LocalVariableElement) {
         bestType = ((element as LocalVariableElement)).type;
@@ -6776,7 +6674,7 @@
       Type2 currentType = getBestType(element);
       Type2 expectedType = expectedParameters[i].type;
       if (currentType == null || expectedType.isMoreSpecificThan(currentType)) {
-        _overrideManager.setType(element, expectedType);
+        overrideManager.setType(element, expectedType);
       }
     }
   }
@@ -6911,14 +6809,14 @@
   }
   get elementResolver_J2DAccessor => _elementResolver;
   set elementResolver_J2DAccessor(__v) => _elementResolver = __v;
-  get labelScope_J2DAccessor => _labelScope;
-  set labelScope_J2DAccessor(__v) => _labelScope = __v;
-  get nameScope_J2DAccessor => _nameScope;
-  set nameScope_J2DAccessor(__v) => _nameScope = __v;
+  get labelScope_J2DAccessor => labelScope;
+  set labelScope_J2DAccessor(__v) => labelScope = __v;
+  get nameScope_J2DAccessor => nameScope;
+  set nameScope_J2DAccessor(__v) => nameScope = __v;
   get typeAnalyzer_J2DAccessor => _typeAnalyzer;
   set typeAnalyzer_J2DAccessor(__v) => _typeAnalyzer = __v;
-  get enclosingClass_J2DAccessor => _enclosingClass;
-  set enclosingClass_J2DAccessor(__v) => _enclosingClass = __v;
+  get enclosingClass_J2DAccessor => enclosingClass;
+  set enclosingClass_J2DAccessor(__v) => enclosingClass = __v;
 }
 /**
  * The abstract class `ScopedVisitor` maintains name and label scopes as an AST structure is
@@ -6931,12 +6829,12 @@
   /**
    * The element for the library containing the compilation unit being visited.
    */
-  LibraryElement _definingLibrary;
+  LibraryElement definingLibrary;
 
   /**
    * The source representing the compilation unit being visited.
    */
-  Source _source;
+  Source source;
 
   /**
    * The error listener that will be informed of any errors that are found during resolution.
@@ -6946,18 +6844,18 @@
   /**
    * The scope used to resolve identifiers.
    */
-  Scope _nameScope;
+  Scope nameScope;
 
   /**
    * The object used to access the types from the core library.
    */
-  TypeProvider _typeProvider;
+  TypeProvider typeProvider;
 
   /**
    * The scope used to resolve labels for `break` and `continue` statements, or
    * `null` if no labels have been defined in the current context.
    */
-  LabelScope _labelScope;
+  LabelScope labelScope;
 
   /**
    * Initialize a newly created visitor to resolve the nodes in a compilation unit.
@@ -6967,12 +6865,12 @@
    * @param typeProvider the object used to access the types from the core library
    */
   ScopedVisitor.con1(Library library, Source source, TypeProvider typeProvider) {
-    this._definingLibrary = library.libraryElement;
-    this._source = source;
+    this.definingLibrary = library.libraryElement;
+    this.source = source;
     LibraryScope libraryScope = library.libraryScope;
     this._errorListener = libraryScope.errorListener;
-    this._nameScope = libraryScope;
-    this._typeProvider = typeProvider;
+    this.nameScope = libraryScope;
+    this.typeProvider = typeProvider;
   }
 
   /**
@@ -6986,28 +6884,14 @@
    *          during resolution
    */
   ScopedVisitor.con2(LibraryElement definingLibrary, Source source, TypeProvider typeProvider, AnalysisErrorListener errorListener) {
-    this._definingLibrary = definingLibrary;
-    this._source = source;
+    this.definingLibrary = definingLibrary;
+    this.source = source;
     this._errorListener = errorListener;
-    this._nameScope = new LibraryScope(definingLibrary, errorListener);
-    this._typeProvider = typeProvider;
+    this.nameScope = new LibraryScope(definingLibrary, errorListener);
+    this.typeProvider = typeProvider;
   }
 
   /**
-   * Return the library element for the library containing the compilation unit being resolved.
-   *
-   * @return the library element for the library containing the compilation unit being resolved
-   */
-  LibraryElement get definingLibrary => _definingLibrary;
-
-  /**
-   * Return the object used to access the types from the core library.
-   *
-   * @return the object used to access the types from the core library
-   */
-  TypeProvider get typeProvider => _typeProvider;
-
-  /**
    * Report an error with the given analysis error.
    *
    * @param errorCode analysis error
@@ -7016,31 +6900,31 @@
     _errorListener.onError(analysisError);
   }
   Object visitBlock(Block node) {
-    Scope outerScope = _nameScope;
+    Scope outerScope = nameScope;
     try {
-      EnclosedScope enclosedScope = new EnclosedScope(_nameScope);
+      EnclosedScope enclosedScope = new EnclosedScope(nameScope);
       hideNamesDefinedInBlock(enclosedScope, node);
-      _nameScope = enclosedScope;
+      nameScope = enclosedScope;
       super.visitBlock(node);
     } finally {
-      _nameScope = outerScope;
+      nameScope = outerScope;
     }
     return null;
   }
   Object visitCatchClause(CatchClause node) {
     SimpleIdentifier exception = node.exceptionParameter;
     if (exception != null) {
-      Scope outerScope = _nameScope;
+      Scope outerScope = nameScope;
       try {
-        _nameScope = new EnclosedScope(_nameScope);
-        _nameScope.define(exception.staticElement);
+        nameScope = new EnclosedScope(nameScope);
+        nameScope.define(exception.staticElement);
         SimpleIdentifier stackTrace = node.stackTraceParameter;
         if (stackTrace != null) {
-          _nameScope.define(stackTrace.staticElement);
+          nameScope.define(stackTrace.staticElement);
         }
         super.visitCatchClause(node);
       } finally {
-        _nameScope = outerScope;
+        nameScope = outerScope;
       }
     } else {
       super.visitCatchClause(node);
@@ -7048,91 +6932,91 @@
     return null;
   }
   Object visitClassDeclaration(ClassDeclaration node) {
-    Scope outerScope = _nameScope;
+    Scope outerScope = nameScope;
     try {
-      _nameScope = new ClassScope(_nameScope, node.element);
+      nameScope = new ClassScope(nameScope, node.element);
       super.visitClassDeclaration(node);
     } finally {
-      _nameScope = outerScope;
+      nameScope = outerScope;
     }
     return null;
   }
   Object visitClassTypeAlias(ClassTypeAlias node) {
-    Scope outerScope = _nameScope;
+    Scope outerScope = nameScope;
     try {
-      _nameScope = new ClassScope(_nameScope, node.element);
+      nameScope = new ClassScope(nameScope, node.element);
       super.visitClassTypeAlias(node);
     } finally {
-      _nameScope = outerScope;
+      nameScope = outerScope;
     }
     return null;
   }
   Object visitConstructorDeclaration(ConstructorDeclaration node) {
-    Scope outerScope = _nameScope;
+    Scope outerScope = nameScope;
     try {
-      _nameScope = new FunctionScope(_nameScope, node.element);
+      nameScope = new FunctionScope(nameScope, node.element);
       super.visitConstructorDeclaration(node);
     } finally {
-      _nameScope = outerScope;
+      nameScope = outerScope;
     }
     return null;
   }
   Object visitDeclaredIdentifier(DeclaredIdentifier node) {
     VariableElement element = node.element;
     if (element != null) {
-      _nameScope.define(element);
+      nameScope.define(element);
     }
     super.visitDeclaredIdentifier(node);
     return null;
   }
   Object visitDoStatement(DoStatement node) {
-    LabelScope outerLabelScope = _labelScope;
+    LabelScope outerLabelScope = labelScope;
     try {
-      _labelScope = new LabelScope.con1(_labelScope, false, false);
+      labelScope = new LabelScope.con1(labelScope, false, false);
       visitStatementInScope(node.body);
       safelyVisit(node.condition);
     } finally {
-      _labelScope = outerLabelScope;
+      labelScope = outerLabelScope;
     }
     return null;
   }
   Object visitForEachStatement(ForEachStatement node) {
-    Scope outerNameScope = _nameScope;
-    LabelScope outerLabelScope = _labelScope;
+    Scope outerNameScope = nameScope;
+    LabelScope outerLabelScope = labelScope;
     try {
-      _nameScope = new EnclosedScope(_nameScope);
-      _labelScope = new LabelScope.con1(outerLabelScope, false, false);
+      nameScope = new EnclosedScope(nameScope);
+      labelScope = new LabelScope.con1(outerLabelScope, false, false);
       visitForEachStatementInScope(node);
     } finally {
-      _labelScope = outerLabelScope;
-      _nameScope = outerNameScope;
+      labelScope = outerLabelScope;
+      nameScope = outerNameScope;
     }
     return null;
   }
   Object visitForStatement(ForStatement node) {
-    Scope outerNameScope = _nameScope;
-    LabelScope outerLabelScope = _labelScope;
+    Scope outerNameScope = nameScope;
+    LabelScope outerLabelScope = labelScope;
     try {
-      _nameScope = new EnclosedScope(_nameScope);
-      _labelScope = new LabelScope.con1(outerLabelScope, false, false);
+      nameScope = new EnclosedScope(nameScope);
+      labelScope = new LabelScope.con1(outerLabelScope, false, false);
       visitForStatementInScope(node);
     } finally {
-      _labelScope = outerLabelScope;
-      _nameScope = outerNameScope;
+      labelScope = outerLabelScope;
+      nameScope = outerNameScope;
     }
     return null;
   }
   Object visitFunctionDeclaration(FunctionDeclaration node) {
     ExecutableElement function = node.element;
-    Scope outerScope = _nameScope;
+    Scope outerScope = nameScope;
     try {
-      _nameScope = new FunctionScope(_nameScope, function);
+      nameScope = new FunctionScope(nameScope, function);
       super.visitFunctionDeclaration(node);
     } finally {
-      _nameScope = outerScope;
+      nameScope = outerScope;
     }
     if (function.enclosingElement is! CompilationUnitElement) {
-      _nameScope.define(function);
+      nameScope.define(function);
     }
     return null;
   }
@@ -7140,27 +7024,27 @@
     if (node.parent is FunctionDeclaration) {
       super.visitFunctionExpression(node);
     } else {
-      Scope outerScope = _nameScope;
+      Scope outerScope = nameScope;
       try {
         ExecutableElement functionElement = node.element;
         if (functionElement == null) {
         } else {
-          _nameScope = new FunctionScope(_nameScope, functionElement);
+          nameScope = new FunctionScope(nameScope, functionElement);
         }
         super.visitFunctionExpression(node);
       } finally {
-        _nameScope = outerScope;
+        nameScope = outerScope;
       }
     }
     return null;
   }
   Object visitFunctionTypeAlias(FunctionTypeAlias node) {
-    Scope outerScope = _nameScope;
+    Scope outerScope = nameScope;
     try {
-      _nameScope = new FunctionTypeScope(_nameScope, node.element);
+      nameScope = new FunctionTypeScope(nameScope, node.element);
       super.visitFunctionTypeAlias(node);
     } finally {
-      _nameScope = outerScope;
+      nameScope = outerScope;
     }
     return null;
   }
@@ -7175,55 +7059,55 @@
     try {
       super.visitLabeledStatement(node);
     } finally {
-      _labelScope = outerScope;
+      labelScope = outerScope;
     }
     return null;
   }
   Object visitMethodDeclaration(MethodDeclaration node) {
-    Scope outerScope = _nameScope;
+    Scope outerScope = nameScope;
     try {
-      _nameScope = new FunctionScope(_nameScope, node.element);
+      nameScope = new FunctionScope(nameScope, node.element);
       super.visitMethodDeclaration(node);
     } finally {
-      _nameScope = outerScope;
+      nameScope = outerScope;
     }
     return null;
   }
   Object visitSwitchCase(SwitchCase node) {
     node.expression.accept(this);
-    Scope outerNameScope = _nameScope;
+    Scope outerNameScope = nameScope;
     try {
-      _nameScope = new EnclosedScope(_nameScope);
+      nameScope = new EnclosedScope(nameScope);
       node.statements.accept(this);
     } finally {
-      _nameScope = outerNameScope;
+      nameScope = outerNameScope;
     }
     return null;
   }
   Object visitSwitchDefault(SwitchDefault node) {
-    Scope outerNameScope = _nameScope;
+    Scope outerNameScope = nameScope;
     try {
-      _nameScope = new EnclosedScope(_nameScope);
+      nameScope = new EnclosedScope(nameScope);
       node.statements.accept(this);
     } finally {
-      _nameScope = outerNameScope;
+      nameScope = outerNameScope;
     }
     return null;
   }
   Object visitSwitchStatement(SwitchStatement node) {
-    LabelScope outerScope = _labelScope;
+    LabelScope outerScope = labelScope;
     try {
-      _labelScope = new LabelScope.con1(outerScope, true, false);
+      labelScope = new LabelScope.con1(outerScope, true, false);
       for (SwitchMember member in node.members) {
         for (Label label in member.labels) {
           SimpleIdentifier labelName = label.label;
           LabelElement labelElement = labelName.staticElement as LabelElement;
-          _labelScope = new LabelScope.con2(_labelScope, labelName.name, labelElement);
+          labelScope = new LabelScope.con2(labelScope, labelName.name, labelElement);
         }
       }
       super.visitSwitchStatement(node);
     } finally {
-      _labelScope = outerScope;
+      labelScope = outerScope;
     }
     return null;
   }
@@ -7231,46 +7115,25 @@
     if (node.parent.parent is! TopLevelVariableDeclaration && node.parent.parent is! FieldDeclaration) {
       VariableElement element = node.element;
       if (element != null) {
-        _nameScope.define(element);
+        nameScope.define(element);
       }
     }
     super.visitVariableDeclaration(node);
     return null;
   }
   Object visitWhileStatement(WhileStatement node) {
-    LabelScope outerScope = _labelScope;
+    LabelScope outerScope = labelScope;
     try {
-      _labelScope = new LabelScope.con1(outerScope, false, false);
+      labelScope = new LabelScope.con1(outerScope, false, false);
       safelyVisit(node.condition);
       visitStatementInScope(node.body);
     } finally {
-      _labelScope = outerScope;
+      labelScope = outerScope;
     }
     return null;
   }
 
   /**
-   * Return the label scope in which the current node is being resolved.
-   *
-   * @return the label scope in which the current node is being resolved
-   */
-  LabelScope get labelScope => _labelScope;
-
-  /**
-   * Return the name scope in which the current node is being resolved.
-   *
-   * @return the name scope in which the current node is being resolved
-   */
-  Scope get nameScope => _nameScope;
-
-  /**
-   * Return the source.
-   *
-   * @return the source
-   */
-  Source get source => _source;
-
-  /**
    * Report an error with the given error code and arguments.
    *
    * @param errorCode the error code of the error to be reported
@@ -7278,7 +7141,7 @@
    * @param arguments the arguments to the error, used to compose the error message
    */
   void reportError5(ErrorCode errorCode, ASTNode node, List<Object> arguments) {
-    _errorListener.onError(new AnalysisError.con2(_source, node.offset, node.length, errorCode, arguments));
+    _errorListener.onError(new AnalysisError.con2(source, node.offset, node.length, errorCode, arguments));
   }
 
   /**
@@ -7290,7 +7153,7 @@
    * @param arguments the arguments to the error, used to compose the error message
    */
   void reportError6(ErrorCode errorCode, int offset, int length, List<Object> arguments) {
-    _errorListener.onError(new AnalysisError.con2(_source, offset, length, errorCode, arguments));
+    _errorListener.onError(new AnalysisError.con2(source, offset, length, errorCode, arguments));
   }
 
   /**
@@ -7301,7 +7164,7 @@
    * @param arguments the arguments to the error, used to compose the error message
    */
   void reportError7(ErrorCode errorCode, sc.Token token, List<Object> arguments) {
-    _errorListener.onError(new AnalysisError.con2(_source, token.offset, token.length, errorCode, arguments));
+    _errorListener.onError(new AnalysisError.con2(source, token.offset, token.length, errorCode, arguments));
   }
 
   /**
@@ -7353,12 +7216,12 @@
     if (node is Block) {
       visitBlock(node as Block);
     } else if (node != null) {
-      Scope outerNameScope = _nameScope;
+      Scope outerNameScope = nameScope;
       try {
-        _nameScope = new EnclosedScope(_nameScope);
+        nameScope = new EnclosedScope(nameScope);
         node.accept(this);
       } finally {
-        _nameScope = outerNameScope;
+        nameScope = outerNameScope;
       }
     }
   }
@@ -7370,12 +7233,12 @@
    * @return the scope that was in effect before the new scopes were added
    */
   LabelScope addScopesFor(NodeList<Label> labels) {
-    LabelScope outerScope = _labelScope;
+    LabelScope outerScope = labelScope;
     for (Label label in labels) {
       SimpleIdentifier labelNameNode = label.label;
       String labelName = labelNameNode.name;
       LabelElement labelElement = labelNameNode.staticElement as LabelElement;
-      _labelScope = new LabelScope.con2(_labelScope, labelName, labelElement);
+      labelScope = new LabelScope.con2(labelScope, labelName, labelElement);
     }
     return outerScope;
   }
@@ -8262,30 +8125,54 @@
    */
   Object visitPrefixedIdentifier(PrefixedIdentifier node) {
     SimpleIdentifier prefixedIdentifier = node.identifier;
-    Element element = prefixedIdentifier.staticElement;
+    Element staticElement = prefixedIdentifier.staticElement;
     Type2 staticType = _dynamicType;
-    if (element is ClassElement) {
+    if (staticElement is ClassElement) {
       if (isNotTypeLiteral(node)) {
-        staticType = ((element as ClassElement)).type;
+        staticType = ((staticElement as ClassElement)).type;
       } else {
         staticType = _typeProvider.typeType;
       }
-    } else if (element is FunctionTypeAliasElement) {
-      staticType = ((element as FunctionTypeAliasElement)).type;
-    } else if (element is MethodElement) {
-      staticType = ((element as MethodElement)).type;
-    } else if (element is PropertyAccessorElement) {
-      staticType = getType(element as PropertyAccessorElement, node.prefix.staticType);
-    } else if (element is ExecutableElement) {
-      staticType = ((element as ExecutableElement)).type;
-    } else if (element is TypeVariableElement) {
-      staticType = ((element as TypeVariableElement)).type;
-    } else if (element is VariableElement) {
-      staticType = ((element as VariableElement)).type;
+    } else if (staticElement is FunctionTypeAliasElement) {
+      staticType = ((staticElement as FunctionTypeAliasElement)).type;
+    } else if (staticElement is MethodElement) {
+      staticType = ((staticElement as MethodElement)).type;
+    } else if (staticElement is PropertyAccessorElement) {
+      staticType = getType(staticElement as PropertyAccessorElement, node.prefix.staticType);
+    } else if (staticElement is ExecutableElement) {
+      staticType = ((staticElement as ExecutableElement)).type;
+    } else if (staticElement is TypeVariableElement) {
+      staticType = ((staticElement as TypeVariableElement)).type;
+    } else if (staticElement is VariableElement) {
+      staticType = ((staticElement as VariableElement)).type;
     }
     recordStaticType(prefixedIdentifier, staticType);
     recordStaticType(node, staticType);
-    Type2 propagatedType = _overrideManager.getType(element);
+    Element propagatedElement = prefixedIdentifier.propagatedElement;
+    Type2 propagatedType = null;
+    if (propagatedElement is ClassElement) {
+      if (isNotTypeLiteral(node)) {
+        propagatedType = ((propagatedElement as ClassElement)).type;
+      } else {
+        propagatedType = _typeProvider.typeType;
+      }
+    } else if (propagatedElement is FunctionTypeAliasElement) {
+      propagatedType = ((propagatedElement as FunctionTypeAliasElement)).type;
+    } else if (propagatedElement is MethodElement) {
+      propagatedType = ((propagatedElement as MethodElement)).type;
+    } else if (propagatedElement is PropertyAccessorElement) {
+      propagatedType = getType(propagatedElement as PropertyAccessorElement, node.prefix.staticType);
+    } else if (propagatedElement is ExecutableElement) {
+      propagatedType = ((propagatedElement as ExecutableElement)).type;
+    } else if (propagatedElement is TypeVariableElement) {
+      propagatedType = ((propagatedElement as TypeVariableElement)).type;
+    } else if (propagatedElement is VariableElement) {
+      propagatedType = ((propagatedElement as VariableElement)).type;
+    }
+    Type2 overriddenType = _overrideManager.getType(propagatedElement);
+    if (propagatedType == null || (overriddenType != null && overriddenType.isMoreSpecificThan(propagatedType))) {
+      propagatedType = overriddenType;
+    }
     if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
       recordPropagatedType2(prefixedIdentifier, propagatedType);
       recordPropagatedType2(node, propagatedType);
@@ -10306,7 +10193,7 @@
   /**
    * The scope in which this scope is lexically enclosed.
    */
-  Scope _enclosingScope;
+  Scope enclosingScope;
 
   /**
    * A set of names that will be defined in this scope, but right now are not defined. However
@@ -10321,10 +10208,10 @@
    * @param enclosingScope the scope in which this scope is lexically enclosed
    */
   EnclosedScope(Scope enclosingScope) {
-    this._enclosingScope = enclosingScope;
+    this.enclosingScope = enclosingScope;
   }
-  LibraryElement get definingLibrary => _enclosingScope.definingLibrary;
-  AnalysisErrorListener get errorListener => _enclosingScope.errorListener;
+  LibraryElement get definingLibrary => enclosingScope.definingLibrary;
+  AnalysisErrorListener get errorListener => enclosingScope.errorListener;
 
   /**
    * Hides the name of the given element in this scope. If there is already an element with the
@@ -10340,13 +10227,6 @@
       }
     }
   }
-
-  /**
-   * Return the scope in which this scope is lexically enclosed.
-   *
-   * @return the scope in which this scope is lexically enclosed
-   */
-  Scope get enclosingScope => _enclosingScope;
   Element lookup3(Identifier identifier, String name, LibraryElement referencingLibrary) {
     Element element = localLookup(name, referencingLibrary);
     if (element != null) {
@@ -10355,7 +10235,7 @@
     if (_hiddenNames.contains(name)) {
       return null;
     }
-    return _enclosingScope.lookup3(identifier, name, referencingLibrary);
+    return enclosingScope.lookup3(identifier, name, referencingLibrary);
   }
 }
 /**
@@ -11381,7 +11261,7 @@
    * @param expression the expression to validate
    */
   void validateInitializerExpression(List<ParameterElement> parameterElements, Expression expression) {
-    EvaluationResultImpl result = expression.accept(new ConstantVisitor_10(this, parameterElements));
+    EvaluationResultImpl result = expression.accept(new ConstantVisitor_12(this, parameterElements));
     reportErrors(result, CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER);
   }
 
@@ -11426,10 +11306,10 @@
     }
   }
 }
-class ConstantVisitor_10 extends ConstantVisitor {
+class ConstantVisitor_12 extends ConstantVisitor {
   final ConstantVerifier ConstantVerifier_this;
   List<ParameterElement> parameterElements;
-  ConstantVisitor_10(this.ConstantVerifier_this, this.parameterElements) : super();
+  ConstantVisitor_12(this.ConstantVerifier_this, this.parameterElements) : super();
   EvaluationResultImpl visitSimpleIdentifier(SimpleIdentifier node) {
     Element element = node.staticElement;
     for (ParameterElement parameterElement in parameterElements) {
@@ -15373,7 +15253,7 @@
           break;
         }
       }
-      current.accept(new GeneralizingElementVisitor_11(target, toCheck));
+      current.accept(new GeneralizingElementVisitor_13(target, toCheck));
       javaSetAdd(checked, current);
     }
   }
@@ -15552,10 +15432,10 @@
       INIT_IN_INITIALIZERS];
   INIT_STATE(String name, int ordinal) : super(name, ordinal);
 }
-class GeneralizingElementVisitor_11 extends GeneralizingElementVisitor<Object> {
+class GeneralizingElementVisitor_13 extends GeneralizingElementVisitor<Object> {
   Element target;
   List<Element> toCheck;
-  GeneralizingElementVisitor_11(this.target, this.toCheck) : super();
+  GeneralizingElementVisitor_13(this.target, this.toCheck) : super();
   bool _inClass = false;
   Object visitClassElement(ClassElement element) {
     addTypeToCheck(element.supertype);
diff --git a/pkg/analyzer_experimental/lib/src/generated/scanner.dart b/pkg/analyzer_experimental/lib/src/generated/scanner.dart
index 89c7df4..677d4fb 100644
--- a/pkg/analyzer_experimental/lib/src/generated/scanner.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/scanner.dart
@@ -320,13 +320,13 @@
   /**
    * The lexeme for the keyword.
    */
-  String _syntax;
+  String syntax;
 
   /**
    * A flag indicating whether the keyword is a pseudo-keyword. Pseudo keywords can be used as
    * identifiers.
    */
-  bool _isPseudoKeyword2 = false;
+  bool isPseudoKeyword = false;
 
   /**
    * A table mapping the lexemes of keywords to the corresponding keyword.
@@ -341,7 +341,7 @@
   static Map<String, Keyword> createKeywordMap() {
     LinkedHashMap<String, Keyword> result = new LinkedHashMap<String, Keyword>();
     for (Keyword keyword in values) {
-      result[keyword._syntax] = keyword;
+      result[keyword.syntax] = keyword;
     }
     return result;
   }
@@ -362,24 +362,9 @@
    * @param isPseudoKeyword `true` if this keyword is a pseudo-keyword
    */
   Keyword.con2(String name, int ordinal, String syntax, bool isPseudoKeyword) : super(name, ordinal) {
-    this._syntax = syntax;
-    this._isPseudoKeyword2 = isPseudoKeyword;
+    this.syntax = syntax;
+    this.isPseudoKeyword = isPseudoKeyword;
   }
-
-  /**
-   * Return the lexeme for the keyword.
-   *
-   * @return the lexeme for the keyword
-   */
-  String get syntax => _syntax;
-
-  /**
-   * Return `true` if this keyword is a pseudo-keyword. Pseudo keywords can be used as
-   * identifiers.
-   *
-   * @return `true` if this keyword is a pseudo-keyword
-   */
-  bool get isPseudoKeyword => _isPseudoKeyword2;
 }
 /**
  * The abstract class `AbstractScanner` implements a scanner for Dart code. Subclasses are
@@ -398,7 +383,7 @@
   /**
    * The source being scanned.
    */
-  Source _source;
+  Source source;
 
   /**
    * The error listener that will be informed of any errors that are found during the scan.
@@ -453,7 +438,7 @@
    * @param errorListener the error listener that will be informed of any errors that are found
    */
   AbstractScanner(Source source, AnalysisErrorListener errorListener) {
-    this._source = source;
+    this.source = source;
     this._errorListener = errorListener;
     _tokens = new Token(TokenType.EOF, -1);
     _tokens.setNext(_tokens);
@@ -805,13 +790,6 @@
   Token firstToken() => _tokens.next;
 
   /**
-   * Return the source being scanned.
-   *
-   * @return the source being scanned
-   */
-  Source get source => _source;
-
-  /**
    * Report an error at the current offset.
    *
    * @param errorCode the error code indicating the nature of the error
@@ -1456,22 +1434,22 @@
   /**
    * The type of the token.
    */
-  TokenType _type;
+  TokenType type;
 
   /**
    * The offset from the beginning of the file to the first character in the token.
    */
-  int _offset = 0;
+  int offset = 0;
 
   /**
    * The previous token in the token stream.
    */
-  Token _previous;
+  Token previous;
 
   /**
    * The next token in the token stream.
    */
-  Token _next;
+  Token next;
 
   /**
    * Initialize a newly created token to have the given type and offset.
@@ -1480,8 +1458,8 @@
    * @param offset the offset from the beginning of the file to the first character in the token
    */
   Token(TokenType type, int offset) {
-    this._type = type;
-    this._offset = offset;
+    this.type = type;
+    this.offset = offset;
   }
 
   /**
@@ -1491,7 +1469,7 @@
    * @return the offset from the beginning of the file to the first character after last character
    *         of the token
    */
-  int get end => _offset + length;
+  int get end => offset + length;
 
   /**
    * Return the number of characters in the node's source range.
@@ -1505,21 +1483,7 @@
    *
    * @return the lexeme that represents this token
    */
-  String get lexeme => _type.lexeme;
-
-  /**
-   * Return the next token in the token stream.
-   *
-   * @return the next token in the token stream
-   */
-  Token get next => _next;
-
-  /**
-   * Return the offset from the beginning of the file to the first character in the token.
-   *
-   * @return the offset from the beginning of the file to the first character in the token
-   */
-  int get offset => _offset;
+  String get lexeme => type.lexeme;
 
   /**
    * Return the first comment in the list of comments that precede this token, or `null` if
@@ -1531,25 +1495,11 @@
   Token get precedingComments => null;
 
   /**
-   * Return the previous token in the token stream.
-   *
-   * @return the previous token in the token stream
-   */
-  Token get previous => _previous;
-
-  /**
-   * Return the type of the token.
-   *
-   * @return the type of the token
-   */
-  TokenType get type => _type;
-
-  /**
    * Return `true` if this token represents an operator.
    *
    * @return `true` if this token represents an operator
    */
-  bool get isOperator => _type.isOperator;
+  bool get isOperator => type.isOperator;
 
   /**
    * Return `true` if this token is a synthetic token. A synthetic token is a token that was
@@ -1565,7 +1515,7 @@
    *
    * @return `true` if this token represents an operator that can be defined by users
    */
-  bool get isUserDefinableOperator => _type.isUserDefinableOperator;
+  bool get isUserDefinableOperator => type.isUserDefinableOperator;
 
   /**
    * Set the next token in the token stream to the given token. This has the side-effect of setting
@@ -1575,7 +1525,7 @@
    * @return the token that was passed in
    */
   Token setNext(Token token) {
-    _next = token;
+    next = token;
     token.previous = this;
     return token;
   }
@@ -1588,19 +1538,9 @@
    * @return the token that was passed in
    */
   Token setNextWithoutSettingPrevious(Token token) {
-    _next = token;
+    next = token;
     return token;
   }
-
-  /**
-   * Set the offset from the beginning of the file to the first character in the token to the given
-   * offset.
-   *
-   * @param offset the offset from the beginning of the file to the first character in the token
-   */
-  void set offset(int offset2) {
-    this._offset = offset2;
-  }
   String toString() => lexeme;
 
   /**
@@ -1609,16 +1549,7 @@
    *
    * @return the value of this token
    */
-  Object value() => _type.lexeme;
-
-  /**
-   * Set the previous token in the token stream to the given token.
-   *
-   * @param previous the previous token in the token stream
-   */
-  void set previous(Token previous2) {
-    this._previous = previous2;
-  }
+  Object value() => type.lexeme;
 }
 /**
  * Instances of the class `StringScanner` implement a scanner that reads from a string. The
@@ -1738,7 +1669,7 @@
   /**
    * The keyword being represented by this token.
    */
-  Keyword _keyword;
+  Keyword keyword;
 
   /**
    * Initialize a newly created token to represent the given keyword.
@@ -1747,17 +1678,10 @@
    * @param offset the offset from the beginning of the file to the first character in the token
    */
   KeywordToken(Keyword keyword, int offset) : super(TokenType.KEYWORD, offset) {
-    this._keyword = keyword;
+    this.keyword = keyword;
   }
-
-  /**
-   * Return the keyword being represented by this token.
-   *
-   * @return the keyword being represented by this token
-   */
-  Keyword get keyword => _keyword;
-  String get lexeme => _keyword.syntax;
-  Keyword value() => _keyword;
+  String get lexeme => keyword.syntax;
+  Keyword value() => keyword;
 }
 /**
  * Instances of the class `BeginToken` represent the opening half of a grouping pair of
@@ -1770,7 +1694,7 @@
   /**
    * The token that corresponds to this token.
    */
-  Token _endToken;
+  Token endToken;
 
   /**
    * Initialize a newly created token representing the opening half of a grouping pair of tokens.
@@ -1781,22 +1705,6 @@
   BeginToken(TokenType type, int offset) : super(type, offset) {
     assert((identical(type, TokenType.OPEN_CURLY_BRACKET) || identical(type, TokenType.OPEN_PAREN) || identical(type, TokenType.OPEN_SQUARE_BRACKET) || identical(type, TokenType.STRING_INTERPOLATION_EXPRESSION)));
   }
-
-  /**
-   * Return the token that corresponds to this token.
-   *
-   * @return the token that corresponds to this token
-   */
-  Token get endToken => _endToken;
-
-  /**
-   * Set the token that corresponds to this token to the given token.
-   *
-   * @param token the token that corresponds to this token
-   */
-  void set endToken(Token token) {
-    this._endToken = token;
-  }
 }
 /**
  * The enumeration `TokenClass` represents classes (or groups) of tokens with a similar use.
@@ -1906,19 +1814,11 @@
    * The precedence of tokens of this class, or `0` if the such tokens do not represent an
    * operator.
    */
-  int _precedence = 0;
+  int precedence = 0;
   TokenClass.con1(String name, int ordinal) : this.con2(name, ordinal, 0);
   TokenClass.con2(String name, int ordinal, int precedence) : super(name, ordinal) {
-    this._precedence = precedence;
+    this.precedence = precedence;
   }
-
-  /**
-   * Return the precedence of tokens of this class, or `0` if the such tokens do not represent
-   * an operator.
-   *
-   * @return the precedence of tokens of this class
-   */
-  int get precedence => _precedence;
 }
 /**
  * Instances of the class `KeywordTokenWithComment` implement a keyword token that is preceded
@@ -2104,22 +2004,14 @@
    * The lexeme that defines this type of token, or `null` if there is more than one possible
    * lexeme for this type of token.
    */
-  String _lexeme;
+  String lexeme;
   TokenType.con1(String name, int ordinal) : this.con2(name, ordinal, TokenClass.NO_CLASS, null);
   TokenType.con2(String name, int ordinal, TokenClass tokenClass, String lexeme) : super(name, ordinal) {
     this._tokenClass = tokenClass == null ? TokenClass.NO_CLASS : tokenClass;
-    this._lexeme = lexeme;
+    this.lexeme = lexeme;
   }
 
   /**
-   * Return the lexeme that defines this type of token, or `null` if there is more than one
-   * possible lexeme for this type of token.
-   *
-   * @return the lexeme that defines this type of token
-   */
-  String get lexeme => _lexeme;
-
-  /**
    * Return the precedence of the token, or `0` if the token does not represent an operator.
    *
    * @return the precedence of the token
@@ -2166,7 +2058,7 @@
    *
    * @return `true` if this type of token represents an increment operator
    */
-  bool get isIncrementOperator => identical(_lexeme, "++") || identical(_lexeme, "--");
+  bool get isIncrementOperator => identical(lexeme, "++") || identical(lexeme, "--");
 
   /**
    * Return `true` if this type of token represents a multiplicative operator.
@@ -2215,7 +2107,7 @@
    *
    * @return `true` if this token type represents an operator that can be defined by users
    */
-  bool get isUserDefinableOperator => identical(_lexeme, "==") || identical(_lexeme, "~") || identical(_lexeme, "[]") || identical(_lexeme, "[]=") || identical(_lexeme, "*") || identical(_lexeme, "/") || identical(_lexeme, "%") || identical(_lexeme, "~/") || identical(_lexeme, "+") || identical(_lexeme, "-") || identical(_lexeme, "<<") || identical(_lexeme, ">>") || identical(_lexeme, ">=") || identical(_lexeme, ">") || identical(_lexeme, "<=") || identical(_lexeme, "<") || identical(_lexeme, "&") || identical(_lexeme, "^") || identical(_lexeme, "|");
+  bool get isUserDefinableOperator => identical(lexeme, "==") || identical(lexeme, "~") || identical(lexeme, "[]") || identical(lexeme, "[]=") || identical(lexeme, "*") || identical(lexeme, "/") || identical(lexeme, "%") || identical(lexeme, "~/") || identical(lexeme, "+") || identical(lexeme, "-") || identical(lexeme, "<<") || identical(lexeme, ">>") || identical(lexeme, ">=") || identical(lexeme, ">") || identical(lexeme, "<=") || identical(lexeme, "<") || identical(lexeme, "&") || identical(lexeme, "^") || identical(lexeme, "|");
 }
 class TokenType_EOF extends TokenType {
   TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super.con2(name, ordinal, arg0, arg1);
diff --git a/pkg/analyzer_experimental/lib/src/generated/sdk_io.dart b/pkg/analyzer_experimental/lib/src/generated/sdk_io.dart
index 47d9a8f..a4e79e1 100644
--- a/pkg/analyzer_experimental/lib/src/generated/sdk_io.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/sdk_io.dart
@@ -27,7 +27,7 @@
   /**
    * The directory containing the SDK.
    */
-  JavaFile _sdkDirectory;
+  JavaFile directory;
 
   /**
    * The revision number of this SDK, or `"0"` if the revision number cannot be discovered.
@@ -152,6 +152,22 @@
   }
 
   /**
+   * Return the default Dart SDK, or `null` if the directory containing the default SDK cannot
+   * be determined (or does not exist).
+   *
+   * Added in order to test AnalysisContextImpl2.
+   *
+   * @return the default Dart SDK
+   */
+  static DirectoryBasedDartSdk get defaultSdk2 {
+    JavaFile sdkDirectory = defaultSdkDirectory;
+    if (sdkDirectory == null) {
+      return null;
+    }
+    return new DirectoryBasedDartSdk.con1(sdkDirectory, true);
+  }
+
+  /**
    * Return the default directory for the Dart SDK, or `null` if the directory cannot be
    * determined (or does not exist). The default directory is provided by a [System] property
    * named `com.google.dart.sdk`, or, if the property is not defined, an environment variable
@@ -180,10 +196,35 @@
    * @param sdkDirectory the directory containing the SDK
    */
   DirectoryBasedDartSdk(JavaFile sdkDirectory) {
-    this._sdkDirectory = sdkDirectory.getAbsoluteFile();
+    this.directory = sdkDirectory.getAbsoluteFile();
     initializeSdk();
     initializeLibraryMap();
-    _analysisContext = new AnalysisContextImpl();
+    if (AnalysisEngine.instance.useExperimentalContext) {
+      _analysisContext = new AnalysisContextImpl2();
+    } else {
+      _analysisContext = new AnalysisContextImpl();
+    }
+    _analysisContext.sourceFactory = new SourceFactory.con2([new DartUriResolver(this)]);
+    List<String> uris = this.uris;
+    ChangeSet changeSet = new ChangeSet();
+    for (String uri in uris) {
+      changeSet.added(_analysisContext.sourceFactory.forUri(uri));
+    }
+    _analysisContext.applyChanges(changeSet);
+  }
+
+  /**
+   * Initialize a newly created SDK to represent the Dart SDK installed in the given directory.
+   *
+   * Added in order to test AnalysisContextImpl2.
+   *
+   * @param sdkDirectory the directory containing the SDK
+   */
+  DirectoryBasedDartSdk.con1(JavaFile sdkDirectory, bool ignored) {
+    this.directory = sdkDirectory.getAbsoluteFile();
+    initializeSdk();
+    initializeLibraryMap();
+    _analysisContext = new AnalysisContextImpl2();
     _analysisContext.sourceFactory = new SourceFactory.con2([new DartUriResolver(this)]);
     List<String> uris = this.uris;
     ChangeSet changeSet = new ChangeSet();
@@ -218,21 +259,14 @@
    *
    * @return the directory where dartium can be found
    */
-  JavaFile get dartiumWorkingDirectory => new JavaFile.relative(_sdkDirectory.getParentFile(), _CHROMIUM_DIRECTORY_NAME);
-
-  /**
-   * Return the directory containing the SDK.
-   *
-   * @return the directory containing the SDK
-   */
-  JavaFile get directory => _sdkDirectory;
+  JavaFile get dartiumWorkingDirectory => new JavaFile.relative(directory.getParentFile(), _CHROMIUM_DIRECTORY_NAME);
 
   /**
    * Return the directory containing documentation for the SDK.
    *
    * @return the SDK's documentation directory
    */
-  JavaFile get docDirectory => new JavaFile.relative(_sdkDirectory, _DOCS_DIRECTORY_NAME);
+  JavaFile get docDirectory => new JavaFile.relative(directory, _DOCS_DIRECTORY_NAME);
 
   /**
    * Return the auxiliary documentation file for the given library, or `null` if no such file
@@ -260,7 +294,7 @@
    *
    * @return the directory that contains the libraries
    */
-  JavaFile get libraryDirectory => new JavaFile.relative(_sdkDirectory, _LIB_DIRECTORY_NAME);
+  JavaFile get libraryDirectory => new JavaFile.relative(directory, _LIB_DIRECTORY_NAME);
 
   /**
    * Return the file containing the Pub executable, or `null` if it does not exist.
@@ -269,7 +303,7 @@
    */
   JavaFile get pubExecutable {
     String pubBinaryName = OSUtilities.isWindows() ? _PUB_EXECUTABLE_NAME_WIN : _PUB_EXECUTABLE_NAME;
-    JavaFile file = new JavaFile.relative(new JavaFile.relative(_sdkDirectory, _BIN_DIRECTORY_NAME), pubBinaryName);
+    JavaFile file = new JavaFile.relative(new JavaFile.relative(directory, _BIN_DIRECTORY_NAME), pubBinaryName);
     return file.exists() ? file : null;
   }
   List<SdkLibrary> get sdkLibraries => _libraryMap.sdkLibraries;
@@ -285,7 +319,7 @@
     {
       if (_sdkVersion == null) {
         _sdkVersion = DartSdk.DEFAULT_VERSION;
-        JavaFile revisionFile = new JavaFile.relative(_sdkDirectory, _REVISION_FILE_NAME);
+        JavaFile revisionFile = new JavaFile.relative(directory, _REVISION_FILE_NAME);
         try {
           String revision = revisionFile.readAsStringSync();
           if (revision != null) {
@@ -313,7 +347,7 @@
   JavaFile get vmExecutable {
     {
       if (_vmExecutable == null) {
-        JavaFile file = new JavaFile.relative(new JavaFile.relative(_sdkDirectory, _BIN_DIRECTORY_NAME), vmBinaryName);
+        JavaFile file = new JavaFile.relative(new JavaFile.relative(directory, _BIN_DIRECTORY_NAME), vmBinaryName);
         if (file.exists()) {
           _vmExecutable = file;
         }
@@ -487,15 +521,7 @@
    * The library map that is populated by visiting the AST structure parsed from the contents of
    * the libraries file.
    */
-  LibraryMap _librariesMap = new LibraryMap();
-
-  /**
-   * Return the library map that was populated by visiting the AST structure parsed from the
-   * contents of the libraries file.
-   *
-   * @return the library map describing the contents of the SDK
-   */
-  LibraryMap get librariesMap => _librariesMap;
+  final LibraryMap librariesMap = new LibraryMap();
   Object visitMapLiteralEntry(MapLiteralEntry node) {
     String libraryName = null;
     Expression key = node.key;
@@ -530,7 +556,7 @@
           }
         }
       }
-      _librariesMap.setLibrary(libraryName, library);
+      librariesMap.setLibrary(libraryName, library);
     }
     return null;
   }
diff --git a/pkg/analyzer_experimental/lib/src/generated/source.dart b/pkg/analyzer_experimental/lib/src/generated/source.dart
index 128cf1f..659f631 100644
--- a/pkg/analyzer_experimental/lib/src/generated/source.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/source.dart
@@ -15,7 +15,7 @@
   /**
    * The analysis context that this source factory is associated with.
    */
-  AnalysisContext _context;
+  AnalysisContext context;
 
   /**
    * The resolvers used to resolve absolute URI's.
@@ -25,7 +25,7 @@
   /**
    * A cache of content used to override the default content of a source.
    */
-  ContentCache _contentCache;
+  ContentCache contentCache;
 
   /**
    * Initialize a newly created source factory.
@@ -34,7 +34,7 @@
    * @param resolvers the resolvers used to resolve absolute URI's
    */
   SourceFactory.con1(ContentCache contentCache, List<UriResolver> resolvers) {
-    this._contentCache = contentCache;
+    this.contentCache = contentCache;
     this._resolvers = resolvers;
   }
 
@@ -82,7 +82,7 @@
     try {
       Uri uri = parseUriWithException(encoding.substring(1));
       for (UriResolver resolver in _resolvers) {
-        Source result = resolver.fromEncoding(_contentCache, kind, uri);
+        Source result = resolver.fromEncoding(contentCache, kind, uri);
         if (result != null) {
           return result;
         }
@@ -94,20 +94,6 @@
   }
 
   /**
-   * Return a cache of content used to override the default content of a source.
-   *
-   * @return a cache of content used to override the default content of a source
-   */
-  ContentCache get contentCache => _contentCache;
-
-  /**
-   * Return the analysis context that this source factory is associated with.
-   *
-   * @return the analysis context that this source factory is associated with
-   */
-  AnalysisContext get context => _context;
-
-  /**
    * Return the [DartSdk] associated with this [SourceFactory], or `null` if there
    * is no such SDK.
    *
@@ -170,20 +156,7 @@
    * @param contents the new contents of the source
    * @return `true` if the new cached contents are different from the old, else `false`
    */
-  bool setContents(Source source, String contents) => _contentCache.setContents(source, contents);
-
-  /**
-   * Set the analysis context that this source factory is associated with to the given context.
-   *
-   * <b>Note:</b> This method should only be invoked by
-   * [AnalysisContextImpl#setSourceFactory] and is only public out of
-   * necessity.
-   *
-   * @param context the analysis context that this source factory is associated with
-   */
-  void set context(AnalysisContext context2) {
-    this._context = context2;
-  }
+  bool setContents(Source source, String contents) => contentCache.setContents(source, contents);
 
   /**
    * Return the contents of the given source, or `null` if this factory does not override the
@@ -195,7 +168,7 @@
    * @param source the source whose content is to be returned
    * @return the contents of the given source
    */
-  String getContents(Source source) => _contentCache.getContents(source);
+  String getContents(Source source) => contentCache.getContents(source);
 
   /**
    * Return the modification stamp of the given source, or `null` if this factory does not
@@ -207,7 +180,7 @@
    * @param source the source whose modification stamp is to be returned
    * @return the modification stamp of the given source
    */
-  int getModificationStamp(Source source) => _contentCache.getModificationStamp(source);
+  int getModificationStamp(Source source) => contentCache.getModificationStamp(source);
 
   /**
    * Return a source object representing the URI that results from resolving the given (possibly
@@ -222,7 +195,7 @@
   Source resolveUri2(Source containingSource, Uri containedUri) {
     if (containedUri.isAbsolute) {
       for (UriResolver resolver in _resolvers) {
-        Source result = resolver.resolveAbsolute(_contentCache, containedUri);
+        Source result = resolver.resolveAbsolute(contentCache, containedUri);
         if (result != null) {
           return result;
         }
@@ -476,7 +449,7 @@
   /**
    * The single character encoding used to identify this kind of URI.
    */
-  int _encoding = 0;
+  int encoding = 0;
 
   /**
    * Initialize a newly created URI kind to have the given encoding.
@@ -484,7 +457,7 @@
    * @param encoding the single character encoding used to identify this kind of URI.
    */
   UriKind(String name, int ordinal, int encoding) : super(name, ordinal) {
-    this._encoding = encoding;
+    this.encoding = encoding;
   }
 
   /**
@@ -507,13 +480,6 @@
     }
     return null;
   }
-
-  /**
-   * Return the single character encoding used to identify this kind of URI.
-   *
-   * @return the single character encoding used to identify this kind of URI
-   */
-  int get encoding => _encoding;
 }
 /**
  * A source range defines an [Element]'s source coordinates relative to its [Source].
@@ -526,13 +492,13 @@
    * The 0-based index of the first character of the source code for this element, relative to the
    * source buffer in which this element is contained.
    */
-  int _offset = 0;
+  int offset = 0;
 
   /**
    * The number of characters of the source code for this element, relative to the source buffer in
    * which this element is contained.
    */
-  int _length = 0;
+  int length = 0;
 
   /**
    * Initialize a newly created source range using the given offset and the given length.
@@ -541,19 +507,19 @@
    * @param length the given length
    */
   SourceRange(int offset, int length) {
-    this._offset = offset;
-    this._length = length;
+    this.offset = offset;
+    this.length = length;
   }
 
   /**
    * @return `true` if <code>x</code> is in [offset, offset + length) interval.
    */
-  bool contains(int x) => _offset <= x && x < _offset + _length;
+  bool contains(int x) => offset <= x && x < offset + length;
 
   /**
    * @return `true` if <code>x</code> is in (offset, offset + length) interval.
    */
-  bool containsExclusive(int x) => _offset < x && x < _offset + _length;
+  bool containsExclusive(int x) => offset < x && x < offset + length;
 
   /**
    * @return `true` if <code>otherRange</code> covers this [SourceRange].
@@ -577,48 +543,30 @@
       return false;
     }
     SourceRange sourceRange = obj as SourceRange;
-    return sourceRange.offset == _offset && sourceRange.length == _length;
+    return sourceRange.offset == offset && sourceRange.length == length;
   }
 
   /**
    * @return the 0-based index of the after-last character of the source code for this element,
    *         relative to the source buffer in which this element is contained.
    */
-  int get end => _offset + _length;
+  int get end => offset + length;
 
   /**
    * @return the expanded instance of [SourceRange], which has the same center.
    */
-  SourceRange getExpanded(int delta) => new SourceRange(_offset - delta, delta + _length + delta);
-
-  /**
-   * Returns the number of characters of the source code for this element, relative to the source
-   * buffer in which this element is contained.
-   *
-   * @return the number of characters of the source code for this element, relative to the source
-   *         buffer in which this element is contained
-   */
-  int get length => _length;
+  SourceRange getExpanded(int delta) => new SourceRange(offset - delta, delta + length + delta);
 
   /**
    * @return the instance of [SourceRange] with end moved on "delta".
    */
-  SourceRange getMoveEnd(int delta) => new SourceRange(_offset, _length + delta);
-
-  /**
-   * Returns the 0-based index of the first character of the source code for this element, relative
-   * to the source buffer in which this element is contained.
-   *
-   * @return the 0-based index of the first character of the source code for this element, relative
-   *         to the source buffer in which this element is contained
-   */
-  int get offset => _offset;
+  SourceRange getMoveEnd(int delta) => new SourceRange(offset, length + delta);
 
   /**
    * @return the expanded translated of [SourceRange], with moved start and the same length.
    */
-  SourceRange getTranslated(int delta) => new SourceRange(_offset + delta, _length);
-  int get hashCode => 31 * _offset + _length;
+  SourceRange getTranslated(int delta) => new SourceRange(offset + delta, length);
+  int get hashCode => 31 * offset + length;
 
   /**
    * @return `true` if this [SourceRange] intersects with given.
@@ -639,13 +587,13 @@
   /**
    * @return `true` if this [SourceRange] starts in <code>otherRange</code>.
    */
-  bool startsIn(SourceRange otherRange) => otherRange.contains(_offset);
+  bool startsIn(SourceRange otherRange) => otherRange.contains(offset);
   String toString() {
     JavaStringBuilder builder = new JavaStringBuilder();
     builder.append("[offset=");
-    builder.append(_offset);
+    builder.append(offset);
     builder.append(", length=");
-    builder.append(_length);
+    builder.append(length);
     builder.append("]");
     return builder.toString();
   }
@@ -680,7 +628,7 @@
   /**
    * The Dart SDK against which URI's are to be resolved.
    */
-  DartSdk _sdk;
+  DartSdk dartSdk;
 
   /**
    * The name of the `dart` scheme.
@@ -702,26 +650,19 @@
    * @param sdk the Dart SDK against which URI's are to be resolved
    */
   DartUriResolver(DartSdk sdk) {
-    this._sdk = sdk;
+    this.dartSdk = sdk;
   }
   Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) {
     if (identical(kind, UriKind.DART_URI)) {
-      return _sdk.fromEncoding(contentCache, kind, uri);
+      return dartSdk.fromEncoding(contentCache, kind, uri);
     }
     return null;
   }
-
-  /**
-   * Return the [DartSdk] against which URIs are to be resolved.
-   *
-   * @return the [DartSdk] against which URIs are to be resolved.
-   */
-  DartSdk get dartSdk => _sdk;
   Source resolveAbsolute(ContentCache contentCache, Uri uri) {
     if (!isDartUri(uri)) {
       return null;
     }
-    return _sdk.mapDartUri(uri.toString());
+    return dartSdk.mapDartUri(uri.toString());
   }
 }
 /**
@@ -777,12 +718,12 @@
   /**
    * The one-based index of the line containing the character.
    */
-  int _lineNumber = 0;
+  int lineNumber = 0;
 
   /**
    * The one-based index of the column containing the character.
    */
-  int _columnNumber = 0;
+  int columnNumber = 0;
 
   /**
    * Initialize a newly created location to represent the location of the character at the given
@@ -792,23 +733,9 @@
    * @param columnNumber the one-based index of the column containing the character
    */
   LineInfo_Location(int lineNumber, int columnNumber) {
-    this._lineNumber = lineNumber;
-    this._columnNumber = columnNumber;
+    this.lineNumber = lineNumber;
+    this.columnNumber = columnNumber;
   }
-
-  /**
-   * Return the one-based index of the column containing the character.
-   *
-   * @return the one-based index of the column containing the character
-   */
-  int get columnNumber => _columnNumber;
-
-  /**
-   * Return the one-based index of the line containing the character.
-   *
-   * @return the one-based index of the line containing the character
-   */
-  int get lineNumber => _lineNumber;
 }
 /**
  * Instances of class `ContentCache` hold content used to override the default content of a
diff --git a/pkg/analyzer_experimental/lib/src/generated/source_io.dart b/pkg/analyzer_experimental/lib/src/generated/source_io.dart
index fd374b5..76bfcd2 100644
--- a/pkg/analyzer_experimental/lib/src/generated/source_io.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/source_io.dart
@@ -22,7 +22,7 @@
   /**
    * The file represented by this source.
    */
-  JavaFile _file;
+  JavaFile file;
 
   /**
    * The cached encoding for this source.
@@ -52,7 +52,7 @@
    */
   FileBasedSource.con2(ContentCache contentCache, JavaFile file, UriKind uriKind) {
     this._contentCache = contentCache;
-    this._file = file;
+    this.file = file;
     this._uriKind = uriKind;
     if (file.getPath().indexOf(':') > 2) {
       try {
@@ -63,8 +63,8 @@
       }
     }
   }
-  bool operator ==(Object object) => object != null && this.runtimeType == object.runtimeType && _file == ((object as FileBasedSource))._file;
-  bool exists() => _contentCache.getContents(this) != null || (_file.exists() && !_file.isDirectory());
+  bool operator ==(Object object) => object != null && this.runtimeType == object.runtimeType && file == ((object as FileBasedSource)).file;
+  bool exists() => _contentCache.getContents(this) != null || (file.exists() && !file.isDirectory());
   void getContents(Source_ContentReceiver receiver) {
     {
       String contents = _contentCache.getContents(this);
@@ -73,25 +73,25 @@
         return;
       }
     }
-    receiver.accept2(_file.readAsStringSync(), _file.lastModified());
+    receiver.accept2(file.readAsStringSync(), file.lastModified());
   }
   String get encoding {
     if (_encoding == null) {
-      _encoding = "${_uriKind.encoding}${_file.toURI().toString()}";
+      _encoding = "${_uriKind.encoding}${file.toURI().toString()}";
     }
     return _encoding;
   }
-  String get fullName => _file.getAbsolutePath();
+  String get fullName => file.getAbsolutePath();
   int get modificationStamp {
     int stamp = _contentCache.getModificationStamp(this);
     if (stamp != null) {
       return stamp;
     }
-    return _file.lastModified();
+    return file.lastModified();
   }
-  String get shortName => _file.getName();
+  String get shortName => file.getName();
   UriKind get uriKind => _uriKind;
-  int get hashCode => _file.hashCode;
+  int get hashCode => file.hashCode;
   bool get isInSystemLibrary => identical(_uriKind, UriKind.DART_URI);
   Source resolveRelative(Uri containedUri) {
     try {
@@ -102,19 +102,11 @@
     return null;
   }
   String toString() {
-    if (_file == null) {
+    if (file == null) {
       return "<unknown source>";
     }
-    return _file.getAbsolutePath();
+    return file.getAbsolutePath();
   }
-
-  /**
-   * Return the file represented by this source. This is an internal method that is only intended to
-   * be used by [UriResolver].
-   *
-   * @return the file represented by this source
-   */
-  JavaFile get file => _file;
 }
 /**
  * Instances of the class `PackageUriResolver` resolve `package` URI's in the context of
@@ -272,7 +264,7 @@
   /**
    * The container's path (not `null`).
    */
-  String _path;
+  String path;
 
   /**
    * Construct a container representing the specified directory and containing any sources whose
@@ -291,19 +283,12 @@
    * @param path the path (not `null` and not empty)
    */
   DirectoryBasedSourceContainer.con2(String path) {
-    this._path = appendFileSeparator(path);
+    this.path = appendFileSeparator(path);
   }
-  bool contains(Source source) => source.fullName.startsWith(_path);
+  bool contains(Source source) => source.fullName.startsWith(path);
   bool operator ==(Object obj) => (obj is DirectoryBasedSourceContainer) && ((obj as DirectoryBasedSourceContainer)).path == path;
-
-  /**
-   * Answer the receiver's path, used to determine if a source is contained in the receiver.
-   *
-   * @return the path (not `null`, not empty)
-   */
-  String get path => _path;
-  int get hashCode => _path.hashCode;
-  String toString() => "SourceContainer[${_path}]";
+  int get hashCode => path.hashCode;
+  String toString() => "SourceContainer[${path}]";
 }
 /**
  * Instances of the class `FileUriResolver` resolve `file` URI's.
diff --git a/pkg/analyzer_experimental/lib/src/generated/utilities_dart.dart b/pkg/analyzer_experimental/lib/src/generated/utilities_dart.dart
index 726e294..40fe9a4 100644
--- a/pkg/analyzer_experimental/lib/src/generated/utilities_dart.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/utilities_dart.dart
@@ -18,7 +18,7 @@
   /**
    * A flag indicating whether this is an optional parameter.
    */
-  bool _isOptional2 = false;
+  bool isOptional = false;
 
   /**
    * Initialize a newly created kind with the given state.
@@ -26,13 +26,6 @@
    * @param isOptional `true` if this is an optional parameter
    */
   ParameterKind(String name, int ordinal, bool isOptional) : super(name, ordinal) {
-    this._isOptional2 = isOptional;
+    this.isOptional = isOptional;
   }
-
-  /**
-   * Return `true` if this is an optional parameter.
-   *
-   * @return `true` if this is an optional parameter
-   */
-  bool get isOptional => _isOptional2;
 }
\ No newline at end of file
diff --git a/pkg/analyzer_experimental/lib/src/services/formatter_impl.dart b/pkg/analyzer_experimental/lib/src/services/formatter_impl.dart
index ce7da334..71855f5 100644
--- a/pkg/analyzer_experimental/lib/src/services/formatter_impl.dart
+++ b/pkg/analyzer_experimental/lib/src/services/formatter_impl.dart
@@ -153,10 +153,9 @@
   /// A flag to indicate that a newline should be emitted before the next token.
   bool needsNewline = false;
 
-  /// A flag to indicate that user introduced newlines should be emitted before
-  /// the next token.
-  bool preservePrecedingNewlines = false;
-
+  /// Used for matching EOL comments
+  final twoSlashes = new RegExp(r'//[^/]');
+  
   /// Initialize a newly created visitor to write source code representing
   /// the visited nodes to the given [writer].
   SourceVisitor(FormatterOptions options, this.lineInfo) :
@@ -322,14 +321,11 @@
     var directives = node.directives;
     visit(scriptTag);
 
-    preservePrecedingNewlines = true;
     visitNodes(directives, separatedBy: newlines, followedBy: newlines);
 
-    preservePrecedingNewlines = true;
     visitNodes(node.declarations, separatedBy: newlines);
 
     // Handle trailing whitespace
-    preservePrecedingNewlines = true;
     token(node.endToken /* EOF */);
   }
 
@@ -1033,7 +1029,6 @@
   /// Indicate that at least one newline should be emitted and possibly more
   /// if the source has them.
   newlines() {
-    preservePrecedingNewlines = true;
     needsNewline = true;
   }
 
@@ -1042,17 +1037,13 @@
       if (needsNewline) {
         minNewlines = max(1, minNewlines);
       }
-      if (preservePrecedingNewlines || minNewlines > 0) {
-        var emitted = emitPrecedingNewlines(token, min: minNewlines);
-        preservePrecedingNewlines = false;
-        if (emitted > 0) {
-          needsNewline = false;
-        }
+      var emitted = emitPrecedingCommentsAndNewlines(token, min: minNewlines);
+      if (emitted > 0) {
+        needsNewline = false;
       }
       if (precededBy !=null) {
         precededBy();
       }
-      emitBlockComments(token);
       append(token.lexeme);
       if (followedBy != null) {
         followedBy();
@@ -1098,37 +1089,40 @@
     writer.unindent();
   }
 
-  emitBlockComments(Token token) {
-    var comment = token.precedingComments;
-    while (comment != null) {
-      if (isBlock(comment)) {
-        append(comment.toString().trim());
-        if (linesBetween(comment.end, token.offset) >= 1) {
-          writer.newline();
-        } else {
-          space();
-        }
-      }
-      comment = comment.next;
-    }
-  }
-
-  /// Emit any detected newlines or a minimum as specified by [min].
-  int emitPrecedingNewlines(Token token, {min: 0}) {
+  
+  /// Emit any detected comments and newlines or a minimum as specified 
+  /// by [min].
+  int emitPrecedingCommentsAndNewlines(Token token, {min: 0}) {
+    
     var comment = token.precedingComments;
     var currentToken = comment != null ? comment : token;
+    
+    //Handle EOLs before newlines
+    if (isAtEOL(comment)) {
+      emitComment(comment, previousToken);
+      comment = comment.next;
+      currentToken = comment != null ? comment : token;
+    }
+    
     var lines = max(min, countNewlinesBetween(previousToken, currentToken));
     writer.newlines(lines);
-
+    
+    var previousToken = currentToken.previous;
+    
     while (comment != null) {
-      if (!isBlock(comment)) {
-        append(comment.toString().trim());
-        var nextToken = comment.next != null ? comment.next : token;
-        var postCommentNewlines =
-            max(1, countNewlinesBetween(comment, nextToken));
-        writer.newlines(postCommentNewlines);
-        lines += postCommentNewlines;
+
+      emitComment(comment, previousToken);
+      
+      var nextToken = comment.next != null ? comment.next : token;
+      var newlines = calculateNewlinesBetweenComments(comment, nextToken);
+      if (newlines > 0) {
+        writer.newlines(newlines);
+        lines += newlines;
+      } else if (!isEOF(token)) {
+        space();
       }
+      
+      previousToken = comment;
       comment = comment.next;
     }
 
@@ -1136,6 +1130,31 @@
     return lines;
   }
 
+  /// Test if this [comment] is at the end of a line.
+  bool isAtEOL(Token comment) => 
+      comment != null && comment.toString().trim().startsWith(twoSlashes) && 
+      sameLine(comment, previousToken);
+
+  /// Emit this [comment], inserting leading whitespace if appropriate.
+  emitComment(Token comment, Token previousToken) {
+    if (!writer.currentLine.isWhitespace() && !isBlock(comment)) {
+      var ws = countSpacesBetween(previousToken, comment);
+      // Preserve one space but no more
+      if (ws > 0) {
+        space();
+      }
+    }
+    
+    append(comment.toString().trim());
+  }
+
+  /// Test if this token is an EOF token.
+  bool isEOF(Token token) => token.type == TokenType.EOF;
+  
+  /// Count spaces between these tokens.  Tokens on different lines return 0.
+  int countSpacesBetween(Token last, Token current) => isEOF(last) || 
+      countNewlinesBetween(last, current) > 0 ? 0 : current.offset - last.end;  
+     
   /// Count the blanks between these two nodes.
   int countBlankLinesBetween(ASTNode lastNode, ASTNode currentNode) =>
       countNewlinesBetween(lastNode.endToken, currentNode.beginToken);
@@ -1148,7 +1167,7 @@
   int countSucceedingNewlines(ASTNode node) => node == null ? 0 :
       countNewlinesBetween(node.endToken, node.endToken.next);
 
-  /// Count the blanks between these two nodes.
+  /// Count the blanks between these two tokens.
   int countNewlinesBetween(Token last, Token current) {
     if (last == null || current == null) {
       return 0;
@@ -1156,11 +1175,40 @@
 
     return linesBetween(last.end - 1, current.offset);
   }
+  
+  /// Calculate the newlines that should separate these comments.
+  int calculateNewlinesBetweenComments(Token last, Token current) {
+    // Insist on a newline after doc comments or single line comments
+    // (NOTE that EOL comments have already been processed).
+    if (isOldSingleLineDocComment(last) || isSingleLineComment(last)) {
+      return max(1, countNewlinesBetween(last, current)); 
+    } else {
+      return countNewlinesBetween(last, current);
+    }
+  }
+  
+  /// Single line multi-line comments (e.g., '/** like this */').
+  bool isOldSingleLineDocComment(Token comment) =>
+      comment.lexeme.startsWith(r'/**') && singleLine(comment);
+  
+  /// Test if this [token] spans just one line.
+  bool singleLine(Token token) => linesBetween(token.offset, token.end) < 1;
 
-  /// Test if this [comment] is a block comment.
+  /// Test if token [first] is on the same line as [second].
+  bool sameLine(Token first, Token second) =>
+      countNewlinesBetween(first, second) == 0;
+   
+  /// Test if this is a multi-line [comment] (e.g., '/* ...' or '/** ...')
+  bool isMultiLineComment(Token comment) => 
+      comment.type == TokenType.MULTI_LINE_COMMENT;
+  
+  /// Test if this is a single-line [comment] (e.g., '// ...')
+  bool isSingleLineComment(Token comment) => 
+      comment.type == TokenType.SINGLE_LINE_COMMENT;
+  
+  /// Test if this [comment] is a block comment (e.g., '/* like this */')..
   bool isBlock(Token comment) =>
-      comment.type != TokenType.SINGLE_LINE_COMMENT &&
-        linesBetween(comment.offset, comment.end) < 1;
+      isMultiLineComment(comment) && singleLine(comment);
 
   /// Count the lines between two offsets.
   int linesBetween(int lastOffset, int currentOffset) {
diff --git a/pkg/analyzer_experimental/test/generated/ast_test.dart b/pkg/analyzer_experimental/test/generated/ast_test.dart
index 06dcee9..a8d31ed 100644
--- a/pkg/analyzer_experimental/test/generated/ast_test.dart
+++ b/pkg/analyzer_experimental/test/generated/ast_test.dart
@@ -774,7 +774,7 @@
         "}"]);
     CompilationUnit unit = ParserTestCase.parseCompilationUnit(source, []);
     List<ASTNode> nodes = new List<ASTNode>();
-    BreadthFirstVisitor<Object> visitor = new BreadthFirstVisitor_16(nodes);
+    BreadthFirstVisitor<Object> visitor = new BreadthFirstVisitor_18(nodes);
     visitor.visitAllNodes(unit);
     EngineTestCase.assertSize(59, nodes);
     EngineTestCase.assertInstanceOf(CompilationUnit, nodes[0]);
@@ -792,9 +792,9 @@
     });
   }
 }
-class BreadthFirstVisitor_16 extends BreadthFirstVisitor<Object> {
+class BreadthFirstVisitor_18 extends BreadthFirstVisitor<Object> {
   List<ASTNode> nodes;
-  BreadthFirstVisitor_16(this.nodes) : super();
+  BreadthFirstVisitor_18(this.nodes) : super();
   Object visitNode(ASTNode node) {
     nodes.add(node);
     return super.visitNode(node);
diff --git a/pkg/analyzer_experimental/test/generated/element_test.dart b/pkg/analyzer_experimental/test/generated/element_test.dart
index 3619510..2674d10 100644
--- a/pkg/analyzer_experimental/test/generated/element_test.dart
+++ b/pkg/analyzer_experimental/test/generated/element_test.dart
@@ -2382,7 +2382,7 @@
   }
   void test_isSubtypeOf_baseCase_classFunction() {
     ClassElementImpl functionElement = ElementFactory.classElement2("Function", []);
-    InterfaceTypeImpl functionType = new InterfaceTypeImpl_21(functionElement);
+    InterfaceTypeImpl functionType = new InterfaceTypeImpl_25(functionElement);
     FunctionType f = ElementFactory.functionElement("f").type;
     JUnitTestCase.assertTrue(f.isSubtypeOf(functionType));
   }
@@ -2846,8 +2846,8 @@
     });
   }
 }
-class InterfaceTypeImpl_21 extends InterfaceTypeImpl {
-  InterfaceTypeImpl_21(ClassElement arg0) : super.con1(arg0);
+class InterfaceTypeImpl_25 extends InterfaceTypeImpl {
+  InterfaceTypeImpl_25(ClassElement arg0) : super.con1(arg0);
   bool get isDartCoreFunction => true;
 }
 main() {
diff --git a/pkg/analyzer_experimental/test/generated/parser_test.dart b/pkg/analyzer_experimental/test/generated/parser_test.dart
index c4b11b8..0a7adad 100644
--- a/pkg/analyzer_experimental/test/generated/parser_test.dart
+++ b/pkg/analyzer_experimental/test/generated/parser_test.dart
@@ -3775,7 +3775,7 @@
    * @throws Exception if the method could not be invoked or throws an exception
    */
   String computeStringValue(String lexeme, bool first, bool last) {
-    AnalysisErrorListener listener = new AnalysisErrorListener_22();
+    AnalysisErrorListener listener = new AnalysisErrorListener_26();
     Parser parser = new Parser(null, listener);
     return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme, first, last], null) as String;
   }
@@ -6003,7 +6003,7 @@
     });
   }
 }
-class AnalysisErrorListener_22 implements AnalysisErrorListener {
+class AnalysisErrorListener_26 implements AnalysisErrorListener {
   void onError(AnalysisError event) {
     JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event.offset}, ${event.length})");
   }
diff --git a/pkg/analyzer_experimental/test/generated/resolver_test.dart b/pkg/analyzer_experimental/test/generated/resolver_test.dart
index 7cc689b..bd7948d 100644
--- a/pkg/analyzer_experimental/test/generated/resolver_test.dart
+++ b/pkg/analyzer_experimental/test/generated/resolver_test.dart
@@ -6005,12 +6005,12 @@
   /**
    * The source factory used to create [Source].
    */
-  SourceFactory _sourceFactory;
+  SourceFactory sourceFactory;
 
   /**
    * The analysis context used to parse the compilation units being resolved.
    */
-  AnalysisContextImpl _analysisContext;
+  AnalysisContextImpl analysisContext;
   void setUp() {
     reset();
   }
@@ -6034,7 +6034,7 @@
     Source source = cacheSource(filePath, contents);
     ChangeSet changeSet = new ChangeSet();
     changeSet.added(source);
-    _analysisContext.applyChanges(changeSet);
+    analysisContext.applyChanges(changeSet);
     return source;
   }
 
@@ -6049,7 +6049,7 @@
    */
   void assertErrors(List<ErrorCode> expectedErrorCodes) {
     GatheringErrorListener errorListener = new GatheringErrorListener();
-    for (ChangeNotice notice in _analysisContext.performAnalysisTask()) {
+    for (ChangeNotice notice in analysisContext.performAnalysisTask()) {
       for (AnalysisError error in notice.errors) {
         errorListener.onError(error);
       }
@@ -6064,7 +6064,7 @@
    */
   void assertNoErrors() {
     GatheringErrorListener errorListener = new GatheringErrorListener();
-    for (ChangeNotice notice in _analysisContext.performAnalysisTask()) {
+    for (ChangeNotice notice in analysisContext.performAnalysisTask()) {
       for (AnalysisError error in notice.errors) {
         errorListener.onError(error);
       }
@@ -6081,8 +6081,8 @@
    * @return the source object representing the cached file
    */
   Source cacheSource(String filePath, String contents) {
-    Source source = new FileBasedSource.con1(_sourceFactory.contentCache, FileUtilities2.createFile(filePath));
-    _sourceFactory.setContents(source, contents);
+    Source source = new FileBasedSource.con1(sourceFactory.contentCache, FileUtilities2.createFile(filePath));
+    sourceFactory.setContents(source, contents);
     return source;
   }
 
@@ -6121,8 +6121,6 @@
     library.parts = sourcedCompilationUnits;
     return library;
   }
-  AnalysisContext get analysisContext => _analysisContext;
-  SourceFactory get sourceFactory => _sourceFactory;
 
   /**
    * Return a type provider that can be used to test the results of resolution.
@@ -6130,8 +6128,8 @@
    * @return a type provider
    */
   TypeProvider get typeProvider {
-    Source coreSource = _analysisContext.sourceFactory.forUri(DartSdk.DART_CORE);
-    LibraryElement coreElement = _analysisContext.getLibraryElement(coreSource);
+    Source coreSource = analysisContext.sourceFactory.forUri(DartSdk.DART_CORE);
+    LibraryElement coreElement = analysisContext.getLibraryElement(coreSource);
     return new TypeProviderImpl(coreElement);
   }
 
@@ -6140,8 +6138,8 @@
    * reset test instance to reuse it.
    */
   void reset() {
-    _analysisContext = AnalysisContextFactory.contextWithCore();
-    _sourceFactory = _analysisContext.sourceFactory;
+    analysisContext = AnalysisContextFactory.contextWithCore();
+    sourceFactory = analysisContext.sourceFactory;
   }
 
   /**
@@ -6153,7 +6151,7 @@
    * @return the element representing the resolved library
    * @throws AnalysisException if the analysis could not be performed
    */
-  LibraryElement resolve(Source librarySource) => _analysisContext.computeLibraryElement(librarySource);
+  LibraryElement resolve(Source librarySource) => analysisContext.computeLibraryElement(librarySource);
 
   /**
    * Return the resolved compilation unit corresponding to the given source in the given library.
@@ -6163,7 +6161,7 @@
    * @return the resolved compilation unit
    * @throws Exception if the compilation unit could not be resolved
    */
-  CompilationUnit resolveCompilationUnit(Source source, LibraryElement library) => _analysisContext.resolveCompilationUnit(source, library);
+  CompilationUnit resolveCompilationUnit(Source source, LibraryElement library) => analysisContext.resolveCompilationUnit(source, library);
 
   /**
    * Verify that all of the identifiers in the compilation units associated with the given sources
@@ -6177,7 +6175,7 @@
   void verify(List<Source> sources) {
     ResolutionVerifier verifier = new ResolutionVerifier();
     for (Source source in sources) {
-      _analysisContext.parseCompilationUnit(source).accept(verifier);
+      analysisContext.parseCompilationUnit(source).accept(verifier);
     }
     verifier.assertResolved();
   }
@@ -6189,8 +6187,8 @@
    * @return the source that was created
    */
   FileBasedSource createSource2(String fileName) {
-    FileBasedSource source = new FileBasedSource.con1(_sourceFactory.contentCache, FileUtilities2.createFile(fileName));
-    _sourceFactory.setContents(source, "");
+    FileBasedSource source = new FileBasedSource.con1(sourceFactory.contentCache, FileUtilities2.createFile(fileName));
+    sourceFactory.setContents(source, "");
     return source;
   }
   static dartSuite() {
@@ -14902,6 +14900,73 @@
   /**
    * Create an analysis context that has a fake core library already resolved.
    *
+   * Added in order to test AnalysisContextImpl2.
+   *
+   * @return the analysis context that was created
+   */
+  static AnalysisContextImpl2 context2WithCore() {
+    AnalysisContextImpl2 sdkContext = DirectoryBasedDartSdk.defaultSdk2.context as AnalysisContextImpl2;
+    SourceFactory sourceFactory = sdkContext.sourceFactory;
+    TestTypeProvider provider = new TestTypeProvider();
+    CompilationUnitElementImpl coreUnit = new CompilationUnitElementImpl("core.dart");
+    Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE);
+    sdkContext.setContents(coreSource, "");
+    coreUnit.source = coreSource;
+    coreUnit.types = <ClassElement> [
+        provider.boolType.element,
+        provider.doubleType.element,
+        provider.functionType.element,
+        provider.intType.element,
+        provider.listType.element,
+        provider.mapType.element,
+        provider.nullType.element,
+        provider.numType.element,
+        provider.objectType.element,
+        provider.stackTraceType.element,
+        provider.stringType.element,
+        provider.typeType.element];
+    LibraryElementImpl coreLibrary = new LibraryElementImpl(sdkContext, ASTFactory.libraryIdentifier2(["dart", "core"]));
+    coreLibrary.definingCompilationUnit = coreUnit;
+    CompilationUnitElementImpl htmlUnit = new CompilationUnitElementImpl("html_dartium.dart");
+    Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML);
+    sdkContext.setContents(htmlSource, "");
+    htmlUnit.source = htmlSource;
+    ClassElementImpl elementElement = ElementFactory.classElement2("Element", []);
+    InterfaceType elementType = elementElement.type;
+    ClassElementImpl documentElement = ElementFactory.classElement("Document", elementType, []);
+    ClassElementImpl htmlDocumentElement = ElementFactory.classElement("HtmlDocument", documentElement.type, []);
+    htmlDocumentElement.methods = <MethodElement> [ElementFactory.methodElement("query", elementType, <Type2> [provider.stringType])];
+    htmlUnit.types = <ClassElement> [
+        ElementFactory.classElement("AnchorElement", elementType, []),
+        ElementFactory.classElement("BodyElement", elementType, []),
+        ElementFactory.classElement("ButtonElement", elementType, []),
+        ElementFactory.classElement("DivElement", elementType, []),
+        documentElement,
+        elementElement,
+        htmlDocumentElement,
+        ElementFactory.classElement("InputElement", elementType, []),
+        ElementFactory.classElement("SelectElement", elementType, [])];
+    htmlUnit.functions = <FunctionElement> [ElementFactory.functionElement3("query", elementElement, <ClassElement> [provider.stringType.element], ClassElementImpl.EMPTY_ARRAY)];
+    TopLevelVariableElementImpl document = ElementFactory.topLevelVariableElement3("document", true, htmlDocumentElement.type);
+    htmlUnit.topLevelVariables = <TopLevelVariableElement> [document];
+    htmlUnit.accessors = <PropertyAccessorElement> [document.getter];
+    LibraryElementImpl htmlLibrary = new LibraryElementImpl(sdkContext, ASTFactory.libraryIdentifier2(["dart", "dom", "html"]));
+    htmlLibrary.definingCompilationUnit = htmlUnit;
+    Map<Source, LibraryElement> elementMap = new Map<Source, LibraryElement>();
+    elementMap[coreSource] = coreLibrary;
+    elementMap[htmlSource] = htmlLibrary;
+    sdkContext.recordLibraryElements(elementMap);
+    AnalysisContextImpl2 context = new DelegatingAnalysisContextImpl2();
+    sourceFactory = new SourceFactory.con2([
+        new DartUriResolver(sdkContext.sourceFactory.dartSdk),
+        new FileUriResolver()]);
+    context.sourceFactory = sourceFactory;
+    return context;
+  }
+
+  /**
+   * Create an analysis context that has a fake core library already resolved.
+   *
    * @return the analysis context that was created
    */
   static AnalysisContextImpl contextWithCore() {
@@ -16491,7 +16556,7 @@
   void test_define_duplicate() {
     LibraryElement definingLibrary2 = createTestLibrary();
     GatheringErrorListener errorListener2 = new GatheringErrorListener();
-    Scope rootScope = new Scope_19(definingLibrary2, errorListener2);
+    Scope rootScope = new Scope_23(definingLibrary2, errorListener2);
     EnclosedScope scope = new EnclosedScope(rootScope);
     VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.identifier3("v1"));
     VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.identifier3("v1"));
@@ -16502,7 +16567,7 @@
   void test_define_normal() {
     LibraryElement definingLibrary3 = createTestLibrary();
     GatheringErrorListener errorListener3 = new GatheringErrorListener();
-    Scope rootScope = new Scope_20(definingLibrary3, errorListener3);
+    Scope rootScope = new Scope_24(definingLibrary3, errorListener3);
     EnclosedScope outerScope = new EnclosedScope(rootScope);
     EnclosedScope innerScope = new EnclosedScope(outerScope);
     VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.identifier3("v1"));
@@ -16524,18 +16589,18 @@
     });
   }
 }
-class Scope_19 extends Scope {
+class Scope_23 extends Scope {
   LibraryElement definingLibrary2;
   GatheringErrorListener errorListener2;
-  Scope_19(this.definingLibrary2, this.errorListener2) : super();
+  Scope_23(this.definingLibrary2, this.errorListener2) : super();
   LibraryElement get definingLibrary => definingLibrary2;
   AnalysisErrorListener get errorListener => errorListener2;
   Element lookup3(Identifier identifier, String name, LibraryElement referencingLibrary) => null;
 }
-class Scope_20 extends Scope {
+class Scope_24 extends Scope {
   LibraryElement definingLibrary3;
   GatheringErrorListener errorListener3;
-  Scope_20(this.definingLibrary3, this.errorListener3) : super();
+  Scope_24(this.definingLibrary3, this.errorListener3) : super();
   LibraryElement get definingLibrary => definingLibrary3;
   AnalysisErrorListener get errorListener => errorListener3;
   Element lookup3(Identifier identifier, String name, LibraryElement referencingLibrary) => null;
diff --git a/pkg/analyzer_experimental/test/generated/test_support.dart b/pkg/analyzer_experimental/test/generated/test_support.dart
index 6d7ae8f..0152e1a 100644
--- a/pkg/analyzer_experimental/test/generated/test_support.dart
+++ b/pkg/analyzer_experimental/test/generated/test_support.dart
@@ -30,7 +30,7 @@
   /**
    * A list containing the errors that were collected.
    */
-  List<AnalysisError> _errors = new List<AnalysisError>();
+  final List<AnalysisError> errors = new List<AnalysisError>();
 
   /**
    * A table mapping sources to the line information for the source.
@@ -76,14 +76,14 @@
    *           expected or if they do not have the same codes and locations
    */
   void assertErrors(List<AnalysisError> expectedErrors) {
-    if (_errors.length != expectedErrors.length) {
+    if (errors.length != expectedErrors.length) {
       fail(expectedErrors);
     }
     List<AnalysisError> remainingErrors = new List<AnalysisError>();
     for (AnalysisError error in expectedErrors) {
       remainingErrors.add(error);
     }
-    for (AnalysisError error in _errors) {
+    for (AnalysisError error in errors) {
       if (!foundAndRemoved(remainingErrors, error)) {
         fail(expectedErrors);
       }
@@ -115,7 +115,7 @@
       expectedCounts[code] = count;
     }
     Map<ErrorCode, List<AnalysisError>> errorsByCode = new Map<ErrorCode, List<AnalysisError>>();
-    for (AnalysisError error in _errors) {
+    for (AnalysisError error in errors) {
       ErrorCode code = error.errorCode;
       List<AnalysisError> list = errorsByCode[code];
       if (list == null) {
@@ -196,7 +196,7 @@
     }
     int actualErrorCount = 0;
     int actualWarningCount = 0;
-    for (AnalysisError error in _errors) {
+    for (AnalysisError error in errors) {
       if (identical(error.errorCode.errorSeverity, ErrorSeverity.ERROR)) {
         actualErrorCount++;
       } else {
@@ -218,13 +218,6 @@
   }
 
   /**
-   * Return the errors that were collected.
-   *
-   * @return the errors that were collected
-   */
-  List<AnalysisError> get errors => _errors;
-
-  /**
    * Return the line information associated with the given source, or `null` if no line
    * information has been associated with the source.
    *
@@ -240,7 +233,7 @@
    * @return `true` if an error with the given error code has been gathered
    */
   bool hasError(ErrorCode errorCode2) {
-    for (AnalysisError error in _errors) {
+    for (AnalysisError error in errors) {
       if (identical(error.errorCode, errorCode2)) {
         return true;
       }
@@ -253,14 +246,14 @@
    *
    * @return `true` if at least one error has been gathered
    */
-  bool hasErrors() => _errors.length > 0;
+  bool hasErrors() => errors.length > 0;
   void onError(AnalysisError error) {
     if (_rawSource != null) {
       int left = error.offset;
       int right = left + error.length - 1;
       _markedSource = "${_rawSource.substring(0, left)}^${_rawSource.substring(left, right)}^${_rawSource.substring(right)}";
     }
-    _errors.add(error);
+    errors.add(error);
   }
 
   /**
@@ -344,9 +337,9 @@
     }
     writer.newLine();
     writer.print("found ");
-    writer.print(_errors.length);
+    writer.print(errors.length);
     writer.print(" errors:");
-    for (AnalysisError error in _errors) {
+    for (AnalysisError error in errors) {
       Source source = error.source;
       LineInfo lineInfo = _lineInfoMap[source];
       writer.newLine();
diff --git a/pkg/analyzer_experimental/test/services/formatter_test.dart b/pkg/analyzer_experimental/test/services/formatter_test.dart
index 25934ff..afd2fc7 100644
--- a/pkg/analyzer_experimental/test/services/formatter_test.dart
+++ b/pkg/analyzer_experimental/test/services/formatter_test.dart
@@ -76,6 +76,10 @@
           '//comment two\n\n'
       );
       expectCUFormatsTo(
+          'var x;   //x\n',
+          'var x; //x\n'
+      );
+      expectCUFormatsTo(
           'library foo;\n'
           '\n'
           '//comment one\n'
@@ -329,7 +333,8 @@
           '}\n',
           '/** Old school class comment */\n'
           'class C {\n'
-          '  /** Foo! */ int foo() => 42;\n'
+          '  /** Foo! */\n'
+          '  int foo() => 42;\n'
           '}\n'
       );
       expectCUFormatsTo(
@@ -406,6 +411,130 @@
       );
     });
     
+    test('CU - mixed comments', () {
+      expectCUFormatsTo(
+          'library foo;\n'
+          '\n'
+          '\n'
+          '/* Comment 1 */\n'
+          '\n'
+          '// Comment 2\n'
+          '\n'
+          '/* Comment 3 */',
+          'library foo;\n'
+          '\n'
+          '\n'
+          '/* Comment 1 */\n'
+          '\n'
+          '// Comment 2\n'
+          '\n'
+          '/* Comment 3 */'
+        );
+    });
+    
+    test('CU - comments (EOF)', () {
+      expectCUFormatsTo(
+          'library foo; //zamm',
+          'library foo; //zamm\n' //<-- note extra NEWLINE
+        );
+    });  
+    
+    test('CU - comments (0)', () {
+      expectCUFormatsTo(
+          'library foo; //zamm\n'
+          '\n'
+          'class A {\n'
+          '}\n',
+          'library foo; //zamm\n'
+          '\n'
+          'class A {\n'
+          '}\n'
+        );
+    });
+
+    test('CU - comments (1)', () {
+      expectCUFormatsTo(
+          '/* foo */ /* bar */\n',
+          '/* foo */ /* bar */\n'
+      );
+    });
+    
+    test('CU - comments (2)', () {
+      expectCUFormatsTo(
+          '/** foo */ /** bar */\n',
+          '/** foo */\n' 
+          '/** bar */\n'
+      );
+    });
+
+    test('CU - comments (3)', () {
+      expectCUFormatsTo(
+          'var x;   //x\n',
+          'var x; //x\n'
+      );
+    });
+
+    test('CU - comments (4)', () {
+      expectCUFormatsTo(
+          'class X { //X!\n'
+          '}',
+          'class X { //X!\n'
+          '}'
+      );
+    });
+    
+    test('CU - comments (5)', () {
+      expectCUFormatsTo(
+          '//comment one\n\n'
+          '//comment two\n\n',
+          '//comment one\n\n'
+          '//comment two\n\n'
+      );
+    });    
+    
+    test('CU - comments (6)', () {
+      expectCUFormatsTo(
+          'var x;   //x\n',
+          'var x; //x\n'
+      );
+    });    
+
+    test('CU - comments (6)', () {
+      expectCUFormatsTo(
+          'var /* int */ x; //x\n',
+          'var /* int */ x; //x\n'
+      );
+    });    
+    
+    test('CU - comments (7)', () {
+      expectCUFormatsTo(
+          'library foo;\n'
+          '\n'
+          '/// Docs\n'
+          '/// spanning\n'
+          '/// lines.\n'
+          'class A {\n'
+          '}\n'
+          '\n'
+          '/// ... and\n'
+          '\n'
+          '/// Dangling ones too\n'
+          'int x;\n',
+          'library foo;\n'
+          '\n'
+          '/// Docs\n'
+          '/// spanning\n'
+          '/// lines.\n'
+          'class A {\n'
+          '}\n'
+          '\n'
+          '/// ... and\n'
+          '\n'
+          '/// Dangling ones too\n'
+          'int x;\n'
+        );
+    });
+    
     
     test('CU - constructor', () {
       expectCUFormatsTo(
diff --git a/pkg/async_helper/lib/async_helper.dart b/pkg/async_helper/lib/async_helper.dart
index f1a84b3..84df557 100644
--- a/pkg/async_helper/lib/async_helper.dart
+++ b/pkg/async_helper/lib/async_helper.dart
@@ -61,3 +61,8 @@
     print('unittest-suite-success');
   }
 }
+
+void asyncTest(f()) {
+  asyncStart();
+  f().whenComplete(() => asyncEnd());
+}
\ No newline at end of file
diff --git a/pkg/barback/lib/src/phase.dart b/pkg/barback/lib/src/phase.dart
index 48fd46f..1230bea 100644
--- a/pkg/barback/lib/src/phase.dart
+++ b/pkg/barback/lib/src/phase.dart
@@ -148,6 +148,7 @@
       // Removing [output]'s listeners will cause it to be removed from
       // [_outputs], so we have to put it back.
       _outputs[output.output.id] = output;
+      output.output.whenRemoved.then((_) => _outputs.remove(output.output.id));
       _next.addInput(output.output);
     }
     return _next;
@@ -188,8 +189,9 @@
             _outputs[asset.id].add(asset);
           } else {
             _outputs[asset.id] = new PhaseOutput(this, asset);
-            _outputs[asset.id].output.whenRemoved
-                .then((_) => _outputs.remove(asset.id));
+            _outputs[asset.id].output.whenRemoved.then((_) {
+              _outputs.remove(asset.id);
+            });
             if (_next != null) _next.addInput(_outputs[asset.id].output);
           }
         }
diff --git a/pkg/barback/lib/src/phase_input.dart b/pkg/barback/lib/src/phase_input.dart
index 840b564..736bd05 100644
--- a/pkg/barback/lib/src/phase_input.dart
+++ b/pkg/barback/lib/src/phase_input.dart
@@ -136,7 +136,7 @@
     if (brandNewTransformers.isEmpty) return;
 
     brandNewTransformers.forEach(_transformers.add);
-    _adjustTransformers();
+    if (_adjustTransformersFuture == null) _adjustTransformers();
   }
 
   /// Asynchronously determines which transformers can consume [input] as a
diff --git a/pkg/barback/lib/src/phase_output.dart b/pkg/barback/lib/src/phase_output.dart
index 1bfb8d4..2317a9a 100644
--- a/pkg/barback/lib/src/phase_output.dart
+++ b/pkg/barback/lib/src/phase_output.dart
@@ -52,6 +52,7 @@
   /// Adds an asset node as an output with this id.
   void add(AssetNode node) {
     assert(node.id == output.id);
+    assert(!output.state.isRemoved);
     _assets.add(node);
     _watchAsset(node);
   }
diff --git a/pkg/barback/test/package_graph/add_remove_transform_test.dart b/pkg/barback/test/package_graph/add_remove_transform_test.dart
index bd68f68..ac0076c 100644
--- a/pkg/barback/test/package_graph/add_remove_transform_test.dart
+++ b/pkg/barback/test/package_graph/add_remove_transform_test.dart
@@ -174,6 +174,24 @@
     buildShouldSucceed();
   });
 
+  test("a transformer is added to an existing phase during isPrimary", () {
+    var rewrite = new RewriteTransformer("blub", "blab");
+    initGraph(["app|foo.blub", "app|bar.blib"], {"app": [[rewrite]]});
+
+    rewrite.pauseIsPrimary("app|foo.blub");
+    updateSources(["app|foo.blub", "app|bar.blib"]);
+    // Ensure we're waiting on [rewrite.isPrimary].
+    schedule(pumpEventQueue);
+
+    updateTransformers("app", [
+      [rewrite, new RewriteTransformer("blib", "blob")]
+    ]);
+    rewrite.resumeIsPrimary("app|foo.blub");
+    expectAsset("app|foo.blab", "foo.blab");
+    expectAsset("app|bar.blob", "bar.blob");
+    buildShouldSucceed();
+  });
+
   test("a new transformer can see pass-through assets", () {
     var rewrite = new RewriteTransformer("zip", "zap");
     initGraph(["app|foo.blub"], {"app": [[rewrite]]});
@@ -234,4 +252,31 @@
     expectAsset("pkg1|foo.out", "foo.inc");
     buildShouldSucceed();
   });
+
+  // Regression test.
+  test("a phase is added, then an input is removed and re-added", () {
+    var rewrite = new RewriteTransformer("txt", "mid");
+    initGraph(["app|foo.txt"], {
+      "app": [[rewrite]]
+    });
+
+    updateSources(["app|foo.txt"]);
+    expectAsset("app|foo.mid", "foo.mid");
+    buildShouldSucceed();
+
+    updateTransformers("app", [
+      [rewrite],
+      [new RewriteTransformer("mid", "out")]
+    ]);
+    expectAsset("app|foo.out", "foo.mid.out");
+    buildShouldSucceed();
+
+    removeSources(["app|foo.txt"]);
+    expectNoAsset("app|foo.out");
+    buildShouldSucceed();
+
+    updateSources(["app|foo.txt"]);
+    expectAsset("app|foo.out", "foo.mid.out");
+    buildShouldSucceed();
+  });
 }
\ No newline at end of file
diff --git a/pkg/custom_element/lib/custom_element.dart b/pkg/custom_element/lib/custom_element.dart
index 202a0ee..2a13fda 100644
--- a/pkg/custom_element/lib/custom_element.dart
+++ b/pkg/custom_element/lib/custom_element.dart
@@ -197,6 +197,29 @@
   BindingDelegate get bindingDelegate => host.bindingDelegate;
   set bindingDelegate(BindingDelegate value) { host.bindingDelegate = value; }
 
+  // TODO(efortuna): Update these when we decide what to do with these
+  // properties.
+  @deprecated
+  String getAttribute(String name) =>
+      host.getAttribute(name);
+
+  @deprecated
+  String getAttributeNS(String namespaceUri, String localName) =>
+      host.getAttributeNS(namespaceUri, localName);
+
+  @deprecated
+  String setAttributeNS(
+      String namespaceUri, String localName, String value) {
+    host.setAttributeNS(namespaceUri, localName, value);
+  }
+
+  @deprecated
+  void setAttribute(String name, String value) =>
+      host.setAttribute(name, value);
+
+  @deprecated
+  List<Node> get childNodes => host.childNodes;
+
   // TODO(jmesserly): this forwarding is temporary until Dart supports
   // subclassing Elements.
   // TODO(jmesserly): we were missing the setter for title, are other things
diff --git a/pkg/intl/lib/bidi_formatter.dart b/pkg/intl/lib/bidi_formatter.dart
index a9655f9..6ae3982 100644
--- a/pkg/intl/lib/bidi_formatter.dart
+++ b/pkg/intl/lib/bidi_formatter.dart
@@ -86,18 +86,8 @@
    * included verbatim in HTML source code, either in an element body or in an
    * attribute value.
    */
-  String htmlEscape(String text) {
-    // TODO(alanknight): This is copied into here directly to avoid having a
-    // dependency on the htmlescape library, which is difficult to do in a way
-    // that's compatible with both package: links and direct links in the SDK.
-    // Once pub is used in test.dart (Issue #4968) this should be removed.
-    // TODO(efortuna): A more efficient implementation.
-    return text.replaceAll("&", "&amp;")
-        .replaceAll("<", "&lt;")
-        .replaceAll(">", "&gt;")
-        .replaceAll('"', "&quot;")
-        .replaceAll("'", "&apos;");
-  }
+  @deprecated
+  String htmlEscape(String text) => HTML_ESCAPE.convert(text);
 
   /**
    * Formats a string of a given (or estimated, if not provided)
@@ -119,7 +109,7 @@
                       TextDirection direction}) {
     if (direction == null) direction = estimateDirection(text, isHtml: isHtml);
     var result;
-    if (!isHtml) text = htmlEscape(text);
+    if (!isHtml) text = HTML_ESCAPE.convert(text);
     var directionChange = contextDirection.isDirectionChange(direction);
     if (_alwaysSpan || directionChange) {
       var spanDirection = '';
diff --git a/pkg/intl/lib/intl.dart b/pkg/intl/lib/intl.dart
index 4f17a82..0632aed 100644
--- a/pkg/intl/lib/intl.dart
+++ b/pkg/intl/lib/intl.dart
@@ -32,6 +32,8 @@
 library intl;
 
 import 'dart:collection';
+import 'dart:convert';
+import 'package:meta/meta.dart';
 import 'src/intl_helpers.dart';
 import 'dart:math';
 import 'date_symbols.dart';
diff --git a/pkg/intl/lib/src/date_format_field.dart b/pkg/intl/lib/src/date_format_field.dart
index 08afc04..fb8274c 100644
--- a/pkg/intl/lib/src/date_format_field.dart
+++ b/pkg/intl/lib/src/date_format_field.dart
@@ -345,7 +345,7 @@
   }
 
   String formatQuarter(DateTime date) {
-    var quarter = (date.month / 3).truncate();
+    var quarter = ((date.month - 1) / 3).truncate();
     if (width < 4) {
       return symbols.SHORTQUARTERS[quarter];
     } else {
diff --git a/pkg/intl/lib/src/intl_message.dart b/pkg/intl/lib/src/intl_message.dart
index ad88395..0eb67b1 100644
--- a/pkg/intl/lib/src/intl_message.dart
+++ b/pkg/intl/lib/src/intl_message.dart
@@ -233,14 +233,22 @@
 
 /**
  * Represents an interpolation of a variable value in a message. We expect
- * this to be specified as an [index] into the list of variables, and we will
- * compute the variable name for the interpolation based on that.
+ * this to be specified as an [index] into the list of variables, or else
+ * as the name of a variable that exists in [arguments] and we will
+ * compute the variable name or the index based on the value of the other.
  */
 class VariableSubstitution extends Message {
-  VariableSubstitution(this.index, Message parent) : super(parent);
+  VariableSubstitution(this._index, Message parent) : super(parent);
+  VariableSubstitution.named(this._variableName, Message parent)
+      : super(parent);
 
   /** The index in the list of parameters of the containing function. */
-  int index;
+  int _index;
+  int get index {
+    if (_index != null) return _index;
+    if (arguments.isEmpty) return null;
+    return _index = arguments.indexOf(_variableName);
+  }
 
   /**
    * The name of the variable in the parameter list of the containing function.
diff --git a/pkg/intl/pubspec.yaml b/pkg/intl/pubspec.yaml
index 8c4bc92..a1bd29e 100644
--- a/pkg/intl/pubspec.yaml
+++ b/pkg/intl/pubspec.yaml
@@ -5,6 +5,7 @@
 documentation: http://api.dartlang.org/docs/pkg/intl
 dependencies:
   analyzer_experimental: any
+  meta: any
   path: any
 dev_dependencies:
   serialization: any
diff --git a/pkg/intl/test/date_time_format_test_core.dart b/pkg/intl/test/date_time_format_test_core.dart
index d4a03c1..b39372d 100644
--- a/pkg/intl/test/date_time_format_test_core.dart
+++ b/pkg/intl/test/date_time_format_test_core.dart
@@ -355,4 +355,18 @@
     var symbols = emptyFormat.dateSymbols;
     expect(symbols.NARROWWEEKDAYS, ['S', 'M', 'T', 'W', 'T', 'F', 'S']);
   });
-}
+
+  test('Quarter calculation', () {
+    var quarters = ['Q1', 'Q1', 'Q1',
+                    'Q2', 'Q2', 'Q2',
+                    'Q3', 'Q3', 'Q3',
+                    'Q4', 'Q4', 'Q4'];
+    var quarterFormat = new DateFormat.QQQ();
+    for (int i = 0; i < 12; i++) {
+        var month = i + 1;
+        var aDate = new DateTime(2012, month, 27, 13, 58, 59, 012);
+        var formatted = quarterFormat.format(aDate);
+        expect(formatted, quarters[i]);
+    }
+  });
+}
\ No newline at end of file
diff --git a/pkg/pkg.status b/pkg/pkg.status
index af24990..6460d2e 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -22,11 +22,6 @@
 third_party/html5lib/test/dom_compat_test: Skip
 third_party/html5lib/test/browser/browser_test: Skip
 
-polymer_expressions/test/syntax_test: Skip # Issue 12954
-
-[ $compiler == dart2js && $runtime == d8 ]
-unmodifiable_collection/test/unmodifiable_collection_test: Pass, Fail # Issue 12429
-
 [ $compiler == dart2js ]
 analyzer_experimental/test/generated/ast_test: Fail #Issue 12341
 
diff --git a/pkg/polymer/lib/deploy.dart b/pkg/polymer/lib/deploy.dart
index 73051c4..4c5b564 100644
--- a/pkg/polymer/lib/deploy.dart
+++ b/pkg/polymer/lib/deploy.dart
@@ -4,13 +4,18 @@
 
 /**
  * Temporary deploy command used to create a version of the app that can be
- * compiled with dart2js and deployed. This library should go away once `pub
- * deploy` can be configured to run barback transformers.
+ * compiled with dart2js and deployed. Following pub layout conventions, this
+ * script will treat any HTML file under a package 'web/' and 'test/'
+ * directories as entry points.
  *
- * From an application package you can run this program by calling dart with a
- * 'package:' url to this file:
+ * From an application package you can run deploy by creating a small program
+ * as follows:
  *
- *    dart package:polymer/deploy.dart
+ *    import "package:polymer/deploy.dart" as deploy;
+ *    main() => deploy.main();
+ *
+ * This library should go away once `pub deploy` can be configured to run
+ * barback transformers.
  */
 library polymer.deploy;
 
@@ -28,12 +33,47 @@
 main() {
   var args = _parseArgs(new Options().arguments);
   if (args == null) return;
+
+  var test = args['test'];
+  if (test != null) {
+    _initForTest(test);
+  }
+
   print('polymer/deploy.dart: creating a deploy target for "$_currentPackage"');
   var outDir = args['out'];
-  _run(args['webdir'], outDir).then(
+  _run(outDir, test != null).then(
       (_) => print('Done! All files written to "$outDir"'));
 }
 
+// TODO(jmesserly): the current deploy/barback architecture is very unfriendly
+// to deploying a single test. We need to fix it somehow but it isn't clear yet.
+void _initForTest(String testFile) {
+  var testDir = path.normalize(path.dirname(testFile));
+
+  // A test must be allowed to import things in the package.
+  // So we must find its package root, given the entry point. We can do this
+  // by walking up to find pubspec.yaml.
+  var pubspecDir = _findDirWithFile(path.absolute(testDir), 'pubspec.yaml');
+  if (pubspecDir == null) {
+    print('error: pubspec.yaml file not found, please run this script from '
+        'your package root directory or a subdirectory.');
+    exit(1);
+  }
+
+  _currentPackage = '_test';
+  _packageDirs = {'_test' : pubspecDir};
+}
+
+String _findDirWithFile(String dir, String filename) {
+  while (!new File(path.join(dir, filename)).existsSync()) {
+    var parentDir = path.dirname(dir);
+    // If we reached root and failed to find it, bail.
+    if (parentDir == dir) return null;
+    dir = parentDir;
+  }
+  return dir;
+}
+
 /**
  * API exposed for testing purposes. Runs this deploy command but prentend that
  * the sources under [webDir] belong to package 'test'.
@@ -43,46 +83,49 @@
 
   // associate package dirs with their location in the repo:
   _packageDirs = {'test' : '.'};
-  addPackages(String dir) {
-    for (var packageDir in new Directory(dir).listSync().map((d) => d.path)) {
-      _packageDirs[path.basename(packageDir)] = packageDir;
-    }
-  }
-  addPackages('..');
-  addPackages('../third_party');
-  addPackages('../../third_party/pkg');
+  _addPackages('..');
+  _addPackages('../third_party');
+  _addPackages('../../third_party/pkg');
   return _run(webDir, outDir);
 }
 
-Future _run(String webDir, String outDir) {
+_addPackages(String dir) {
+  for (var packageDir in new Directory(dir).listSync().map((d) => d.path)) {
+    _packageDirs[path.basename(packageDir)] = packageDir;
+  }
+}
+
+Future _run(String outDir, bool includeTests) {
   var barback = new Barback(new _PolymerDeployProvider());
-  _initializeBarback(barback, webDir);
+  _initializeBarback(barback, includeTests);
   _attachListeners(barback);
-  return _emitAllFiles(barback, webDir, outDir);
+  return _emitAllFiles(barback, 'web', outDir).then(
+      (_) => includeTests ? _emitAllFiles(barback, 'test', outDir) : null);
 }
 
 /** Tell barback which transformers to use and which assets to process. */
-void _initializeBarback(Barback barback, String webDir) {
+void _initializeBarback(Barback barback, bool includeTests) {
   var assets = [];
+  void addAssets(String package, String subDir) {
+    for (var filepath in _listDir(package, subDir)) {
+      assets.add(new AssetId(package, filepath));
+    }
+  }
+
   for (var package in _packageDirs.keys) {
     // Do not process packages like 'polymer' where there is nothing to do.
     if (_ignoredPackages.contains(package)) continue;
     barback.updateTransformers(package, phases);
 
     // notify barback to process anything under 'lib' and 'asset'
-    for (var filepath in _listDir(package, 'lib')) {
-      assets.add(new AssetId(package, filepath));
-    }
-
-    for (var filepath in _listDir(package, 'asset')) {
-      assets.add(new AssetId(package, filepath));
-    }
+    addAssets(package, 'lib');
+    addAssets(package, 'asset');
   }
 
   // In case of the current package, include also 'web'.
-  for (var filepath in _listDir(_currentPackage, webDir)) {
-    assets.add(new AssetId(_currentPackage, filepath));
-  }
+  addAssets(_currentPackage, 'web');
+  if (includeTests) addAssets(_currentPackage, 'test');
+
   barback.updateSources(assets);
 }
 
@@ -230,12 +273,13 @@
 
 ArgResults _parseArgs(arguments) {
   var parser = new ArgParser()
-      ..addFlag('help', abbr: 'h', help: 'Displays this help message',
+      ..addFlag('help', abbr: 'h', help: 'Displays this help message.',
           defaultsTo: false, negatable: false)
-      ..addOption('webdir', help: 'Directory containing the application',
-          defaultsTo: 'web')
-      ..addOption('out', abbr: 'o', help: 'Directory where to generated files',
-          defaultsTo: 'out');
+      ..addOption('out', abbr: 'o', help: 'Directory where to generated files.',
+          defaultsTo: 'out')
+      ..addOption('test', help: 'Deploy the test at the given path.\n'
+          'Note: currently this will deploy all tests in its directory,\n'
+          'but it will eventually deploy only the specified test.');
   try {
     var results = parser.parse(arguments);
     if (results['help']) {
diff --git a/pkg/polymer/lib/src/linter.dart b/pkg/polymer/lib/src/linter.dart
new file mode 100644
index 0000000..f443603
--- /dev/null
+++ b/pkg/polymer/lib/src/linter.dart
@@ -0,0 +1,417 @@
+// Copyright (c) 2013, 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.
+
+/**
+ * Logic to validate that developers are correctly using Polymer constructs.
+ * This is mainly used to produce warnings for feedback in the editor.
+ */
+library polymer.src.linter;
+
+import 'dart:async';
+import 'dart:mirrors';
+import 'dart:convert' show JSON;
+
+import 'package:barback/barback.dart';
+import 'package:html5lib/dom.dart';
+import 'package:html5lib/dom_parsing.dart';
+
+import 'transform/common.dart';
+
+typedef String MessageFormatter(String kind, String message, Span span);
+
+/**
+ * A linter that checks for common Polymer errors and produces warnings to
+ * show on the editor or the command line. Leaves sources unchanged, but creates
+ * a new asset containing all the warnings.
+ */
+class Linter extends Transformer {
+  /** Only run on .html files. */
+  final String allowedExtensions = '.html';
+
+  final MessageFormatter _formatter;
+
+  Linter([this._formatter]);
+
+  Future apply(Transform transform) {
+    var wrapper = new _LoggerInterceptor(transform, _formatter);
+    var seen = new Set<AssetId>();
+    var primary = transform.primaryInput;
+    var id = primary.id;
+    wrapper.addOutput(primary); // this phase is analysis only
+    seen.add(id);
+    return readPrimaryAsHtml(wrapper).then((document) {
+      return _collectElements(document, id, wrapper, seen).then((elements) {
+        new _LinterVisitor(wrapper, elements).visit(document);
+        var messagesId = id.addExtension('.messages');
+        wrapper.addOutput(new Asset.fromString(messagesId,
+            wrapper._messages.join('\n')));
+      });
+    });
+  }
+
+  /**
+   * Collect into [elements] any data about each polymer-element defined in
+   * [document] or any of it's imports, unless they have already been [seen].
+   * Elements are added in the order they appear, transitive imports are added
+   * first.
+   */
+  Future<Map<String, _ElementSummary>> _collectElements(
+      Document document, AssetId sourceId, Transform transform,
+      Set<AssetId> seen, [Map<String, _ElementSummary> elements]) {
+    if (elements == null) elements = <String, _ElementSummary>{};
+    var logger = transform.logger;
+    // Note: the import order is relevant, so we visit in that order.
+    return Future.forEach(_getImportedIds(document, sourceId, logger), (id) {
+      if (seen.contains(id)) return new Future.value(null);
+      seen.add(id);
+      return readAsHtml(id, transform)
+        .then((doc) => _collectElements(doc, id, transform, seen, elements));
+    }).then((_) {
+      _addElements(document, logger, elements);
+      return elements;
+    });
+  }
+
+  List<AssetId> _getImportedIds(
+      Document document, AssetId sourceId, TranformLogger logger) {
+    var importIds = [];
+    for (var tag in document.queryAll('link')) {
+      if (tag.attributes['rel'] != 'import') continue;
+      var href = tag.attributes['href'];
+      var id = resolve(sourceId, href, logger, tag.sourceSpan);
+      if (id == null) continue;
+      importIds.add(id);
+    }
+    return importIds;
+  }
+
+  void _addElements(Document document, TransformLogger logger,
+      Map<String, _ElementSummary> elements) {
+    for (var tag in document.queryAll('polymer-element')) {
+      var name = tag.attributes['name'];
+      if (name == null) continue;
+      var extendsTag = tag.attributes['extends'];
+      var span = tag.sourceSpan;
+      var existing = elements[name];
+      if (existing != null) {
+
+        // Report warning only once.
+        if (existing.hasConflict) continue;
+        existing.hasConflict = true;
+        logger.warning('duplicate definition for custom tag "$name".',
+          existing.span);
+        logger.warning('duplicate definition for custom tag "$name" '
+          ' (second definition).', span);
+        continue;
+      }
+
+      elements[name] = new _ElementSummary(name, extendsTag, tag.sourceSpan);
+    }
+  }
+}
+
+/** A proxy of [Transform] that returns a different logger. */
+// TODO(sigmund): get rid of this when barback supports a better way to log
+// messages without printing them.
+class _LoggerInterceptor implements Transform, TransformLogger {
+  final Transform _original;
+  final List<String> _messages = [];
+  final MessageFormatter _formatter;
+
+  _LoggerInterceptor(this._original, MessageFormatter formatter)
+      : _formatter = formatter == null ? _defaultFormatter : formatter;
+
+  TransformLogger get logger => this;
+
+  noSuchMethod(Invocation m) => reflect(_original).delegate(m);
+
+  // form TransformLogger:
+  void warning(String message, [Span span]) => _write('warning', message, span);
+
+  void error(String message, [Span span]) => _write('error', message, span);
+
+  void _write(String kind, String message, Span span) {
+    _messages.add(_formatter(kind, message, span));
+  }
+}
+
+/**
+ * Default formatter that generates messages using a format that can be parsed
+ * by tools, such as the Dart Editor, for reporting error messages.
+ */
+String _defaultFormatter(String kind, String message, Span span) {
+  return JSON.encode((span == null)
+      ? [{'method': 'warning', 'params': {'message': message}}]
+      : [{'method': kind,
+          'params': {
+            'file': span.sourceUrl,
+            'message': message,
+            'line': span.start.line + 1,
+            'charStart': span.start.offset,
+            'charEnd': span.end.offset,
+          }}]);
+}
+
+
+/**
+ * Information needed about other polymer-element tags in order to validate
+ * how they are used and extended.
+ */
+class _ElementSummary {
+  final String tagName;
+  final String extendsTag;
+  final Span span;
+
+  _ElementSummary extendsType;
+  bool hasConflict = false;
+
+  String get baseExtendsTag => extendsType == null
+      ? extendsTag : extendsType.baseExtendsTag;
+
+  _ElementSummary(this.tagName, this.extendsTag, this.span);
+
+  String toString() => "($tagName <: $extendsTag)";
+}
+
+class _LinterVisitor extends TreeVisitor {
+  TransformLogger _logger;
+  bool _inPolymerElement = false;
+  Map<String, _ElementSummary> _elements;
+
+  _LinterVisitor(this._logger, this._elements) {
+    // We normalize the map, so each element has a direct reference to any
+    // element it extends from.
+    for (var tag in _elements.values) {
+      var extendsTag = tag.extendsTag;
+      if (extendsTag == null) continue;
+      tag.extendsType = _elements[extendsTag];
+    }
+  }
+
+  void visitElement(Element node) {
+    switch (node.tagName) {
+      case 'link': _validateLinkElement(node); break;
+      case 'element': _validateElementElement(node); break;
+      case 'polymer-element': _validatePolymerElement(node); break;
+      case 'script': _validateScriptElement(node); break;
+      default:
+         _validateNormalElement(node);
+         super.visitElement(node);
+         break;
+    }
+  }
+
+  /** Produce warnings for invalid link-rel tags. */
+  void _validateLinkElement(Element node) {
+    var rel = node.attributes['rel'];
+    if (rel != 'import' && rel != 'stylesheet') return;
+
+    var href = node.attributes['href'];
+    if (href != null && href != '') return;
+
+    // TODO(sigmund): warn also if href can't be resolved.
+    _logger.warning('link rel="$rel" missing href.', node.sourceSpan);
+  }
+
+  /** Produce warnings if using `<element>` instead of `<polymer-element>`. */
+  void _validateElementElement(Element node) {
+    _logger.warning('<element> elements are not supported, use'
+        ' <polymer-element> instead', node.sourceSpan);
+  }
+
+  /**
+   * Produce warnings if using `<polymer-element>` in the wrong place or if the
+   * definition is not complete.
+   */
+  void _validatePolymerElement(Element node) {
+    if (_inPolymerElement) {
+      _logger.error('Nested polymer element definitions are not allowed.',
+          node.sourceSpan);
+      return;
+    }
+
+    var tagName = node.attributes['name'];
+    var extendsTag = node.attributes['extends'];
+
+    if (tagName == null) {
+      _logger.error('Missing tag name of the custom element. Please include an '
+          'attribute like \'name="your-tag-name"\'.',
+          node.sourceSpan);
+    } else if (!_isCustomTag(tagName)) {
+      _logger.error('Invalid name "$tagName". Custom element names must have '
+          'at least one dash and can\'t be any of the following names: '
+          '${_invalidTagNames.keys.join(", ")}.',
+          node.sourceSpan);
+    }
+
+    if (_elements[extendsTag] == null && _isCustomTag(extendsTag)) {
+      _logger.warning('custom element with name "$extendsTag" not found.',
+          node.sourceSpan);
+    }
+
+    var oldValue = _inPolymerElement;
+    _inPolymerElement = true;
+    super.visitElement(node);
+    _inPolymerElement = oldValue;
+  }
+
+  /**
+   * Produces warnings for malformed script tags. In html5 leaving off type= is
+   * fine, but it defaults to text/javascript. Because this might be a common
+   * error, we warn about it when  src file ends in .dart, but the type is
+   * incorrect, or when users write code in an inline script tag of a custom
+   * element.
+   *
+   * The hope is that these cases shouldn't break existing valid code, but that
+   * they'll help Polymer authors avoid having their Dart code accidentally
+   * interpreted as JavaScript by the browser.
+   */
+  void _validateScriptElement(Element node) {
+    var scriptType = node.attributes['type'];
+    var src = node.attributes['src'];
+
+    if (scriptType == null) {
+      if (src == null && _inPolymerElement) {
+        // TODO(sigmund): revisit this check once we start interop with polymer
+        // elements written in JS. Maybe we need to inspect the contents of the
+        // script to find whether there is an import or something that indicates
+        // that the code is indeed using Dart.
+        _logger.warning('script tag in polymer element with no type will '
+            'be treated as JavaScript. Did you forget type="application/dart"?',
+            node.sourceSpan);
+      }
+      if (src != null && src.endsWith('.dart')) {
+        _logger.warning('script tag with .dart source file but no type will '
+            'be treated as JavaScript. Did you forget type="application/dart"?',
+            node.sourceSpan);
+      }
+      return;
+    }
+
+    if (scriptType != 'application/dart') return;
+
+    if (src != null) {
+      if (!src.endsWith('.dart')) {
+        _logger.warning('"application/dart" scripts should '
+            'use the .dart file extension.',
+            node.sourceSpan);
+      }
+
+      if (node.innerHtml.trim() != '') {
+        _logger.warning('script tag has "src" attribute and also has script '
+            'text.', node.sourceSpan);
+      }
+    }
+  }
+
+  /**
+   * Produces warnings for misuses of on-foo event handlers, and for instanting
+   * custom tags incorrectly.
+   */
+  void _validateNormalElement(Element node) {
+    // Event handlers only allowed inside polymer-elements
+    node.attributes.forEach((name, value) {
+      if (name.startsWith('on')) {
+        _validateEventHandler(node, name, value);
+      }
+    });
+
+    // Validate uses of custom-tags
+    var nodeTag = node.tagName;
+    var hasIsAttribute;
+    var customTagName;
+    if (_isCustomTag(nodeTag)) {
+      // <fancy-button>
+      customTagName = nodeTag;
+      hasIsAttribute = false;
+    } else {
+      // <button is="fancy-button">
+      customTagName = node.attributes['is'];
+      hasIsAttribute = true;
+    }
+
+    if (customTagName == null || customTagName == 'polymer-element') return;
+
+    var info = _elements[customTagName];
+    if (info == null) {
+      _logger.warning('definition for custom element with tag name '
+          '"$customTagName" not found.', node.sourceSpan);
+      return;
+    } 
+
+    var baseTag = info.baseExtendsTag;
+    if (baseTag != null && !hasIsAttribute) {
+      _logger.warning(
+          'custom element "$customTagName" extends from "$baseTag", but '
+          'this tag will not include the default properties of "$baseTag". '
+          'To fix this, either write this tag as <$baseTag '
+          'is="$customTagName"> or remove the "extends" attribute from '
+          'the custom element declaration.', node.sourceSpan);
+      return;
+    }
+    
+    if (hasIsAttribute && baseTag == null) {
+      _logger.warning(
+          'custom element "$customTagName" doesn\'t declare any type '
+          'extensions. To fix this, either rewrite this tag as '
+          '<$customTagName> or add \'extends="$nodeTag"\' to '
+          'the custom element declaration.', node.sourceSpan);
+      return;
+    }
+    
+    if (hasIsAttribute && baseTag != nodeTag) {
+      _logger.warning(
+          'custom element "$customTagName" extends from "$baseTag". '
+          'Did you mean to write <$baseTag is="$customTagName">?',
+          node.sourceSpan);
+    }
+  }
+
+  /** Validate event handlers are used correctly. */
+  void _validateEventHandler(Element node, String name, String value) {
+    if (!name.startsWith('on-')) {
+      _logger.warning('Event handler "$name" will be interpreted as an inline'
+          ' JavaScript event handler. Use the form '
+          'on-event-name="handlerName" if you want a Dart handler '
+          'that will automatically update the UI based on model changes.',
+          node.sourceSpan);
+      return;
+    }
+
+    if (!_inPolymerElement) {
+      _logger.warning('Inline event handlers are only supported inside '
+          'declarations of <polymer-element>.', node.sourceSpan);
+    }
+
+    if (value.contains('.') || value.contains('(')) {
+      _logger.warning('Invalid event handler body "$value". Declare a method '
+          'in your custom element "void handlerName(event, detail, target)" '
+          'and use the form $name="handlerName".',
+          node.sourceSpan);
+    }
+  }
+}
+
+
+// These names have meaning in SVG or MathML, so they aren't allowed as custom
+// tags.
+var _invalidTagNames = const {
+  'annotation-xml': '',
+  'color-profile': '',
+  'font-face': '',
+  'font-face-src': '',
+  'font-face-uri': '',
+  'font-face-format': '',
+  'font-face-name': '',
+  'missing-glyph': '',
+};
+
+/**
+ * Returns true if this is a valid custom element name. See:
+ * <https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn-custom-element-name>
+ */
+bool _isCustomTag(String name) {
+  if (name == null || !name.contains('-')) return false;
+  return !_invalidTagNames.containsKey(name);
+}
diff --git a/pkg/polymer/lib/src/transform/code_extractor.dart b/pkg/polymer/lib/src/transform/code_extractor.dart
index 20fd73a..a46300e 100644
--- a/pkg/polymer/lib/src/transform/code_extractor.dart
+++ b/pkg/polymer/lib/src/transform/code_extractor.dart
@@ -24,11 +24,10 @@
   /** Only run this transformer on .html files. */
   final String allowedExtensions = ".html";
 
-
   Future apply(Transform transform) {
-    var inputId = transform.primaryInput.id;
-    return transform.primaryInput.readAsString().then((content) {
-      var document = parseHtml(content, inputId.path, transform.logger);
+    var input = transform.primaryInput;
+    var id = transform.primaryInput.id;
+    return readPrimaryAsHtml(transform).then((document) {
       int count = 0;
       bool htmlChanged = false;
       for (var tag in document.queryAll('script')) {
@@ -45,23 +44,23 @@
           continue;
         }
 
-        var filename = path.url.basename(inputId.path);
+        var filename = path.url.basename(id.path);
         // TODO(sigmund): ensure this filename is unique (dartbug.com/12618).
         tag.attributes['src'] = '$filename.$count.dart';
         var textContent = tag.nodes.first;
         var code = textContent.value;
-        var id = inputId.addExtension('.$count.dart');
+        var newId = id.addExtension('.$count.dart');
         if (!_hasLibraryDirective(code)) {
-          var libname = path.withoutExtension(id.path)
+          var libname = path.withoutExtension(newId.path)
               .replaceAll(new RegExp('[-./]'), '_');
           code = "library $libname;\n$code";
         }
-        transform.addOutput(new Asset.fromString(id, code));
+        transform.addOutput(new Asset.fromString(newId, code));
         textContent.remove();
         count++;
       }
-      transform.addOutput(new Asset.fromString(inputId,
-          htmlChanged ? document.outerHtml : content));
+      transform.addOutput(
+          htmlChanged ? new Asset.fromString(id, document.outerHtml) : input);
     });
   }
 }
diff --git a/pkg/polymer/lib/src/transform/common.dart b/pkg/polymer/lib/src/transform/common.dart
index f20d836..e18a053 100644
--- a/pkg/polymer/lib/src/transform/common.dart
+++ b/pkg/polymer/lib/src/transform/common.dart
@@ -17,7 +17,7 @@
  * Parses an HTML file [contents] and returns a DOM-like tree. Adds emitted
  * error/warning to [logger].
  */
-Document parseHtml(String contents, String sourcePath, TransformLogger logger,
+Document _parseHtml(String contents, String sourcePath, TransformLogger logger,
     {bool checkDocType: true}) {
   // TODO(jmesserly): make HTTP encoding configurable
   var parser = new HtmlParser(contents, encoding: 'utf8', generateSpans: true,
@@ -34,6 +34,25 @@
   return document;
 }
 
+Future<Document> readPrimaryAsHtml(Transform transform) {
+  var asset = transform.primaryInput;
+  var id = asset.id;
+  return asset.readAsString().then((content) {
+    return _parseHtml(content, id.path, transform.logger,
+      checkDocType: isPrimaryHtml(id));
+  });
+}
+
+Future<Document> readAsHtml(AssetId id, Transform transform) {
+  var primaryId = transform.primaryInput.id;
+  var url = (id.package == primaryId.package) ? id.path
+      : assetUrlFor(id, primaryId, transform.logger, allowAssetUrl: true);
+  return transform.readInputAsString(id).then((content) {
+    return _parseHtml(content, url, transform.logger,
+      checkDocType: isPrimaryHtml(id));
+  });
+}
+
 /** Create an [AssetId] for a [url] seen in the [source] asset. */
 // TODO(sigmund): delete once this is part of barback (dartbug.com/12610)
 AssetId resolve(AssetId source, String url, TransformLogger logger, Span span) {
@@ -72,3 +91,40 @@
   }
   return new AssetId(package, targetPath);
 }
+
+/** Whether an asset with [id] is considered a primary entry point HTML file. */
+bool isPrimaryHtml(AssetId id) => id.extension == '.html' &&
+    // Note: [id.path] is a relative path from the root of a package.
+    (id.path.startsWith('web/') || id.path.startsWith('test/'));
+
+/**
+ * Generate the import url for a file described by [id], referenced by a file
+ * with [sourceId].
+ */
+// TODO(sigmund): this should also be in barback (dartbug.com/12610)
+String assetUrlFor(AssetId id, AssetId sourceId, TransformLogger logger,
+    {bool allowAssetUrl: false}) {
+  // use package: and asset: urls if possible
+  if (id.path.startsWith('lib/')) {
+    return 'package:${id.package}/${id.path.substring(4)}';
+  }
+
+  if (id.path.startsWith('asset/')) {
+    if (!allowAssetUrl) {
+      logger.error("asset urls not allowed. "
+          "Don't know how to refer to $id from $sourceId");
+      return null;
+    }
+    return 'asset:${id.package}/${id.path.substring(6)}';
+  }
+
+  // Use relative urls only if it's possible.
+  if (id.package != sourceId.package) {
+    logger.error("don't know how to refer to $id from $sourceId");
+    return null;
+  }
+
+  var builder = path.url;
+  return builder.relative(builder.join('/', id.path),
+      from: builder.join('/', builder.dirname(sourceId.path)));
+}
diff --git a/pkg/polymer/lib/src/transform/import_inliner.dart b/pkg/polymer/lib/src/transform/import_inliner.dart
index 1f8fbf2..889ce20 100644
--- a/pkg/polymer/lib/src/transform/import_inliner.dart
+++ b/pkg/polymer/lib/src/transform/import_inliner.dart
@@ -17,20 +17,20 @@
 // TODO(sigmund): make sure we match semantics of html-imports for tags other
 // than polymer-element (see dartbug.com/12613).
 class ImportedElementInliner extends Transformer {
-  /** Only run this transformer on .html files. */
-  final String allowedExtensions = ".html";
+  /** Only run on entry point .html files. */
+  Future<bool> isPrimary(Asset input) =>
+      new Future.value(isPrimaryHtml(input.id));
 
   Future apply(Transform transform) {
     var seen = new Set<AssetId>();
     var elements = [];
     var id = transform.primaryInput.id;
     seen.add(id);
-    return transform.primaryInput.readAsString().then((content) {
-      var document = parseHtml(content, id.path, transform.logger);
+    return readPrimaryAsHtml(transform).then((document) {
       var future = _visitImports(document, id, transform, seen, elements);
       return future.then((importsFound) {
         if (!importsFound) {
-          transform.addOutput(new Asset.fromString(id, content));
+          transform.addOutput(transform.primaryInput);
           return;
         }
 
@@ -82,9 +82,7 @@
    */
   Future _collectPolymerElements(AssetId id, Transform transform,
       Set<AssetId> seen, List elements) {
-    return transform.readInputAsString(id).then((content) {
-      var document = parseHtml(
-          content, id.path, transform.logger, checkDocType: false);
+    return readAsHtml(id, transform).then((document) {
       return _visitImports(document, id, transform, seen, elements).then((_) {
         var normalizer = new _UrlNormalizer(transform, id);
         for (var element in document.queryAll('polymer-element')) {
diff --git a/pkg/polymer/lib/src/transform/polyfill_injector.dart b/pkg/polymer/lib/src/transform/polyfill_injector.dart
index 899fdd8..6b95113 100644
--- a/pkg/polymer/lib/src/transform/polyfill_injector.dart
+++ b/pkg/polymer/lib/src/transform/polyfill_injector.dart
@@ -22,15 +22,15 @@
  * css shimming).
  */
 class PolyfillInjector extends Transformer {
-  /** Only run this transformer on .html files. */
-  final String allowedExtensions = ".html";
+  /** Only run on entry point .html files. */
+  Future<bool> isPrimary(Asset input) =>
+      new Future.value(isPrimaryHtml(input.id));
 
   Future apply(Transform transform) {
-    var id = transform.primaryInput.id;
-    return transform.primaryInput.readAsString().then((content) {
-      var document = parseHtml(content, id.path, transform.logger);
+    return readPrimaryAsHtml(transform).then((document) {
       bool shadowDomFound = false;
       bool jsInteropFound = false;
+      bool pkgJsInteropFound = false;
       bool dartScriptTags = false;
 
       for (var tag in document.queryAll('script')) {
@@ -39,6 +39,8 @@
           var last = src.split('/').last;
           if (last == 'interop.js') {
             jsInteropFound = true;
+          } else if (last == 'dart_interop.js') {
+            pkgJsInteropFound = true;
           } else if (_shadowDomJS.hasMatch(last)) {
             shadowDomFound = true;
           }
@@ -51,10 +53,16 @@
 
       if (!dartScriptTags) {
         // This HTML has no Dart code, there is nothing to do here.
-        transform.addOutput(new Asset.fromString(id, content));
+        transform.addOutput(transform.primaryInput);
         return;
       }
 
+      if (!pkgJsInteropFound) {
+        // JS interop code is required for Polymer CSS shimming.
+        document.body.nodes.insert(0, parseFragment(
+            '<script src="packages/js/dart_interop.js"></script>\n'));
+      }
+
       if (!jsInteropFound) {
         // JS interop code is required for Polymer CSS shimming.
         document.body.nodes.insert(0, parseFragment(
@@ -64,11 +72,13 @@
       if (!shadowDomFound) {
         // Insert at the beginning (this polyfill needs to run as early as
         // possible).
+        // TODO(jmesserly): this is .debug to workaround issue 13046.
         document.body.nodes.insert(0, parseFragment(
-            '<script src="packages/shadow_dom/shadow_dom.min.js"></script>\n'));
+            '<script src="packages/shadow_dom/shadow_dom.debug.js"></script>\n'));
       }
 
-      transform.addOutput(new Asset.fromString(id, document.outerHtml));
+      transform.addOutput(
+          new Asset.fromString(transform.primaryInput.id, document.outerHtml));
     });
   }
 }
diff --git a/pkg/polymer/lib/src/transform/script_compactor.dart b/pkg/polymer/lib/src/transform/script_compactor.dart
index 8a217e6..c247f2d 100644
--- a/pkg/polymer/lib/src/transform/script_compactor.dart
+++ b/pkg/polymer/lib/src/transform/script_compactor.dart
@@ -28,14 +28,14 @@
  * elements annotated with `@CustomTag`.
  */
 class ScriptCompactor extends Transformer {
-  /** Only run this transformer on .html files. */
-  final String allowedExtensions = ".html";
+  /** Only run on entry point .html files. */
+  Future<bool> isPrimary(Asset input) =>
+      new Future.value(isPrimaryHtml(input.id));
 
   Future apply(Transform transform) {
     var id = transform.primaryInput.id;
     var logger = transform.logger;
-    return transform.primaryInput.readAsString().then((content) {
-      var document = parseHtml(content, id.path, logger);
+    return readPrimaryAsHtml(transform).then((document) {
       var libraries = [];
       bool changed = false;
       var dartLoaderTag = null;
@@ -68,7 +68,7 @@
       }
 
       if (!changed) {
-        transform.addOutput(new Asset.fromString(id, content));
+        transform.addOutput(transform.primaryInput);
         return;
       }
 
@@ -87,7 +87,7 @@
         document.body.insertBefore(bootstrapScript, dartLoaderTag);
       }
 
-      var urls = libraries.map((id) => importUrlFor(id, bootstrapId, logger))
+      var urls = libraries.map((id) => assetUrlFor(id, bootstrapId, logger))
           .where((url) => url != null).toList();
       var buffer = new StringBuffer()..write(_header);
       for (int i = 0; i < urls.length; i++) {
@@ -101,27 +101,6 @@
       transform.addOutput(new Asset.fromString(id, document.outerHtml));
     });
   }
-
-  /**
-   * Generate the import url for a file described by [id], referenced by a file
-   * with [sourceId].
-   */
-  String importUrlFor(AssetId id, AssetId sourceId, TransformLogger logger) {
-    // use package: urls if possible
-    if (id.path.startsWith('lib/')) {
-      return 'package:${id.package}/${id.path.substring(4)}';
-    }
-
-    // Use relative urls only if it's possible.
-    if (id.package != sourceId.package) {
-      logger.error("don't know how to import $id from $sourceId");
-      return null;
-    }
-
-    var builder = path.url;
-    return builder.relative(builder.join('/', id.path),
-        from: builder.join('/', builder.dirname(sourceId.path)));
-  }
 }
 
 const _header = """
diff --git a/pkg/polymer/test/data/unit/event_path_test.html b/pkg/polymer/test/data/unit/web/event_path_test.html
similarity index 100%
rename from pkg/polymer/test/data/unit/event_path_test.html
rename to pkg/polymer/test/data/unit/web/event_path_test.html
diff --git a/pkg/polymer/test/data/unit/events_test.html b/pkg/polymer/test/data/unit/web/events_test.html
similarity index 100%
rename from pkg/polymer/test/data/unit/events_test.html
rename to pkg/polymer/test/data/unit/web/events_test.html
diff --git a/pkg/polymer/test/linter_test.dart b/pkg/polymer/test/linter_test.dart
new file mode 100644
index 0000000..1b4c348
--- /dev/null
+++ b/pkg/polymer/test/linter_test.dart
@@ -0,0 +1,421 @@
+// Copyright (c) 2013, 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 polymer.test.linter_test;
+
+import 'package:source_maps/span.dart';
+import 'package:polymer/src/linter.dart';
+import 'package:unittest/compact_vm_config.dart';
+import 'package:unittest/unittest.dart';
+
+import 'transform/common.dart';
+
+void main() {
+  useCompactVMConfiguration();
+  _testLinter('nothing to report', {
+      'a|web/test.html': '<!DOCTYPE html><html></html>',
+    }, {
+      'a|web/test.html.messages': '',
+    });
+
+  group('doctype warning', () {
+    _testLinter('in web', {
+        'a|web/test.html': '<html></html>',
+      }, {
+        'a|web/test.html.messages': 
+            'warning: Unexpected start tag (html). Expected DOCTYPE. '
+            '(web/test.html 0 0)',
+      });
+
+    _testLinter('in lib', {
+        'a|lib/test.html': '<html></html>',
+      }, {
+        'a|lib/test.html.messages': '',
+      });
+  });
+
+  group('duplicate polymer-elements,', () {
+    _testLinter('same file', {
+        'a|lib/test.html': '''<html>
+            <polymer-element name="x-a"></polymer-element>
+            <polymer-element name="x-a"></polymer-element>
+            </html>'''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages':
+            'warning: duplicate definition for custom tag "x-a". '
+            '(lib/test.html 1 0)\n'
+            'warning: duplicate definition for custom tag "x-a"  '
+            '(second definition). (lib/test.html 2 0)'
+      });
+
+    _testLinter('other file', {
+        'a|lib/b.html': '''<html>
+            <polymer-element name="x-a"></polymer-element>
+            </html>'''.replaceAll('            ', ''),
+        'a|lib/test.html': '''<html>
+            <link rel="import" href="b.html">
+            <polymer-element name="x-a"></polymer-element>
+            </html>'''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages':
+            'warning: duplicate definition for custom tag "x-a". '
+            '(lib/b.html 1 0)\n'
+            'warning: duplicate definition for custom tag "x-a"  '
+            '(second definition). (lib/test.html 2 0)'
+      });
+
+    _testLinter('other package', {
+        'b|lib/b.html': '''<html>
+            <polymer-element name="x-a"></polymer-element>
+            </html>'''.replaceAll('            ', ''),
+        'a|lib/test.html': '''<html>
+            <link rel="import" href="packages/b/b.html">
+            <polymer-element name="x-a"></polymer-element>
+            </html>'''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages':
+            'warning: duplicate definition for custom tag "x-a". '
+            '(package:b/b.html 1 0)\n'
+            'warning: duplicate definition for custom tag "x-a"  '
+            '(second definition). (lib/test.html 2 0)'
+      });
+  });
+
+  _testLinter('bad link-rel tag (href missing)', {
+      'a|lib/test.html': '''<html>
+          <link rel="import">
+          <link rel="stylesheet">
+          <link rel="foo">
+          <link rel="import" href="">
+          </html>'''.replaceAll('          ', ''),
+    }, {
+      'a|lib/test.html.messages':
+          'warning: link rel="import" missing href. (lib/test.html 1 0)\n'
+          'warning: link rel="stylesheet" missing href. (lib/test.html 2 0)\n'
+          'warning: link rel="import" missing href. (lib/test.html 4 0)'
+    });
+
+  _testLinter('<element> is not supported', {
+      'a|lib/test.html': '''<html>
+          <element name="x-a"></element>
+          </html>'''.replaceAll('          ', ''),
+    }, {
+      'a|lib/test.html.messages':
+          'warning: <element> elements are not supported, use <polymer-element>'
+          ' instead (lib/test.html 1 0)'
+    });
+
+  _testLinter('do not nest <polymer-element>', {
+      'a|lib/test.html': '''<html>
+          <polymer-element name="x-a">
+            <template><div>
+              <polymer-element name="b"></polymer-element>
+            </div></template>
+          </polymer-element>
+          </html>'''.replaceAll('          ', ''),
+    }, {
+      'a|lib/test.html.messages':
+          'error: Nested polymer element definitions are not allowed.'
+          ' (lib/test.html 3 4)'
+    });
+
+  _testLinter('need a name for <polymer-element>', {
+      'a|lib/test.html': '''<html>
+          <polymer-element></polymer-element>
+          </html>'''.replaceAll('          ', ''),
+    }, {
+      'a|lib/test.html.messages':
+          'error: Missing tag name of the custom element. Please include an '
+          'attribute like \'name="your-tag-name"\'. (lib/test.html 1 0)'
+    });
+
+  _testLinter('name for <polymer-element> should have dashes', {
+      'a|lib/test.html': '''<html>
+          <polymer-element name="a"></polymer-element>
+          </html>'''.replaceAll('          ', ''),
+    }, {
+      'a|lib/test.html.messages':
+          'error: Invalid name "a". Custom element names must have at least one'
+          ' dash and can\'t be any of the following names: annotation-xml, '
+          'color-profile, font-face, font-face-src, font-face-uri, '
+          'font-face-format, font-face-name, missing-glyph. (lib/test.html 1 0)'
+    });
+
+  _testLinter('extend is a valid element or existing tag', {
+      'a|lib/test.html': '''<html>
+          <polymer-element name="x-a" extends="li"></polymer-element>
+          </html>'''.replaceAll('          ', ''),
+    }, {
+      'a|lib/test.html.messages': ''
+    });
+
+  _testLinter('extend is a valid element or existing tag', {
+      'a|lib/test.html': '''<html>
+          <polymer-element name="x-a" extends="x-b"></polymer-element>
+          </html>'''.replaceAll('          ', ''),
+    }, {
+      'a|lib/test.html.messages': ''
+          'warning: custom element with name "x-b" not found. '
+          '(lib/test.html 1 0)'
+    });
+
+
+  group('script type matches code', () {
+    _testLinter('top-level, .dart url', {
+        'a|lib/test.html': '''<html>
+            <script src="foo.dart"></script>
+            </html>'''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages':
+            'warning: script tag with .dart source file but no type will be '
+            'treated as JavaScript. Did you forget type="application/dart"?'
+            ' (lib/test.html 1 0)'
+      });
+
+    _testLinter('in polymer-element, .dart url', {
+        'a|lib/test.html': '''<html>
+            <polymer-element name="x-a">
+            <script src="foo.dart"></script>
+            </polymer-element>
+            </html>'''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages':
+            'warning: script tag with .dart source file but no type will be '
+            'treated as JavaScript. Did you forget type="application/dart"?'
+            ' (lib/test.html 2 0)'
+      });
+
+    _testLinter('in polymer-element, .js url', {
+        'a|lib/test.html': '''<html>
+            <polymer-element name="x-a">
+            <script src="foo.js"></script>
+            </polymer-element>
+            </html>'''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages': ''
+      });
+
+    _testLinter('in polymer-element, inlined', {
+        'a|lib/test.html': '''<html>
+            <polymer-element name="x-a">
+            <script>foo...</script>
+            </polymer-element>
+            </html>'''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages':
+            'warning: script tag in polymer element with no type will '
+            'be treated as JavaScript. Did you forget type="application/dart"?'
+            ' (lib/test.html 2 0)'
+      });
+
+    _testLinter('top-level, dart type & .dart url', {
+        'a|lib/test.html': '''<html>
+            <script type="applicatino/dart" src="foo.dart"></script>
+            </html>'''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages': ''
+      });
+
+    _testLinter('top-level, dart type & .js url', {
+        'a|lib/test.html': '''<html>
+            <script type="application/dart" src="foo.js"></script>
+            </html>'''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages':
+            'warning: "application/dart" scripts should use the .dart file '
+            'extension. (lib/test.html 1 0)'
+      });
+  });
+
+  _testLinter('script tags should have only src url or inline code', {
+      'a|lib/test.html': '''<html>
+          <script type="application/dart" src="foo.dart">more</script>
+          </html>'''.replaceAll('          ', ''),
+    }, {
+      'a|lib/test.html.messages':
+          'warning: script tag has "src" attribute and also has script text. '
+          '(lib/test.html 1 0)'
+    });
+
+  group('event handlers', () {
+    _testLinter('onfoo is not polymer', {
+        'a|lib/test.html': '''<html><body>
+            <div onfoo="something"></div>
+            '''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages':
+            'warning: Event handler "onfoo" will be interpreted as an inline '
+            'JavaScript event handler. Use the form '
+            'on-event-name="handlerName" if you want a Dart handler '
+            'that will automatically update the UI based on model changes. '
+            '(lib/test.html 1 0)'
+      });
+
+    _testLinter('on-foo is only supported in polymer elements', {
+        'a|lib/test.html': '''<html><body>
+            <div on-foo="something"></div>
+            '''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages':
+            'warning: Inline event handlers are only supported inside '
+            'declarations of <polymer-element>. '
+            '(lib/test.html 1 0)'
+      });
+
+    _testLinter('on-foo is not an expression', {
+        'a|lib/test.html': '''<html><body>
+            <polymer-element name="x-a"><div on-foo="bar()"></div>
+            </polymer-element>
+            '''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages':
+            'warning: Invalid event handler body "bar()". Declare a method '
+            'in your custom element "void handlerName(event, detail, target)" '
+            'and use the form on-foo="handlerName". '
+            '(lib/test.html 1 28)'
+      });
+  });
+
+  group('using custom tags', () {
+    _testLinter('tag exists (x-tag)', {
+        'a|lib/test.html': '<x-foo></x-foo>',
+      }, {
+        'a|lib/test.html.messages':
+            'warning: definition for custom element with tag name "x-foo" not '
+            'found. (lib/test.html 0 0)'
+      });
+
+    _testLinter('tag exists (type extension)', {
+        'a|lib/test.html': '<div is="x-foo"></div>',
+      }, {
+        'a|lib/test.html.messages':
+            'warning: definition for custom element with tag name "x-foo" not '
+            'found. (lib/test.html 0 0)'
+      });
+
+    _testLinter('used correctly (no base tag)', {
+        'a|lib/test.html': '''
+            <polymer-element name="x-a"></polymer-element>
+            <x-a></x-a>
+            '''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages': ''
+      });
+
+    _testLinter('used incorrectly (no base tag)', {
+        'a|lib/test.html': '''
+            <polymer-element name="x-a"></polymer-element>
+            <div is="x-a"></div>
+            '''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages':
+            'warning: custom element "x-a" doesn\'t declare any type '
+            'extensions. To fix this, either rewrite this tag as '
+            '<x-a> or add \'extends="div"\' to '
+            'the custom element declaration. (lib/test.html 1 0)'
+      });
+
+    _testLinter('used incorrectly, imported def (no base tag)', {
+        'a|lib/b.html': '<polymer-element name="x-a"></polymer-element>',
+        'a|lib/test.html': '''
+            <link rel="import" href="b.html">
+            <div is="x-a"></div>
+            '''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages':
+            'warning: custom element "x-a" doesn\'t declare any type '
+            'extensions. To fix this, either rewrite this tag as '
+            '<x-a> or add \'extends="div"\' to '
+            'the custom element declaration. (lib/test.html 1 0)'
+      });
+
+    _testLinter('used correctly (base tag)', {
+        'a|lib/b.html': '''
+            <polymer-element name="x-a" extends="div">
+            </polymer-element>
+            '''.replaceAll('            ', ''),
+        'a|lib/test.html': '''
+            <link rel="import" href="b.html">
+            <div is="x-a"></div>
+            '''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages': ''
+      });
+
+    _testLinter('used incorrectly (missing base tag)', {
+        'a|lib/b.html': '''
+            <polymer-element name="x-a" extends="div">
+            </polymer-element>
+            '''.replaceAll('            ', ''),
+        'a|lib/test.html': '''
+            <link rel="import" href="b.html">
+            <x-a></x-a>
+            '''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages': ''
+            'warning: custom element "x-a" extends from "div", but this tag '
+            'will not include the default properties of "div". To fix this, '
+            'either write this tag as <div is="x-a"> or remove the "extends" '
+            'attribute from the custom element declaration. (lib/test.html 1 0)'
+      });
+
+    _testLinter('used incorrectly (wrong base tag)', {
+        'a|lib/b.html': '''
+            <polymer-element name="x-a" extends="div">
+            </polymer-element>
+            '''.replaceAll('            ', ''),
+        'a|lib/test.html': '''
+            <link rel="import" href="b.html">
+            <span is="x-a"></span>
+            '''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages': ''
+            'warning: custom element "x-a" extends from "div". Did you mean '
+            'to write <div is="x-a">? (lib/test.html 1 0)'
+      });
+
+    _testLinter('used incorrectly (wrong base tag, transitive)', {
+        'a|lib/c.html': '''
+            <polymer-element name="x-c" extends="li">
+            </polymer-element>
+            <polymer-element name="x-b" extends="x-c">
+            </polymer-element>
+            '''.replaceAll('            ', ''),
+        'a|lib/b.html': '''
+            <link rel="import" href="c.html">
+            <polymer-element name="x-a" extends="x-b">
+            </polymer-element>
+            '''.replaceAll('            ', ''),
+        'a|lib/test.html': '''
+            <link rel="import" href="b.html">
+            <span is="x-a"></span>
+            '''.replaceAll('            ', ''),
+      }, {
+        'a|lib/test.html.messages': ''
+            'warning: custom element "x-a" extends from "li". Did you mean '
+            'to write <li is="x-a">? (lib/test.html 1 0)'
+      });
+  });
+}
+
+_testLinter(String name, Map inputFiles, Map outputMessages) {
+  var linter = new Linter(_testFormatter);
+  var outputFiles = {};
+  inputFiles.forEach((k, v) => outputFiles[k] = v);
+  outputMessages.forEach((k, v) => outputFiles[k] = v);
+  var keys = inputFiles.keys.toSet();
+  keys.retainAll(outputMessages.keys);
+  expect(keys, isEmpty);
+  testPhases(name, [[linter]], inputFiles, outputFiles);
+}
+
+
+_testFormatter(String kind, String message, Span span) {
+  var formattedMessage = '$kind: $message';
+  if (span != null) {
+    formattedMessage = '$formattedMessage '
+        '(${span.sourceUrl} ${span.start.line} ${span.start.column})';
+  }
+  return formattedMessage;
+}
diff --git a/pkg/polymer/test/run_all.dart b/pkg/polymer/test/run_all.dart
index d11f475..6191492 100644
--- a/pkg/polymer/test/run_all.dart
+++ b/pkg/polymer/test/run_all.dart
@@ -13,14 +13,15 @@
 import 'package:unittest/unittest.dart';
 import 'package:polymer/testing/content_shell_test.dart';
 
-import 'css_test.dart' as css_test;
 import 'compiler_test.dart' as compiler_test;
-import 'utils_test.dart' as utils_test;
+import 'css_test.dart' as css_test;
 import 'transform/all_phases_test.dart' as all_phases_test;
 import 'transform/code_extractor_test.dart' as code_extractor_test;
 import 'transform/import_inliner_test.dart' as import_inliner_test;
 import 'transform/polyfill_injector_test.dart' as polyfill_injector_test;
 import 'transform/script_compactor_test.dart' as script_compactor_test;
+import 'utils_test.dart' as utils_test;
+import 'linter_test.dart' as linter_test;
 
 main() {
   var args = new Options().arguments;
@@ -34,6 +35,7 @@
     }
   }
 
+  addGroup('linter_test.dart', linter_test.main);
   addGroup('compiler_test.dart', compiler_test.main);
   addGroup('css_test.dart', css_test.main);
   addGroup('utils_test.dart', utils_test.main);
@@ -44,7 +46,7 @@
       polyfill_injector_test.main);
   addGroup('transform/all_phases_test.dart', all_phases_test.main);
 
-  endToEndTests('data/unit/', 'data/out');
+  endToEndTests('data/unit/web', 'data/out');
 
   // Note: if you're adding more render test suites, make sure to update run.sh
   // as well for convenient baseline diff/updating.
diff --git a/pkg/polymer/test/transform/all_phases_test.dart b/pkg/polymer/test/transform/all_phases_test.dart
index a3826fa..81de2f9 100644
--- a/pkg/polymer/test/transform/all_phases_test.dart
+++ b/pkg/polymer/test/transform/all_phases_test.dart
@@ -36,6 +36,7 @@
           '<!DOCTYPE html><html><head></head><body>'
           '$SHADOW_DOM_TAG'
           '$INTEROP_TAG'
+          '$PKG_JS_INTEROP_TAG'
           '<script type="application/dart" '
           'src="test.html_bootstrap.dart"></script>'
           '<script src="packages/browser/dart.js"></script>'
@@ -68,6 +69,7 @@
           '<!DOCTYPE html><html><head></head><body>'
           '$SHADOW_DOM_TAG'
           '$INTEROP_TAG'
+          '$PKG_JS_INTEROP_TAG'
           '<script type="application/dart" '
           'src="test.html_bootstrap.dart"></script>'
           '<script src="packages/browser/dart.js"></script>'
@@ -107,6 +109,7 @@
           '<!DOCTYPE html><html><head></head><body>'
           '$SHADOW_DOM_TAG'
           '$INTEROP_TAG'
+          '$PKG_JS_INTEROP_TAG'
           '<div></div>'
           '<script type="application/dart" '
           'src="test.html_bootstrap.dart"></script>'
@@ -158,6 +161,7 @@
           '<!DOCTYPE html><html><head></head><body>'
           '$SHADOW_DOM_TAG'
           '$INTEROP_TAG'
+          '$PKG_JS_INTEROP_TAG'
           '<polymer-element>1</polymer-element>'
           '<script type="application/dart" '
           'src="index.html_bootstrap.dart"></script>'
diff --git a/pkg/polymer/test/transform/code_extractor_test.dart b/pkg/polymer/test/transform/code_extractor_test.dart
index 9619684..72aefb9 100644
--- a/pkg/polymer/test/transform/code_extractor_test.dart
+++ b/pkg/polymer/test/transform/code_extractor_test.dart
@@ -13,60 +13,76 @@
   useCompactVMConfiguration();
 
   testPhases('no changes', [[new InlineCodeExtractor()]], {
-      'a|test.html': '<!DOCTYPE html><html></html>',
+      'a|web/test.html': '<!DOCTYPE html><html></html>',
     }, {
-      'a|test.html': '<!DOCTYPE html><html></html>',
+      'a|web/test.html': '<!DOCTYPE html><html></html>',
     });
 
-  testPhases('single script, no lib', [[new InlineCodeExtractor()]], {
-      'a|test.html':
+  testPhases('single script, no library in script',
+      [[new InlineCodeExtractor()]], {
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<script type="application/dart">main() { }</script>',
     }, {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<script type="application/dart" src="test.html.0.dart"></script>'
           '</head><body></body></html>',
 
-      'a|test.html.0.dart':
-          'library test_html_0;\nmain() { }',
+      'a|web/test.html.0.dart':
+          'library web_test_html_0;\nmain() { }',
     });
 
-  testPhases('single script, with lib', [[new InlineCodeExtractor()]], {
-      'a|test.html':
+  testPhases('single script, with library', [[new InlineCodeExtractor()]], {
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<script type="application/dart">library f;\nmain() { }</script>',
     }, {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<script type="application/dart" src="test.html.0.dart"></script>'
           '</head><body></body></html>',
 
-      'a|test.html.0.dart':
+      'a|web/test.html.0.dart':
+          'library f;\nmain() { }',
+    });
+
+  testPhases('under lib/ directory also transformed',
+      [[new InlineCodeExtractor()]], {
+      'a|lib/test.html':
+          '<!DOCTYPE html><html><head>'
+          '<script type="application/dart">library f;\nmain() { }</script>',
+    }, {
+      'a|lib/test.html':
+          '<!DOCTYPE html><html><head>'
+          '<script type="application/dart" src="test.html.0.dart"></script>'
+          '</head><body></body></html>',
+
+      'a|lib/test.html.0.dart':
           'library f;\nmain() { }',
     });
 
   testPhases('multiple scripts', [[new InlineCodeExtractor()]], {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<script type="application/dart">library a1;\nmain1() { }</script>'
           '<script type="application/dart">library a2;\nmain2() { }</script>',
     }, {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<script type="application/dart" src="test.html.0.dart"></script>'
           '<script type="application/dart" src="test.html.1.dart"></script>'
           '</head><body></body></html>',
 
-      'a|test.html.0.dart':
+      'a|web/test.html.0.dart':
           'library a1;\nmain1() { }',
 
-      'a|test.html.1.dart':
+      'a|web/test.html.1.dart':
           'library a2;\nmain2() { }',
     });
 
   testPhases('multiple deeper scripts', [[new InlineCodeExtractor()]], {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<script type="application/dart">main1() { }</script>'
           '</head><body><div>'
@@ -75,7 +91,7 @@
           '<script type="application/dart">main3() { }</script>'
           '</div></div>'
     }, {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<script type="application/dart" src="test.html.0.dart"></script>'
           '</head><body><div>'
@@ -84,13 +100,13 @@
           '<script type="application/dart" src="test.html.2.dart"></script>'
           '</div></div></body></html>',
 
-      'a|test.html.0.dart':
-          'library test_html_0;\nmain1() { }',
+      'a|web/test.html.0.dart':
+          'library web_test_html_0;\nmain1() { }',
 
-      'a|test.html.1.dart':
-          'library test_html_1;\nmain2() { }',
+      'a|web/test.html.1.dart':
+          'library web_test_html_1;\nmain2() { }',
 
-      'a|test.html.2.dart':
-          'library test_html_2;\nmain3() { }',
+      'a|web/test.html.2.dart':
+          'library web_test_html_2;\nmain3() { }',
     });
 }
diff --git a/pkg/polymer/test/transform/common.dart b/pkg/polymer/test/transform/common.dart
index 8114feb..f1d8500 100644
--- a/pkg/polymer/test/transform/common.dart
+++ b/pkg/polymer/test/transform/common.dart
@@ -23,7 +23,7 @@
 class TestHelper implements PackageProvider {
   /**
    * Maps from an asset string identifier of the form 'package|path' to the
-   * file contents. 
+   * file contents.
    */
   final Map<String, String> files;
   final Iterable<String> packages;
@@ -95,7 +95,11 @@
   });
 }
 
+// TODO(jmesserly): this is .debug to workaround issue 13046.
 const SHADOW_DOM_TAG =
-    '<script src="packages/shadow_dom/shadow_dom.min.js"></script>\n';
+    '<script src="packages/shadow_dom/shadow_dom.debug.js"></script>\n';
 
 const INTEROP_TAG = '<script src="packages/browser/interop.js"></script>\n';
+
+const PKG_JS_INTEROP_TAG =
+    '<script src="packages/js/dart_interop.js"></script>\n';
diff --git a/pkg/polymer/test/transform/import_inliner_test.dart b/pkg/polymer/test/transform/import_inliner_test.dart
index 7776bbd..fbc405f 100644
--- a/pkg/polymer/test/transform/import_inliner_test.dart
+++ b/pkg/polymer/test/transform/import_inliner_test.dart
@@ -13,100 +13,119 @@
 void main() {
   useCompactVMConfiguration();
   testPhases('no changes', [[new ImportedElementInliner()]], {
-      'a|test.html': '<!DOCTYPE html><html></html>',
+      'a|web/test.html': '<!DOCTYPE html><html></html>',
     }, {
-      'a|test.html': '<!DOCTYPE html><html></html>',
+      'a|web/test.html': '<!DOCTYPE html><html></html>',
     });
 
   testPhases('empty import', [[new ImportedElementInliner()]], {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="">' // empty href
           '</head></html>',
-      'a|test2.html':
+      'a|web/test2.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import">'         // no href
           '</head></html>',
     }, {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '</head><body></body></html>',
-      'a|test2.html':
+      'a|web/test2.html':
           '<!DOCTYPE html><html><head>'
           '</head><body></body></html>',
     });
 
   testPhases('shallow, no elements', [[new ImportedElementInliner()]], {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test2.html">'
           '</head></html>',
-      'a|test2.html':
+      'a|web/test2.html':
           '<!DOCTYPE html><html><head>'
           '</head></html>',
     }, {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '</head><body></body></html>',
-      'a|test2.html':
+      'a|web/test2.html':
           '<!DOCTYPE html><html><head>'
           '</head></html>',
     });
 
   testPhases('shallow, elements, one import', [[new ImportedElementInliner()]],
     {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test2.html">'
           '</head></html>',
-      'a|test2.html':
+      'a|web/test2.html':
           '<!DOCTYPE html><html><head>'
           '</head><body><polymer-element>2</polymer-element></html>',
     }, {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>2</polymer-element>'
           '</body></html>',
-      'a|test2.html':
+      'a|web/test2.html':
+          '<!DOCTYPE html><html><head>'
+          '</head><body><polymer-element>2</polymer-element></html>',
+    });
+
+  testPhases('no transformation outside web/', [[new ImportedElementInliner()]],
+    {
+      'a|lib/test.html':
+          '<!DOCTYPE html><html><head>'
+          '<link rel="import" href="test2.html">'
+          '</head></html>',
+      'a|lib/test2.html':
+          '<!DOCTYPE html><html><head>'
+          '</head><body><polymer-element>2</polymer-element></html>',
+    }, {
+      'a|lib/test.html':
+          '<!DOCTYPE html><html><head>'
+          '<link rel="import" href="test2.html">'
+          '</head></html>',
+      'a|lib/test2.html':
           '<!DOCTYPE html><html><head>'
           '</head><body><polymer-element>2</polymer-element></html>',
     });
 
   testPhases('shallow, elements, many', [[new ImportedElementInliner()]],
     {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test2.html">'
           '<link rel="import" href="test3.html">'
           '</head></html>',
-      'a|test2.html':
+      'a|web/test2.html':
           '<!DOCTYPE html><html><head>'
           '</head><body><polymer-element>2</polymer-element></html>',
-      'a|test3.html':
+      'a|web/test3.html':
           '<!DOCTYPE html><html><head>'
           '</head><body><polymer-element>3</polymer-element></html>',
     }, {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>2</polymer-element>'
           '<polymer-element>3</polymer-element>'
           '</body></html>',
-      'a|test2.html':
+      'a|web/test2.html':
           '<!DOCTYPE html><html><head>'
           '</head><body><polymer-element>2</polymer-element></html>',
-      'a|test3.html':
+      'a|web/test3.html':
           '<!DOCTYPE html><html><head>'
           '</head><body><polymer-element>3</polymer-element></html>',
     });
 
   testPhases('deep, elements, one per file', [[new ImportedElementInliner()]], {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test2.html">'
           '</head></html>',
-      'a|test2.html':
+      'a|web/test2.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="assets/b/test3.html">'
           '</head><body><polymer-element>2</polymer-element></html>',
@@ -118,13 +137,13 @@
           '<!DOCTYPE html><html><head>'
           '</head><body><polymer-element>4</polymer-element></html>',
     }, {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>4</polymer-element>'
           '<polymer-element>3</polymer-element>'
           '<polymer-element>2</polymer-element></body></html>',
-      'a|test2.html':
+      'a|web/test2.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>4</polymer-element>'
@@ -132,44 +151,43 @@
           '<polymer-element>2</polymer-element></body></html>',
       'b|asset/test3.html':
           '<!DOCTYPE html><html><head>'
-          '</head><body>'
-          '<polymer-element>4</polymer-element>'
-          '<polymer-element>3</polymer-element></body></html>',
+          '<link rel="import" href="packages/c/test4.html">'
+          '</head><body><polymer-element>3</polymer-element></html>',
       'c|lib/test4.html':
           '<!DOCTYPE html><html><head>'
           '</head><body><polymer-element>4</polymer-element></html>',
     });
 
   testPhases('deep, elements, many imports', [[new ImportedElementInliner()]], {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test2a.html">'
           '<link rel="import" href="test2b.html">'
           '</head></html>',
-      'a|test2a.html':
+      'a|web/test2a.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test3a.html">'
           '<link rel="import" href="test3b.html">'
           '</head><body><polymer-element>2a</polymer-element></body></html>',
-      'a|test2b.html':
+      'a|web/test2b.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test4a.html">'
           '<link rel="import" href="test4b.html">'
           '</head><body><polymer-element>2b</polymer-element></body></html>',
-      'a|test3a.html':
+      'a|web/test3a.html':
           '<!DOCTYPE html><html><head>'
           '</head><body><polymer-element>3a</polymer-element></body></html>',
-      'a|test3b.html':
+      'a|web/test3b.html':
           '<!DOCTYPE html><html><head>'
           '</head><body><polymer-element>3b</polymer-element></body></html>',
-      'a|test4a.html':
+      'a|web/test4a.html':
           '<!DOCTYPE html><html><head>'
           '</head><body><polymer-element>4a</polymer-element></body></html>',
-      'a|test4b.html':
+      'a|web/test4b.html':
           '<!DOCTYPE html><html><head>'
           '</head><body><polymer-element>4b</polymer-element></body></html>',
     }, {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>3a</polymer-element>'
@@ -179,36 +197,36 @@
           '<polymer-element>4b</polymer-element>'
           '<polymer-element>2b</polymer-element>'
           '</body></html>',
-      'a|test2a.html':
+      'a|web/test2a.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>3a</polymer-element>'
           '<polymer-element>3b</polymer-element>'
           '<polymer-element>2a</polymer-element>'
           '</body></html>',
-      'a|test2b.html':
+      'a|web/test2b.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>4a</polymer-element>'
           '<polymer-element>4b</polymer-element>'
           '<polymer-element>2b</polymer-element>'
           '</body></html>',
-      'a|test3a.html':
+      'a|web/test3a.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>3a</polymer-element>'
           '</body></html>',
-      'a|test3b.html':
+      'a|web/test3b.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>3b</polymer-element>'
           '</body></html>',
-      'a|test4a.html':
+      'a|web/test4a.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>4a</polymer-element>'
           '</body></html>',
-      'a|test4b.html':
+      'a|web/test4b.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>4b</polymer-element>'
@@ -216,30 +234,30 @@
     });
 
   testPhases('imports cycle, 1-step lasso', [[new ImportedElementInliner()]], {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test_1.html">'
           '</head></html>',
-      'a|test_1.html':
+      'a|web/test_1.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test_2.html">'
           '</head><body><polymer-element>1</polymer-element></html>',
-      'a|test_2.html':
+      'a|web/test_2.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test_1.html">'
           '</head><body><polymer-element>2</polymer-element></html>',
     }, {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>2</polymer-element>'
           '<polymer-element>1</polymer-element></body></html>',
-      'a|test_1.html':
+      'a|web/test_1.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>2</polymer-element>'
           '<polymer-element>1</polymer-element></body></html>',
-      'a|test_2.html':
+      'a|web/test_2.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>1</polymer-element>'
@@ -247,42 +265,42 @@
     });
 
   testPhases('imports cycle, 2-step lasso', [[new ImportedElementInliner()]], {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test_1.html">'
           '</head></html>',
-      'a|test_1.html':
+      'a|web/test_1.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test_2.html">'
           '</head><body><polymer-element>1</polymer-element></html>',
-      'a|test_2.html':
+      'a|web/test_2.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test_3.html">'
           '</head><body><polymer-element>2</polymer-element></html>',
-      'a|test_3.html':
+      'a|web/test_3.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test_1.html">'
           '</head><body><polymer-element>3</polymer-element></html>',
     }, {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>3</polymer-element>'
           '<polymer-element>2</polymer-element>'
           '<polymer-element>1</polymer-element></body></html>',
-      'a|test_1.html':
+      'a|web/test_1.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>3</polymer-element>'
           '<polymer-element>2</polymer-element>'
           '<polymer-element>1</polymer-element></body></html>',
-      'a|test_2.html':
+      'a|web/test_2.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>1</polymer-element>'
           '<polymer-element>3</polymer-element>'
           '<polymer-element>2</polymer-element></body></html>',
-      'a|test_3.html':
+      'a|web/test_3.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>2</polymer-element>'
@@ -291,60 +309,60 @@
     });
 
   testPhases('imports cycle, self cycle', [[new ImportedElementInliner()]], {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test_1.html">'
           '</head></html>',
-      'a|test_1.html':
+      'a|web/test_1.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test_1.html">'
           '</head><body><polymer-element>1</polymer-element></html>',
     }, {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>1</polymer-element></body></html>',
-      'a|test_1.html':
+      'a|web/test_1.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>1</polymer-element></body></html>',
     });
 
   testPhases('imports DAG', [[new ImportedElementInliner()]], {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test_1.html">'
           '<link rel="import" href="test_2.html">'
           '</head></html>',
-      'a|test_1.html':
+      'a|web/test_1.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test_3.html">'
           '</head><body><polymer-element>1</polymer-element></body></html>',
-      'a|test_2.html':
+      'a|web/test_2.html':
           '<!DOCTYPE html><html><head>'
           '<link rel="import" href="test_3.html">'
           '</head><body><polymer-element>2</polymer-element></body></html>',
-      'a|test_3.html':
+      'a|web/test_3.html':
           '<!DOCTYPE html><html><head>'
           '</head><body><polymer-element>3</polymer-element></body></html>',
     }, {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>3</polymer-element>'
           '<polymer-element>1</polymer-element>'
           '<polymer-element>2</polymer-element></body></html>',
-      'a|test_1.html':
+      'a|web/test_1.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>3</polymer-element>'
           '<polymer-element>1</polymer-element></body></html>',
-      'a|test_2.html':
+      'a|web/test_2.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>3</polymer-element>'
           '<polymer-element>2</polymer-element></body></html>',
-      'a|test_3.html':
+      'a|web/test_3.html':
           '<!DOCTYPE html><html><head>'
           '</head><body>'
           '<polymer-element>3</polymer-element></body></html>',
diff --git a/pkg/polymer/test/transform/polyfill_injector_test.dart b/pkg/polymer/test/transform/polyfill_injector_test.dart
index 0800325..e8bbb89 100644
--- a/pkg/polymer/test/transform/polyfill_injector_test.dart
+++ b/pkg/polymer/test/transform/polyfill_injector_test.dart
@@ -18,6 +18,16 @@
       'a|web/test.html': '<!DOCTYPE html><html></html>',
     });
 
+  testPhases('no changes under lib ', [[new PolyfillInjector()]], {
+      'a|lib/test.html':
+          '<!DOCTYPE html><html><head></head><body>'
+          '<script type="application/dart" src="a.dart"></script>',
+    }, {
+      'a|lib/test.html':
+          '<!DOCTYPE html><html><head></head><body>'
+          '<script type="application/dart" src="a.dart"></script>',
+    });
+
   testPhases('with some script', [[new PolyfillInjector()]], {
       'a|web/test.html':
           '<!DOCTYPE html><html><head></head><body>'
@@ -25,7 +35,7 @@
     }, {
       'a|web/test.html':
           '<!DOCTYPE html><html><head></head><body>'
-          '$SHADOW_DOM_TAG$INTEROP_TAG'
+          '$SHADOW_DOM_TAG$INTEROP_TAG$PKG_JS_INTEROP_TAG'
           '<script type="application/dart" src="a.dart"></script>'
           '</body></html>',
     });
@@ -35,12 +45,15 @@
           '<!DOCTYPE html><html><head></head><body>'
           '<script type="application/dart" src="a.dart"></script>'
           '$SHADOW_DOM_TAG'
-          '$INTEROP_TAG',
+          '$INTEROP_TAG'
+          '$PKG_JS_INTEROP_TAG',
     }, {
       'a|web/test.html':
           '<!DOCTYPE html><html><head></head><body>'
           '<script type="application/dart" src="a.dart"></script>'
           '$SHADOW_DOM_TAG'
-          '$INTEROP_TAG</body></html>',
+          '$INTEROP_TAG'
+          '$PKG_JS_INTEROP_TAG'
+          '</body></html>',
     });
 }
diff --git a/pkg/polymer/test/transform/script_compactor_test.dart b/pkg/polymer/test/transform/script_compactor_test.dart
index e12d379..1588bd1 100644
--- a/pkg/polymer/test/transform/script_compactor_test.dart
+++ b/pkg/polymer/test/transform/script_compactor_test.dart
@@ -13,24 +13,34 @@
   useCompactVMConfiguration();
 
   testPhases('no changes', [[new ScriptCompactor()]], {
-      'a|test.html': '<!DOCTYPE html><html></html>',
+      'a|web/test.html': '<!DOCTYPE html><html></html>',
     }, {
-      'a|test.html': '<!DOCTYPE html><html></html>',
+      'a|web/test.html': '<!DOCTYPE html><html></html>',
     });
 
-  testPhases('single script', [[new ScriptCompactor()]], {
-      'a|test.html':
+  testPhases('no changes outside web/', [[new ScriptCompactor()]], {
+      'a|lib/test.html':
           '<!DOCTYPE html><html><head>'
           '<script type="application/dart" src="a.dart"></script>',
     }, {
-      'a|test.html':
+      'a|lib/test.html':
+          '<!DOCTYPE html><html><head>'
+          '<script type="application/dart" src="a.dart"></script>',
+    });
+
+  testPhases('single script', [[new ScriptCompactor()]], {
+      'a|web/test.html':
+          '<!DOCTYPE html><html><head>'
+          '<script type="application/dart" src="a.dart"></script>',
+    }, {
+      'a|web/test.html':
           '<!DOCTYPE html><html><head></head><body>'
           '<script type="application/dart" '
           'src="test.html_bootstrap.dart"></script>'
           '<script src="packages/browser/dart.js"></script>'
           '</body></html>',
 
-      'a|test.html_bootstrap.dart':
+      'a|web/test.html_bootstrap.dart':
           '''library app_bootstrap;
 
           import 'package:polymer/polymer.dart';
@@ -47,7 +57,7 @@
     });
 
   testPhases('several scripts', [[new ScriptCompactor()]], {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head>'
           '<script type="application/dart" src="a.dart"></script>'
           '<script type="application/dart" src="b.dart"></script>'
@@ -56,14 +66,14 @@
           '</div>'
           '<script type="application/dart" src="d.dart"></script>',
     }, {
-      'a|test.html':
+      'a|web/test.html':
           '<!DOCTYPE html><html><head></head><body><div></div>'
           '<script type="application/dart" '
           'src="test.html_bootstrap.dart"></script>'
           '<script src="packages/browser/dart.js"></script>'
           '</body></html>',
 
-      'a|test.html_bootstrap.dart':
+      'a|web/test.html_bootstrap.dart':
           '''library app_bootstrap;
 
           import 'package:polymer/polymer.dart';
diff --git a/pkg/polymer_expressions/test/syntax_test.html b/pkg/polymer_expressions/test/syntax_test.html
deleted file mode 100644
index 4f494a6..0000000
--- a/pkg/polymer_expressions/test/syntax_test.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-
-<html>
-  <head>
-    <title>syntax_test</title>
-  </head>
-
-  <body>
-    <script type="application/dart" src="syntax_test.dart"></script>
-    <script src="packages/browser/dart.js"></script>
-  </body>
-</html>
diff --git a/pkg/scheduled_test/lib/scheduled_test.dart b/pkg/scheduled_test/lib/scheduled_test.dart
index 0a3b2bf..aab455e 100644
--- a/pkg/scheduled_test/lib/scheduled_test.dart
+++ b/pkg/scheduled_test/lib/scheduled_test.dart
@@ -197,8 +197,7 @@
 import 'src/schedule_error.dart';
 
 export 'package:unittest/unittest.dart' hide
-    test, solo_test, group, setUp, tearDown, unittestConfiguration,
-    currentTestCase, completes, completion;
+    test, solo_test, group, setUp, tearDown, completes, completion;
 
 export 'src/schedule.dart';
 export 'src/schedule_error.dart';
@@ -376,13 +375,3 @@
 
   return currentSchedule.wrapFuture(future, description);
 }
-
-// TODO(nweiz): re-export these once issue 9535 is fixed.
-unittest.Configuration get unittestConfiguration =>
-  unittest.unittestConfiguration;
-void set unittestConfiguration(unittest.Configuration value) {
-  unittest.unittestConfiguration = value;
-}
-
-// TODO(nweiz): re-export these once issue 9535 is fixed.
-unittest.TestCase get currentTestCase => unittest.currentTestCase;
diff --git a/pkg/serialization/lib/src/serialization_helpers.dart b/pkg/serialization/lib/src/serialization_helpers.dart
index 015215c..ec89857 100644
--- a/pkg/serialization/lib/src/serialization_helpers.dart
+++ b/pkg/serialization/lib/src/serialization_helpers.dart
@@ -209,9 +209,11 @@
  * wrapped objects. It also treats equal primitive values as identical
  * to conserve space.
  */
-class IdentityMap<K, V> extends HashMap<K, V> {
+class IdentityMap<K, V> extends LinkedHashMap<K, V> {
 // TODO(alanknight): Replace with a system identity-based map once
 // one is available. Issue 4161.
+// TODO(lrn): Replace with identity map when custom hash maps are introduced
+// (which is soon).
 
   // Check before wrapping because some methods may call others, e.g. on
   // dart2js putIfAbsent calls containsKey, so without this we wrap forever.
diff --git a/pkg/shadow_dom/lib/shadow_dom.debug.js b/pkg/shadow_dom/lib/shadow_dom.debug.js
index eff86b3..07b283e 100644
--- a/pkg/shadow_dom/lib/shadow_dom.debug.js
+++ b/pkg/shadow_dom/lib/shadow_dom.debug.js
@@ -31,8 +31,7 @@
 } else {
   (function() {
     var defineProperty = Object.defineProperty;
-    var hasOwnProperty = Object.hasOwnProperty;
-    var counter = new Date().getTime() % 1e9;
+    var counter = Date.now() % 1e9;
 
     SideTable = function() {
       this.name = '__st' + (Math.random() * 1e9 >>> 0) + (counter++ + '__');
@@ -40,10 +39,16 @@
 
     SideTable.prototype = {
       set: function(key, value) {
-        defineProperty(key, this.name, {value: value, writable: true});
+        var entry = key[this.name];
+        if (entry && entry[0] === key)
+          entry[1] = value;
+        else
+          defineProperty(key, this.name, {value: [key, value], writable: true});
       },
       get: function(key) {
-        return hasOwnProperty.call(key, this.name) ? key[this.name] : undefined;
+        var entry;
+        return (entry = key[this.name]) && entry[0] === key ?
+            entry[1] : undefined;
       },
       delete: function(key) {
         this.set(key, undefined);
@@ -63,6 +68,7 @@
 
   var wrapperTable = new SideTable();
   var constructorTable = new SideTable();
+  var nativePrototypeTable = new SideTable();
   var wrappers = Object.create(null);
 
   function assert(b) {
@@ -95,6 +101,13 @@
     return to;
   };
 
+  function oneOf(object, propertyNames) {
+    for (var i = 0; i < propertyNames.length; i++) {
+      if (propertyNames[i] in object)
+        return propertyNames[i];
+    }
+  }
+
   // Mozilla's old DOM bindings are bretty busted:
   // https://bugzilla.mozilla.org/show_bug.cgi?id=855844
   // Make sure they are create before we start modifying things.
@@ -133,6 +146,10 @@
     enumerable: true
   };
 
+  function isEventHandlerName(name) {
+    return /^on[a-z]+$/.test(name);
+  }
+
   function installProperty(source, target, allowMethod) {
     Object.getOwnPropertyNames(source).forEach(function(name) {
       if (name in target)
@@ -146,8 +163,8 @@
       try {
         descriptor = Object.getOwnPropertyDescriptor(source, name);
       } catch (ex) {
-        // JSC and V8 both use data properties instead accessors which can cause
-        // getting the property desciptor throw an exception.
+        // JSC and V8 both use data properties instead of accessors which can
+        // cause getting the property desciptor to throw an exception.
         // https://bugs.webkit.org/show_bug.cgi?id=49739
         descriptor = dummyDescriptor;
       }
@@ -159,14 +176,23 @@
         return;
       }
 
-      getter = function() {
-        return this.impl[name];
-      };
+      var isEvent = isEventHandlerName(name);
+      if (isEvent) {
+        getter = scope.getEventHandlerGetter(name);
+      } else {
+        getter = function() {
+          return this.impl[name];
+        };
+      }
 
       if (descriptor.writable || descriptor.set) {
-        setter = function(value) {
-          this.impl[name] = value;
-        };
+        if (isEvent) {
+          setter = scope.getEventHandlerSetter(name);
+        } else {
+          setter = function(value) {
+            this.impl[name] = value;
+          };
+        }
       }
 
       Object.defineProperty(target, name, {
@@ -181,9 +207,8 @@
   /**
    * @param {Function} nativeConstructor
    * @param {Function} wrapperConstructor
-   * @param {string|Object=} opt_instance If present, this is used to extract
-   *     properties from an instance object. If this is a string
-   *     |document.createElement| is used to create an instance.
+   * @param {Object=} opt_instance If present, this is used to extract
+   *     properties from an instance object.
    */
   function register(nativeConstructor, wrapperConstructor, opt_instance) {
     var nativePrototype = nativeConstructor.prototype;
@@ -194,7 +219,10 @@
   function registerInternal(nativePrototype, wrapperConstructor, opt_instance) {
     var wrapperPrototype = wrapperConstructor.prototype;
     assert(constructorTable.get(nativePrototype) === undefined);
+
     constructorTable.set(nativePrototype, wrapperConstructor);
+    nativePrototypeTable.set(wrapperPrototype, nativePrototype);
+
     addForwardingProperties(nativePrototype, wrapperPrototype);
     if (opt_instance)
       registerInstanceProperties(wrapperPrototype, opt_instance);
@@ -232,10 +260,6 @@
     GeneratedWrapper.prototype =
         Object.create(superWrapperConstructor.prototype);
     GeneratedWrapper.prototype.constructor = GeneratedWrapper;
-    // We add this property to work around a Firefox bug where HTMLFormElement
-    // and HTMLInputElements sometimes have their constructor incorrectly
-    // attached to GeneratedWrapper. See lib/patches-shadowdom-polyfill.js
-    GeneratedWrapper._ShadowDOMPolyfill$isGeneratedWrapper = true;
 
     return GeneratedWrapper;
   }
@@ -244,10 +268,12 @@
   var OriginalEvent = Event;
   var OriginalNode = Node;
   var OriginalWindow = Window;
+  var OriginalRange = Range;
 
   function isWrapper(object) {
     return object instanceof wrappers.EventTarget ||
            object instanceof wrappers.Event ||
+           object instanceof wrappers.Range ||
            object instanceof wrappers.DOMImplementation;
   }
 
@@ -255,6 +281,7 @@
     return object instanceof OriginalNode ||
            object instanceof OriginalEvent ||
            object instanceof OriginalWindow ||
+           object instanceof OriginalRange ||
            object instanceof OriginalDOMImplementation;
   }
 
@@ -270,11 +297,8 @@
 
     assert(isNative(impl));
     var wrapper = wrapperTable.get(impl);
-    if (!wrapper) {
-      var wrapperConstructor = getWrapperConstructor(impl);
-      wrapper = new wrapperConstructor(impl);
-      wrapperTable.set(impl, wrapper);
-    }
+    if (!wrapper)
+      wrapperTable.set(impl, wrapper = new (getWrapperConstructor(impl))(impl));
     return wrapper;
   }
 
@@ -347,7 +371,7 @@
     constructors.forEach(function(constructor) {
       names.forEach(function(name) {
         constructor.prototype[name] = function() {
-          var w = wrap(this);
+          var w = wrapIfNeeded(this);
           return w[name].apply(w, arguments);
         };
       });
@@ -355,12 +379,14 @@
   }
 
   scope.assert = assert;
+  scope.constructorTable = constructorTable;
   scope.defineGetter = defineGetter;
   scope.defineWrapGetter = defineWrapGetter;
   scope.forwardMethodsToWrapper = forwardMethodsToWrapper;
-  scope.isWrapper = isWrapper;
   scope.isWrapperFor = isWrapperFor;
   scope.mixin = mixin;
+  scope.nativePrototypeTable = nativePrototypeTable;
+  scope.oneOf = oneOf;
   scope.registerObject = registerObject;
   scope.registerWrapper = register;
   scope.rewrap = rewrap;
@@ -371,7 +397,6 @@
   scope.wrappers = wrappers;
 
 })(this.ShadowDOMPolyfill);
-
 // Copyright 2013 The Polymer Authors. All rights reserved.
 // Use of this source code is goverened by a BSD-style
 // license that can be found in the LICENSE file.
@@ -395,6 +420,8 @@
   var eventPhaseTable = new SideTable();
   var stopPropagationTable = new SideTable();
   var stopImmediatePropagationTable = new SideTable();
+  var eventHandlersTable = new SideTable();
+  var eventPathTable = new SideTable();
 
   function isShadowRoot(node) {
     return node instanceof wrappers.ShadowRoot;
@@ -421,7 +448,7 @@
 
     // 1.
     if (isShadowRoot(node))
-      return node.insertionParent || scope.getHostForShadowRoot(node);
+      return getInsertionParent(node) || scope.getHostForShadowRoot(node);
 
     // 2.
     var eventParents = scope.eventParentsTable.get(node);
@@ -438,7 +465,7 @@
       var parentNode = node.parentNode;
       if (parentNode && isShadowHost(parentNode)) {
         var trees = scope.getShadowTrees(parentNode);
-        var p = context.insertionParent;
+        var p = getInsertionParent(context);
         for (var i = 0; i < trees.length; i++) {
           if (trees[i].contains(p))
             return p;
@@ -523,8 +550,12 @@
     }
   }
 
+  function getInsertionParent(node) {
+    return scope.insertionParentTable.get(node);
+  }
+
   function isDistributed(node) {
-    return node.insertionParent;
+    return getInsertionParent(node);
   }
 
   function rootOfNode(node) {
@@ -539,6 +570,17 @@
     return rootOfNode(a) === rootOfNode(b);
   }
 
+  function enclosedBy(a, b) {
+    if (a === b)
+      return true;
+    if (a instanceof wrappers.ShadowRoot) {
+      var host = scope.getHostForShadowRoot(a);
+      return enclosedBy(rootOfNode(host), b);
+    }
+    return false;
+
+  }
+
   function isMutationEvent(type) {
     switch (type) {
       case 'DOMAttrModified':
@@ -580,13 +622,15 @@
     //
     // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#the-end
     //
-    // TODO(arv): Find a loess hacky way to do this.
+    // TODO(arv): Find a less hacky way to do this.
     if (event.type === 'load' &&
         eventPath.length === 2 &&
         eventPath[0].target instanceof wrappers.Document) {
       eventPath.shift();
     }
 
+    eventPathTable.set(event, eventPath);
+
     if (dispatchCapturing(event, eventPath)) {
       if (dispatchAtTarget(event, eventPath)) {
         dispatchBubbling(event, eventPath);
@@ -750,6 +794,27 @@
     get eventPhase() {
       return eventPhaseTable.get(this);
     },
+    get path() {
+      var nodeList = new wrappers.NodeList();
+      var eventPath = eventPathTable.get(this);
+      if (eventPath) {
+        var index = 0;
+        var lastIndex = eventPath.length - 1;
+        var baseRoot = rootOfNode(currentTargetTable.get(this));
+
+        for (var i = 0; i <= lastIndex; i++) {
+          var currentTarget = eventPath[i].currentTarget;
+          var currentRoot = rootOfNode(currentTarget);
+          if (enclosedBy(baseRoot, currentRoot) &&
+              // Make sure we do not add Window to the path.
+              (i !== lastIndex || currentTarget instanceof wrappers.Node)) {
+            nodeList[index++] = currentTarget;
+          }
+        }
+        nodeList.length = index;
+      }
+      return nodeList;
+    },
     stopPropagation: function() {
       stopPropagationTable.set(this, true);
     },
@@ -779,10 +844,17 @@
     GenericEvent.prototype = Object.create(SuperEvent.prototype);
     if (prototype)
       mixin(GenericEvent.prototype, prototype);
-    // Firefox does not support FocusEvent
-    // https://bugzilla.mozilla.org/show_bug.cgi?id=855741
-    if (OriginalEvent)
-      registerWrapper(OriginalEvent, GenericEvent, document.createEvent(name));
+    if (OriginalEvent) {
+      // IE does not support event constructors but FocusEvent can only be
+      // created using new FocusEvent in Firefox.
+      // https://bugzilla.mozilla.org/show_bug.cgi?id=882165
+      if (OriginalEvent.prototype['init' + name]) {
+        registerWrapper(OriginalEvent, GenericEvent,
+                        document.createEvent(name));
+      } else {
+        registerWrapper(OriginalEvent, GenericEvent, new OriginalEvent('temp'));
+      }
+    }
     return GenericEvent;
   }
 
@@ -912,7 +984,7 @@
     'dispatchEvent'
   ];
 
-  [Element, Window, Document].forEach(function(constructor) {
+  [Node, Window].forEach(function(constructor) {
     var p = constructor.prototype;
     methodNames.forEach(function(name) {
       Object.defineProperty(p, name + '_', {value: p[name]});
@@ -999,8 +1071,61 @@
     return null;
   }
 
+  /**
+   * Returns a function that is to be used as a getter for `onfoo` properties.
+   * @param {string} name
+   * @return {Function}
+   */
+  function getEventHandlerGetter(name) {
+    return function() {
+      var inlineEventHandlers = eventHandlersTable.get(this);
+      return inlineEventHandlers && inlineEventHandlers[name] &&
+          inlineEventHandlers[name].value || null;
+     };
+  }
+
+  /**
+   * Returns a function that is to be used as a setter for `onfoo` properties.
+   * @param {string} name
+   * @return {Function}
+   */
+  function getEventHandlerSetter(name) {
+    var eventType = name.slice(2);
+    return function(value) {
+      var inlineEventHandlers = eventHandlersTable.get(this);
+      if (!inlineEventHandlers) {
+        inlineEventHandlers = Object.create(null);
+        eventHandlersTable.set(this, inlineEventHandlers);
+      }
+
+      var old = inlineEventHandlers[name];
+      if (old)
+        this.removeEventListener(eventType, old.wrapped, false);
+
+      if (typeof value === 'function') {
+        var wrapped = function(e) {
+          var rv = value.call(this, e);
+          if (rv === false)
+            e.preventDefault();
+          else if (name === 'onbeforeunload' && typeof rv === 'string')
+            e.returnValue = rv;
+          // mouseover uses true for preventDefault but preventDefault for
+          // mouseover is ignored by browsers these day.
+        };
+
+        this.addEventListener(eventType, wrapped, false);
+        inlineEventHandlers[name] = {
+          value: value,
+          wrapped: wrapped
+        };
+      }
+    };
+  }
+
   scope.adjustRelatedTarget = adjustRelatedTarget;
   scope.elementFromPoint = elementFromPoint;
+  scope.getEventHandlerGetter = getEventHandlerGetter;
+  scope.getEventHandlerSetter = getEventHandlerSetter;
   scope.wrapEventTargetMethods = wrapEventTargetMethods;
   scope.wrappers.CustomEvent = CustomEvent;
   scope.wrappers.Event = Event;
@@ -1073,6 +1198,7 @@
   var registerWrapper = scope.registerWrapper;
   var unwrap = scope.unwrap;
   var wrap = scope.wrap;
+  var wrapIfNeeded = scope.wrapIfNeeded;
 
   function assertIsNodeWrapper(node) {
     assert(node instanceof Node);
@@ -1119,30 +1245,72 @@
     return nodes;
   }
 
-  function unwrapNodesForInsertion(nodes) {
-    if (nodes.length === 1)
+  function ensureSameOwnerDocument(parent, child) {
+    var ownerDoc = parent.nodeType === Node.DOCUMENT_NODE ?
+        parent : parent.ownerDocument;
+    if (ownerDoc !== child.ownerDocument)
+      ownerDoc.adoptNode(child);
+  }
+
+  function adoptNodesIfNeeded(owner, nodes) {
+    if (!nodes.length)
+      return;
+
+    var ownerDoc = owner.ownerDocument;
+
+    // All nodes have the same ownerDocument when we get here.
+    if (ownerDoc === nodes[0].ownerDocument)
+      return;
+
+    for (var i = 0; i < nodes.length; i++) {
+      scope.adoptNodeNoRemove(nodes[i], ownerDoc);
+    }
+  }
+
+  function unwrapNodesForInsertion(owner, nodes) {
+    adoptNodesIfNeeded(owner, nodes);
+    var length = nodes.length;
+
+    if (length === 1)
       return unwrap(nodes[0]);
 
-    var df = unwrap(document.createDocumentFragment());
-    for (var i = 0; i < nodes.length; i++) {
+    var df = unwrap(owner.ownerDocument.createDocumentFragment());
+    for (var i = 0; i < length; i++) {
       df.appendChild(unwrap(nodes[i]));
     }
     return df;
   }
 
   function removeAllChildNodes(wrapper) {
-    var childWrapper = wrapper.firstChild;
-    while (childWrapper) {
-      assert(childWrapper.parentNode === wrapper);
-      var nextSibling = childWrapper.nextSibling;
-      var childNode = unwrap(childWrapper);
-      var parentNode = childNode.parentNode;
-      if (parentNode)
-        originalRemoveChild.call(parentNode, childNode);
-      childWrapper.previousSibling_ = childWrapper.nextSibling_ = childWrapper.parentNode_ = null;
-      childWrapper = nextSibling;
+    if (wrapper.invalidateShadowRenderer()) {
+      var childWrapper = wrapper.firstChild;
+      while (childWrapper) {
+        assert(childWrapper.parentNode === wrapper);
+        var nextSibling = childWrapper.nextSibling;
+        var childNode = unwrap(childWrapper);
+        var parentNode = childNode.parentNode;
+        if (parentNode)
+          originalRemoveChild.call(parentNode, childNode);
+        childWrapper.previousSibling_ = childWrapper.nextSibling_ =
+            childWrapper.parentNode_ = null;
+        childWrapper = nextSibling;
+      }
+      wrapper.firstChild_ = wrapper.lastChild_ = null;
+    } else {
+      var node = unwrap(wrapper);
+      var child = node.firstChild;
+      var nextSibling;
+      while (child) {
+        nextSibling = child.nextSibling;
+        originalRemoveChild.call(node, child);
+        child = nextSibling;
+      }
     }
-    wrapper.firstChild_ = wrapper.lastChild_ = null;
+  }
+
+  function invalidateParent(node) {
+    var p = node.parentNode;
+    return p && p.invalidateShadowRenderer();
   }
 
   var OriginalNode = window.Node;
@@ -1205,22 +1373,22 @@
     appendChild: function(childWrapper) {
       assertIsNodeWrapper(childWrapper);
 
-      this.invalidateShadowRenderer();
+      if (this.invalidateShadowRenderer() || invalidateParent(childWrapper)) {
+        var previousNode = this.lastChild;
+        var nextNode = null;
+        var nodes = collectNodes(childWrapper, this, previousNode, nextNode);
 
-      var previousNode = this.lastChild;
-      var nextNode = null;
-      var nodes = collectNodes(childWrapper, this,
-                               previousNode, nextNode);
+        this.lastChild_ = nodes[nodes.length - 1];
+        if (!previousNode)
+          this.firstChild_ = nodes[0];
 
-      this.lastChild_ = nodes[nodes.length - 1];
-      if (!previousNode)
-        this.firstChild_ = nodes[0];
+        originalAppendChild.call(this.impl, unwrapNodesForInsertion(this, nodes));
+      } else {
+        ensureSameOwnerDocument(this, childWrapper);
+        originalAppendChild.call(this.impl, unwrap(childWrapper));
+      }
 
-      // TODO(arv): It is unclear if we need to update the visual DOM here.
-      // A better aproach might be to make sure we only get here for nodes that
-      // are related to a shadow host and then invalidate that and re-render
-      // the host (on reflow?).
-      originalAppendChild.call(this.impl, unwrapNodesForInsertion(nodes));
+      childWrapper.nodeWasAdded_();
 
       return childWrapper;
     },
@@ -1234,27 +1402,34 @@
       assertIsNodeWrapper(refWrapper);
       assert(refWrapper.parentNode === this);
 
-      this.invalidateShadowRenderer();
+      if (this.invalidateShadowRenderer() || invalidateParent(childWrapper)) {
+        var previousNode = refWrapper.previousSibling;
+        var nextNode = refWrapper;
+        var nodes = collectNodes(childWrapper, this, previousNode, nextNode);
 
-      var previousNode = refWrapper.previousSibling;
-      var nextNode = refWrapper;
-      var nodes = collectNodes(childWrapper, this,
-                               previousNode, nextNode);
+        if (this.firstChild === refWrapper)
+          this.firstChild_ = nodes[0];
 
+        // insertBefore refWrapper no matter what the parent is?
+        var refNode = unwrap(refWrapper);
+        var parentNode = refNode.parentNode;
 
-      if (this.firstChild === refWrapper)
-        this.firstChild_ = nodes[0];
-
-      // insertBefore refWrapper no matter what the parent is?
-      var refNode = unwrap(refWrapper);
-      var parentNode = refNode.parentNode;
-      if (parentNode) {
-        originalInsertBefore.call(
-            parentNode,
-            unwrapNodesForInsertion(nodes),
-            refNode);
+        if (parentNode) {
+          originalInsertBefore.call(
+              parentNode,
+              unwrapNodesForInsertion(this, nodes),
+              refNode);
+        } else {
+          adoptNodesIfNeeded(this, nodes);
+        }
+      } else {
+        ensureSameOwnerDocument(this, childWrapper);
+        originalInsertBefore.call(this.impl, unwrap(childWrapper),
+                                  unwrap(refWrapper));
       }
 
+      childWrapper.nodeWasAdded_();
+
       return childWrapper;
     },
 
@@ -1265,31 +1440,37 @@
         throw new Error('NotFoundError');
       }
 
-      this.invalidateShadowRenderer();
-
-      // We need to remove the real node from the DOM before updating the
-      // pointers. This is so that that mutation event is dispatched before
-      // the pointers have changed.
-      var thisFirstChild = this.firstChild;
-      var thisLastChild = this.lastChild;
-      var childWrapperNextSibling = childWrapper.nextSibling;
-      var childWrapperPreviousSibling = childWrapper.previousSibling;
-
       var childNode = unwrap(childWrapper);
-      var parentNode = childNode.parentNode;
-      if (parentNode)
-        originalRemoveChild.call(parentNode, childNode);
+      if (this.invalidateShadowRenderer()) {
 
-      if (thisFirstChild === childWrapper)
-        this.firstChild_ = childWrapperNextSibling;
-      if (thisLastChild === childWrapper)
-        this.lastChild_ = childWrapperPreviousSibling;
-      if (childWrapperPreviousSibling)
-        childWrapperPreviousSibling.nextSibling_ = childWrapperNextSibling;
-      if (childWrapperNextSibling)
-        childWrapperNextSibling.previousSibling_ = childWrapperPreviousSibling;
+        // We need to remove the real node from the DOM before updating the
+        // pointers. This is so that that mutation event is dispatched before
+        // the pointers have changed.
+        var thisFirstChild = this.firstChild;
+        var thisLastChild = this.lastChild;
+        var childWrapperNextSibling = childWrapper.nextSibling;
+        var childWrapperPreviousSibling = childWrapper.previousSibling;
 
-      childWrapper.previousSibling_ = childWrapper.nextSibling_ = childWrapper.parentNode_ = null;
+        var parentNode = childNode.parentNode;
+        if (parentNode)
+          originalRemoveChild.call(parentNode, childNode);
+
+        if (thisFirstChild === childWrapper)
+          this.firstChild_ = childWrapperNextSibling;
+        if (thisLastChild === childWrapper)
+          this.lastChild_ = childWrapperPreviousSibling;
+        if (childWrapperPreviousSibling)
+          childWrapperPreviousSibling.nextSibling_ = childWrapperNextSibling;
+        if (childWrapperNextSibling) {
+          childWrapperNextSibling.previousSibling_ =
+              childWrapperPreviousSibling;
+        }
+
+        childWrapper.previousSibling_ = childWrapper.nextSibling_ =
+            childWrapper.parentNode_ = undefined;
+      } else {
+        originalRemoveChild.call(this.impl, childNode);
+      }
 
       return childWrapper;
     },
@@ -1303,36 +1484,50 @@
         throw new Error('NotFoundError');
       }
 
-      this.invalidateShadowRenderer();
-
-      var previousNode = oldChildWrapper.previousSibling;
-      var nextNode = oldChildWrapper.nextSibling;
-      if (nextNode === newChildWrapper)
-        nextNode = newChildWrapper.nextSibling;
-      var nodes = collectNodes(newChildWrapper, this,
-                               previousNode, nextNode);
-
-      if (this.firstChild === oldChildWrapper)
-        this.firstChild_ = nodes[0];
-      if (this.lastChild === oldChildWrapper)
-        this.lastChild_ = nodes[nodes.length - 1];
-
-      oldChildWrapper.previousSibling_ = null;
-      oldChildWrapper.nextSibling_ = null;
-      oldChildWrapper.parentNode_ = null;
-
-      // replaceChild no matter what the parent is?
       var oldChildNode = unwrap(oldChildWrapper);
-      if (oldChildNode.parentNode) {
-        originalReplaceChild.call(
-            oldChildNode.parentNode,
-            unwrapNodesForInsertion(nodes),
-            oldChildNode);
+
+      if (this.invalidateShadowRenderer() ||
+          invalidateParent(newChildWrapper)) {
+        var previousNode = oldChildWrapper.previousSibling;
+        var nextNode = oldChildWrapper.nextSibling;
+        if (nextNode === newChildWrapper)
+          nextNode = newChildWrapper.nextSibling;
+        var nodes = collectNodes(newChildWrapper, this,
+                                 previousNode, nextNode);
+
+        if (this.firstChild === oldChildWrapper)
+          this.firstChild_ = nodes[0];
+        if (this.lastChild === oldChildWrapper)
+          this.lastChild_ = nodes[nodes.length - 1];
+
+        oldChildWrapper.previousSibling_ = oldChildWrapper.nextSibling_ =
+            oldChildWrapper.parentNode_ = undefined;
+
+        // replaceChild no matter what the parent is?
+        if (oldChildNode.parentNode) {
+          originalReplaceChild.call(
+              oldChildNode.parentNode,
+              unwrapNodesForInsertion(this, nodes),
+              oldChildNode);
+        }
+      } else {
+        ensureSameOwnerDocument(this, newChildWrapper);
+        originalReplaceChild.call(this.impl, unwrap(newChildWrapper),
+                                  oldChildNode);
       }
 
+      newChildWrapper.nodeWasAdded_();
+
       return oldChildWrapper;
     },
 
+    /**
+     * Called after a node was added. Subclasses override this to invalidate
+     * the renderer as needed.
+     * @private
+     */
+    nodeWasAdded_: function() {},
+
     hasChildNodes: function() {
       return this.firstChild === null;
     },
@@ -1386,11 +1581,14 @@
       return s;
     },
     set textContent(textContent) {
-      removeAllChildNodes(this);
-      this.invalidateShadowRenderer();
-      if (textContent !== '') {
-        var textNode = this.impl.ownerDocument.createTextNode(textContent);
-        this.appendChild(textNode);
+      if (this.invalidateShadowRenderer()) {
+        removeAllChildNodes(this);
+        if (textContent !== '') {
+          var textNode = this.impl.ownerDocument.createTextNode(textContent);
+          this.appendChild(textNode);
+        }
+      } else {
+        this.impl.textContent = textContent;
       }
     },
 
@@ -1418,12 +1616,12 @@
       return clone;
     },
 
-    // insertionParent is added in ShadowRender.js
-
     contains: function(child) {
       if (!child)
         return false;
 
+      child = wrapIfNeeded(child);
+
       // TODO(arv): Optimize using ownerDocument etc.
       if (child === this)
         return true;
@@ -1598,7 +1796,7 @@
     },
 
     get previousElementSibling() {
-      return backwardsElement(this.nextSibling);
+      return backwardsElement(this.previousSibling);
     }
   };
 
@@ -1656,17 +1854,33 @@
   var SelectorsInterface = scope.SelectorsInterface;
   var addWrapNodeListMethod = scope.addWrapNodeListMethod;
   var mixin = scope.mixin;
+  var oneOf = scope.oneOf;
   var registerWrapper = scope.registerWrapper;
   var wrappers = scope.wrappers;
 
   var shadowRootTable = new SideTable();
   var OriginalElement = window.Element;
 
-  var originalMatches =
-      OriginalElement.prototype.matches ||
-      OriginalElement.prototype.mozMatchesSelector ||
-      OriginalElement.prototype.msMatchesSelector ||
-      OriginalElement.prototype.webkitMatchesSelector;
+
+  var matchesName = oneOf(OriginalElement.prototype, [
+    'matches',
+    'mozMatchesSelector',
+    'msMatchesSelector',
+    'webkitMatchesSelector',
+  ]);
+
+  var originalMatches = OriginalElement.prototype[matchesName];
+
+  function invalidateRendererBasedOnAttribute(element, name) {
+    // Only invalidate if parent node is a shadow host.
+    var p = element.parentNode;
+    if (!p || !p.shadowRoot)
+      return;
+
+    var renderer = scope.getRendererForHost(p);
+    if (renderer.dependsOnAttribute(name))
+      renderer.invalidate();
+  }
 
   function Element(node) {
     Node.call(this, node);
@@ -1677,9 +1891,8 @@
       var newShadowRoot = new wrappers.ShadowRoot(this);
       shadowRootTable.set(this, newShadowRoot);
 
-      scope.getRendererForHost(this);
-
-      this.invalidateShadowRenderer(true);
+      var renderer = scope.getRendererForHost(this);
+      renderer.invalidate();
 
       return newShadowRoot;
     },
@@ -1690,10 +1903,12 @@
 
     setAttribute: function(name, value) {
       this.impl.setAttribute(name, value);
-      // This is a bit agressive. We need to invalidate if it affects
-      // the rendering content[select] or if it effects the value of a content
-      // select.
-      this.invalidateShadowRenderer();
+      invalidateRendererBasedOnAttribute(this, name);
+    },
+
+    removeAttribute: function(name) {
+      this.impl.removeAttribute(name);
+      invalidateRendererBasedOnAttribute(this, name);
     },
 
     matches: function(selector) {
@@ -1701,6 +1916,37 @@
     }
   });
 
+  Element.prototype[matchesName] = function(selector) {
+    return this.matches(selector);
+  };
+
+  if (OriginalElement.prototype.webkitCreateShadowRoot) {
+    Element.prototype.webkitCreateShadowRoot =
+        Element.prototype.createShadowRoot;
+  }
+
+  /**
+   * Useful for generating the accessor pair for a property that reflects an
+   * attribute.
+   */
+  function setterDirtiesAttribute(prototype, propertyName, opt_attrName) {
+    var attrName = opt_attrName || propertyName;
+    Object.defineProperty(prototype, propertyName, {
+      get: function() {
+        return this.impl[propertyName];
+      },
+      set: function(v) {
+        this.impl[propertyName] = v;
+        invalidateRendererBasedOnAttribute(this, attrName);
+      },
+      configurable: true,
+      enumerable: true
+    });
+  }
+
+  setterDirtiesAttribute(Element.prototype, 'id');
+  setterDirtiesAttribute(Element.prototype, 'className', 'class');
+
   mixin(Element.prototype, ChildNodeInterface);
   mixin(Element.prototype, GetElementsByInterface);
   mixin(Element.prototype, ParentNodeInterface);
@@ -1708,6 +1954,9 @@
 
   registerWrapper(OriginalElement, Element);
 
+  // TODO(arv): Export setterDirtiesAttribute and apply it to more bindings
+  // that reflect attributes.
+  scope.matchesName = matchesName;
   scope.wrappers.Element = Element;
 })(this.ShadowDOMPolyfill);
 
@@ -1802,7 +2051,7 @@
   function setInnerHTML(node, value, opt_tagName) {
     var tagName = opt_tagName || 'div';
     node.textContent = '';
-    var tempElement =unwrap(node.ownerDocument.createElement(tagName));
+    var tempElement = unwrap(node.ownerDocument.createElement(tagName));
     tempElement.innerHTML = value;
     var firstChild;
     while (firstChild = tempElement.firstChild) {
@@ -1823,7 +2072,10 @@
       return getInnerHTML(this);
     },
     set innerHTML(value) {
-      setInnerHTML(this, value, this.tagName);
+      if (this.invalidateShadowRenderer())
+        setInnerHTML(this, value, this.tagName);
+      else
+        this.impl.innerHTML = value;
     },
 
     get outerHTML() {
@@ -1832,10 +2084,10 @@
       return getOuterHTML(this);
     },
     set outerHTML(value) {
-      if (!this.invalidateShadowRenderer()) {
+      var p = this.parentNode;
+      if (p) {
+        p.invalidateShadowRenderer();
         this.impl.outerHTML = value;
-      } else {
-        throw new Error('not implemented');
       }
     }
   });
@@ -1945,18 +2197,9 @@
 
   function HTMLShadowElement(node) {
     HTMLElement.call(this, node);
-    this.olderShadowRoot_ = null;
   }
   HTMLShadowElement.prototype = Object.create(HTMLElement.prototype);
   mixin(HTMLShadowElement.prototype, {
-    get olderShadowRoot() {
-      return this.olderShadowRoot_;
-    },
-
-    invalidateShadowRenderer: function() {
-      HTMLElement.prototype.invalidateShadowRenderer.call(this, true);
-    },
-
     // TODO: attribute boolean resetStyleInheritance;
   });
 
@@ -1965,6 +2208,7 @@
 
   scope.wrappers.HTMLShadowElement = HTMLShadowElement;
 })(this.ShadowDOMPolyfill);
+
 // Copyright 2013 The Polymer Authors. All rights reserved.
 // Use of this source code is goverened by a BSD-style
 // license that can be found in the LICENSE file.
@@ -1977,6 +2221,7 @@
   var mixin = scope.mixin;
   var registerWrapper = scope.registerWrapper;
   var setInnerHTML = scope.setInnerHTML;
+  var unwrap = scope.unwrap;
   var wrap = scope.wrap;
 
   var contentTable = new SideTable();
@@ -2000,9 +2245,9 @@
   }
 
   function extractContent(templateElement) {
+    // templateElement is not a wrapper here.
     var doc = getTemplateContentsOwner(templateElement.ownerDocument);
-    var df = doc.createDocumentFragment();
-    var nextSibling;
+    var df = unwrap(doc.createDocumentFragment());
     var child;
     while (child = templateElement.firstChild) {
       df.appendChild(child);
@@ -2014,6 +2259,10 @@
 
   function HTMLTemplateElement(node) {
     HTMLElement.call(this, node);
+    if (!OriginalHTMLTemplateElement) {
+      var content = extractContent(node);
+      contentTable.set(this, wrap(content));
+    }
   }
   HTMLTemplateElement.prototype = Object.create(HTMLElement.prototype);
 
@@ -2021,16 +2270,7 @@
     get content() {
       if (OriginalHTMLTemplateElement)
         return wrap(this.impl.content);
-
-      // TODO(arv): This should be done in createCallback. I initially tried to
-      // do this in the constructor but the wrapper is not yet created at that
-      // point in time so we hit an iloop.
-      var content = contentTable.get(this);
-      if (!content) {
-        content = extractContent(this);
-        contentTable.set(this, content);
-      }
-      return content;
+      return contentTable.get(this);
     },
 
     get innerHTML() {
@@ -2038,7 +2278,6 @@
     },
     set innerHTML(value) {
       setInnerHTML(this.content, value);
-      this.invalidateShadowRenderer();
     }
 
     // TODO(arv): cloneNode needs to clone content.
@@ -2124,6 +2363,7 @@
   var unwrap = scope.unwrap;
 
   var shadowHostTable = new SideTable();
+  var nextOlderShadowTreeTable = new SideTable();
 
   function ShadowRoot(hostWrapper) {
     var node = unwrap(hostWrapper.impl.ownerDocument.createDocumentFragment());
@@ -2134,7 +2374,7 @@
     rewrap(node, this);
 
     var oldShadowRoot = hostWrapper.shadowRoot;
-    scope.nextOlderShadowTreeTable.set(this, oldShadowRoot);
+    nextOlderShadowTreeTable.set(this, oldShadowRoot);
 
     shadowHostTable.set(this, hostWrapper);
   }
@@ -2148,6 +2388,10 @@
       this.invalidateShadowRenderer();
     },
 
+    get olderShadowRoot() {
+      return nextOlderShadowTreeTable.get(this) || null;
+    },
+
     invalidateShadowRenderer: function() {
       return shadowHostTable.get(this).invalidateShadowRenderer();
     },
@@ -2174,9 +2418,13 @@
   'use strict';
 
   var HTMLContentElement = scope.wrappers.HTMLContentElement;
+  var HTMLShadowElement = scope.wrappers.HTMLShadowElement;
   var Node = scope.wrappers.Node;
+  var ShadowRoot = scope.wrappers.ShadowRoot;
   var assert = scope.assert;
+  var getHostForShadowRoot = scope.getHostForShadowRoot;
   var mixin = scope.mixin;
+  var oneOf = scope.oneOf;
   var unwrap = scope.unwrap;
   var wrap = scope.wrap;
 
@@ -2219,7 +2467,8 @@
   function removeAllChildNodes(parentNodeWrapper) {
     var parentNode = unwrap(parentNodeWrapper);
     updateAllChildNodes(parentNodeWrapper);
-    parentNode.textContent = '';
+    if (parentNode.firstChild)
+      parentNode.textContent = '';
   }
 
   function appendChild(parentNodeWrapper, childWrapper) {
@@ -2274,7 +2523,6 @@
   var distributedChildNodesTable = new SideTable();
   var eventParentsTable = new SideTable();
   var insertionParentTable = new SideTable();
-  var nextOlderShadowTreeTable = new SideTable();
   var rendererForHostTable = new SideTable();
   var shadowDOMRendererTable = new SideTable();
 
@@ -2288,7 +2536,7 @@
 
   function distributeChildToInsertionPoint(child, insertionPoint) {
     getDistributedChildNodes(insertionPoint).push(child);
-    insertionParentTable.set(child, insertionPoint);
+    assignToInsertionPoint(child, insertionPoint);
 
     var eventParents = eventParentsTable.get(child);
     if (!eventParents)
@@ -2333,33 +2581,6 @@
     }
   }
 
-  // http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#dfn-distribution-algorithm
-  function distribute(tree, pool) {
-    var anyRemoved = false;
-
-    visit(tree, isActiveInsertionPoint,
-        function(insertionPoint) {
-          resetDistributedChildNodes(insertionPoint);
-          for (var i = 0; i < pool.length; i++) {  // 1.2
-            var node = pool[i];  // 1.2.1
-            if (node === undefined)  // removed
-              continue;
-            if (matchesCriteria(node, insertionPoint)) {  // 1.2.2
-              distributeChildToInsertionPoint(node, insertionPoint);  // 1.2.2.1
-              pool[i] = undefined;  // 1.2.2.2
-              anyRemoved = true;
-            }
-          }
-        });
-
-    if (!anyRemoved)
-      return pool;
-
-    return pool.filter(function(item) {
-      return item !== undefined;
-    });
-  }
-
   // Matching Insertion Points
   // http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#matching-insertion-points
 
@@ -2386,13 +2607,6 @@
   ].join('|') + ')');
 
 
-  function oneOf(object, propertyNames) {
-    for (var i = 0; i < propertyNames.length; i++) {
-      if (propertyNames[i] in object)
-        return propertyNames[i];
-    }
-  }
-
   /**
    * @param {Element} node
    * @oaram {Element} point The insertion point element.
@@ -2447,9 +2661,15 @@
   function ShadowRenderer(host) {
     this.host = host;
     this.dirty = false;
+    this.invalidateAttributes();
     this.associateNode(host);
   }
 
+  /**
+   * Returns existing shadow renderer for a host or creates it if it is needed.
+   * @params {!Element} host
+   * @return {!ShadowRenderer}
+   */
   function getRendererForHost(host) {
     var renderer = rendererForHostTable.get(host);
     if (!renderer) {
@@ -2459,17 +2679,30 @@
     return renderer;
   }
 
+  function getShadowRootAncestor(node) {
+    for (; node; node = node.parentNode) {
+      if (node instanceof ShadowRoot)
+        return node;
+    }
+    return null;
+  }
+
+  function getRendererForShadowRoot(shadowRoot) {
+    return getRendererForHost(getHostForShadowRoot(shadowRoot));
+  }
+
   ShadowRenderer.prototype = {
+
     // http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#rendering-shadow-trees
     render: function() {
       if (!this.dirty)
         return;
 
-      var host = this.host;
+      this.invalidateAttributes();
       this.treeComposition();
+
+      var host = this.host;
       var shadowDOM = host.shadowRoot;
-      if (!shadowDOM)
-        return;
 
       this.removeAllChildNodes(this.host);
 
@@ -2506,14 +2739,18 @@
       }
     },
 
-    renderAsAnyDomTree: function(visualParent, tree, child, isNested) {
-      this.appendChild(visualParent, child);
+    renderAsAnyDomTree: function(visualParent, tree, node, isNested) {
+      this.appendChild(visualParent, node);
 
-      if (isShadowHost(child)) {
-        render(child);
+      if (isShadowHost(node)) {
+        render(node);
       } else {
-        var parent = child;
+        var parent = node;
         var logicalChildNodes = getChildNodesSnapshot(parent);
+        // We associate the parent of a content/shadow with the renderer
+        // because we may need to remove stale childNodes.
+        if (shadowDOMRendererTable.get(parent))
+          this.removeAllChildNodes(parent);
         logicalChildNodes.forEach(function(node) {
           this.renderNode(parent, tree, node, isNested);
         }, this);
@@ -2538,11 +2775,9 @@
     },
 
     renderShadowInsertionPoint: function(visualParent, tree, shadowInsertionPoint) {
-      var nextOlderTree = getNextOlderTree(tree);
+      var nextOlderTree = tree.olderShadowRoot;
       if (nextOlderTree) {
-        // This makes ShadowRoot have its insertionParent be the <shadow>.
-        insertionParentTable.set(nextOlderTree, shadowInsertionPoint);
-        shadowInsertionPoint.olderShadowRoot_ = nextOlderTree;
+        assignToInsertionPoint(nextOlderTree, shadowInsertionPoint);
         this.remove(shadowInsertionPoint);
         var shadowDOMChildNodes = getChildNodesSnapshot(nextOlderTree);
         shadowDOMChildNodes.forEach(function(node) {
@@ -2555,11 +2790,82 @@
 
     renderFallbackContent: function (visualParent, fallbackHost) {
       var logicalChildNodes = getChildNodesSnapshot(fallbackHost);
+      this.associateNode(fallbackHost);
+      this.remove(fallbackHost);
       logicalChildNodes.forEach(function(node) {
         this.appendChild(visualParent, node);
       }, this);
     },
 
+    /**
+     * Invalidates the attributes used to keep track of which attributes may
+     * cause the renderer to be invalidated.
+     */
+    invalidateAttributes: function() {
+      this.attributes = Object.create(null);
+    },
+
+    /**
+     * Parses the selector and makes this renderer dependent on the attribute
+     * being used in the selector.
+     * @param {string} selector
+     */
+    updateDependentAttributes: function(selector) {
+      if (!selector)
+        return;
+
+      var attributes = this.attributes;
+
+      // .class
+      if (/\.\w+/.test(selector))
+        attributes['class'] = true;
+
+      // #id
+      if (/#\w+/.test(selector))
+        attributes['id'] = true;
+
+      selector.replace(/\[\s*([^\s=\|~\]]+)/g, function(_, name) {
+        attributes[name] = true;
+      });
+
+      // Pseudo selectors have been removed from the spec.
+    },
+
+    dependsOnAttribute: function(name) {
+      return this.attributes[name];
+    },
+
+    // http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#dfn-distribution-algorithm
+    distribute: function(tree, pool) {
+      var anyRemoved = false;
+      var self = this;
+
+      visit(tree, isActiveInsertionPoint,
+          function(insertionPoint) {
+            resetDistributedChildNodes(insertionPoint);
+            self.updateDependentAttributes(
+                insertionPoint.getAttribute('select'));
+
+            for (var i = 0; i < pool.length; i++) {  // 1.2
+              var node = pool[i];  // 1.2.1
+              if (node === undefined)  // removed
+                continue;
+              if (matchesCriteria(node, insertionPoint)) {  // 1.2.2
+                distributeChildToInsertionPoint(node, insertionPoint);  // 1.2.2.1
+                pool[i] = undefined;  // 1.2.2.2
+                anyRemoved = true;
+              }
+            }
+          });
+
+      if (!anyRemoved)
+        return pool;
+
+      return pool.filter(function(item) {
+        return item !== undefined;
+      });
+    },
+
     // http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#dfn-tree-composition
     treeComposition: function () {
       var shadowHost = this.host;
@@ -2588,14 +2894,14 @@
         });
         point = shadowInsertionPoint;
 
-        pool = distribute(tree, pool);  // 4.2.
+        pool = this.distribute(tree, pool);  // 4.2.
         if (point) {  // 4.3.
-          var nextOlderTree = getNextOlderTree(tree);  // 4.3.1.
+          var nextOlderTree = tree.olderShadowRoot;  // 4.3.1.
           if (!nextOlderTree) {
             break;  // 4.3.1.1.
           } else {
             tree = nextOlderTree;  // 4.3.2.2.
-            assignShadowTreeToShadowInsertionPoint(tree, point);  // 4.3.2.2.
+            assignToInsertionPoint(tree, point);  // 4.3.2.2.
             continue;  // 4.3.2.3.
           }
         } else {
@@ -2604,24 +2910,24 @@
       }
     },
 
-    // Visual DOM mutation.
     appendChild: function(parent, child) {
+      // this.associateNode(child);
+      this.associateNode(parent);
       appendChild(parent, child);
-      this.associateNode(child);
     },
 
     remove: function(node) {
+      // this.associateNode(node);
+      this.associateNode(node.parentNode);
       remove(node);
-      this.associateNode(node);
     },
 
     removeAllChildNodes: function(parent) {
+      this.associateNode(parent);
       removeAllChildNodes(parent);
-      // TODO(arv): Does this need to associate all the nodes with this renderer?
     },
 
     associateNode: function(node) {
-      // TODO: Clear when moved out of shadow tree.
       shadowDOMRendererTable.set(node, this);
     }
   };
@@ -2646,28 +2952,19 @@
   }
 
   function isShadowHost(shadowHost) {
-    return !!shadowHost.shadowRoot;
-  }
-
-  /**
-   * @param {WrapperShadowRoot} tree
-   */
-  function getNextOlderTree(tree) {
-    return nextOlderShadowTreeTable.get(tree);
+    return shadowHost.shadowRoot;
   }
 
   function getShadowTrees(host) {
     var trees = [];
 
-    for (var tree = host.shadowRoot;
-         tree;
-         tree = nextOlderShadowTreeTable.get(tree)) {
+    for (var tree = host.shadowRoot; tree; tree = tree.olderShadowRoot) {
       trees.push(tree);
     }
     return trees;
   }
 
-  function assignShadowTreeToShadowInsertionPoint(tree, point) {
+  function assignToInsertionPoint(tree, point) {
     insertionParentTable.set(tree, point);
   }
 
@@ -2676,41 +2973,54 @@
     new ShadowRenderer(host).render();
   };
 
-  Node.prototype.invalidateShadowRenderer = function(force) {
-    // TODO: If this is in light DOM we only need to invalidate renderer if this
-    // is a direct child of a ShadowRoot.
-    // Maybe we should only associate renderers with direct child nodes of a
-    // shadow root (and all nodes in the shadow dom).
-    var renderer = shadowDOMRendererTable.get(this);
-    if (!renderer)
-      return false;
+  // Need to rerender shadow host when:
+  //
+  // - a direct child to the ShadowRoot is added or removed
+  // - a direct child to the host is added or removed
+  // - a new shadow root is created
+  // - a direct child to a content/shadow element is added or removed
+  // - a sibling to a content/shadow element is added or removed
+  // - content[select] is changed
+  // - an attribute in a direct child to a host is modified
 
-    var p;
-    if (force || this.shadowRoot ||
-        (p = this.parentNode) && (p.shadowRoot || p instanceof ShadowRoot)) {
+  /**
+   * This gets called when a node was added or removed to it.
+   */
+  Node.prototype.invalidateShadowRenderer = function(force) {
+    var renderer = shadowDOMRendererTable.get(this);
+    if (renderer) {
       renderer.invalidate();
+      return true;
     }
 
-    return true;
+    return false;
   };
 
   HTMLContentElement.prototype.getDistributedNodes = function() {
-    // TODO(arv): We should associate the element with the shadow root so we
-    // only have to rerender this ShadowRenderer.
-    renderAllPending();
+    var renderer = shadowDOMRendererTable.get(this);
+    if (renderer)
+      renderer.render();
     return getDistributedChildNodes(this);
   };
 
-  mixin(Node.prototype, {
-    get insertionParent() {
-      return insertionParentTable.get(this) || null;
-    }
-  });
+  HTMLShadowElement.prototype.nodeWasAdded_ =
+  HTMLContentElement.prototype.nodeWasAdded_ = function() {
+    // Invalidate old renderer if any.
+    this.invalidateShadowRenderer();
+
+    var shadowRoot = getShadowRootAncestor(this);
+    var renderer;
+    if (shadowRoot)
+      renderer = getRendererForShadowRoot(shadowRoot);
+    shadowDOMRendererTable.set(this, renderer);
+    if (renderer)
+      renderer.invalidate();
+  };
 
   scope.eventParentsTable = eventParentsTable;
   scope.getRendererForHost = getRendererForHost;
   scope.getShadowTrees = getShadowTrees;
-  scope.nextOlderShadowTreeTable = nextOlderShadowTreeTable;
+  scope.insertionParentTable = insertionParentTable;
   scope.renderAllPending = renderAllPending;
 
   // Exposed for testing
@@ -2728,13 +3038,70 @@
 (function(scope) {
   'use strict';
 
+  var HTMLElement = scope.wrappers.HTMLElement;
+  var assert = scope.assert;
+  var mixin = scope.mixin;
+  var registerWrapper = scope.registerWrapper;
+  var unwrap = scope.unwrap;
+  var wrap = scope.wrap;
+
+  var elementsWithFormProperty = [
+    'HTMLButtonElement',
+    'HTMLFieldSetElement',
+    'HTMLInputElement',
+    'HTMLKeygenElement',
+    'HTMLLabelElement',
+    'HTMLLegendElement',
+    'HTMLObjectElement',
+    'HTMLOptionElement',
+    'HTMLOutputElement',
+    'HTMLSelectElement',
+    'HTMLTextAreaElement',
+  ];
+
+  function createWrapperConstructor(name) {
+    if (!window[name])
+      return;
+
+    // Ensure we are not overriding an already existing constructor.
+    assert(!scope.wrappers[name]);
+
+    var GeneratedWrapper = function(node) {
+      // At this point all of them extend HTMLElement.
+      HTMLElement.call(this, node);
+    }
+    GeneratedWrapper.prototype = Object.create(HTMLElement.prototype);
+    mixin(GeneratedWrapper.prototype, {
+      get form() {
+        return wrap(unwrap(this).form);
+      },
+    });
+
+    registerWrapper(window[name], GeneratedWrapper,
+        document.createElement(name.slice(4, -7)));
+    scope.wrappers[name] = GeneratedWrapper;
+  }
+
+  elementsWithFormProperty.forEach(createWrapperConstructor);
+
+})(this.ShadowDOMPolyfill);
+
+// Copyright 2013 The Polymer Authors. All rights reserved.
+// Use of this source code is goverened by a BSD-style
+// license that can be found in the LICENSE file.
+
+(function(scope) {
+  'use strict';
+
   var GetElementsByInterface = scope.GetElementsByInterface;
   var Node = scope.wrappers.Node;
   var ParentNodeInterface = scope.ParentNodeInterface;
   var SelectorsInterface = scope.SelectorsInterface;
+  var ShadowRoot = scope.wrappers.ShadowRoot;
   var defineWrapGetter = scope.defineWrapGetter;
   var elementFromPoint = scope.elementFromPoint;
   var forwardMethodsToWrapper = scope.forwardMethodsToWrapper;
+  var matchesName = scope.matchesName;
   var mixin = scope.mixin;
   var registerWrapper = scope.registerWrapper;
   var unwrap = scope.unwrap;
@@ -2767,48 +3134,145 @@
   }
 
   [
-    'getElementById',
+    'createComment',
+    'createDocumentFragment',
     'createElement',
     'createElementNS',
-    'createTextNode',
-    'createDocumentFragment',
     'createEvent',
     'createEventNS',
+    'createRange',
+    'createTextNode',
+    'getElementById',
   ].forEach(wrapMethod);
 
   var originalAdoptNode = document.adoptNode;
-  var originalWrite = document.write;
+
+  function adoptNodeNoRemove(node, doc) {
+    originalAdoptNode.call(doc.impl, unwrap(node));
+    adoptSubtree(node, doc);
+  }
+
+  function adoptSubtree(node, doc) {
+    if (node.shadowRoot)
+      doc.adoptNode(node.shadowRoot);
+    if (node instanceof ShadowRoot)
+      adoptOlderShadowRoots(node, doc);
+    for (var child = node.firstChild; child; child = child.nextSibling) {
+      adoptSubtree(child, doc);
+    }
+  }
+
+  function adoptOlderShadowRoots(shadowRoot, doc) {
+    var oldShadowRoot = shadowRoot.olderShadowRoot;
+    if (oldShadowRoot)
+      doc.adoptNode(oldShadowRoot);
+  }
 
   mixin(Document.prototype, {
     adoptNode: function(node) {
-      originalAdoptNode.call(this.impl, unwrap(node));
+      if (node.parentNode)
+        node.parentNode.removeChild(node);
+      adoptNodeNoRemove(node, this);
       return node;
     },
     elementFromPoint: function(x, y) {
       return elementFromPoint(this, this, x, y);
-    },
-    write: function(s) {
-      var all = this.querySelectorAll('*');
-      var last = all[all.length - 1];
-      while (last.nextSibling) {
-        last = last.nextSibling;
-      }
-      var p = last.parentNode;
-      p.lastChild_ = undefined;
-      last.nextSibling_ = undefined;
-      originalWrite.call(this.impl, s);
     }
   });
 
+  if (document.register) {
+    var originalRegister = document.register;
+    Document.prototype.register = function(tagName, object) {
+      var prototype = object.prototype;
+
+      // If we already used the object as a prototype for another custom
+      // element.
+      if (scope.nativePrototypeTable.get(prototype)) {
+        // TODO(arv): DOMException
+        throw new Error('NotSupportedError');
+      }
+
+      // Find first object on the prototype chain that already have a native
+      // prototype. Keep track of all the objects before that so we can create
+      // a similar structure for the native case.
+      var proto = Object.getPrototypeOf(prototype);
+      var nativePrototype;
+      var prototypes = [];
+      while (proto) {
+        nativePrototype = scope.nativePrototypeTable.get(proto);
+        if (nativePrototype)
+          break;
+        prototypes.push(proto);
+        proto = Object.getPrototypeOf(proto);
+      }
+
+      if (!nativePrototype) {
+        // TODO(arv): DOMException
+        throw new Error('NotSupportedError');
+      }
+
+      // This works by creating a new prototype object that is empty, but has
+      // the native prototype as its proto. The original prototype object
+      // passed into register is used as the wrapper prototype.
+
+      var newPrototype = Object.create(nativePrototype);
+      for (var i = prototypes.length - 1; i >= 0; i--) {
+        newPrototype = Object.create(newPrototype);
+      }
+
+      // Add callbacks if present.
+      // Names are taken from:
+      //   https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.cpp&sq=package:chromium&type=cs&l=156
+      // and not from the spec since the spec is out of date.
+      [
+        'createdCallback',
+        'enteredDocumentCallback',
+        'leftDocumentCallback',
+        'attributeChangedCallback',
+      ].forEach(function(name) {
+        var f = prototype[name];
+        if (!f)
+          return;
+        newPrototype[name] = function() {
+          f.apply(wrap(this), arguments);
+        };
+      });
+
+      var nativeConstructor = originalRegister.call(unwrap(this), tagName,
+          {prototype: newPrototype});
+
+      function GeneratedWrapper(node) {
+        if (!node)
+          return document.createElement(tagName);
+        this.impl = node;
+      }
+      GeneratedWrapper.prototype = prototype;
+      GeneratedWrapper.prototype.constructor = GeneratedWrapper;
+
+      scope.constructorTable.set(newPrototype, GeneratedWrapper);
+      scope.nativePrototypeTable.set(prototype, newPrototype);
+
+      return GeneratedWrapper;
+    };
+
+    forwardMethodsToWrapper([
+      window.HTMLDocument || window.Document,  // Gecko adds these to HTMLDocument
+    ], [
+      'register',
+    ]);
+  }
+
   // We also override some of the methods on document.body and document.head
   // for convenience.
   forwardMethodsToWrapper([
     window.HTMLBodyElement,
     window.HTMLDocument || window.Document,  // Gecko adds these to HTMLDocument
     window.HTMLHeadElement,
+    window.HTMLHtmlElement,
   ], [
     'appendChild',
     'compareDocumentPosition',
+    'contains',
     'getElementsByClassName',
     'getElementsByTagName',
     'getElementsByTagNameNS',
@@ -2817,21 +3281,24 @@
     'querySelectorAll',
     'removeChild',
     'replaceChild',
+    matchesName,
   ]);
 
   forwardMethodsToWrapper([
     window.HTMLDocument || window.Document,  // Gecko adds these to HTMLDocument
   ], [
     'adoptNode',
+    'contains',
+    'createComment',
     'createDocumentFragment',
     'createElement',
     'createElementNS',
     'createEvent',
     'createEventNS',
+    'createRange',
     'createTextNode',
     'elementFromPoint',
     'getElementById',
-    'write',
   ]);
 
   mixin(Document.prototype, GetElementsByInterface);
@@ -2898,8 +3365,9 @@
     'hasFeature',
   ]);
 
-  scope.wrappers.Document = Document;
+  scope.adoptNodeNoRemove = adoptNodeNoRemove;
   scope.wrappers.DOMImplementation = DOMImplementation;
+  scope.wrappers.Document = Document;
 
 })(this.ShadowDOMPolyfill);
 
@@ -3046,6 +3514,99 @@
 (function(scope) {
   'use strict';
 
+  var registerWrapper = scope.registerWrapper;
+  var unwrap = scope.unwrap;
+  var unwrapIfNeeded = scope.unwrapIfNeeded;
+  var wrap = scope.wrap;
+
+  var OriginalRange = window.Range;
+
+  function Range(impl) {
+    this.impl = impl;
+  }
+  Range.prototype = {
+    get startContainer() {
+      return wrap(this.impl.startContainer);
+    },
+    get endContainer() {
+      return wrap(this.impl.endContainer);
+    },
+    get commonAncestorContainer() {
+      return wrap(this.impl.commonAncestorContainer);
+    },
+    setStart: function(refNode,offset) {
+      this.impl.setStart(unwrapIfNeeded(refNode), offset);
+    },
+    setEnd: function(refNode,offset) {
+      this.impl.setEnd(unwrapIfNeeded(refNode), offset);
+    },
+    setStartBefore: function(refNode) {
+      this.impl.setStartBefore(unwrapIfNeeded(refNode));
+    },
+    setStartAfter: function(refNode) {
+      this.impl.setStartAfter(unwrapIfNeeded(refNode));
+    },
+    setEndBefore: function(refNode) {
+      this.impl.setEndBefore(unwrapIfNeeded(refNode));
+    },
+    setEndAfter: function(refNode) {
+      this.impl.setEndAfter(unwrapIfNeeded(refNode));
+    },
+    selectNode: function(refNode) {
+      this.impl.selectNode(unwrapIfNeeded(refNode));
+    },
+    selectNodeContents: function(refNode) {
+      this.impl.selectNodeContents(unwrapIfNeeded(refNode));
+    },
+    compareBoundaryPoints: function(how, sourceRange) {
+      return this.impl.compareBoundaryPoints(how, unwrap(sourceRange));
+    },
+    extractContents: function() {
+      return wrap(this.impl.extractContents());
+    },
+    cloneContents: function() {
+      return wrap(this.impl.cloneContents());
+    },
+    insertNode: function(node) {
+      this.impl.insertNode(unwrapIfNeeded(node));
+    },
+    surroundContents: function(newParent) {
+      this.impl.surroundContents(unwrapIfNeeded(newParent));
+    },
+    cloneRange: function() {
+      return wrap(this.impl.cloneRange());
+    },
+    isPointInRange: function(node, offset) {
+      return this.impl.isPointInRange(unwrapIfNeeded(node), offset);
+    },
+    comparePoint: function(node, offset) {
+      return this.impl.comparePoint(unwrapIfNeeded(node), offset);
+    },
+    intersectsNode: function(node) {
+      return this.impl.intersectsNode(unwrapIfNeeded(node));
+    }
+  };
+
+  // IE9 does not have createContextualFragment.
+  if (OriginalRange.prototype.createContextualFragment) {
+    Range.prototype.createContextualFragment = function(html) {
+      return wrap(this.impl.createContextualFragment(html));
+    };
+  }
+
+  registerWrapper(window.Range, Range);
+
+  scope.wrappers.Range = Range;
+
+})(this.ShadowDOMPolyfill);
+
+// Copyright 2013 The Polymer Authors. All rights reserved.
+// Use of this source code is goverened by a BSD-style
+// license that can be found in the LICENSE file.
+
+(function(scope) {
+  'use strict';
+
   var isWrapperFor = scope.isWrapperFor;
 
   // This is a list of the elements we currently override the global constructor
@@ -3171,31 +3732,34 @@
   window.dartExperimentalFixupGetTag = function(originalGetTag) {
     var NodeList = ShadowDOMPolyfill.wrappers.NodeList;
     var ShadowRoot = ShadowDOMPolyfill.wrappers.ShadowRoot;
-    var isWrapper = ShadowDOMPolyfill.isWrapper;
-    var unwrap = ShadowDOMPolyfill.unwrap;
+    var unwrapIfNeeded = ShadowDOMPolyfill.unwrapIfNeeded;
     function getTag(obj) {
+      // TODO(jmesserly): do we still need these?
       if (obj instanceof NodeList) return 'NodeList';
       if (obj instanceof ShadowRoot) return 'ShadowRoot';
       if (obj instanceof MutationRecord) return 'MutationRecord';
       if (obj instanceof MutationObserver) return 'MutationObserver';
 
-      if (isWrapper(obj)) {
-        obj = unwrap(obj);
-
-        // Fix up class names for Firefox. For some of them like
-        // HTMLFormElement and HTMLInputElement, the "constructor" property of
-        // the unwrapped nodes points at the wrapper for some reason.
-        // TODO(jmesserly): figure out why this is happening.
+      var unwrapped = unwrapIfNeeded(obj);
+      if (obj !== unwrapped) {
+        // Fix up class names for Firefox.
+        // For some of them (like HTMLFormElement and HTMLInputElement),
+        // the "constructor" property of the unwrapped nodes points at the
+        // wrapper.
+        // Note: it is safe to check for the GeneratedWrapper string because
+        // we know it is some kind of Shadow DOM wrapper object.
         var ctor = obj.constructor;
-        if (ctor && ctor._ShadowDOMPolyfill$isGeneratedWrapper) {
+        if (ctor && ctor.name == 'GeneratedWrapper') {
           var name = ctor._ShadowDOMPolyfill$cacheTag_;
           if (!name) {
-            name = Object.prototype.toString.call(obj);
+            name = Object.prototype.toString.call(unwrapped);
             name = name.substring(8, name.length - 1);
             ctor._ShadowDOMPolyfill$cacheTag_ = name;
           }
           return name;
         }
+
+        obj = unwrapped;
       }
       return originalGetTag(obj);
     }
diff --git a/pkg/shadow_dom/lib/shadow_dom.min.js b/pkg/shadow_dom/lib/shadow_dom.min.js
index 888ec35..7d3ff1b 100644
--- a/pkg/shadow_dom/lib/shadow_dom.min.js
+++ b/pkg/shadow_dom/lib/shadow_dom.min.js
@@ -1,2 +1,2 @@
-if(!HTMLElement.prototype.createShadowRoot&&!HTMLElement.prototype.webkitCreateShadowRoot||window.__forceShadowDomPolyfill){!function(){Element.prototype.webkitCreateShadowRoot&&(Element.prototype.webkitCreateShadowRoot=function(){return window.ShadowDOMPolyfill.wrapIfNeeded(this).createShadowRoot()})}();var SideTable;"undefined"!=typeof WeakMap&&navigator.userAgent.indexOf("Firefox/")<0?SideTable=WeakMap:function(){var a=Object.defineProperty,b=Object.hasOwnProperty,c=(new Date).getTime()%1e9;SideTable=function(){this.name="__st"+(1e9*Math.random()>>>0)+(c++ +"__")},SideTable.prototype={set:function(b,c){a(b,this.name,{value:c,writable:!0})},get:function(a){return b.call(a,this.name)?a[this.name]:void 0},"delete":function(a){this.set(a,void 0)}}}();var ShadowDOMPolyfill={};!function(a){"use strict";function b(a){if(!a)throw new Error("Assertion failed")}function c(a,b){return Object.getOwnPropertyNames(b).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))}),a}function d(a,b){return Object.getOwnPropertyNames(b).forEach(function(c){switch(c){case"arguments":case"caller":case"length":case"name":case"prototype":case"toString":return}Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))}),a}function e(a){var b=a.__proto__||Object.getPrototypeOf(a),c=y.get(b);if(c)return c;var d=e(b),f=m(d);return j(b,f,a),f}function f(a,b){h(a,b,!0)}function g(a,b){h(b,a,!1)}function h(a,b,c){Object.getOwnPropertyNames(a).forEach(function(d){if(!(d in b)){A&&a.__lookupGetter__(d);var e;try{e=Object.getOwnPropertyDescriptor(a,d)}catch(f){e=B}var g,h;if(c&&"function"==typeof e.value)return b[d]=function(){return this.impl[d].apply(this.impl,arguments)},void 0;g=function(){return this.impl[d]},(e.writable||e.set)&&(h=function(a){this.impl[d]=a}),Object.defineProperty(b,d,{get:g,set:h,configurable:e.configurable,enumerable:e.enumerable})}})}function i(a,b,c){var e=a.prototype;j(e,b,c),d(b,a)}function j(a,c,d){var e=c.prototype;b(void 0===y.get(a)),y.set(a,c),f(a,e),d&&g(e,d)}function k(a,b){return y.get(b.prototype)===a}function l(a){var b=Object.getPrototypeOf(a),c=e(b),d=m(c);return j(b,d,a),d}function m(a){function b(b){a.call(this,b)}return b.prototype=Object.create(a.prototype),b.prototype.constructor=b,b._ShadowDOMPolyfill$isGeneratedWrapper=!0,b}function n(a){return a instanceof z.EventTarget||a instanceof z.Event||a instanceof z.DOMImplementation}function o(a){return a instanceof E||a instanceof D||a instanceof F||a instanceof C}function p(a){if(null===a)return null;b(o(a));var c=x.get(a);if(!c){var d=e(a);c=new d(a),x.set(a,c)}return c}function q(a){return null===a?null:(b(n(a)),a.impl)}function r(a){return a&&n(a)?q(a):a}function s(a){return a&&!n(a)?p(a):a}function t(a,c){null!==c&&(b(o(a)),b(void 0===c||n(c)),x.set(a,c))}function u(a,b,c){Object.defineProperty(a.prototype,b,{get:c,configurable:!0,enumerable:!0})}function v(a,b){u(a,b,function(){return p(this.impl[b])})}function w(a,b){a.forEach(function(a){b.forEach(function(b){a.prototype[b]=function(){var a=p(this);return a[b].apply(a,arguments)}})})}var x=new SideTable,y=new SideTable,z=Object.create(null);Object.getOwnPropertyNames(window);var A=/Firefox/.test(navigator.userAgent),B={get:function(){},set:function(){},configurable:!0,enumerable:!0},C=DOMImplementation,D=Event,E=Node,F=Window;a.assert=b,a.defineGetter=u,a.defineWrapGetter=v,a.forwardMethodsToWrapper=w,a.isWrapper=n,a.isWrapperFor=k,a.mixin=c,a.registerObject=l,a.registerWrapper=i,a.rewrap=t,a.unwrap=q,a.unwrapIfNeeded=r,a.wrap=p,a.wrapIfNeeded=s,a.wrappers=z}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){return a instanceof J.ShadowRoot}function c(a){var b=a.localName;return"content"===b||"shadow"===b}function d(a){return!!a.shadowRoot}function e(a){var b;return a.parentNode||(b=a.defaultView)&&I(b)||null}function f(f,g,h){if(h.length)return h.shift();if(b(f))return f.insertionParent||a.getHostForShadowRoot(f);var i=a.eventParentsTable.get(f);if(i){for(var j=1;j<i.length;j++)h[j-1]=i[j];return i[0]}if(g&&c(f)){var k=f.parentNode;if(k&&d(k))for(var l=a.getShadowTrees(k),m=g.insertionParent,j=0;j<l.length;j++)if(l[j].contains(m))return m}return e(f)}function g(a){for(var d=[],e=a,g=[],i=[];e;){var j=null;if(c(e)){j=h(d);var k=d[d.length-1]||e;d.push(k)}else d.length||d.push(e);var l=d[d.length-1];g.push({target:l,currentTarget:e}),b(e)&&d.pop(),e=f(e,j,i)}return g}function h(a){for(var b=a.length-1;b>=0;b--)if(!c(a[b]))return a[b];return null}function i(d,e){for(var g=[];d;){for(var i=[],k=e,m=void 0;k;){var n=null;if(i.length){if(c(k)&&(n=h(i),j(m))){var o=i[i.length-1];i.push(o)}}else i.push(k);if(l(k,d))return i[i.length-1];b(k)&&i.pop(),m=k,k=f(k,n,g)}d=b(d)?a.getHostForShadowRoot(d):d.parentNode}}function j(a){return a.insertionParent}function k(a){for(var b;b=a.parentNode;)a=b;return a}function l(a,b){return k(a)===k(b)}function m(a){switch(a){case"DOMAttrModified":case"DOMAttributeNameChanged":case"DOMCharacterDataModified":case"DOMElementNameChanged":case"DOMNodeInserted":case"DOMNodeInsertedIntoDocument":case"DOMNodeRemoved":case"DOMNodeRemovedFromDocument":case"DOMSubtreeModified":return!0}return!1}function n(b){if(!L.get(b)){L.set(b,!0),m(b.type)||a.renderAllPending();var c=I(b.target),d=I(b);return o(d,c)}}function o(a,b){var c=g(b);return"load"===a.type&&2===c.length&&c[0].target instanceof J.Document&&c.shift(),p(a,c)&&q(a,c)&&r(a,c),P.set(a,u.NONE),N.set(a,null),a.defaultPrevented}function p(a,b){for(var c,d=b.length-1;d>0;d--){var e=b[d].target,f=b[d].currentTarget;if(e!==f&&(c=u.CAPTURING_PHASE,!s(b[d],a,c)))return!1}return!0}function q(a,b){var c=u.AT_TARGET;return s(b[0],a,c)}function r(a,b){for(var c,d=a.bubbles,e=1;e<b.length;e++){var f=b[e].target,g=b[e].currentTarget;if(f===g)c=u.AT_TARGET;else{if(!d||R.get(a))continue;c=u.BUBBLING_PHASE}if(!s(b[e],a,c))return}}function s(a,b,c){var d=a.target,e=a.currentTarget,f=K.get(e);if(!f)return!0;if("relatedTarget"in b){var g=H(b),h=I(g.relatedTarget),j=i(e,h);if(j===d)return!0;O.set(b,j)}P.set(b,c);var k=b.type,l=!1;M.set(b,d),N.set(b,e);for(var m=0;m<f.length;m++){var n=f[m];if(n.removed)l=!0;else if(!(n.type!==k||!n.capture&&c===u.CAPTURING_PHASE||n.capture&&c===u.BUBBLING_PHASE))try{if("function"==typeof n.handler?n.handler.call(e,b):n.handler.handleEvent(b),R.get(b))return!1}catch(o){window.onerror?window.onerror(o.message):console.error(o)}}if(l){var p=f.slice();f.length=0;for(var m=0;m<p.length;m++)p[m].removed||f.push(p[m])}return!Q.get(b)}function t(a,b,c){this.type=a,this.handler=b,this.capture=Boolean(c)}function u(a,b){return a instanceof S?(this.impl=a,void 0):I(y(S,"Event",a,b))}function v(a){return a&&a.relatedTarget?Object.create(a,{relatedTarget:{value:H(a.relatedTarget)}}):a}function w(a,b,c){var d=window[a],e=function(b,c){return b instanceof d?(this.impl=b,void 0):I(y(d,a,b,c))};return e.prototype=Object.create(b.prototype),c&&F(e.prototype,c),d&&G(d,e,document.createEvent(a)),e}function x(a,b){return function(){arguments[b]=H(arguments[b]);var c=H(this);c[a].apply(c,arguments)}}function y(a,b,c,d){if(ab)return new a(c,v(d));var e=H(document.createEvent(b)),f=_[b],g=[c];return Object.keys(f).forEach(function(a){var b=null!=d&&a in d?d[a]:f[a];"relatedTarget"===a&&(b=H(b)),g.push(b)}),e["init"+b].apply(e,g),e}function z(a){return"function"==typeof a?!0:a&&a.handleEvent}function A(a){this.impl=a}function B(b){return b instanceof J.ShadowRoot&&(b=a.getHostForShadowRoot(b)),H(b)}function C(a){E(a,db)}function D(b,c,d,e){a.renderAllPending();for(var f=I(eb.call(c.impl,d,e)),h=g(f,this),i=0;i<h.length;i++){var j=h[i];if(j.currentTarget===b)return j.target}return null}var E=a.forwardMethodsToWrapper,F=a.mixin,G=a.registerWrapper,H=a.unwrap,I=a.wrap,J=a.wrappers;new SideTable;var K=new SideTable,L=new SideTable,M=new SideTable,N=new SideTable,O=new SideTable,P=new SideTable,Q=new SideTable,R=new SideTable;t.prototype={equals:function(a){return this.handler===a.handler&&this.type===a.type&&this.capture===a.capture},get removed(){return null===this.handler},remove:function(){this.handler=null}};var S=window.Event;u.prototype={get target(){return M.get(this)},get currentTarget(){return N.get(this)},get eventPhase(){return P.get(this)},stopPropagation:function(){Q.set(this,!0)},stopImmediatePropagation:function(){Q.set(this,!0),R.set(this,!0)}},G(S,u,document.createEvent("Event"));var T=w("UIEvent",u),U=w("CustomEvent",u),V={get relatedTarget(){return O.get(this)||I(H(this).relatedTarget)}},W=F({initMouseEvent:x("initMouseEvent",14)},V),X=F({initFocusEvent:x("initFocusEvent",5)},V),Y=w("MouseEvent",T,W),Z=w("FocusEvent",T,X),$=w("MutationEvent",u,{initMutationEvent:x("initMutationEvent",3),get relatedNode(){return I(this.impl.relatedNode)}}),_=Object.create(null),ab=function(){try{new window.MouseEvent("click")}catch(a){return!1}return!0}();if(!ab){var bb=function(a,b,c){if(c){var d=_[c];b=F(F({},d),b)}_[a]=b};bb("Event",{bubbles:!1,cancelable:!1}),bb("CustomEvent",{detail:null},"Event"),bb("UIEvent",{view:null,detail:0},"Event"),bb("MouseEvent",{screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null},"UIEvent"),bb("FocusEvent",{relatedTarget:null},"UIEvent")}var cb=window.EventTarget,db=["addEventListener","removeEventListener","dispatchEvent"];[Element,Window,Document].forEach(function(a){var b=a.prototype;db.forEach(function(a){Object.defineProperty(b,a+"_",{value:b[a]})})}),A.prototype={addEventListener:function(a,b,c){if(z(b)){var d=new t(a,b,c),e=K.get(this);if(e){for(var f=0;f<e.length;f++)if(d.equals(e[f]))return}else e=[],K.set(this,e);e.push(d);var g=B(this);g.addEventListener_(a,n,!0)}},removeEventListener:function(a,b,c){c=Boolean(c);var d=K.get(this);if(d){for(var e=0,f=!1,g=0;g<d.length;g++)d[g].type===a&&d[g].capture===c&&(e++,d[g].handler===b&&(f=!0,d[g].remove()));if(f&&1===e){var h=B(this);h.removeEventListener_(a,n,!0)}}},dispatchEvent:function(b){a.renderAllPending();var c=B(this);return c.dispatchEvent_(H(b))}},cb&&G(cb,A);var eb=document.elementFromPoint;a.adjustRelatedTarget=i,a.elementFromPoint=D,a.wrapEventTargetMethods=C,a.wrappers.CustomEvent=U,a.wrappers.Event=u,a.wrappers.EventTarget=A,a.wrappers.FocusEvent=Z,a.wrappers.MouseEvent=Y,a.wrappers.MutationEvent=$,a.wrappers.UIEvent=T}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a,b){Object.defineProperty(a,b,{enumerable:!1})}function c(){this.length=0,b(this,"length")}function d(a){if(null==a)return a;for(var b=new c,d=0,e=a.length;e>d;d++)b[d]=f(a[d]);return b.length=e,b}function e(a,b){a.prototype[b]=function(){return d(this.impl[b].apply(this.impl,arguments))}}var f=a.wrap;c.prototype={item:function(a){return this[a]}},b(c.prototype,"item"),a.wrappers.NodeList=c,a.addWrapNodeListMethod=e,a.wrapNodeList=d}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){i(a instanceof f)}function c(a,b,c,d){if(a.nodeType!==f.DOCUMENT_FRAGMENT_NODE)return a.parentNode&&a.parentNode.removeChild(a),a.parentNode_=b,a.previousSibling_=c,a.nextSibling_=d,c&&(c.nextSibling_=a),d&&(d.previousSibling_=a),[a];for(var e,g=[];e=a.firstChild;)a.removeChild(e),g.push(e),e.parentNode_=b;for(var h=0;h<g.length;h++)g[h].previousSibling_=g[h-1]||c,g[h].nextSibling_=g[h+1]||d;return c&&(c.nextSibling_=g[0]),d&&(d.previousSibling_=g[g.length-1]),g}function d(a){if(1===a.length)return l(a[0]);for(var b=l(document.createDocumentFragment()),c=0;c<a.length;c++)b.appendChild(l(a[c]));return b}function e(a){for(var b=a.firstChild;b;){i(b.parentNode===a);var c=b.nextSibling,d=l(b),e=d.parentNode;e&&r.call(e,d),b.previousSibling_=b.nextSibling_=b.parentNode_=null,b=c}a.firstChild_=a.lastChild_=null}function f(a){i(a instanceof n),g.call(this,a),this.parentNode_=void 0,this.firstChild_=void 0,this.lastChild_=void 0,this.nextSibling_=void 0,this.previousSibling_=void 0}var g=a.wrappers.EventTarget,h=a.wrappers.NodeList;a.defineWrapGetter;var i=a.assert,j=a.mixin,k=a.registerWrapper,l=a.unwrap,m=a.wrap,n=window.Node,o=n.prototype.appendChild,p=n.prototype.insertBefore,q=n.prototype.replaceChild,r=n.prototype.removeChild,s=n.prototype.compareDocumentPosition;f.prototype=Object.create(g.prototype),j(f.prototype,{appendChild:function(a){b(a),this.invalidateShadowRenderer();var e=this.lastChild,f=null,g=c(a,this,e,f);return this.lastChild_=g[g.length-1],e||(this.firstChild_=g[0]),o.call(this.impl,d(g)),a},insertBefore:function(a,e){if(!e)return this.appendChild(a);b(a),b(e),i(e.parentNode===this),this.invalidateShadowRenderer();var f=e.previousSibling,g=e,h=c(a,this,f,g);this.firstChild===e&&(this.firstChild_=h[0]);var j=l(e),k=j.parentNode;return k&&p.call(k,d(h),j),a},removeChild:function(a){if(b(a),a.parentNode!==this)throw new Error("NotFoundError");this.invalidateShadowRenderer();var c=this.firstChild,d=this.lastChild,e=a.nextSibling,f=a.previousSibling,g=l(a),h=g.parentNode;return h&&r.call(h,g),c===a&&(this.firstChild_=e),d===a&&(this.lastChild_=f),f&&(f.nextSibling_=e),e&&(e.previousSibling_=f),a.previousSibling_=a.nextSibling_=a.parentNode_=null,a},replaceChild:function(a,e){if(b(a),b(e),e.parentNode!==this)throw new Error("NotFoundError");this.invalidateShadowRenderer();var f=e.previousSibling,g=e.nextSibling;g===a&&(g=a.nextSibling);var h=c(a,this,f,g);this.firstChild===e&&(this.firstChild_=h[0]),this.lastChild===e&&(this.lastChild_=h[h.length-1]),e.previousSibling_=null,e.nextSibling_=null,e.parentNode_=null;var i=l(e);return i.parentNode&&q.call(i.parentNode,d(h),i),e},hasChildNodes:function(){return null===this.firstChild},get parentNode(){return void 0!==this.parentNode_?this.parentNode_:m(this.impl.parentNode)},get firstChild(){return void 0!==this.firstChild_?this.firstChild_:m(this.impl.firstChild)},get lastChild(){return void 0!==this.lastChild_?this.lastChild_:m(this.impl.lastChild)},get nextSibling(){return void 0!==this.nextSibling_?this.nextSibling_:m(this.impl.nextSibling)},get previousSibling(){return void 0!==this.previousSibling_?this.previousSibling_:m(this.impl.previousSibling)},get parentElement(){for(var a=this.parentNode;a&&a.nodeType!==f.ELEMENT_NODE;)a=a.parentNode;return a},get textContent(){for(var a="",b=this.firstChild;b;b=b.nextSibling)a+=b.textContent;return a},set textContent(a){if(e(this),this.invalidateShadowRenderer(),""!==a){var b=this.impl.ownerDocument.createTextNode(a);this.appendChild(b)}},get childNodes(){for(var a=new h,b=0,c=this.firstChild;c;c=c.nextSibling)a[b++]=c;return a.length=b,a},cloneNode:function(a){if(!this.invalidateShadowRenderer())return m(this.impl.cloneNode(a));var b=m(this.impl.cloneNode(!1));if(a)for(var c=this.firstChild;c;c=c.nextSibling)b.appendChild(c.cloneNode(!0));return b},contains:function(a){if(!a)return!1;if(a===this)return!0;var b=a.parentNode;return b?this.contains(b):!1},compareDocumentPosition:function(a){return s.call(this.impl,l(a))},get ownerDocument(){return a.renderAllPending(),m(this.impl.ownerDocument)}}),k(n,f,document.createDocumentFragment()),delete f.prototype.querySelector,delete f.prototype.querySelectorAll,f.prototype=j(Object.create(g.prototype),f.prototype),a.wrappers.Node=f}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a,c){for(var d,e=a.firstElementChild;e;){if(e.matches(c))return e;if(d=b(e,c))return d;e=e.nextElementSibling}return null}function c(a,b,d){for(var e=a.firstElementChild;e;)e.matches(b)&&(d[d.length++]=e),c(e,b,d),e=e.nextElementSibling;return d}var d={querySelector:function(a){return b(this,a)},querySelectorAll:function(a){return c(this,a,new NodeList)}},e={getElementsByTagName:function(a){return this.querySelectorAll(a)},getElementsByClassName:function(a){return this.querySelectorAll("."+a)},getElementsByTagNameNS:function(a,b){if("*"===a)return this.getElementsByTagName(b);for(var c=new NodeList,d=this.getElementsByTagName(b),e=0,f=0;e<d.length;e++)d[e].namespaceURI===a&&(c[f++]=d[e]);return c.length=f,c}};a.GetElementsByInterface=e,a.SelectorsInterface=d}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){for(;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.nextSibling;return a}function c(a){for(;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.previousSibling;return a}var d=a.wrappers.NodeList,e={get firstElementChild(){return b(this.firstChild)},get lastElementChild(){return c(this.lastChild)},get childElementCount(){for(var a=0,b=this.firstElementChild;b;b=b.nextElementSibling)a++;return a},get children(){for(var a=new d,b=0,c=this.firstElementChild;c;c=c.nextElementSibling)a[b++]=c;return a.length=b,a}},f={get nextElementSibling(){return b(this.nextSibling)},get previousElementSibling(){return c(this.nextSibling)}};a.ChildNodeInterface=f,a.ParentNodeInterface=e}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){d.call(this,a)}var c=a.ChildNodeInterface,d=a.wrappers.Node,e=a.mixin,f=a.registerWrapper,g=window.CharacterData;b.prototype=Object.create(d.prototype),e(b.prototype,{get textContent(){return this.data},set textContent(a){this.data=a}}),e(b.prototype,c),f(g,b,document.createTextNode("")),a.wrappers.CharacterData=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){e.call(this,a)}var c=a.ChildNodeInterface,d=a.GetElementsByInterface,e=a.wrappers.Node,f=a.ParentNodeInterface,g=a.SelectorsInterface;a.addWrapNodeListMethod;var h=a.mixin,i=a.registerWrapper,j=a.wrappers,k=new SideTable,l=window.Element,m=l.prototype.matches||l.prototype.mozMatchesSelector||l.prototype.msMatchesSelector||l.prototype.webkitMatchesSelector;b.prototype=Object.create(e.prototype),h(b.prototype,{createShadowRoot:function(){var b=new j.ShadowRoot(this);return k.set(this,b),a.getRendererForHost(this),this.invalidateShadowRenderer(!0),b},get shadowRoot(){return k.get(this)||null},setAttribute:function(a,b){this.impl.setAttribute(a,b),this.invalidateShadowRenderer()},matches:function(a){return m.call(this.impl,a)}}),h(b.prototype,c),h(b.prototype,d),h(b.prototype,f),h(b.prototype,g),i(l,b),a.wrappers.Element=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){switch(a){case"&":return"&amp;";case"<":return"&lt;";case'"':return"&quot;"}}function c(a){return a.replace(p,b)}function d(a){switch(a.nodeType){case Node.ELEMENT_NODE:for(var b,d=a.tagName.toLowerCase(),f="<"+d,g=a.attributes,h=0;b=g[h];h++)f+=" "+b.name+'="'+c(b.value)+'"';return f+=">",q[d]?f:f+e(a)+"</"+d+">";case Node.TEXT_NODE:return c(a.nodeValue);case Node.COMMENT_NODE:return"<!--"+c(a.nodeValue)+"-->";default:throw console.error(a),new Error("not implemented")}}function e(a){for(var b="",c=a.firstChild;c;c=c.nextSibling)b+=d(c);return b}function f(a,b,c){var d=c||"div";a.textContent="";var e=n(a.ownerDocument.createElement(d));e.innerHTML=b;for(var f;f=e.firstChild;)a.appendChild(o(f))}function g(a){j.call(this,a)}function h(b){k(g,b,function(){return a.renderAllPending(),this.impl[b]})}function i(b){Object.defineProperty(g.prototype,b,{value:function(){return a.renderAllPending(),this.impl[b].apply(this.impl,arguments)},configurable:!0,enumerable:!0})}var j=a.wrappers.Element,k=a.defineGetter,l=a.mixin,m=a.registerWrapper,n=a.unwrap,o=a.wrap,p=/&|<|"/g,q={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},r=window.HTMLElement;g.prototype=Object.create(j.prototype),l(g.prototype,{get innerHTML(){return e(this)},set innerHTML(a){f(this,a,this.tagName)},get outerHTML(){return d(this)},set outerHTML(a){if(this.invalidateShadowRenderer())throw new Error("not implemented");this.impl.outerHTML=a}}),["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetTop","offsetWidth","scrollHeight","scrollLeft","scrollTop","scrollWidth"].forEach(h),["getBoundingClientRect","getClientRects","scrollIntoView"].forEach(i),m(r,g,document.createElement("b")),a.wrappers.HTMLElement=g,a.getInnerHTML=e,a.setInnerHTML=f}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=window.HTMLContentElement;b.prototype=Object.create(c.prototype),d(b.prototype,{get select(){return this.getAttribute("select")},set select(a){this.setAttribute("select",a)},setAttribute:function(a,b){c.prototype.setAttribute.call(this,a,b),"select"===String(a).toLowerCase()&&this.invalidateShadowRenderer(!0)}}),f&&e(f,b),a.wrappers.HTMLContentElement=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a),this.olderShadowRoot_=null}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=window.HTMLShadowElement;b.prototype=Object.create(c.prototype),d(b.prototype,{get olderShadowRoot(){return this.olderShadowRoot_},invalidateShadowRenderer:function(){c.prototype.invalidateShadowRenderer.call(this,!0)}}),f&&e(f,b),a.wrappers.HTMLShadowElement=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){if(!a.defaultView)return a;var b=l.get(a);if(!b){for(b=a.implementation.createHTMLDocument("");b.lastChild;)b.removeChild(b.lastChild);l.set(a,b)}return b}function c(a){for(var c,d=b(a.ownerDocument),e=d.createDocumentFragment();c=a.firstChild;)e.appendChild(c);return e}function d(a){e.call(this,a)}var e=a.wrappers.HTMLElement,f=a.getInnerHTML,g=a.mixin,h=a.registerWrapper,i=a.setInnerHTML,j=a.wrap,k=new SideTable,l=new SideTable,m=window.HTMLTemplateElement;d.prototype=Object.create(e.prototype),g(d.prototype,{get content(){if(m)return j(this.impl.content);var a=k.get(this);return a||(a=c(this),k.set(this,a)),a},get innerHTML(){return f(this.content)},set innerHTML(a){i(this.content,a),this.invalidateShadowRenderer()}}),m&&h(m,d),a.wrappers.HTMLTemplateElement=d}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){switch(a.localName){case"content":return new c(a);case"shadow":return new e(a);case"template":return new f(a)}d.call(this,a)}var c=a.wrappers.HTMLContentElement,d=a.wrappers.HTMLElement,e=a.wrappers.HTMLShadowElement,f=a.wrappers.HTMLTemplateElement;a.mixin;var g=a.registerWrapper,h=window.HTMLUnknownElement;b.prototype=Object.create(d.prototype),g(h,b),a.wrappers.HTMLUnknownElement=b}(this.ShadowDOMPolyfill),function(a){"use strict";var b=a.GetElementsByInterface,c=a.ParentNodeInterface,d=a.SelectorsInterface,e=a.mixin,f=a.registerObject,g=f(document.createDocumentFragment());e(g.prototype,c),e(g.prototype,d),e(g.prototype,b);var h=f(document.createTextNode("")),i=f(document.createComment(""));a.wrappers.Comment=i,a.wrappers.DocumentFragment=g,a.wrappers.Text=h}(this.ShadowDOMPolyfill),function(a){"use strict";function b(b){var d=i(b.impl.ownerDocument.createDocumentFragment());c.call(this,d),g(d,this);var e=b.shadowRoot;a.nextOlderShadowTreeTable.set(this,e),j.set(this,b)}var c=a.wrappers.DocumentFragment,d=a.elementFromPoint,e=a.getInnerHTML,f=a.mixin,g=a.rewrap,h=a.setInnerHTML,i=a.unwrap,j=new SideTable;b.prototype=Object.create(c.prototype),f(b.prototype,{get innerHTML(){return e(this)},set innerHTML(a){h(this,a),this.invalidateShadowRenderer()},invalidateShadowRenderer:function(){return j.get(this).invalidateShadowRenderer()},elementFromPoint:function(a,b){return d(this,this.ownerDocument,a,b)},getElementById:function(a){return this.querySelector("#"+a)}}),a.wrappers.ShadowRoot=b,a.getHostForShadowRoot=function(a){return j.get(a)}}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){a.previousSibling_=a.previousSibling,a.nextSibling_=a.nextSibling,a.parentNode_=a.parentNode}function c(a){a.firstChild_=a.firstChild,a.lastChild_=a.lastChild}function d(a){F(a instanceof E);for(var d=a.firstChild;d;d=d.nextSibling)b(d);c(a)}function e(a){var b=H(a);d(a),b.textContent=""}function f(a,c){var e=H(a),f=H(c);f.nodeType===E.DOCUMENT_FRAGMENT_NODE?d(c):(h(c),b(c)),a.lastChild_=a.lastChild,a.lastChild===a.firstChild&&(a.firstChild_=a.firstChild);var g=I(e.lastChild);g&&(g.nextSibling_=g.nextSibling),e.appendChild(f)}function g(a,c){var d=H(a),e=H(c);b(c),c.previousSibling&&(c.previousSibling.nextSibling_=c),c.nextSibling&&(c.nextSibling.previousSibling_=c),a.lastChild===c&&(a.lastChild_=c),a.firstChild===c&&(a.firstChild_=c),d.removeChild(e)}function h(a){var b=H(a),c=b.parentNode;c&&g(I(c),a)}function i(a,b){k(b).push(a),L.set(a,b);var c=K.get(a);c||K.set(a,c=[]),c.push(b)}function j(a){J.set(a,[])}function k(a){return J.get(a)}function l(a){for(var b=[],c=0,d=a.firstChild;d;d=d.nextSibling)b[c++]=d;return b}function m(a,b,c){for(var d=l(a),e=0;e<d.length;e++){var f=d[e];if(b(f)){if(c(f)===!1)return}else m(f,b,c)}}function n(a,b){var c=!1;return m(a,u,function(a){j(a);for(var d=0;d<b.length;d++){var e=b[d];void 0!==e&&p(e,a)&&(i(e,a),b[d]=void 0,c=!0)}}),c?b.filter(function(a){return void 0!==a}):b}function o(a,b){for(var c=0;c<b.length;c++)if(b[c]in a)return b[c]}function p(a,b){var c=b.getAttribute("select");if(!c)return!0;if(c=c.trim(),!c)return!0;if(a.nodeType!==E.ELEMENT_NODE)return!1;if(!P.test(c))return!1;if(":"===c[0]&&!Q.test(c))return!1;try{return a.matches(c)}catch(d){return!1}}function q(){C=null,S.forEach(function(a){a.render()}),S=[]}function r(a){this.host=a,this.dirty=!1,this.associateNode(a)}function s(a){var b=N.get(a);return b||(b=new r(a),N.set(a,b)),b}function t(a){return"content"===a.localName}function u(a){return"content"===a.localName}function v(a){return"shadow"===a.localName}function w(a){return"shadow"===a.localName}function x(a){return!!a.shadowRoot}function y(a){return M.get(a)}function z(a){for(var b=[],c=a.shadowRoot;c;c=M.get(c))b.push(c);return b}function A(a,b){L.set(a,b)}function B(a){new r(a).render()}var C,D=a.wrappers.HTMLContentElement,E=a.wrappers.Node,F=a.assert,G=a.mixin,H=a.unwrap,I=a.wrap,J=new SideTable,K=new SideTable,L=new SideTable,M=new SideTable,N=new SideTable,O=new SideTable,P=/^[*.:#[a-zA-Z_|]/,Q=new RegExp("^:("+["link","visited","target","enabled","disabled","checked","indeterminate","nth-child","nth-last-child","nth-of-type","nth-last-of-type","first-child","last-child","first-of-type","last-of-type","only-of-type"].join("|")+")"),R=o(window,["requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","setTimeout"]),S=[];r.prototype={render:function(){if(this.dirty){var a=this.host;this.treeComposition();var b=a.shadowRoot;if(b){this.removeAllChildNodes(this.host);var c=l(b);c.forEach(function(c){this.renderNode(a,b,c,!1)},this),this.dirty=!1}}},invalidate:function(){if(!this.dirty){if(this.dirty=!0,S.push(this),C)return;C=window[R](q,0)}},renderNode:function(a,b,c,d){if(x(c)){this.appendChild(a,c);var e=s(c);e.dirty=!0,e.render()}else t(c)?this.renderInsertionPoint(a,b,c,d):v(c)?this.renderShadowInsertionPoint(a,b,c):this.renderAsAnyDomTree(a,b,c,d)},renderAsAnyDomTree:function(a,b,c,d){if(this.appendChild(a,c),x(c))B(c);else{var e=c,f=l(e);f.forEach(function(a){this.renderNode(e,b,a,d)},this)}},renderInsertionPoint:function(a,b,c,d){var e=k(c);e.length?(this.removeAllChildNodes(c),e.forEach(function(c){t(c)&&d?this.renderInsertionPoint(a,b,c,d):this.renderAsAnyDomTree(a,b,c,d)},this)):this.renderFallbackContent(a,c),this.remove(c)},renderShadowInsertionPoint:function(a,b,c){var d=y(b);if(d){L.set(d,c),c.olderShadowRoot_=d,this.remove(c);var e=l(d);e.forEach(function(b){this.renderNode(a,d,b,!0)},this)}else this.renderFallbackContent(a,c)},renderFallbackContent:function(a,b){var c=l(b);c.forEach(function(b){this.appendChild(a,b)},this)},treeComposition:function(){var a=this.host,b=a.shadowRoot,c=[],d=l(a);d.forEach(function(a){if(t(a)){var b=k(a);b&&b.length||(b=l(a)),c.push.apply(c,b)}else c.push(a)});for(var e,f;b;){if(e=void 0,m(b,w,function(a){return e=a,!1}),f=e,c=n(b,c),f){var g=y(b);if(g){b=g,A(b,f);continue}break}break}},appendChild:function(a,b){f(a,b),this.associateNode(b)},remove:function(a){h(a),this.associateNode(a)},removeAllChildNodes:function(a){e(a)},associateNode:function(a){O.set(a,this)}},E.prototype.invalidateShadowRenderer=function(a){var b=O.get(this);if(!b)return!1;var c;return(a||this.shadowRoot||(c=this.parentNode)&&(c.shadowRoot||c instanceof ShadowRoot))&&b.invalidate(),!0},D.prototype.getDistributedNodes=function(){return q(),k(this)},G(E.prototype,{get insertionParent(){return L.get(this)||null}}),a.eventParentsTable=K,a.getRendererForHost=s,a.getShadowTrees=z,a.nextOlderShadowTreeTable=M,a.renderAllPending=q,a.visual={removeAllChildNodes:e,appendChild:f,removeChild:g}}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){h.call(this,a)}function c(a){var c=document[a];b.prototype[a]=function(){return q(c.apply(this.impl,arguments))}}function d(a){this.impl=a}function e(a,b){var c=document.implementation[b];a.prototype[b]=function(){return q(c.apply(this.impl,arguments))}}function f(a,b){var c=document.implementation[b];a.prototype[b]=function(){return c.apply(this.impl,arguments)}}var g=a.GetElementsByInterface,h=a.wrappers.Node,i=a.ParentNodeInterface,j=a.SelectorsInterface,k=a.defineWrapGetter,l=a.elementFromPoint,m=a.forwardMethodsToWrapper,n=a.mixin,o=a.registerWrapper,p=a.unwrap,q=a.wrap,r=a.wrapEventTargetMethods;a.wrapNodeList;var s=new SideTable;b.prototype=Object.create(h.prototype),k(b,"documentElement"),k(b,"body"),k(b,"head"),["getElementById","createElement","createElementNS","createTextNode","createDocumentFragment","createEvent","createEventNS"].forEach(c);var t=document.adoptNode,u=document.write;n(b.prototype,{adoptNode:function(a){return t.call(this.impl,p(a)),a},elementFromPoint:function(a,b){return l(this,this,a,b)},write:function(a){for(var b=this.querySelectorAll("*"),c=b[b.length-1];c.nextSibling;)c=c.nextSibling;var d=c.parentNode;d.lastChild_=void 0,c.nextSibling_=void 0,u.call(this.impl,a)}}),m([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement],["appendChild","compareDocumentPosition","getElementsByClassName","getElementsByTagName","getElementsByTagNameNS","insertBefore","querySelector","querySelectorAll","removeChild","replaceChild"]),m([window.HTMLDocument||window.Document],["adoptNode","createDocumentFragment","createElement","createElementNS","createEvent","createEventNS","createTextNode","elementFromPoint","getElementById","write"]),n(b.prototype,g),n(b.prototype,i),n(b.prototype,j),n(b.prototype,{get implementation(){var a=s.get(this);return a?a:(a=new d(p(this).implementation),s.set(this,a),a)}}),o(window.Document,b,document.implementation.createHTMLDocument("")),window.HTMLDocument&&o(window.HTMLDocument,b),r([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement]),e(d,"createDocumentType"),e(d,"createDocument"),e(d,"createHTMLDocument"),f(d,"hasFeature"),o(window.DOMImplementation,d),m([window.DOMImplementation],["createDocumentType","createDocument","createHTMLDocument","hasFeature"]),a.wrappers.Document=b,a.wrappers.DOMImplementation=d}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.EventTarget,d=a.mixin,e=a.registerWrapper,f=a.unwrap,g=a.unwrapIfNeeded,h=a.wrap,i=window.Window;b.prototype=Object.create(c.prototype);var j=window.getComputedStyle;i.prototype.getComputedStyle=function(a,b){return j.call(this||window,g(a),b)},["addEventListener","removeEventListener","dispatchEvent"].forEach(function(a){i.prototype[a]=function(){var b=h(this||window);return b[a].apply(b,arguments)}}),d(b.prototype,{getComputedStyle:function(a,b){return j.call(f(this),g(a),b)}}),e(i,b),a.wrappers.Window=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){this.impl=a}function c(a){return new b(a)}function d(a){return a.map(c)}function e(a){var b=this;this.impl=new k(function(c){a.call(b,d(c),b)})}var f=a.defineGetter,g=a.defineWrapGetter,h=a.registerWrapper,i=a.unwrapIfNeeded,j=a.wrapNodeList;a.wrappers;var k=window.MutationObserver||window.WebKitMutationObserver;if(k){var l=window.MutationRecord;b.prototype={get addedNodes(){return j(this.impl.addedNodes)},get removedNodes(){return j(this.impl.removedNodes)}},["target","previousSibling","nextSibling"].forEach(function(a){g(b,a)}),["type","attributeName","attributeNamespace","oldValue"].forEach(function(a){f(b,a,function(){return this.impl[a]
-})}),l&&h(l,b),window.Node,e.prototype={observe:function(a,b){this.impl.observe(i(a),b)},disconnect:function(){this.impl.disconnect()},takeRecords:function(){return d(this.impl.takeRecords())}},a.wrappers.MutationObserver=e,a.wrappers.MutationRecord=b}}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){var b=c[a],d=window[b];if(d){var e=document.createElement(a),f=e.constructor;window[b]=f}}a.isWrapperFor;var c={a:"HTMLAnchorElement",applet:"HTMLAppletElement",area:"HTMLAreaElement",audio:"HTMLAudioElement",br:"HTMLBRElement",base:"HTMLBaseElement",body:"HTMLBodyElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",dl:"HTMLDListElement",datalist:"HTMLDataListElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",font:"HTMLFontElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",hr:"HTMLHRElement",head:"HTMLHeadElement",h1:"HTMLHeadingElement",html:"HTMLHtmlElement",iframe:"HTMLIFrameElement",input:"HTMLInputElement",li:"HTMLLIElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",link:"HTMLLinkElement",map:"HTMLMapElement",menu:"HTMLMenuElement",menuitem:"HTMLMenuItemElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",del:"HTMLModElement",ol:"HTMLOListElement",object:"HTMLObjectElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",script:"HTMLScriptElement",select:"HTMLSelectElement",source:"HTMLSourceElement",span:"HTMLSpanElement",style:"HTMLStyleElement",caption:"HTMLTableCaptionElement",col:"HTMLTableColElement",table:"HTMLTableElement",tr:"HTMLTableRowElement",thead:"HTMLTableSectionElement",tbody:"HTMLTableSectionElement",textarea:"HTMLTextAreaElement",title:"HTMLTitleElement",ul:"HTMLUListElement",video:"HTMLVideoElement"};Object.keys(c).forEach(b),Object.getOwnPropertyNames(a.wrappers).forEach(function(b){window[b]=a.wrappers[b]}),a.knownElements=c}(this.ShadowDOMPolyfill),function(){var a=window.ShadowDOMPolyfill;a.wrap,Object.defineProperties(HTMLElement.prototype,{webkitShadowRoot:{get:function(){return this.shadowRoot}}}),HTMLElement.prototype.webkitCreateShadowRoot=HTMLElement.prototype.createShadowRoot,window.dartExperimentalFixupGetTag=function(b){function c(a){if(a instanceof d)return"NodeList";if(a instanceof e)return"ShadowRoot";if(a instanceof MutationRecord)return"MutationRecord";if(a instanceof MutationObserver)return"MutationObserver";if(f(a)){a=g(a);var c=a.constructor;if(c&&c._ShadowDOMPolyfill$isGeneratedWrapper){var h=c._ShadowDOMPolyfill$cacheTag_;return h||(h=Object.prototype.toString.call(a),h=h.substring(8,h.length-1),c._ShadowDOMPolyfill$cacheTag_=h),h}}return b(a)}var d=a.wrappers.NodeList,e=a.wrappers.ShadowRoot,f=a.isWrapper,g=a.unwrap;return c}}();var Platform={};!function(a){function b(a,b){var c="";return Array.prototype.forEach.call(a,function(a){c+=a.textContent+"\n\n"}),b||(c=c.replace(m,"")),c}function c(a){var b=document.createElement("style");b.textContent=a,document.head.appendChild(b);var c=b.sheet.cssRules;return b.parentNode.removeChild(b),c}function d(a){for(var b=0,c=[];b<a.length;b++)c.push(a[b].cssText);return c.join("\n\n")}function e(a){a&&f().appendChild(document.createTextNode(a))}function f(){return g||(g=document.createElement("style"),g.setAttribute("ShadowCSSShim","")),g}var g,h={strictStyling:!1,registry:{},shimStyling:function(a,b,c){if(a){var d=this.registerDefinition(a,b,c);this.strictStyling&&this.applyScopeToContent(a,b),this.shimPolyfillDirectives(d.rootStyles,b),this.applyShimming(d.scopeStyles,b)}},shimShadowDOMStyling:function(a,b){this.shimPolyfillDirectives(a,b),this.applyShimming(a,b)},registerDefinition:function(a,b,c){var d=this.registry[b]={root:a,name:b,extendsName:c},e=a.querySelectorAll("style");e=e?Array.prototype.slice.call(e,0):[],d.rootStyles=e,d.scopeStyles=d.rootStyles;var f=this.registry[d.extendsName];return f&&(d.scopeStyles=d.scopeStyles.concat(f.scopeStyles)),d},applyScopeToContent:function(a,b){a&&(Array.prototype.forEach.call(a.querySelectorAll("*"),function(a){a.setAttribute(b,"")}),Array.prototype.forEach.call(a.querySelectorAll("template"),function(a){this.applyScopeToContent(a.content,b)},this))},shimPolyfillDirectives:function(a,b){a&&Array.prototype.forEach.call(a,function(a){a.textContent=this.convertPolyfillDirectives(a.textContent,b)},this)},convertPolyfillDirectives:function(a,b){for(var c,d,e="",f=0;c=n.exec(a);)e+=a.substring(f,c.index),d=c[1].slice(0,-2).replace(q,b),e+=this.scopeSelector(d,b)+"{",f=n.lastIndex;return e+=a.substring(f,a.length)},applyShimming:function(a,b){var c=this.shimAtHost(a,b);c+=this.shimScoping(a,b),e(c)},shimAtHost:function(a,b){return a?this.convertAtHostStyles(a,b):void 0},convertAtHostStyles:function(a,e){for(var f,g=b(a),h="",j=0;f=i.exec(g);)h+=g.substring(j,f.index),h+=this.scopeHostCss(f[1],e),j=i.lastIndex;h+=g.substring(j,g.length);var k=new RegExp("^"+e+p,"m"),g=d(this.findAtHostRules(c(h),k));return g},scopeHostCss:function(a,b){for(var c,d="";c=j.exec(a);)d+=this.scopeHostSelector(c[1],b)+" "+c[2]+"\n	";return d},scopeHostSelector:function(a,b){var c=[],d=a.split(","),e="[is="+b+"]";return d.forEach(function(a){a=a.trim(),a.match(k)?a=a.replace(k,b+"$1$3, "+e+"$1$3"):a.match(l)&&(a=b+a+", "+e+a),c.push(a)},this),c.join(", ")},findAtHostRules:function(a,b){return Array.prototype.filter.call(a,this.isHostRule.bind(this,b))},isHostRule:function(a,b){return b.selectorText&&b.selectorText.match(a)||b.cssRules&&this.findAtHostRules(b.cssRules,a).length||b.type==CSSRule.WEBKIT_KEYFRAMES_RULE},shimScoping:function(a,b){return a?this.convertScopedStyles(a,b):void 0},convertScopedStyles:function(a,d){Array.prototype.forEach.call(a,function(a){a.parentNode&&a.parentNode.removeChild(a)});var e=b(a).replace(i,"");e=this.convertPseudos(e);var f=c(e);return e=this.scopeRules(f,d)},convertPseudos:function(a){return a.replace(o," [pseudo=$1]")},scopeRules:function(a,b){var c="";return Array.prototype.forEach.call(a,function(a){a.selectorText&&a.style&&a.style.cssText?(c+=this.scopeSelector(a.selectorText,b,this.strictStyling)+" {\n	",c+=this.propertiesFromRule(a)+"\n}\n\n"):a.media?(c+="@media "+a.media.mediaText+" {\n",c+=this.scopeRules(a.cssRules,b),c+="\n}\n\n"):a.cssText&&(c+=a.cssText+"\n\n")},this),c},scopeSelector:function(a,b,c){var d=[],e=a.split(",");return e.forEach(function(a){a=a.trim(),this.selectorNeedsScoping(a,b)&&(a=c?this.applyStrictSelectorScope(a,b):this.applySimpleSelectorScope(a,b)),d.push(a)},this),d.join(", ")},selectorNeedsScoping:function(a,b){var c="("+b+"|\\[is="+b+"\\])",d=new RegExp("^"+c+p,"m");return!a.match(d)},applySimpleSelectorScope:function(a,b){return b+" "+a+", "+"[is="+b+"] "+a},applyStrictSelectorScope:function(a,b){var c=[" ",">","+","~"],d=a,e="["+b+"]";return c.forEach(function(a){var b=d.split(a);d=b.map(function(a){var b=a.trim();return b&&c.indexOf(b)<0&&b.indexOf(e)<0&&(a=b.replace(/([^:]*)(:*)(.*)/,"$1"+e+"$2$3")),a}).join(a)}),d},propertiesFromRule:function(a){var b=a.style.cssText;return a.style.content&&!a.style.content.match(/['"]+/)&&(b="content: '"+a.style.content+"';\n"+a.style.cssText.replace(/content:[^;]*;/g,"")),b}},i=/@host[^{]*{(([^}]*?{[^{]*?}[\s\S]*?)+)}/gim,j=/([^{]*)({[\s\S]*?})/gim,k=/(.*)((?:\*)|(?:\:scope))(.*)/,l=/^[.\[:]/,m=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,n=/\/\*\s*@polyfill ([^*]*\*+([^/*][^*]*\*+)*\/)([^{]*?){/gim,o=/::(x-[^\s{,(]*)/gim,p="([>\\s~+[.,{:][\\s\\S]*)?$",q=/@host/gim;if(window.ShadowDOMPolyfill){e("style { display: none !important; }\n");var r=document.querySelector("head");r.insertBefore(f(),r.childNodes[0])}a.ShadowCSS=h}(window.Platform),function(a){function b(a,b){if(window.ShadowDOMPolyfill){for(var h,i=this.convertPolyfillDirectives(a,b),j="",k=0;h=e.exec(i);)j+=i.substring(k,h.index),j+=this.scopeHostCss(h[1],b),k=e.lastIndex;j+=i.substring(k,i.length);var l=new RegExp("^"+b+g,"m"),m=d(this.findAtHostRules(c(j),l));i=i.replace(f,""),i=this.convertPseudos(i);var n=c(i),o=this.scopeRules(n,b);return m+o}}function c(a){var b=document.createElement("style");b.textContent=a,document.head.appendChild(b);var c=b.sheet.cssRules;return b.parentNode.removeChild(b),c}function d(a){for(var b=0,c=[];b<a.length;b++)c.push(a[b].cssText);return c.join("\n\n")}var e=/@host[^{]*{(([^}]*?{[^{]*?}[\s\S]*?)+)}/gim,f=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,g="([>\\s~+[.,{:][\\s\\S]*)?$";a.ShadowCSS.shimShadowDOMStyling2=b}(window.Platform)}
\ No newline at end of file
+if(!HTMLElement.prototype.createShadowRoot&&!HTMLElement.prototype.webkitCreateShadowRoot||window.__forceShadowDomPolyfill){!function(){Element.prototype.webkitCreateShadowRoot&&(Element.prototype.webkitCreateShadowRoot=function(){return window.ShadowDOMPolyfill.wrapIfNeeded(this).createShadowRoot()})}();var SideTable;"undefined"!=typeof WeakMap&&navigator.userAgent.indexOf("Firefox/")<0?SideTable=WeakMap:!function(){var a=Object.defineProperty,b=Date.now()%1e9;SideTable=function(){this.name="__st"+(1e9*Math.random()>>>0)+(b++ +"__")},SideTable.prototype={set:function(b,c){var d=b[this.name];d&&d[0]===b?d[1]=c:a(b,this.name,{value:[b,c],writable:!0})},get:function(a){var b;return(b=a[this.name])&&b[0]===a?b[1]:void 0},"delete":function(a){this.set(a,void 0)}}}();var ShadowDOMPolyfill={};!function(a){"use strict";function b(a){if(!a)throw new Error("Assertion failed")}function c(a,b){return Object.getOwnPropertyNames(b).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))}),a}function d(a,b){return Object.getOwnPropertyNames(b).forEach(function(c){switch(c){case"arguments":case"caller":case"length":case"name":case"prototype":case"toString":return}Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))}),a}function e(a,b){for(var c=0;c<b.length;c++)if(b[c]in a)return b[c]}function f(a){var b=a.__proto__||Object.getPrototypeOf(a),c=A.get(b);if(c)return c;var d=f(b),e=o(d);return l(b,e,a),e}function g(a,b){j(a,b,!0)}function h(a,b){j(b,a,!1)}function i(a){return/^on[a-z]+$/.test(a)}function j(b,c,d){Object.getOwnPropertyNames(b).forEach(function(e){if(!(e in c)){D&&b.__lookupGetter__(e);var f;try{f=Object.getOwnPropertyDescriptor(b,e)}catch(g){f=E}var h,j;if(d&&"function"==typeof f.value)return c[e]=function(){return this.impl[e].apply(this.impl,arguments)},void 0;var k=i(e);h=k?a.getEventHandlerGetter(e):function(){return this.impl[e]},(f.writable||f.set)&&(j=k?a.getEventHandlerSetter(e):function(a){this.impl[e]=a}),Object.defineProperty(c,e,{get:h,set:j,configurable:f.configurable,enumerable:f.enumerable})}})}function k(a,b,c){var e=a.prototype;l(e,b,c),d(b,a)}function l(a,c,d){var e=c.prototype;b(void 0===A.get(a)),A.set(a,c),B.set(e,a),g(a,e),d&&h(e,d)}function m(a,b){return A.get(b.prototype)===a}function n(a){var b=Object.getPrototypeOf(a),c=f(b),d=o(c);return l(b,d,a),d}function o(a){function b(b){a.call(this,b)}return b.prototype=Object.create(a.prototype),b.prototype.constructor=b,b}function p(a){return a instanceof C.EventTarget||a instanceof C.Event||a instanceof C.Range||a instanceof C.DOMImplementation}function q(a){return a instanceof H||a instanceof G||a instanceof I||a instanceof J||a instanceof F}function r(a){if(null===a)return null;b(q(a));var c=z.get(a);return c||z.set(a,c=new(f(a))(a)),c}function s(a){return null===a?null:(b(p(a)),a.impl)}function t(a){return a&&p(a)?s(a):a}function u(a){return a&&!p(a)?r(a):a}function v(a,c){null!==c&&(b(q(a)),b(void 0===c||p(c)),z.set(a,c))}function w(a,b,c){Object.defineProperty(a.prototype,b,{get:c,configurable:!0,enumerable:!0})}function x(a,b){w(a,b,function(){return r(this.impl[b])})}function y(a,b){a.forEach(function(a){b.forEach(function(b){a.prototype[b]=function(){var a=u(this);return a[b].apply(a,arguments)}})})}var z=new SideTable,A=new SideTable,B=new SideTable,C=Object.create(null);Object.getOwnPropertyNames(window);var D=/Firefox/.test(navigator.userAgent),E={get:function(){},set:function(){},configurable:!0,enumerable:!0},F=DOMImplementation,G=Event,H=Node,I=Window,J=Range;a.assert=b,a.constructorTable=A,a.defineGetter=w,a.defineWrapGetter=x,a.forwardMethodsToWrapper=y,a.isWrapperFor=m,a.mixin=c,a.nativePrototypeTable=B,a.oneOf=e,a.registerObject=n,a.registerWrapper=k,a.rewrap=v,a.unwrap=s,a.unwrapIfNeeded=t,a.wrap=r,a.wrapIfNeeded=u,a.wrappers=C}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){return a instanceof N.ShadowRoot}function c(a){var b=a.localName;return"content"===b||"shadow"===b}function d(a){return!!a.shadowRoot}function e(a){var b;return a.parentNode||(b=a.defaultView)&&M(b)||null}function f(f,g,h){if(h.length)return h.shift();if(b(f))return j(f)||a.getHostForShadowRoot(f);var i=a.eventParentsTable.get(f);if(i){for(var k=1;k<i.length;k++)h[k-1]=i[k];return i[0]}if(g&&c(f)){var l=f.parentNode;if(l&&d(l))for(var m=a.getShadowTrees(l),n=j(g),k=0;k<m.length;k++)if(m[k].contains(n))return n}return e(f)}function g(a){for(var d=[],e=a,g=[],i=[];e;){var j=null;if(c(e)){j=h(d);var k=d[d.length-1]||e;d.push(k)}else d.length||d.push(e);var l=d[d.length-1];g.push({target:l,currentTarget:e}),b(e)&&d.pop(),e=f(e,j,i)}return g}function h(a){for(var b=a.length-1;b>=0;b--)if(!c(a[b]))return a[b];return null}function i(d,e){for(var g=[];d;){for(var i=[],j=e,l=void 0;j;){var n=null;if(i.length){if(c(j)&&(n=h(i),k(l))){var o=i[i.length-1];i.push(o)}}else i.push(j);if(m(j,d))return i[i.length-1];b(j)&&i.pop(),l=j,j=f(j,n,g)}d=b(d)?a.getHostForShadowRoot(d):d.parentNode}}function j(b){return a.insertionParentTable.get(b)}function k(a){return j(a)}function l(a){for(var b;b=a.parentNode;)a=b;return a}function m(a,b){return l(a)===l(b)}function n(b,c){if(b===c)return!0;if(b instanceof N.ShadowRoot){var d=a.getHostForShadowRoot(b);return n(l(d),c)}return!1}function o(a){switch(a){case"DOMAttrModified":case"DOMAttributeNameChanged":case"DOMCharacterDataModified":case"DOMElementNameChanged":case"DOMNodeInserted":case"DOMNodeInsertedIntoDocument":case"DOMNodeRemoved":case"DOMNodeRemovedFromDocument":case"DOMSubtreeModified":return!0}return!1}function p(b){if(!P.get(b)){P.set(b,!0),o(b.type)||a.renderAllPending();var c=M(b.target),d=M(b);return q(d,c)}}function q(a,b){var c=g(b);return"load"===a.type&&2===c.length&&c[0].target instanceof N.Document&&c.shift(),X.set(a,c),r(a,c)&&s(a,c)&&t(a,c),T.set(a,w.NONE),R.set(a,null),a.defaultPrevented}function r(a,b){for(var c,d=b.length-1;d>0;d--){var e=b[d].target,f=b[d].currentTarget;if(e!==f&&(c=w.CAPTURING_PHASE,!u(b[d],a,c)))return!1}return!0}function s(a,b){var c=w.AT_TARGET;return u(b[0],a,c)}function t(a,b){for(var c,d=a.bubbles,e=1;e<b.length;e++){var f=b[e].target,g=b[e].currentTarget;if(f===g)c=w.AT_TARGET;else{if(!d||V.get(a))continue;c=w.BUBBLING_PHASE}if(!u(b[e],a,c))return}}function u(a,b,c){var d=a.target,e=a.currentTarget,f=O.get(e);if(!f)return!0;if("relatedTarget"in b){var g=L(b),h=M(g.relatedTarget),j=i(e,h);if(j===d)return!0;S.set(b,j)}T.set(b,c);var k=b.type,l=!1;Q.set(b,d),R.set(b,e);for(var m=0;m<f.length;m++){var n=f[m];if(n.removed)l=!0;else if(!(n.type!==k||!n.capture&&c===w.CAPTURING_PHASE||n.capture&&c===w.BUBBLING_PHASE))try{if("function"==typeof n.handler?n.handler.call(e,b):n.handler.handleEvent(b),V.get(b))return!1}catch(o){window.onerror?window.onerror(o.message):console.error(o)}}if(l){var p=f.slice();f.length=0;for(var m=0;m<p.length;m++)p[m].removed||f.push(p[m])}return!U.get(b)}function v(a,b,c){this.type=a,this.handler=b,this.capture=Boolean(c)}function w(a,b){return a instanceof Y?(this.impl=a,void 0):M(A(Y,"Event",a,b))}function x(a){return a&&a.relatedTarget?Object.create(a,{relatedTarget:{value:L(a.relatedTarget)}}):a}function y(a,b,c){var d=window[a],e=function(b,c){return b instanceof d?(this.impl=b,void 0):M(A(d,a,b,c))};return e.prototype=Object.create(b.prototype),c&&J(e.prototype,c),d&&(d.prototype["init"+a]?K(d,e,document.createEvent(a)):K(d,e,new d("temp"))),e}function z(a,b){return function(){arguments[b]=L(arguments[b]);var c=L(this);c[a].apply(c,arguments)}}function A(a,b,c,d){if(gb)return new a(c,x(d));var e=L(document.createEvent(b)),f=fb[b],g=[c];return Object.keys(f).forEach(function(a){var b=null!=d&&a in d?d[a]:f[a];"relatedTarget"===a&&(b=L(b)),g.push(b)}),e["init"+b].apply(e,g),e}function B(a){return"function"==typeof a?!0:a&&a.handleEvent}function C(a){this.impl=a}function D(b){return b instanceof N.ShadowRoot&&(b=a.getHostForShadowRoot(b)),L(b)}function E(a){I(a,jb)}function F(b,c,d,e){a.renderAllPending();for(var f=M(kb.call(c.impl,d,e)),h=g(f,this),i=0;i<h.length;i++){var j=h[i];if(j.currentTarget===b)return j.target}return null}function G(a){return function(){var b=W.get(this);return b&&b[a]&&b[a].value||null}}function H(a){var b=a.slice(2);return function(c){var d=W.get(this);d||(d=Object.create(null),W.set(this,d));var e=d[a];if(e&&this.removeEventListener(b,e.wrapped,!1),"function"==typeof c){var f=function(b){var d=c.call(this,b);d===!1?b.preventDefault():"onbeforeunload"===a&&"string"==typeof d&&(b.returnValue=d)};this.addEventListener(b,f,!1),d[a]={value:c,wrapped:f}}}}var I=a.forwardMethodsToWrapper,J=a.mixin,K=a.registerWrapper,L=a.unwrap,M=a.wrap,N=a.wrappers;new SideTable;var O=new SideTable,P=new SideTable,Q=new SideTable,R=new SideTable,S=new SideTable,T=new SideTable,U=new SideTable,V=new SideTable,W=new SideTable,X=new SideTable;v.prototype={equals:function(a){return this.handler===a.handler&&this.type===a.type&&this.capture===a.capture},get removed(){return null===this.handler},remove:function(){this.handler=null}};var Y=window.Event;w.prototype={get target(){return Q.get(this)},get currentTarget(){return R.get(this)},get eventPhase(){return T.get(this)},get path(){var a=new N.NodeList,b=X.get(this);if(b){for(var c=0,d=b.length-1,e=l(R.get(this)),f=0;d>=f;f++){var g=b[f].currentTarget,h=l(g);n(e,h)&&(f!==d||g instanceof N.Node)&&(a[c++]=g)}a.length=c}return a},stopPropagation:function(){U.set(this,!0)},stopImmediatePropagation:function(){U.set(this,!0),V.set(this,!0)}},K(Y,w,document.createEvent("Event"));var Z=y("UIEvent",w),$=y("CustomEvent",w),_={get relatedTarget(){return S.get(this)||M(L(this).relatedTarget)}},ab=J({initMouseEvent:z("initMouseEvent",14)},_),bb=J({initFocusEvent:z("initFocusEvent",5)},_),cb=y("MouseEvent",Z,ab),db=y("FocusEvent",Z,bb),eb=y("MutationEvent",w,{initMutationEvent:z("initMutationEvent",3),get relatedNode(){return M(this.impl.relatedNode)}}),fb=Object.create(null),gb=function(){try{new window.MouseEvent("click")}catch(a){return!1}return!0}();if(!gb){var hb=function(a,b,c){if(c){var d=fb[c];b=J(J({},d),b)}fb[a]=b};hb("Event",{bubbles:!1,cancelable:!1}),hb("CustomEvent",{detail:null},"Event"),hb("UIEvent",{view:null,detail:0},"Event"),hb("MouseEvent",{screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null},"UIEvent"),hb("FocusEvent",{relatedTarget:null},"UIEvent")}var ib=window.EventTarget,jb=["addEventListener","removeEventListener","dispatchEvent"];[Node,Window].forEach(function(a){var b=a.prototype;jb.forEach(function(a){Object.defineProperty(b,a+"_",{value:b[a]})})}),C.prototype={addEventListener:function(a,b,c){if(B(b)){var d=new v(a,b,c),e=O.get(this);if(e){for(var f=0;f<e.length;f++)if(d.equals(e[f]))return}else e=[],O.set(this,e);e.push(d);var g=D(this);g.addEventListener_(a,p,!0)}},removeEventListener:function(a,b,c){c=Boolean(c);var d=O.get(this);if(d){for(var e=0,f=!1,g=0;g<d.length;g++)d[g].type===a&&d[g].capture===c&&(e++,d[g].handler===b&&(f=!0,d[g].remove()));if(f&&1===e){var h=D(this);h.removeEventListener_(a,p,!0)}}},dispatchEvent:function(b){a.renderAllPending();var c=D(this);return c.dispatchEvent_(L(b))}},ib&&K(ib,C);var kb=document.elementFromPoint;a.adjustRelatedTarget=i,a.elementFromPoint=F,a.getEventHandlerGetter=G,a.getEventHandlerSetter=H,a.wrapEventTargetMethods=E,a.wrappers.CustomEvent=$,a.wrappers.Event=w,a.wrappers.EventTarget=C,a.wrappers.FocusEvent=db,a.wrappers.MouseEvent=cb,a.wrappers.MutationEvent=eb,a.wrappers.UIEvent=Z}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a,b){Object.defineProperty(a,b,{enumerable:!1})}function c(){this.length=0,b(this,"length")}function d(a){if(null==a)return a;for(var b=new c,d=0,e=a.length;e>d;d++)b[d]=f(a[d]);return b.length=e,b}function e(a,b){a.prototype[b]=function(){return d(this.impl[b].apply(this.impl,arguments))}}var f=a.wrap;c.prototype={item:function(a){return this[a]}},b(c.prototype,"item"),a.wrappers.NodeList=c,a.addWrapNodeListMethod=e,a.wrapNodeList=d}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){l(a instanceof i)}function c(a,b,c,d){if(a.nodeType!==i.DOCUMENT_FRAGMENT_NODE)return a.parentNode&&a.parentNode.removeChild(a),a.parentNode_=b,a.previousSibling_=c,a.nextSibling_=d,c&&(c.nextSibling_=a),d&&(d.previousSibling_=a),[a];for(var e,f=[];e=a.firstChild;)a.removeChild(e),f.push(e),e.parentNode_=b;for(var g=0;g<f.length;g++)f[g].previousSibling_=f[g-1]||c,f[g].nextSibling_=f[g+1]||d;return c&&(c.nextSibling_=f[0]),d&&(d.previousSibling_=f[f.length-1]),f}function d(a,b){var c=a.nodeType===i.DOCUMENT_NODE?a:a.ownerDocument;c!==b.ownerDocument&&c.adoptNode(b)}function e(b,c){if(c.length){var d=b.ownerDocument;if(d!==c[0].ownerDocument)for(var e=0;e<c.length;e++)a.adoptNodeNoRemove(c[e],d)}}function f(a,b){e(a,b);var c=b.length;if(1===c)return o(b[0]);for(var d=o(a.ownerDocument.createDocumentFragment()),f=0;c>f;f++)d.appendChild(o(b[f]));return d}function g(a){if(a.invalidateShadowRenderer()){for(var b=a.firstChild;b;){l(b.parentNode===a);var c=b.nextSibling,d=o(b),e=d.parentNode;e&&v.call(e,d),b.previousSibling_=b.nextSibling_=b.parentNode_=null,b=c}a.firstChild_=a.lastChild_=null}else for(var c,f=o(a),g=f.firstChild;g;)c=g.nextSibling,v.call(f,g),g=c}function h(a){var b=a.parentNode;return b&&b.invalidateShadowRenderer()}function i(a){l(a instanceof r),j.call(this,a),this.parentNode_=void 0,this.firstChild_=void 0,this.lastChild_=void 0,this.nextSibling_=void 0,this.previousSibling_=void 0}var j=a.wrappers.EventTarget,k=a.wrappers.NodeList;a.defineWrapGetter;var l=a.assert,m=a.mixin,n=a.registerWrapper,o=a.unwrap,p=a.wrap,q=a.wrapIfNeeded,r=window.Node,s=r.prototype.appendChild,t=r.prototype.insertBefore,u=r.prototype.replaceChild,v=r.prototype.removeChild,w=r.prototype.compareDocumentPosition;i.prototype=Object.create(j.prototype),m(i.prototype,{appendChild:function(a){if(b(a),this.invalidateShadowRenderer()||h(a)){var e=this.lastChild,g=null,i=c(a,this,e,g);this.lastChild_=i[i.length-1],e||(this.firstChild_=i[0]),s.call(this.impl,f(this,i))}else d(this,a),s.call(this.impl,o(a));return a.nodeWasAdded_(),a},insertBefore:function(a,g){if(!g)return this.appendChild(a);if(b(a),b(g),l(g.parentNode===this),this.invalidateShadowRenderer()||h(a)){var i=g.previousSibling,j=g,k=c(a,this,i,j);this.firstChild===g&&(this.firstChild_=k[0]);var m=o(g),n=m.parentNode;n?t.call(n,f(this,k),m):e(this,k)}else d(this,a),t.call(this.impl,o(a),o(g));return a.nodeWasAdded_(),a},removeChild:function(a){if(b(a),a.parentNode!==this)throw new Error("NotFoundError");var c=o(a);if(this.invalidateShadowRenderer()){var d=this.firstChild,e=this.lastChild,f=a.nextSibling,g=a.previousSibling,h=c.parentNode;h&&v.call(h,c),d===a&&(this.firstChild_=f),e===a&&(this.lastChild_=g),g&&(g.nextSibling_=f),f&&(f.previousSibling_=g),a.previousSibling_=a.nextSibling_=a.parentNode_=void 0}else v.call(this.impl,c);return a},replaceChild:function(a,e){if(b(a),b(e),e.parentNode!==this)throw new Error("NotFoundError");var g=o(e);if(this.invalidateShadowRenderer()||h(a)){var i=e.previousSibling,j=e.nextSibling;j===a&&(j=a.nextSibling);var k=c(a,this,i,j);this.firstChild===e&&(this.firstChild_=k[0]),this.lastChild===e&&(this.lastChild_=k[k.length-1]),e.previousSibling_=e.nextSibling_=e.parentNode_=void 0,g.parentNode&&u.call(g.parentNode,f(this,k),g)}else d(this,a),u.call(this.impl,o(a),g);return a.nodeWasAdded_(),e},nodeWasAdded_:function(){},hasChildNodes:function(){return null===this.firstChild},get parentNode(){return void 0!==this.parentNode_?this.parentNode_:p(this.impl.parentNode)},get firstChild(){return void 0!==this.firstChild_?this.firstChild_:p(this.impl.firstChild)},get lastChild(){return void 0!==this.lastChild_?this.lastChild_:p(this.impl.lastChild)},get nextSibling(){return void 0!==this.nextSibling_?this.nextSibling_:p(this.impl.nextSibling)},get previousSibling(){return void 0!==this.previousSibling_?this.previousSibling_:p(this.impl.previousSibling)},get parentElement(){for(var a=this.parentNode;a&&a.nodeType!==i.ELEMENT_NODE;)a=a.parentNode;return a},get textContent(){for(var a="",b=this.firstChild;b;b=b.nextSibling)a+=b.textContent;return a},set textContent(a){if(this.invalidateShadowRenderer()){if(g(this),""!==a){var b=this.impl.ownerDocument.createTextNode(a);this.appendChild(b)}}else this.impl.textContent=a},get childNodes(){for(var a=new k,b=0,c=this.firstChild;c;c=c.nextSibling)a[b++]=c;return a.length=b,a},cloneNode:function(a){if(!this.invalidateShadowRenderer())return p(this.impl.cloneNode(a));var b=p(this.impl.cloneNode(!1));if(a)for(var c=this.firstChild;c;c=c.nextSibling)b.appendChild(c.cloneNode(!0));return b},contains:function(a){if(!a)return!1;if(a=q(a),a===this)return!0;var b=a.parentNode;return b?this.contains(b):!1},compareDocumentPosition:function(a){return w.call(this.impl,o(a))},get ownerDocument(){return a.renderAllPending(),p(this.impl.ownerDocument)}}),n(r,i,document.createDocumentFragment()),delete i.prototype.querySelector,delete i.prototype.querySelectorAll,i.prototype=m(Object.create(j.prototype),i.prototype),a.wrappers.Node=i}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a,c){for(var d,e=a.firstElementChild;e;){if(e.matches(c))return e;if(d=b(e,c))return d;e=e.nextElementSibling}return null}function c(a,b,d){for(var e=a.firstElementChild;e;)e.matches(b)&&(d[d.length++]=e),c(e,b,d),e=e.nextElementSibling;return d}var d={querySelector:function(a){return b(this,a)},querySelectorAll:function(a){return c(this,a,new NodeList)}},e={getElementsByTagName:function(a){return this.querySelectorAll(a)},getElementsByClassName:function(a){return this.querySelectorAll("."+a)},getElementsByTagNameNS:function(a,b){if("*"===a)return this.getElementsByTagName(b);for(var c=new NodeList,d=this.getElementsByTagName(b),e=0,f=0;e<d.length;e++)d[e].namespaceURI===a&&(c[f++]=d[e]);return c.length=f,c}};a.GetElementsByInterface=e,a.SelectorsInterface=d}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){for(;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.nextSibling;return a}function c(a){for(;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.previousSibling;return a}var d=a.wrappers.NodeList,e={get firstElementChild(){return b(this.firstChild)},get lastElementChild(){return c(this.lastChild)},get childElementCount(){for(var a=0,b=this.firstElementChild;b;b=b.nextElementSibling)a++;return a},get children(){for(var a=new d,b=0,c=this.firstElementChild;c;c=c.nextElementSibling)a[b++]=c;return a.length=b,a}},f={get nextElementSibling(){return b(this.nextSibling)},get previousElementSibling(){return c(this.previousSibling)}};a.ChildNodeInterface=f,a.ParentNodeInterface=e}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){d.call(this,a)}var c=a.ChildNodeInterface,d=a.wrappers.Node,e=a.mixin,f=a.registerWrapper,g=window.CharacterData;b.prototype=Object.create(d.prototype),e(b.prototype,{get textContent(){return this.data},set textContent(a){this.data=a}}),e(b.prototype,c),f(g,b,document.createTextNode("")),a.wrappers.CharacterData=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(b,c){var d=b.parentNode;if(d&&d.shadowRoot){var e=a.getRendererForHost(d);e.dependsOnAttribute(c)&&e.invalidate()}}function c(a){g.call(this,a)}function d(a,c,d){var e=d||c;Object.defineProperty(a,c,{get:function(){return this.impl[c]},set:function(a){this.impl[c]=a,b(this,e)},configurable:!0,enumerable:!0})}var e=a.ChildNodeInterface,f=a.GetElementsByInterface,g=a.wrappers.Node,h=a.ParentNodeInterface,i=a.SelectorsInterface;a.addWrapNodeListMethod;var j=a.mixin,k=a.oneOf,l=a.registerWrapper,m=a.wrappers,n=new SideTable,o=window.Element,p=k(o.prototype,["matches","mozMatchesSelector","msMatchesSelector","webkitMatchesSelector"]),q=o.prototype[p];c.prototype=Object.create(g.prototype),j(c.prototype,{createShadowRoot:function(){var b=new m.ShadowRoot(this);n.set(this,b);var c=a.getRendererForHost(this);return c.invalidate(),b},get shadowRoot(){return n.get(this)||null},setAttribute:function(a,c){this.impl.setAttribute(a,c),b(this,a)},removeAttribute:function(a){this.impl.removeAttribute(a),b(this,a)},matches:function(a){return q.call(this.impl,a)}}),c.prototype[p]=function(a){return this.matches(a)},o.prototype.webkitCreateShadowRoot&&(c.prototype.webkitCreateShadowRoot=c.prototype.createShadowRoot),d(c.prototype,"id"),d(c.prototype,"className","class"),j(c.prototype,e),j(c.prototype,f),j(c.prototype,h),j(c.prototype,i),l(o,c),a.matchesName=p,a.wrappers.Element=c}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){switch(a){case"&":return"&amp;";case"<":return"&lt;";case'"':return"&quot;"}}function c(a){return a.replace(p,b)}function d(a){switch(a.nodeType){case Node.ELEMENT_NODE:for(var b,d=a.tagName.toLowerCase(),f="<"+d,g=a.attributes,h=0;b=g[h];h++)f+=" "+b.name+'="'+c(b.value)+'"';return f+=">",q[d]?f:f+e(a)+"</"+d+">";case Node.TEXT_NODE:return c(a.nodeValue);case Node.COMMENT_NODE:return"<!--"+c(a.nodeValue)+"-->";default:throw console.error(a),new Error("not implemented")}}function e(a){for(var b="",c=a.firstChild;c;c=c.nextSibling)b+=d(c);return b}function f(a,b,c){var d=c||"div";a.textContent="";var e=n(a.ownerDocument.createElement(d));e.innerHTML=b;for(var f;f=e.firstChild;)a.appendChild(o(f))}function g(a){j.call(this,a)}function h(b){k(g,b,function(){return a.renderAllPending(),this.impl[b]})}function i(b){Object.defineProperty(g.prototype,b,{value:function(){return a.renderAllPending(),this.impl[b].apply(this.impl,arguments)},configurable:!0,enumerable:!0})}var j=a.wrappers.Element,k=a.defineGetter,l=a.mixin,m=a.registerWrapper,n=a.unwrap,o=a.wrap,p=/&|<|"/g,q={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},r=window.HTMLElement;g.prototype=Object.create(j.prototype),l(g.prototype,{get innerHTML(){return e(this)},set innerHTML(a){this.invalidateShadowRenderer()?f(this,a,this.tagName):this.impl.innerHTML=a},get outerHTML(){return d(this)},set outerHTML(a){var b=this.parentNode;b&&(b.invalidateShadowRenderer(),this.impl.outerHTML=a)}}),["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetTop","offsetWidth","scrollHeight","scrollLeft","scrollTop","scrollWidth"].forEach(h),["getBoundingClientRect","getClientRects","scrollIntoView"].forEach(i),m(r,g,document.createElement("b")),a.wrappers.HTMLElement=g,a.getInnerHTML=e,a.setInnerHTML=f}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=window.HTMLContentElement;b.prototype=Object.create(c.prototype),d(b.prototype,{get select(){return this.getAttribute("select")},set select(a){this.setAttribute("select",a)},setAttribute:function(a,b){c.prototype.setAttribute.call(this,a,b),"select"===String(a).toLowerCase()&&this.invalidateShadowRenderer(!0)}}),f&&e(f,b),a.wrappers.HTMLContentElement=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=window.HTMLShadowElement;b.prototype=Object.create(c.prototype),d(b.prototype,{}),f&&e(f,b),a.wrappers.HTMLShadowElement=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){if(!a.defaultView)return a;var b=m.get(a);if(!b){for(b=a.implementation.createHTMLDocument("");b.lastChild;)b.removeChild(b.lastChild);m.set(a,b)}return b}function c(a){for(var c,d=b(a.ownerDocument),e=j(d.createDocumentFragment());c=a.firstChild;)e.appendChild(c);return e}function d(a){if(e.call(this,a),!n){var b=c(a);l.set(this,k(b))}}var e=a.wrappers.HTMLElement,f=a.getInnerHTML,g=a.mixin,h=a.registerWrapper,i=a.setInnerHTML,j=a.unwrap,k=a.wrap,l=new SideTable,m=new SideTable,n=window.HTMLTemplateElement;d.prototype=Object.create(e.prototype),g(d.prototype,{get content(){return n?k(this.impl.content):l.get(this)},get innerHTML(){return f(this.content)},set innerHTML(a){i(this.content,a)}}),n&&h(n,d),a.wrappers.HTMLTemplateElement=d}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){switch(a.localName){case"content":return new c(a);case"shadow":return new e(a);case"template":return new f(a)}d.call(this,a)}var c=a.wrappers.HTMLContentElement,d=a.wrappers.HTMLElement,e=a.wrappers.HTMLShadowElement,f=a.wrappers.HTMLTemplateElement;a.mixin;var g=a.registerWrapper,h=window.HTMLUnknownElement;b.prototype=Object.create(d.prototype),g(h,b),a.wrappers.HTMLUnknownElement=b}(this.ShadowDOMPolyfill),function(a){"use strict";var b=a.GetElementsByInterface,c=a.ParentNodeInterface,d=a.SelectorsInterface,e=a.mixin,f=a.registerObject,g=f(document.createDocumentFragment());e(g.prototype,c),e(g.prototype,d),e(g.prototype,b);var h=f(document.createTextNode("")),i=f(document.createComment(""));a.wrappers.Comment=i,a.wrappers.DocumentFragment=g,a.wrappers.Text=h}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){var b=i(a.impl.ownerDocument.createDocumentFragment());c.call(this,b),g(b,this);var d=a.shadowRoot;k.set(this,d),j.set(this,a)}var c=a.wrappers.DocumentFragment,d=a.elementFromPoint,e=a.getInnerHTML,f=a.mixin,g=a.rewrap,h=a.setInnerHTML,i=a.unwrap,j=new SideTable,k=new SideTable;b.prototype=Object.create(c.prototype),f(b.prototype,{get innerHTML(){return e(this)},set innerHTML(a){h(this,a),this.invalidateShadowRenderer()},get olderShadowRoot(){return k.get(this)||null},invalidateShadowRenderer:function(){return j.get(this).invalidateShadowRenderer()},elementFromPoint:function(a,b){return d(this,this.ownerDocument,a,b)},getElementById:function(a){return this.querySelector("#"+a)}}),a.wrappers.ShadowRoot=b,a.getHostForShadowRoot=function(a){return j.get(a)}}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){a.previousSibling_=a.previousSibling,a.nextSibling_=a.nextSibling,a.parentNode_=a.parentNode}function c(a){a.firstChild_=a.firstChild,a.lastChild_=a.lastChild}function d(a){F(a instanceof D);for(var d=a.firstChild;d;d=d.nextSibling)b(d);c(a)}function e(a){var b=J(a);d(a),b.firstChild&&(b.textContent="")}function f(a,c){var e=J(a),f=J(c);f.nodeType===D.DOCUMENT_FRAGMENT_NODE?d(c):(h(c),b(c)),a.lastChild_=a.lastChild,a.lastChild===a.firstChild&&(a.firstChild_=a.firstChild);var g=K(e.lastChild);g&&(g.nextSibling_=g.nextSibling),e.appendChild(f)}function g(a,c){var d=J(a),e=J(c);b(c),c.previousSibling&&(c.previousSibling.nextSibling_=c),c.nextSibling&&(c.nextSibling.previousSibling_=c),a.lastChild===c&&(a.lastChild_=c),a.firstChild===c&&(a.firstChild_=c),d.removeChild(e)}function h(a){var b=J(a),c=b.parentNode;c&&g(K(c),a)}function i(a,b){k(b).push(a),z(a,b);var c=M.get(a);c||M.set(a,c=[]),c.push(b)}function j(a){L.set(a,[])}function k(a){return L.get(a)}function l(a){for(var b=[],c=0,d=a.firstChild;d;d=d.nextSibling)b[c++]=d;return b}function m(a,b,c){for(var d=l(a),e=0;e<d.length;e++){var f=d[e];if(b(f)){if(c(f)===!1)return}else m(f,b,c)}}function n(a,b){var c=b.getAttribute("select");if(!c)return!0;if(c=c.trim(),!c)return!0;if(a.nodeType!==D.ELEMENT_NODE)return!1;if(!Q.test(c))return!1;if(":"===c[0]&&!R.test(c))return!1;try{return a.matches(c)}catch(d){return!1}}function o(){H=null,T.forEach(function(a){a.render()}),T=[]}function p(a){this.host=a,this.dirty=!1,this.invalidateAttributes(),this.associateNode(a)}function q(a){var b=O.get(a);return b||(b=new p(a),O.set(a,b)),b}function r(a){for(;a;a=a.parentNode)if(a instanceof E)return a;return null}function s(a){return q(G(a))}function t(a){return"content"===a.localName}function u(a){return"content"===a.localName}function v(a){return"shadow"===a.localName}function w(a){return"shadow"===a.localName}function x(a){return a.shadowRoot}function y(a){for(var b=[],c=a.shadowRoot;c;c=c.olderShadowRoot)b.push(c);return b}function z(a,b){N.set(a,b)}function A(a){new p(a).render()}var B=a.wrappers.HTMLContentElement,C=a.wrappers.HTMLShadowElement,D=a.wrappers.Node,E=a.wrappers.ShadowRoot,F=a.assert,G=a.getHostForShadowRoot;a.mixin;var H,I=a.oneOf,J=a.unwrap,K=a.wrap,L=new SideTable,M=new SideTable,N=new SideTable,O=new SideTable,P=new SideTable,Q=/^[*.:#[a-zA-Z_|]/,R=new RegExp("^:("+["link","visited","target","enabled","disabled","checked","indeterminate","nth-child","nth-last-child","nth-of-type","nth-last-of-type","first-child","last-child","first-of-type","last-of-type","only-of-type"].join("|")+")"),S=I(window,["requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","setTimeout"]),T=[];p.prototype={render:function(){if(this.dirty){this.invalidateAttributes(),this.treeComposition();var a=this.host,b=a.shadowRoot;this.removeAllChildNodes(this.host);var c=l(b);c.forEach(function(c){this.renderNode(a,b,c,!1)},this),this.dirty=!1}},invalidate:function(){if(!this.dirty){if(this.dirty=!0,T.push(this),H)return;H=window[S](o,0)}},renderNode:function(a,b,c,d){if(x(c)){this.appendChild(a,c);var e=q(c);e.dirty=!0,e.render()}else t(c)?this.renderInsertionPoint(a,b,c,d):v(c)?this.renderShadowInsertionPoint(a,b,c):this.renderAsAnyDomTree(a,b,c,d)},renderAsAnyDomTree:function(a,b,c,d){if(this.appendChild(a,c),x(c))A(c);else{var e=c,f=l(e);P.get(e)&&this.removeAllChildNodes(e),f.forEach(function(a){this.renderNode(e,b,a,d)},this)}},renderInsertionPoint:function(a,b,c,d){var e=k(c);e.length?(this.removeAllChildNodes(c),e.forEach(function(c){t(c)&&d?this.renderInsertionPoint(a,b,c,d):this.renderAsAnyDomTree(a,b,c,d)},this)):this.renderFallbackContent(a,c),this.remove(c)},renderShadowInsertionPoint:function(a,b,c){var d=b.olderShadowRoot;if(d){z(d,c),this.remove(c);var e=l(d);e.forEach(function(b){this.renderNode(a,d,b,!0)},this)}else this.renderFallbackContent(a,c)},renderFallbackContent:function(a,b){var c=l(b);this.associateNode(b),this.remove(b),c.forEach(function(b){this.appendChild(a,b)},this)},invalidateAttributes:function(){this.attributes=Object.create(null)},updateDependentAttributes:function(a){if(a){var b=this.attributes;/\.\w+/.test(a)&&(b["class"]=!0),/#\w+/.test(a)&&(b.id=!0),a.replace(/\[\s*([^\s=\|~\]]+)/g,function(a,c){b[c]=!0})}},dependsOnAttribute:function(a){return this.attributes[a]},distribute:function(a,b){var c=!1,d=this;return m(a,u,function(a){j(a),d.updateDependentAttributes(a.getAttribute("select"));for(var e=0;e<b.length;e++){var f=b[e];void 0!==f&&n(f,a)&&(i(f,a),b[e]=void 0,c=!0)}}),c?b.filter(function(a){return void 0!==a}):b},treeComposition:function(){var a=this.host,b=a.shadowRoot,c=[],d=l(a);d.forEach(function(a){if(t(a)){var b=k(a);b&&b.length||(b=l(a)),c.push.apply(c,b)}else c.push(a)});for(var e,f;b;){if(e=void 0,m(b,w,function(a){return e=a,!1}),f=e,c=this.distribute(b,c),f){var g=b.olderShadowRoot;if(g){b=g,z(b,f);continue}break}break}},appendChild:function(a,b){this.associateNode(a),f(a,b)},remove:function(a){this.associateNode(a.parentNode),h(a)},removeAllChildNodes:function(a){this.associateNode(a),e(a)},associateNode:function(a){P.set(a,this)}},D.prototype.invalidateShadowRenderer=function(){var a=P.get(this);return a?(a.invalidate(),!0):!1},B.prototype.getDistributedNodes=function(){var a=P.get(this);return a&&a.render(),k(this)},C.prototype.nodeWasAdded_=B.prototype.nodeWasAdded_=function(){this.invalidateShadowRenderer();var a,b=r(this);b&&(a=s(b)),P.set(this,a),a&&a.invalidate()},a.eventParentsTable=M,a.getRendererForHost=q,a.getShadowTrees=y,a.insertionParentTable=N,a.renderAllPending=o,a.visual={removeAllChildNodes:e,appendChild:f,removeChild:g}}(this.ShadowDOMPolyfill),function(a){"use strict";function b(b){if(window[b]){d(!a.wrappers[b]);var i=function(a){c.call(this,a)};i.prototype=Object.create(c.prototype),e(i.prototype,{get form(){return h(g(this).form)}}),f(window[b],i,document.createElement(b.slice(4,-7))),a.wrappers[b]=i}}var c=a.wrappers.HTMLElement,d=a.assert,e=a.mixin,f=a.registerWrapper,g=a.unwrap,h=a.wrap,i=["HTMLButtonElement","HTMLFieldSetElement","HTMLInputElement","HTMLKeygenElement","HTMLLabelElement","HTMLLegendElement","HTMLObjectElement","HTMLOptionElement","HTMLOutputElement","HTMLSelectElement","HTMLTextAreaElement"];i.forEach(b)}(this.ShadowDOMPolyfill),function(a){"use strict";
+function b(a){k.call(this,a)}function c(a){var c=document[a];b.prototype[a]=function(){return v(c.apply(this.impl,arguments))}}function d(a,b){y.call(b.impl,u(a)),e(a,b)}function e(a,b){a.shadowRoot&&b.adoptNode(a.shadowRoot),a instanceof n&&f(a,b);for(var c=a.firstChild;c;c=c.nextSibling)e(c,b)}function f(a,b){var c=a.olderShadowRoot;c&&b.adoptNode(c)}function g(a){this.impl=a}function h(a,b){var c=document.implementation[b];a.prototype[b]=function(){return v(c.apply(this.impl,arguments))}}function i(a,b){var c=document.implementation[b];a.prototype[b]=function(){return c.apply(this.impl,arguments)}}var j=a.GetElementsByInterface,k=a.wrappers.Node,l=a.ParentNodeInterface,m=a.SelectorsInterface,n=a.wrappers.ShadowRoot,o=a.defineWrapGetter,p=a.elementFromPoint,q=a.forwardMethodsToWrapper,r=a.matchesName,s=a.mixin,t=a.registerWrapper,u=a.unwrap,v=a.wrap,w=a.wrapEventTargetMethods;a.wrapNodeList;var x=new SideTable;b.prototype=Object.create(k.prototype),o(b,"documentElement"),o(b,"body"),o(b,"head"),["createComment","createDocumentFragment","createElement","createElementNS","createEvent","createEventNS","createRange","createTextNode","getElementById"].forEach(c);var y=document.adoptNode;if(s(b.prototype,{adoptNode:function(a){return a.parentNode&&a.parentNode.removeChild(a),d(a,this),a},elementFromPoint:function(a,b){return p(this,this,a,b)}}),document.register){var z=document.register;b.prototype.register=function(b,c){function d(a){return a?(this.impl=a,void 0):document.createElement(b)}var e=c.prototype;if(a.nativePrototypeTable.get(e))throw new Error("NotSupportedError");for(var f,g=Object.getPrototypeOf(e),h=[];g&&!(f=a.nativePrototypeTable.get(g));)h.push(g),g=Object.getPrototypeOf(g);if(!f)throw new Error("NotSupportedError");for(var i=Object.create(f),j=h.length-1;j>=0;j--)i=Object.create(i);return["createdCallback","enteredDocumentCallback","leftDocumentCallback","attributeChangedCallback"].forEach(function(a){var b=e[a];b&&(i[a]=function(){b.apply(v(this),arguments)})}),z.call(u(this),b,{prototype:i}),d.prototype=e,d.prototype.constructor=d,a.constructorTable.set(i,d),a.nativePrototypeTable.set(e,i),d},q([window.HTMLDocument||window.Document],["register"])}q([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement,window.HTMLHtmlElement],["appendChild","compareDocumentPosition","contains","getElementsByClassName","getElementsByTagName","getElementsByTagNameNS","insertBefore","querySelector","querySelectorAll","removeChild","replaceChild",r]),q([window.HTMLDocument||window.Document],["adoptNode","contains","createComment","createDocumentFragment","createElement","createElementNS","createEvent","createEventNS","createRange","createTextNode","elementFromPoint","getElementById"]),s(b.prototype,j),s(b.prototype,l),s(b.prototype,m),s(b.prototype,{get implementation(){var a=x.get(this);return a?a:(a=new g(u(this).implementation),x.set(this,a),a)}}),t(window.Document,b,document.implementation.createHTMLDocument("")),window.HTMLDocument&&t(window.HTMLDocument,b),w([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement]),h(g,"createDocumentType"),h(g,"createDocument"),h(g,"createHTMLDocument"),i(g,"hasFeature"),t(window.DOMImplementation,g),q([window.DOMImplementation],["createDocumentType","createDocument","createHTMLDocument","hasFeature"]),a.adoptNodeNoRemove=d,a.wrappers.DOMImplementation=g,a.wrappers.Document=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.EventTarget,d=a.mixin,e=a.registerWrapper,f=a.unwrap,g=a.unwrapIfNeeded,h=a.wrap,i=window.Window;b.prototype=Object.create(c.prototype);var j=window.getComputedStyle;i.prototype.getComputedStyle=function(a,b){return j.call(this||window,g(a),b)},["addEventListener","removeEventListener","dispatchEvent"].forEach(function(a){i.prototype[a]=function(){var b=h(this||window);return b[a].apply(b,arguments)}}),d(b.prototype,{getComputedStyle:function(a,b){return j.call(f(this),g(a),b)}}),e(i,b),a.wrappers.Window=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){this.impl=a}function c(a){return new b(a)}function d(a){return a.map(c)}function e(a){var b=this;this.impl=new k(function(c){a.call(b,d(c),b)})}var f=a.defineGetter,g=a.defineWrapGetter,h=a.registerWrapper,i=a.unwrapIfNeeded,j=a.wrapNodeList;a.wrappers;var k=window.MutationObserver||window.WebKitMutationObserver;if(k){var l=window.MutationRecord;b.prototype={get addedNodes(){return j(this.impl.addedNodes)},get removedNodes(){return j(this.impl.removedNodes)}},["target","previousSibling","nextSibling"].forEach(function(a){g(b,a)}),["type","attributeName","attributeNamespace","oldValue"].forEach(function(a){f(b,a,function(){return this.impl[a]})}),l&&h(l,b),window.Node,e.prototype={observe:function(a,b){this.impl.observe(i(a),b)},disconnect:function(){this.impl.disconnect()},takeRecords:function(){return d(this.impl.takeRecords())}},a.wrappers.MutationObserver=e,a.wrappers.MutationRecord=b}}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){this.impl=a}var c=a.registerWrapper,d=a.unwrap,e=a.unwrapIfNeeded,f=a.wrap,g=window.Range;b.prototype={get startContainer(){return f(this.impl.startContainer)},get endContainer(){return f(this.impl.endContainer)},get commonAncestorContainer(){return f(this.impl.commonAncestorContainer)},setStart:function(a,b){this.impl.setStart(e(a),b)},setEnd:function(a,b){this.impl.setEnd(e(a),b)},setStartBefore:function(a){this.impl.setStartBefore(e(a))},setStartAfter:function(a){this.impl.setStartAfter(e(a))},setEndBefore:function(a){this.impl.setEndBefore(e(a))},setEndAfter:function(a){this.impl.setEndAfter(e(a))},selectNode:function(a){this.impl.selectNode(e(a))},selectNodeContents:function(a){this.impl.selectNodeContents(e(a))},compareBoundaryPoints:function(a,b){return this.impl.compareBoundaryPoints(a,d(b))},extractContents:function(){return f(this.impl.extractContents())},cloneContents:function(){return f(this.impl.cloneContents())},insertNode:function(a){this.impl.insertNode(e(a))},surroundContents:function(a){this.impl.surroundContents(e(a))},cloneRange:function(){return f(this.impl.cloneRange())},isPointInRange:function(a,b){return this.impl.isPointInRange(e(a),b)},comparePoint:function(a,b){return this.impl.comparePoint(e(a),b)},intersectsNode:function(a){return this.impl.intersectsNode(e(a))}},g.prototype.createContextualFragment&&(b.prototype.createContextualFragment=function(a){return f(this.impl.createContextualFragment(a))}),c(window.Range,b),a.wrappers.Range=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){var b=c[a],d=window[b];if(d){var e=document.createElement(a),f=e.constructor;window[b]=f}}a.isWrapperFor;var c={a:"HTMLAnchorElement",applet:"HTMLAppletElement",area:"HTMLAreaElement",audio:"HTMLAudioElement",br:"HTMLBRElement",base:"HTMLBaseElement",body:"HTMLBodyElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",dl:"HTMLDListElement",datalist:"HTMLDataListElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",font:"HTMLFontElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",hr:"HTMLHRElement",head:"HTMLHeadElement",h1:"HTMLHeadingElement",html:"HTMLHtmlElement",iframe:"HTMLIFrameElement",input:"HTMLInputElement",li:"HTMLLIElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",link:"HTMLLinkElement",map:"HTMLMapElement",menu:"HTMLMenuElement",menuitem:"HTMLMenuItemElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",del:"HTMLModElement",ol:"HTMLOListElement",object:"HTMLObjectElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",script:"HTMLScriptElement",select:"HTMLSelectElement",source:"HTMLSourceElement",span:"HTMLSpanElement",style:"HTMLStyleElement",caption:"HTMLTableCaptionElement",col:"HTMLTableColElement",table:"HTMLTableElement",tr:"HTMLTableRowElement",thead:"HTMLTableSectionElement",tbody:"HTMLTableSectionElement",textarea:"HTMLTextAreaElement",title:"HTMLTitleElement",ul:"HTMLUListElement",video:"HTMLVideoElement"};Object.keys(c).forEach(b),Object.getOwnPropertyNames(a.wrappers).forEach(function(b){window[b]=a.wrappers[b]}),a.knownElements=c}(this.ShadowDOMPolyfill),function(){var a=window.ShadowDOMPolyfill;a.wrap,Object.defineProperties(HTMLElement.prototype,{webkitShadowRoot:{get:function(){return this.shadowRoot}}}),HTMLElement.prototype.webkitCreateShadowRoot=HTMLElement.prototype.createShadowRoot,window.dartExperimentalFixupGetTag=function(b){function c(a){if(a instanceof d)return"NodeList";if(a instanceof e)return"ShadowRoot";if(a instanceof MutationRecord)return"MutationRecord";if(a instanceof MutationObserver)return"MutationObserver";var c=f(a);if(a!==c){var g=a.constructor;if(g&&"GeneratedWrapper"==g.name){var h=g._ShadowDOMPolyfill$cacheTag_;return h||(h=Object.prototype.toString.call(c),h=h.substring(8,h.length-1),g._ShadowDOMPolyfill$cacheTag_=h),h}a=c}return b(a)}var d=a.wrappers.NodeList,e=a.wrappers.ShadowRoot,f=a.unwrapIfNeeded;return c}}();var Platform={};!function(a){function b(a,b){var c="";return Array.prototype.forEach.call(a,function(a){c+=a.textContent+"\n\n"}),b||(c=c.replace(m,"")),c}function c(a){var b=document.createElement("style");b.textContent=a,document.head.appendChild(b);var c=b.sheet.cssRules;return b.parentNode.removeChild(b),c}function d(a){for(var b=0,c=[];b<a.length;b++)c.push(a[b].cssText);return c.join("\n\n")}function e(a){a&&f().appendChild(document.createTextNode(a))}function f(){return g||(g=document.createElement("style"),g.setAttribute("ShadowCSSShim","")),g}var g,h={strictStyling:!1,registry:{},shimStyling:function(a,b,c){if(a){var d=this.registerDefinition(a,b,c);this.strictStyling&&this.applyScopeToContent(a,b),this.shimPolyfillDirectives(d.rootStyles,b),this.applyShimming(d.scopeStyles,b)}},shimShadowDOMStyling:function(a,b){this.shimPolyfillDirectives(a,b),this.applyShimming(a,b)},registerDefinition:function(a,b,c){var d=this.registry[b]={root:a,name:b,extendsName:c},e=a.querySelectorAll("style");e=e?Array.prototype.slice.call(e,0):[],d.rootStyles=e,d.scopeStyles=d.rootStyles;var f=this.registry[d.extendsName];return f&&(d.scopeStyles=d.scopeStyles.concat(f.scopeStyles)),d},applyScopeToContent:function(a,b){a&&(Array.prototype.forEach.call(a.querySelectorAll("*"),function(a){a.setAttribute(b,"")}),Array.prototype.forEach.call(a.querySelectorAll("template"),function(a){this.applyScopeToContent(a.content,b)},this))},shimPolyfillDirectives:function(a,b){a&&Array.prototype.forEach.call(a,function(a){a.textContent=this.convertPolyfillDirectives(a.textContent,b)},this)},convertPolyfillDirectives:function(a,b){for(var c,d,e="",f=0;c=n.exec(a);)e+=a.substring(f,c.index),d=c[1].slice(0,-2).replace(q,b),e+=this.scopeSelector(d,b)+"{",f=n.lastIndex;return e+=a.substring(f,a.length)},applyShimming:function(a,b){var c=this.shimAtHost(a,b);c+=this.shimScoping(a,b),e(c)},shimAtHost:function(a,b){return a?this.convertAtHostStyles(a,b):void 0},convertAtHostStyles:function(a,e){for(var f,g=b(a),h="",j=0;f=i.exec(g);)h+=g.substring(j,f.index),h+=this.scopeHostCss(f[1],e),j=i.lastIndex;h+=g.substring(j,g.length);var k=new RegExp("^"+e+p,"m"),g=d(this.findAtHostRules(c(h),k));return g},scopeHostCss:function(a,b){for(var c,d="";c=j.exec(a);)d+=this.scopeHostSelector(c[1],b)+" "+c[2]+"\n	";return d},scopeHostSelector:function(a,b){var c=[],d=a.split(","),e="[is="+b+"]";return d.forEach(function(a){a=a.trim(),a.match(k)?a=a.replace(k,b+"$1$3, "+e+"$1$3"):a.match(l)&&(a=b+a+", "+e+a),c.push(a)},this),c.join(", ")},findAtHostRules:function(a,b){return Array.prototype.filter.call(a,this.isHostRule.bind(this,b))},isHostRule:function(a,b){return b.selectorText&&b.selectorText.match(a)||b.cssRules&&this.findAtHostRules(b.cssRules,a).length||b.type==CSSRule.WEBKIT_KEYFRAMES_RULE},shimScoping:function(a,b){return a?this.convertScopedStyles(a,b):void 0},convertScopedStyles:function(a,d){Array.prototype.forEach.call(a,function(a){a.parentNode&&a.parentNode.removeChild(a)});var e=b(a).replace(i,"");e=this.convertPseudos(e);var f=c(e);return e=this.scopeRules(f,d)},convertPseudos:function(a){return a.replace(o," [pseudo=$1]")},scopeRules:function(a,b){var c="";return Array.prototype.forEach.call(a,function(a){a.selectorText&&a.style&&a.style.cssText?(c+=this.scopeSelector(a.selectorText,b,this.strictStyling)+" {\n	",c+=this.propertiesFromRule(a)+"\n}\n\n"):a.media?(c+="@media "+a.media.mediaText+" {\n",c+=this.scopeRules(a.cssRules,b),c+="\n}\n\n"):a.cssText&&(c+=a.cssText+"\n\n")},this),c},scopeSelector:function(a,b,c){var d=[],e=a.split(",");return e.forEach(function(a){a=a.trim(),this.selectorNeedsScoping(a,b)&&(a=c?this.applyStrictSelectorScope(a,b):this.applySimpleSelectorScope(a,b)),d.push(a)},this),d.join(", ")},selectorNeedsScoping:function(a,b){var c="("+b+"|\\[is="+b+"\\])",d=new RegExp("^"+c+p,"m");return!a.match(d)},applySimpleSelectorScope:function(a,b){return b+" "+a+", "+"[is="+b+"] "+a},applyStrictSelectorScope:function(a,b){var c=[" ",">","+","~"],d=a,e="["+b+"]";return c.forEach(function(a){var b=d.split(a);d=b.map(function(a){var b=a.trim();return b&&c.indexOf(b)<0&&b.indexOf(e)<0&&(a=b.replace(/([^:]*)(:*)(.*)/,"$1"+e+"$2$3")),a}).join(a)}),d},propertiesFromRule:function(a){var b=a.style.cssText;return a.style.content&&!a.style.content.match(/['"]+/)&&(b="content: '"+a.style.content+"';\n"+a.style.cssText.replace(/content:[^;]*;/g,"")),b}},i=/@host[^{]*{(([^}]*?{[^{]*?}[\s\S]*?)+)}/gim,j=/([^{]*)({[\s\S]*?})/gim,k=/(.*)((?:\*)|(?:\:scope))(.*)/,l=/^[.\[:]/,m=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,n=/\/\*\s*@polyfill ([^*]*\*+([^/*][^*]*\*+)*\/)([^{]*?){/gim,o=/::(x-[^\s{,(]*)/gim,p="([>\\s~+[.,{:][\\s\\S]*)?$",q=/@host/gim;if(window.ShadowDOMPolyfill){e("style { display: none !important; }\n");var r=document.querySelector("head");r.insertBefore(f(),r.childNodes[0])}a.ShadowCSS=h}(window.Platform),function(a){function b(a,b){if(window.ShadowDOMPolyfill){for(var h,i=this.convertPolyfillDirectives(a,b),j="",k=0;h=e.exec(i);)j+=i.substring(k,h.index),j+=this.scopeHostCss(h[1],b),k=e.lastIndex;j+=i.substring(k,i.length);var l=new RegExp("^"+b+g,"m"),m=d(this.findAtHostRules(c(j),l));i=i.replace(f,""),i=this.convertPseudos(i);var n=c(i),o=this.scopeRules(n,b);return m+o}}function c(a){var b=document.createElement("style");b.textContent=a,document.head.appendChild(b);var c=b.sheet.cssRules;return b.parentNode.removeChild(b),c}function d(a){for(var b=0,c=[];b<a.length;b++)c.push(a[b].cssText);return c.join("\n\n")}var e=/@host[^{]*{(([^}]*?{[^{]*?}[\s\S]*?)+)}/gim,f=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,g="([>\\s~+[.,{:][\\s\\S]*)?$";a.ShadowCSS.shimShadowDOMStyling2=b}(window.Platform)}
\ No newline at end of file
diff --git a/pkg/shadow_dom/lib/src/platform/patches-shadowdom-polyfill.js b/pkg/shadow_dom/lib/src/platform/patches-shadowdom-polyfill.js
index cafb597..828a4fc 100644
--- a/pkg/shadow_dom/lib/src/platform/patches-shadowdom-polyfill.js
+++ b/pkg/shadow_dom/lib/src/platform/patches-shadowdom-polyfill.js
@@ -25,31 +25,34 @@
   window.dartExperimentalFixupGetTag = function(originalGetTag) {
     var NodeList = ShadowDOMPolyfill.wrappers.NodeList;
     var ShadowRoot = ShadowDOMPolyfill.wrappers.ShadowRoot;
-    var isWrapper = ShadowDOMPolyfill.isWrapper;
-    var unwrap = ShadowDOMPolyfill.unwrap;
+    var unwrapIfNeeded = ShadowDOMPolyfill.unwrapIfNeeded;
     function getTag(obj) {
+      // TODO(jmesserly): do we still need these?
       if (obj instanceof NodeList) return 'NodeList';
       if (obj instanceof ShadowRoot) return 'ShadowRoot';
       if (obj instanceof MutationRecord) return 'MutationRecord';
       if (obj instanceof MutationObserver) return 'MutationObserver';
 
-      if (isWrapper(obj)) {
-        obj = unwrap(obj);
-
-        // Fix up class names for Firefox. For some of them like
-        // HTMLFormElement and HTMLInputElement, the "constructor" property of
-        // the unwrapped nodes points at the wrapper for some reason.
-        // TODO(jmesserly): figure out why this is happening.
+      var unwrapped = unwrapIfNeeded(obj);
+      if (obj !== unwrapped) {
+        // Fix up class names for Firefox.
+        // For some of them (like HTMLFormElement and HTMLInputElement),
+        // the "constructor" property of the unwrapped nodes points at the
+        // wrapper.
+        // Note: it is safe to check for the GeneratedWrapper string because
+        // we know it is some kind of Shadow DOM wrapper object.
         var ctor = obj.constructor;
-        if (ctor && ctor._ShadowDOMPolyfill$isGeneratedWrapper) {
+        if (ctor && ctor.name == 'GeneratedWrapper') {
           var name = ctor._ShadowDOMPolyfill$cacheTag_;
           if (!name) {
-            name = Object.prototype.toString.call(obj);
+            name = Object.prototype.toString.call(unwrapped);
             name = name.substring(8, name.length - 1);
             ctor._ShadowDOMPolyfill$cacheTag_ = name;
           }
           return name;
         }
+
+        obj = unwrapped;
       }
       return originalGetTag(obj);
     }
diff --git a/pkg/shadow_dom/tool/README.md b/pkg/shadow_dom/tool/README.md
new file mode 100644
index 0000000..b4ee42c
--- /dev/null
+++ b/pkg/shadow_dom/tool/README.md
@@ -0,0 +1,52 @@
+This folder contains the logic for building the shadow_dom package's
+concatenated and minified JS files.
+
+## Prerequisites
+
+Install nodejs and npm. On Debian based systems this is typically:
+
+```bash
+     sudo apt-get install nodejs
+     sudo apt-get install npm
+```
+- Install grunt-cli:
+
+```bash
+    npm install -g grunt-cli
+```
+
+See the Grunt [getting started](http://gruntjs.com/getting-started) page
+for more information.
+
+## Building
+
+Run shadow_dom/tool/build.sh (from any directory):
+
+```bash
+    ./build.sh
+```
+
+## (optional) How to integrate Polymer upstream changes
+
+One time setup:
+
+```bash
+    # Note: this requires commit access to dart-lang/ShadowDOM.
+    # You can use your own fork instead if you like.
+    # Just use that URL here and edit build.sh to pull from there.
+    git clone -b shadowdom_patches https://github.com/dart-lang/ShadowDOM.git
+    cd ShadowDOM
+    git remote add upstream https://github.com/Polymer/ShadowDOM.git
+```
+
+You can merge upstream changes by doing:
+
+```bash
+    # Check that we are in shadowdom_patches branch and don't have
+    # any pending changes.
+    git status
+
+    git fetch upstream
+    git merge upstream/master
+    git push origin shadowdom_patches
+```
diff --git a/pkg/shadow_dom/tool/build.json b/pkg/shadow_dom/tool/build.json
new file mode 100644
index 0000000..899f6d2
--- /dev/null
+++ b/pkg/shadow_dom/tool/build.json
@@ -0,0 +1,10 @@
+[
+  "build/if-poly.js",
+  "../lib/src/platform/patches-shadowdom-polyfill-before.js",
+  "../../../third_party/polymer/ShadowDOM/build.json",
+  "../lib/src/platform/patches-shadowdom-polyfill.js",
+  "../lib/src/platform/platform-init.js",
+  "../lib/src/platform/ShadowCSS.js",
+  "../lib/src/platform/patches-shadow-css.js",
+  "build/end-if.js"
+]
diff --git a/pkg/shadow_dom/tool/build.sh b/pkg/shadow_dom/tool/build.sh
new file mode 100755
index 0000000..6e2adb7
--- /dev/null
+++ b/pkg/shadow_dom/tool/build.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+# Copyright (c) 2013, 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.
+
+# Usage: call directly in the commandline as test/run.sh ensuring that you have
+# both 'dart' and 'content_shell' in your path. Filter tests by passing a
+# pattern as an argument to this script.
+
+# bail on error
+set -e
+
+DIR=$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd )
+# Note: dartanalyzer and some tests needs to be run from the root directory
+pushd $DIR > /dev/null
+
+SHADOWDOM_REMOTE=https://github.com/dart-lang/ShadowDOM.git
+SHADOWDOM_DIR=../../../third_party/polymer/ShadowDOM
+
+echo "*** Syncing $SHADOWDOM_DIR from $SHADOWDOM_REMOTE"
+if [ -d "$SHADOWDOM_DIR" ]; then
+  pushd $SHADOWDOM_DIR > /dev/null
+  git pull
+  popd
+else
+  git clone --branch shadowdom_patches $SHADOWDOM_REMOTE $SHADOWDOM_DIR
+fi
+
+echo '*** Installing NPM prerequisites'
+npm install
+
+echo '*** Running grunt'
+grunt
diff --git a/pkg/shadow_dom/tool/gruntfile.js b/pkg/shadow_dom/tool/gruntfile.js
index f245d73..801b48a 100644
--- a/pkg/shadow_dom/tool/gruntfile.js
+++ b/pkg/shadow_dom/tool/gruntfile.js
@@ -4,53 +4,25 @@
  * license that can be found in the LICENSE file.
  */
 module.exports = function(grunt) {
-  ShadowDOMPolyfill = [
-    'sidetable.js',
-    'wrappers.js',
-    'wrappers/events.js',
-    'wrappers/NodeList.js',
-    'wrappers/Node.js',
-    'querySelector.js',
-    'wrappers/node-interfaces.js',
-    'wrappers/CharacterData.js',
-    'wrappers/Element.js',
-    'wrappers/HTMLElement.js',
-    'wrappers/HTMLContentElement.js',
-    'wrappers/HTMLShadowElement.js',
-    'wrappers/HTMLTemplateElement.js',
-    'wrappers/HTMLUnknownElement.js',
-    'wrappers/generic.js',
-    'wrappers/ShadowRoot.js',
-    'ShadowRenderer.js',
-    'wrappers/Document.js',
-    'wrappers/Window.js',
-    'wrappers/MutationObserver.js',
-    'wrappers/override-constructors.js'
-  ];
-  ShadowDOMPolyfill = ShadowDOMPolyfill.map(function(p) {
-    return '../../../third_party/polymer/ShadowDOM/src/' + p;
-  });
+  // Recursive module builder:
+  var path = require('path');
+  function readManifest(filename, modules) {
+    modules = modules || [];
+    var lines = grunt.file.readJSON(filename);
+    var dir = path.dirname(filename);
+    lines.forEach(function(line) {
+      var fullpath = path.join(dir, line);
+      if (line.slice(-5) == '.json') {
+        // recurse
+        readManifest(fullpath, modules);
+      } else {
+        modules.push(fullpath);
+      }
+    });
+    return modules;
+  }
 
-  // Apply partial patch from Polymer/Platform, dart2js, CSS
-  // polyfill from platform and dart2js CSS patches:
-  ShadowDOMPolyfill.unshift(
-    '../lib/src/platform/patches-shadowdom-polyfill-before.js'
-    );
-  ShadowDOMPolyfill.push(
-    '../lib/src/platform/patches-shadowdom-polyfill.js',
-    '../lib/src/platform/platform-init.js',
-    '../lib/src/platform/ShadowCSS.js',
-    '../lib/src/platform/patches-shadow-css.js'
-    );
-
-  // Only load polyfill if not natively present.
-  ConditionalShadowDOM = [].concat(
-    'build/if-poly.js',
-    ShadowDOMPolyfill,
-    'build/end-if.js'
-  );
-
-  // karma setup
+  // Karma setup:
   var browsers;
   (function() {
     try {
@@ -87,7 +59,7 @@
     },
     concat: {
       ShadowDOM: {
-        src: ConditionalShadowDOM,
+        src: readManifest('build.json'),
         dest: '../lib/shadow_dom.debug.js',
         nonull: true
       }
@@ -140,4 +112,3 @@
   grunt.registerTask('test', ['karma:ShadowDOM']);
   grunt.registerTask('test-buildbot', ['karma:buildbot']);
 };
-
diff --git a/pkg/shadow_dom/tool/readme.txt b/pkg/shadow_dom/tool/readme.txt
deleted file mode 100644
index 829c697..0000000
--- a/pkg/shadow_dom/tool/readme.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-How to build shadow_dom package:
-
-- Install nodejs and npm
-     sudo apt-get install nodejs
-     sudo apt-get install npm
-- Install grunt http://gruntjs.com/getting-started
-
-- Change to the shadow_dom tool directory
-     cd pkg/shadow_dom/tool
-
-- Install project dependencies
-     npm install
-
-- Run grunt to generate the shadow_dom packages in pkg/shadow_dom/lib
-     grunt
-
-
-
diff --git a/pkg/third_party/html5lib/test/tokenizer_test.dart b/pkg/third_party/html5lib/test/tokenizer_test.dart
index 637cc9a..b9e43fe 100644
--- a/pkg/third_party/html5lib/test/tokenizer_test.dart
+++ b/pkg/third_party/html5lib/test/tokenizer_test.dart
@@ -33,8 +33,8 @@
     // Note: we can't get a closure of the state method. However, we can
     // create a new closure to invoke it via mirrors.
     var mtok = reflect(tokenizer);
-    tokenizer.state = () => deprecatedFutureValue(
-        mtok.invokeAsync(new Symbol(_state), const [])).reflectee;
+    tokenizer.state = () =>
+        mtok.invoke(new Symbol(_state), const []).reflectee;
 
     if (_lastStartTag != null) {
       tokenizer.currentToken = new StartTagToken(_lastStartTag);
diff --git a/pkg/unittest/lib/html_config.dart b/pkg/unittest/lib/html_config.dart
index b86b3fc..e4eba0f 100644
--- a/pkg/unittest/lib/html_config.dart
+++ b/pkg/unittest/lib/html_config.dart
@@ -8,6 +8,7 @@
 library unittest_html_config;
 
 import 'dart:async';
+import 'dart:convert';
 import 'dart:html';
 import 'unittest.dart';
 
@@ -76,25 +77,18 @@
       <tr>
         <td>${test_.id}</td>
         <td class="unittest-${test_.result}">${test_.result.toUpperCase()}</td>
-        <td>Expectation: <a href="#testFilter=${test_.description}">${test_.description}</a>. ${_htmlEscape(test_.message)}</td>
+        <td>Expectation: <a href="#testFilter=${test_.description}">${test_.description}</a>. ${HTML_ESCAPE.convert(test_.message)}</td>
       </tr>''';
 
   if (test_.stackTrace != null) {
     html = '$html<tr><td></td><td colspan="2"><pre>' +
-        _htmlEscape(test_.stackTrace.toString()) +
+        HTML_ESCAPE.convert(test_.stackTrace.toString()) +
         '</pre></td></tr>';
   }
 
   return html;
 }
 
-//TODO(pquitslund): Move to a common lib
-String _htmlEscape(String string) {
-  return string.replaceAll('&', '&amp;')
-               .replaceAll('<','&lt;')
-               .replaceAll('>','&gt;');
-}
-
 class HtmlConfiguration extends SimpleConfiguration {
   /** Whether this is run within dartium layout tests. */
   final bool _isLayoutTest;
diff --git a/pkg/unittest/lib/html_enhanced_config.dart b/pkg/unittest/lib/html_enhanced_config.dart
index 75f02ab..ebcf271 100644
--- a/pkg/unittest/lib/html_enhanced_config.dart
+++ b/pkg/unittest/lib/html_enhanced_config.dart
@@ -12,6 +12,7 @@
 
 import 'dart:async';
 import 'dart:collection' show LinkedHashMap;
+import 'dart:convert';
 import 'dart:html';
 import 'unittest.dart';
 
@@ -235,14 +236,6 @@
     var background = 'unittest-row-${test_.id % 2 == 0 ? "even" : "odd"}';
     var display = '${isVisible ? "unittest-row" : "unittest-row-hidden"}';
 
-    // TODO (prujohn@gmail.com) I had to borrow this from html_print.dart
-    // Probably should put it in some more common location.
-    String _htmlEscape(String string) {
-      return string.replaceAll('&', '&amp;')
-                   .replaceAll('<','&lt;')
-                   .replaceAll('>','&gt;');
-    }
-
     addRowElement(id, status, description){
       te.children.add(
         new Element.html(
@@ -267,11 +260,11 @@
     }
 
     addRowElement('${test_.id}', '${test_.result.toUpperCase()}',
-        '${test_.description}. ${_htmlEscape(test_.message)}');
+        '${test_.description}. ${HTML_ESCAPE.convert(test_.message)}');
 
     if (test_.stackTrace != null) {
       addRowElement('', '',
-          '<pre>${_htmlEscape(test_.stackTrace.toString())}</pre>');
+          '<pre>${HTML_ESCAPE.convert(test_.stackTrace.toString())}</pre>');
     }
   }
 
diff --git a/pkg/unittest/lib/src/configuration.dart b/pkg/unittest/lib/src/configuration.dart
index 1862bf5..d8d6c81 100644
--- a/pkg/unittest/lib/src/configuration.dart
+++ b/pkg/unittest/lib/src/configuration.dart
@@ -29,6 +29,7 @@
   bool get autoStart => true;
 
   /// How long a [TestCase] can run before it is considered an error.
+  /// A [timeout] value of [:null:] means that the limit is infinite.
   Duration get timeout => const Duration(seconds: 20);
 
   /**
diff --git a/pkg/unittest/lib/src/simple_configuration.dart b/pkg/unittest/lib/src/simple_configuration.dart
index 20172c3..267fd62 100644
--- a/pkg/unittest/lib/src/simple_configuration.dart
+++ b/pkg/unittest/lib/src/simple_configuration.dart
@@ -53,6 +53,7 @@
   final _testLogBuffer = <Pair<String, StackTrace>>[];
 
   /// How long a [TestCase] can run before it is considered an error.
+  /// A [timeout] value of [:null:] means that the limit is infinite.
   Duration timeout = const Duration(seconds: 20);
 
   /**
diff --git a/pkg/unittest/lib/unittest.dart b/pkg/unittest/lib/unittest.dart
index f3b4e44..e5923f3 100644
--- a/pkg/unittest/lib/unittest.dart
+++ b/pkg/unittest/lib/unittest.dart
@@ -753,14 +753,16 @@
     final testCase = testCases[_currentTestCaseIndex];
     var f = _guardAsync(testCase._run, null, testCase);
     Timer timer;
-    try {
-      final Duration timeout = unittestConfiguration.timeout;
-      timer = new Timer(timeout, () {
-        testCase.error("Test timed out after ${timeout.inSeconds} seconds.");
-      });
-    } on UnsupportedError catch (e) {
-      if (e.message != "Timer greater than 0.") rethrow;
-      // Support running on d8 and jsshell which don't support timers.
+    final Duration timeout = unittestConfiguration.timeout;
+    if (timeout != null) {
+      try {
+        timer = new Timer(timeout, () {
+          testCase.error("Test timed out after ${timeout.inSeconds} seconds.");
+        });
+      } on UnsupportedError catch (e) {
+        if (e.message != "Timer greater than 0.") rethrow;
+        // Support running on d8 and jsshell which don't support timers.
+      }
     }
     f.whenComplete(() {
       if (timer != null) timer.cancel();
diff --git a/runtime/bin/builtin_impl_sources.gypi b/runtime/bin/builtin_impl_sources.gypi
index 2f0f9d5..9d9d8ac 100644
--- a/runtime/bin/builtin_impl_sources.gypi
+++ b/runtime/bin/builtin_impl_sources.gypi
@@ -41,6 +41,12 @@
     'file_macos.cc',
     'file_win.cc',
     'file_test.cc',
+    'file_system_watcher.cc',
+    'file_system_watcher.h',
+    'file_system_watcher_android.cc',
+    'file_system_watcher_linux.cc',
+    'file_system_watcher_macos.cc',
+    'file_system_watcher_win.cc',
     'fdutils.h',
     'fdutils_android.cc',
     'fdutils_linux.cc',
diff --git a/runtime/bin/builtin_natives.cc b/runtime/bin/builtin_natives.cc
index 36d7a75..89698c0 100644
--- a/runtime/bin/builtin_natives.cc
+++ b/runtime/bin/builtin_natives.cc
@@ -60,6 +60,10 @@
   V(File_GetType, 2)                                                           \
   V(File_AreIdentical, 2)                                                      \
   V(File_NewServicePort, 0)                                                    \
+  V(FileSystemWatcher_IsSupported, 0)                                          \
+  V(FileSystemWatcher_ReadEvents, 1)                                           \
+  V(FileSystemWatcher_UnwatchPath, 1)                                          \
+  V(FileSystemWatcher_WatchPath, 4)                                            \
   V(Logger_PrintString, 1)
 
 BUILTIN_NATIVE_LIST(DECLARE_FUNCTION);
diff --git a/runtime/bin/directory_patch.dart b/runtime/bin/directory_patch.dart
index 688686b..49eca55 100644
--- a/runtime/bin/directory_patch.dart
+++ b/runtime/bin/directory_patch.dart
@@ -8,7 +8,7 @@
   /* patch */ static _createTemp(String template) native "Directory_CreateTemp";
   /* patch */ static int _exists(String path) native "Directory_Exists";
   /* patch */ static _create(String path) native "Directory_Create";
-  /* patch */ static _delete(String path, bool recursive)
+  /* patch */ static _deleteNative(String path, bool recursive)
       native "Directory_Delete";
   /* patch */ static _rename(String path, String newPath)
       native "Directory_Rename";
diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc
index 872a815..170c493 100644
--- a/runtime/bin/eventhandler_win.cc
+++ b/runtime/bin/eventhandler_win.cc
@@ -343,6 +343,49 @@
 }
 
 
+void DirectoryWatchHandle::EnsureInitialized(
+    EventHandlerImplementation* event_handler) {
+  ScopedLock lock(this);
+  event_handler_ = event_handler;
+  if (completion_port_ == INVALID_HANDLE_VALUE) {
+    CreateCompletionPort(event_handler_->completion_port());
+  }
+}
+
+
+bool DirectoryWatchHandle::IsClosed() {
+  return IsClosing() && pending_read_ == NULL;
+}
+
+
+void DirectoryWatchHandle::DoClose() {
+  Handle::DoClose();
+}
+
+bool DirectoryWatchHandle::IssueRead() {
+  ScopedLock lock(this);
+  OverlappedBuffer* buffer = OverlappedBuffer::AllocateReadBuffer(kBufferSize);
+
+  ASSERT(completion_port_ != INVALID_HANDLE_VALUE);
+
+  BOOL ok = ReadDirectoryChangesW(handle_,
+                                  buffer->GetBufferStart(),
+                                  buffer->GetBufferSize(),
+                                  recursive_,
+                                  events_,
+                                  NULL,
+                                  buffer->GetCleanOverlapped(),
+                                  NULL);
+  if (ok || GetLastError() == ERROR_IO_PENDING) {
+    // Completing asynchronously.
+    pending_read_ = buffer;
+    return true;
+  }
+  OverlappedBuffer::DisposeBuffer(buffer);
+  return false;
+}
+
+
 void SocketHandle::HandleIssueError() {
   int error = WSAGetLastError();
   if (error == WSAECONNRESET) {
diff --git a/runtime/bin/eventhandler_win.h b/runtime/bin/eventhandler_win.h
index 1c62200..3adaf57 100644
--- a/runtime/bin/eventhandler_win.h
+++ b/runtime/bin/eventhandler_win.h
@@ -130,7 +130,12 @@
 // sockets.
 class Handle {
  public:
-  enum Type { kFile, kClientSocket, kListenSocket };
+  enum Type {
+    kFile,
+    kDirectoryWatch,
+    kClientSocket,
+    kListenSocket
+  };
 
   class ScopedLock {
    public:
@@ -246,9 +251,9 @@
 class FileHandle : public Handle {
  public:
   explicit FileHandle(HANDLE handle)
-      : Handle(reinterpret_cast<HANDLE>(handle)) { type_ = kFile; }
+      : Handle(handle) { type_ = kFile; }
   FileHandle(HANDLE handle, Dart_Port port)
-      : Handle(reinterpret_cast<HANDLE>(handle), port) { type_ = kFile; }
+      : Handle(handle, port) { type_ = kFile; }
 
   virtual void EnsureInitialized(EventHandlerImplementation* event_handler);
   virtual bool IsClosed();
@@ -256,6 +261,27 @@
 };
 
 
+class DirectoryWatchHandle : public Handle {
+ public:
+  DirectoryWatchHandle(HANDLE handle, int events, bool recursive)
+      : Handle(handle),
+        events_(events),
+        recursive_(recursive) {
+    type_ = kDirectoryWatch;
+  }
+
+  virtual void EnsureInitialized(EventHandlerImplementation* event_handler);
+  virtual bool IsClosed();
+  virtual void DoClose();
+
+  virtual bool IssueRead();
+
+ private:
+  int events_;
+  bool recursive_;
+};
+
+
 class SocketHandle : public Handle {
  public:
   SOCKET socket() { return reinterpret_cast<SOCKET>(handle_); }
diff --git a/runtime/bin/file_patch.dart b/runtime/bin/file_patch.dart
index c9e4fcc..7732c2c 100644
--- a/runtime/bin/file_patch.dart
+++ b/runtime/bin/file_patch.dart
@@ -12,8 +12,8 @@
   /* patch */ static _createLink(String path, String target)
       native "File_CreateLink";
   /* patch */ static _linkTarget(String path) native "File_LinkTarget";
-  /* patch */ static _delete(String path) native "File_Delete";
-  /* patch */ static _deleteLink(String path) native "File_DeleteLink";
+  /* patch */ static _deleteNative(String path) native "File_Delete";
+  /* patch */ static _deleteLinkNative(String path) native "File_DeleteLink";
   /* patch */ static _rename(String oldPath, String newPath)
       native "File_Rename";
   /* patch */ static _renameLink(String oldPath, String newPath)
@@ -42,6 +42,119 @@
   /* patch */ static _flush(int id) native "File_Flush";
 }
 
+patch class _FileSystemWatcher {
+  /* patch */ factory _FileSystemWatcher(
+      String path, int events, bool recursive)
+    => new _FileSystemWatcherImpl(path, events, recursive);
+
+  /* patch */ static bool get isSupported => _FileSystemWatcherImpl.isSupported;
+}
+
+class _FileSystemWatcherImpl
+    extends NativeFieldWrapperClass1
+    implements _FileSystemWatcher {
+  final String _path;
+  final int _events;
+  final bool _recursive;
+
+  StreamController _controller;
+  StreamSubscription _subscription;
+
+  _FileSystemWatcherImpl(this._path, this._events, this._recursive) {
+    if (!isSupported) {
+      throw new FileException(
+          "File system watching is not supported on this system",
+          _path);
+    }
+    _controller = new StreamController(onListen: _listen, onCancel: _cancel);
+  }
+
+  void _listen() {
+    int socketId;
+    try {
+      socketId = _watchPath(_path, _events, identical(true, _recursive));
+    } catch (e) {
+      throw new FileException(
+          "Failed to watch path",
+          _path,
+          e);
+    }
+    var socket = new _RawSocket(new _NativeSocket.watch(socketId));
+    _subscription = socket.expand((event) {
+      var events = [];
+      var pair = {};
+      if (event == RawSocketEvent.READ) {
+        String getPath(event) {
+          var path = _path;
+          if (event[2] != null) {
+            path += Platform.pathSeparator;
+            path += event[2];
+          }
+          return path;
+        }
+        while (socket.available() > 0) {
+          for (var event in _readEvents()) {
+            if (event == null) continue;
+            var path = getPath(event);
+            if ((event[0] & FileSystemEvent.CREATE) != 0) {
+              events.add(new FileSystemCreateEvent._(path));
+            }
+            if ((event[0] & FileSystemEvent.MODIFY) != 0) {
+              events.add(new FileSystemModifyEvent._(path, true));
+            }
+            if ((event[0] & FileSystemEvent._MODIFY_ATTRIBUTES) != 0) {
+              events.add(new FileSystemModifyEvent._(path, false));
+            }
+            if ((event[0] & FileSystemEvent.MOVE) != 0) {
+              int link = event[1];
+              if (link > 0) {
+                if (pair.containsKey(link)) {
+                  events.add(
+                      new FileSystemMoveEvent._(getPath(pair[link]), path));
+                  pair.remove(link);
+                } else {
+                  pair[link] = event;
+                }
+              } else {
+                events.add(new FileSystemMoveEvent._(path, null));
+              }
+            }
+            if ((event[0] & FileSystemEvent.DELETE) != 0) {
+              events.add(new FileSystemDeleteEvent._(path));
+            }
+          }
+        }
+        for (var event in pair.values) {
+          events.add(new FileSystemMoveEvent._(getPath(event), null));
+        }
+      } else if (event == RawSocketEvent.CLOSED) {
+      } else if (event == RawSocketEvent.READ_CLOSED) {
+      } else {
+        assert(false);
+      }
+      return events;
+    })
+    .where((event) => (event.type & _events) != 0)
+    .listen(_controller.add, onDone: _cancel);
+  }
+
+  void _cancel() {
+    _unwatchPath();
+    if (_subscription != null) {
+      _subscription.cancel();
+    }
+  }
+
+  Stream<FileSystemEvent> get stream => _controller.stream;
+
+  static bool get isSupported native "FileSystemWatcher_IsSupported";
+
+  int _watchPath(String path, int events, bool recursive)
+      native "FileSystemWatcher_WatchPath";
+  void _unwatchPath() native "FileSystemWatcher_UnwatchPath";
+  List _readEvents() native "FileSystemWatcher_ReadEvents";
+}
+
 Uint8List _makeUint8ListView(Uint8List source, int offsetInBytes, int length) {
   return new Uint8List.view(source.buffer, offsetInBytes, length);
 }
diff --git a/runtime/bin/file_system_watcher.cc b/runtime/bin/file_system_watcher.cc
new file mode 100644
index 0000000..f5efb69
--- /dev/null
+++ b/runtime/bin/file_system_watcher.cc
@@ -0,0 +1,65 @@
+// Copyright (c) 2013, 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.
+
+#include "bin/file_system_watcher.h"
+
+#include "bin/builtin.h"
+#include "bin/dartutils.h"
+
+#include "include/dart_api.h"
+
+namespace dart {
+namespace bin {
+
+static const int kWatcherNativeField = 0;
+
+
+void SetWatcherIdNativeField(Dart_Handle watcher, intptr_t id) {
+  ThrowIfError(Dart_SetNativeInstanceField(watcher, kWatcherNativeField, id));
+}
+
+
+void GetWatcherIdNativeField(Dart_Handle watcher, intptr_t* id) {
+  ThrowIfError(Dart_GetNativeInstanceField(watcher, kWatcherNativeField, id));
+}
+
+void FUNCTION_NAME(FileSystemWatcher_IsSupported)(Dart_NativeArguments args) {
+  Dart_SetReturnValue(args, Dart_NewBoolean(FileSystemWatcher::IsSupported()));
+}
+
+void FUNCTION_NAME(FileSystemWatcher_WatchPath)(Dart_NativeArguments args) {
+  Dart_Handle watcher = Dart_GetNativeArgument(args, 0);
+  const char* path = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 1));
+  int events = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2));
+  bool recursive = DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 3));
+  intptr_t id = FileSystemWatcher::WatchPath(path, events, recursive);
+  if (id == -1) {
+    Dart_PropagateError(DartUtils::NewDartOSError());
+  } else {
+    SetWatcherIdNativeField(watcher, id);
+  }
+  intptr_t socket_id = FileSystemWatcher::GetSocketId(id);
+  Dart_SetReturnValue(args, Dart_NewInteger(socket_id));
+}
+
+
+void FUNCTION_NAME(FileSystemWatcher_UnwatchPath)(Dart_NativeArguments args) {
+  Dart_Handle watcher = Dart_GetNativeArgument(args, 0);
+  intptr_t id;
+  GetWatcherIdNativeField(watcher, &id);
+  FileSystemWatcher::UnwatchPath(id);
+}
+
+
+void FUNCTION_NAME(FileSystemWatcher_ReadEvents)(Dart_NativeArguments args) {
+  Dart_Handle watcher = Dart_GetNativeArgument(args, 0);
+  intptr_t id;
+  GetWatcherIdNativeField(watcher, &id);
+  Dart_Handle handle = FileSystemWatcher::ReadEvents(id);
+  ThrowIfError(handle);
+  Dart_SetReturnValue(args, handle);
+}
+
+}  // namespace bin
+}  // namespace dart
diff --git a/runtime/bin/file_system_watcher.h b/runtime/bin/file_system_watcher.h
new file mode 100644
index 0000000..ea56c11
--- /dev/null
+++ b/runtime/bin/file_system_watcher.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2013, 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.
+
+#ifndef BIN_FILE_SYSTEM_WATCHER_H_
+#define BIN_FILE_SYSTEM_WATCHER_H_
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/types.h>
+
+#include "bin/builtin.h"
+#include "bin/dartutils.h"
+
+
+namespace dart {
+namespace bin {
+
+class FileSystemWatcher {
+ public:
+  enum EventType {
+    kCreate = 1 << 0,
+    kModifyContent = 1 << 1,
+    kDelete = 1 << 2,
+    kMove = 1 << 3,
+    kModefyAttribute = 1 << 4
+  };
+
+  struct Event {
+    intptr_t path_id;
+    int event;
+    const char* filename;
+    int link;
+  };
+
+  static bool IsSupported();
+  static intptr_t WatchPath(const char* path, int events, bool recursive);
+  static void UnwatchPath(intptr_t id);
+  static intptr_t GetSocketId(intptr_t id);
+  static Dart_Handle ReadEvents(intptr_t id);
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(FileSystemWatcher);
+};
+
+}  // namespace bin
+}  // namespace dart
+
+#endif  // BIN_FILE_SYSTEM_WATCHER_H_
+
diff --git a/runtime/bin/file_system_watcher_android.cc b/runtime/bin/file_system_watcher_android.cc
new file mode 100644
index 0000000..63a244a
--- /dev/null
+++ b/runtime/bin/file_system_watcher_android.cc
@@ -0,0 +1,96 @@
+// Copyright (c) 2013, 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.
+
+#include "platform/globals.h"
+#if defined(TARGET_OS_ANDROID)
+
+#include "bin/file_system_watcher.h"
+
+#include <errno.h>  // NOLINT
+#include <sys/inotify.h>  // NOLINT
+
+#include "bin/fdutils.h"
+
+
+namespace dart {
+namespace bin {
+
+bool FileSystemWatcher::IsSupported() {
+  return true;
+}
+
+
+intptr_t FileSystemWatcher::WatchPath(const char* path,
+                                      int events,
+                                      bool recursive) {
+  int fd = TEMP_FAILURE_RETRY(inotify_init());
+  if (fd < 0 || !FDUtils::SetNonBlocking(fd) || !FDUtils::SetCloseOnExec(fd)) {
+    return -1;
+  }
+  int list_events = 0;
+  if (events & kCreate) list_events |= IN_CREATE;
+  if (events & kModifyContent) list_events |= IN_MODIFY | IN_ATTRIB;
+  if (events & kDelete) list_events |= IN_DELETE;
+  if (events & kMove) list_events |= IN_MOVE;
+  int path_fd = TEMP_FAILURE_RETRY(inotify_add_watch(fd, path, list_events));
+  if (path_fd < 0) {
+    close(fd);
+    return -1;
+  }
+  return fd;
+}
+
+
+void FileSystemWatcher::UnwatchPath(intptr_t id) {
+  // Nothing to do.
+}
+
+
+intptr_t FileSystemWatcher::GetSocketId(intptr_t id) {
+  return id;
+}
+
+
+Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id) {
+  const intptr_t kEventSize = sizeof(struct inotify_event);
+  const intptr_t kBufferSize = kEventSize + NAME_MAX + 1;
+  uint8_t buffer[kBufferSize];
+  intptr_t bytes = TEMP_FAILURE_RETRY(read(id, buffer, kBufferSize));
+  if (bytes < 0) {
+    return DartUtils::NewDartOSError();
+  }
+  const intptr_t kMaxCount = kBufferSize / kEventSize + 1;
+  Dart_Handle events = Dart_NewList(kMaxCount);
+  intptr_t offset = 0;
+  intptr_t i = 0;
+  while (offset < bytes) {
+    struct inotify_event* e =
+        reinterpret_cast<struct inotify_event*>(buffer + offset);
+    Dart_Handle event = Dart_NewList(3);
+    int mask = 0;
+    if (e->mask & IN_MODIFY) mask |= kModifyContent;
+    if (e->mask & IN_ATTRIB) mask |= kModefyAttribute;
+    if (e->mask & IN_CREATE) mask |= kCreate;
+    if (e->mask & IN_MOVE) mask |= kMove;
+    if (e->mask & IN_DELETE) mask |= kDelete;
+    Dart_ListSetAt(event, 0, Dart_NewInteger(mask));
+    Dart_ListSetAt(event, 1, Dart_NewInteger(e->cookie));
+    if (e->len > 0) {
+      Dart_ListSetAt(event, 2, Dart_NewStringFromUTF8(
+          reinterpret_cast<uint8_t*>(e->name), strlen(e->name)));
+    } else {
+      Dart_ListSetAt(event, 2, Dart_Null());
+    }
+    Dart_ListSetAt(events, i, event);
+    i++;
+    offset += kEventSize + e->len;
+  }
+  ASSERT(offset == bytes);
+  return events;
+}
+
+}  // namespace bin
+}  // namespace dart
+
+#endif  // defined(TARGET_OS_ANDROID)
diff --git a/runtime/bin/file_system_watcher_linux.cc b/runtime/bin/file_system_watcher_linux.cc
new file mode 100644
index 0000000..c629718
--- /dev/null
+++ b/runtime/bin/file_system_watcher_linux.cc
@@ -0,0 +1,93 @@
+// Copyright (c) 2013, 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.
+
+#include "platform/globals.h"
+#if defined(TARGET_OS_LINUX)
+
+#include "bin/file_system_watcher.h"
+
+#include <errno.h>  // NOLINT
+#include <sys/inotify.h>  // NOLINT
+
+
+namespace dart {
+namespace bin {
+
+bool FileSystemWatcher::IsSupported() {
+  return true;
+}
+
+
+intptr_t FileSystemWatcher::WatchPath(const char* path,
+                                      int events,
+                                      bool recursive) {
+  int fd = TEMP_FAILURE_RETRY(inotify_init1(IN_NONBLOCK | IN_CLOEXEC));
+  if (fd < 0) return -1;
+  int list_events = 0;
+  if (events & kCreate) list_events |= IN_CREATE;
+  if (events & kModifyContent) list_events |= IN_MODIFY | IN_ATTRIB;
+  if (events & kDelete) list_events |= IN_DELETE;
+  if (events & kMove) list_events |= IN_MOVE;
+  int path_fd = TEMP_FAILURE_RETRY(inotify_add_watch(fd, path, list_events));
+  if (path_fd < 0) {
+    close(fd);
+    return -1;
+  }
+  return fd;
+}
+
+
+void FileSystemWatcher::UnwatchPath(intptr_t id) {
+  // Nothing to do.
+}
+
+
+intptr_t FileSystemWatcher::GetSocketId(intptr_t id) {
+  return id;
+}
+
+
+Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id) {
+  const intptr_t kEventSize = sizeof(struct inotify_event);
+  const intptr_t kBufferSize = kEventSize + NAME_MAX + 1;
+  uint8_t buffer[kBufferSize];
+  intptr_t bytes = TEMP_FAILURE_RETRY(read(id, buffer, kBufferSize));
+  if (bytes < 0) {
+    return DartUtils::NewDartOSError();
+  }
+  const intptr_t kMaxCount = kBufferSize / kEventSize + 1;
+  Dart_Handle events = Dart_NewList(kMaxCount);
+  intptr_t offset = 0;
+  intptr_t i = 0;
+  while (offset < bytes) {
+    struct inotify_event* e =
+        reinterpret_cast<struct inotify_event*>(buffer + offset);
+    Dart_Handle event = Dart_NewList(3);
+    int mask = 0;
+    if (e->mask & IN_MODIFY) mask |= kModifyContent;
+    if (e->mask & IN_ATTRIB) mask |= kModefyAttribute;
+    if (e->mask & IN_CREATE) mask |= kCreate;
+    if (e->mask & IN_MOVE) mask |= kMove;
+    if (e->mask & IN_DELETE) mask |= kDelete;
+    Dart_ListSetAt(event, 0, Dart_NewInteger(mask));
+    Dart_ListSetAt(event, 1, Dart_NewInteger(e->cookie));
+    if (e->len > 0) {
+      Dart_ListSetAt(event, 2, Dart_NewStringFromUTF8(
+          reinterpret_cast<uint8_t*>(e->name), strlen(e->name)));
+    } else {
+      Dart_ListSetAt(event, 2, Dart_Null());
+    }
+    Dart_ListSetAt(events, i, event);
+    i++;
+    offset += kEventSize + e->len;
+  }
+  ASSERT(offset == bytes);
+  return events;
+}
+
+}  // namespace bin
+}  // namespace dart
+
+#endif  // defined(TARGET_OS_LINUX)
+
diff --git a/runtime/bin/file_system_watcher_macos.cc b/runtime/bin/file_system_watcher_macos.cc
new file mode 100644
index 0000000..de0be2e
--- /dev/null
+++ b/runtime/bin/file_system_watcher_macos.cc
@@ -0,0 +1,284 @@
+// Copyright (c) 2013, 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.
+
+#include "platform/globals.h"
+#if defined(TARGET_OS_MACOS)
+
+#include "bin/file_system_watcher.h"
+
+#include <errno.h>  // NOLINT
+#include <fcntl.h>  // NOLINT
+#include <unistd.h>  // NOLINT
+#include <CoreServices/CoreServices.h>  // NOLINT
+
+#include "bin/eventhandler.h"
+#include "bin/fdutils.h"
+#include "bin/socket.h"
+#include "bin/thread.h"
+
+
+#ifndef MAC_OS_X_VERSION_10_7
+enum {
+  kFSEventStreamCreateFlagFileEvents = 0x00000010
+};
+enum {
+  kFSEventStreamEventFlagItemCreated = 0x00000100,
+  kFSEventStreamEventFlagItemRemoved = 0x00000200,
+  kFSEventStreamEventFlagItemInodeMetaMod = 0x00000400,
+  kFSEventStreamEventFlagItemRenamed = 0x00000800,
+  kFSEventStreamEventFlagItemModified = 0x00001000,
+  kFSEventStreamEventFlagItemFinderInfoMod = 0x00002000,
+  kFSEventStreamEventFlagItemChangeOwner = 0x00004000,
+  kFSEventStreamEventFlagItemXattrMod = 0x00008000,
+  kFSEventStreamEventFlagItemIsFile = 0x00010000,
+  kFSEventStreamEventFlagItemIsDir = 0x00020000,
+  kFSEventStreamEventFlagItemIsSymlink = 0x00040000
+};
+#endif
+
+
+namespace dart {
+namespace bin {
+
+static Mutex* watcher_mutex = new Mutex();
+static Monitor* watcher_monitor = new Monitor();
+
+class FSEventsWatcher;
+static FSEventsWatcher* watcher = NULL;
+
+union FSEvent {
+  struct {
+    uint32_t flags;
+    char path[PATH_MAX];
+  } data;
+  uint8_t bytes[PATH_MAX + 4];
+};
+
+class FSEventsWatcher {
+ public:
+  class Node {
+   public:
+    Node(intptr_t base_path_length, int read_fd, int write_fd, bool recursive)
+      : base_path_length_(base_path_length),
+        read_fd_(read_fd),
+        write_fd_(write_fd),
+        recursive_(recursive),
+        ref_(NULL) {}
+
+    ~Node() {
+      close(write_fd_);
+      FSEventStreamInvalidate(ref_);
+      FSEventStreamRelease(ref_);
+    }
+
+    void set_ref(FSEventStreamRef ref) {
+      ref_ = ref;
+    }
+
+    void Start() {
+      FSEventStreamStart(ref_);
+    }
+
+    void Stop() {
+      FSEventStreamStop(ref_);
+    }
+
+    intptr_t base_path_length() const { return base_path_length_; }
+    int read_fd() const { return read_fd_; }
+    int write_fd() const { return write_fd_; }
+    bool recursive() const { return recursive_; }
+
+   private:
+    intptr_t base_path_length_;
+    int read_fd_;
+    int write_fd_;
+    bool recursive_;
+    FSEventStreamRef ref_;
+  };
+
+  FSEventsWatcher() : run_loop_(0), users_(0) {
+    Thread::Start(Run, reinterpret_cast<uword>(this));
+  }
+
+  ~FSEventsWatcher() {
+    CFRunLoopStop(run_loop_);
+  }
+
+  static void TimerCallback(CFRunLoopTimerRef timer, void* context) {
+    // Dummy callback to keep RunLoop alive.
+  }
+
+  static void Run(uword arg) {
+    FSEventsWatcher* watcher = reinterpret_cast<FSEventsWatcher*>(arg);
+    watcher->run_loop_ = CFRunLoopGetCurrent();
+
+    // Notify, as the run-loop is set.
+    watcher_monitor->Enter();
+    watcher_monitor->Notify();
+    watcher_monitor->Exit();
+
+    CFRunLoopTimerRef timer = CFRunLoopTimerCreate(
+        NULL,
+        CFAbsoluteTimeGetCurrent() + 1,
+        1,
+        0,
+        0,
+        TimerCallback,
+        NULL);
+
+    CFRunLoopAddTimer(watcher->run_loop_, timer, kCFRunLoopCommonModes);
+
+    CFRunLoopRun();
+  }
+
+  static void Increment() {
+    if (watcher == NULL) {
+      watcher_monitor->Enter();
+      watcher = new FSEventsWatcher();
+      watcher_monitor->Wait(Monitor::kNoTimeout);
+      watcher_monitor->Exit();
+    }
+    watcher->users_++;
+  }
+
+  static void Decrement() {
+    ASSERT(watcher->users_ > 0);
+    watcher->users_--;
+    if (watcher->users_ == 0) {
+      delete watcher;
+      watcher = NULL;
+    }
+  }
+
+  Node* AddPath(const char* path, int events, bool recursive) {
+    int fds[2];
+    VOID_TEMP_FAILURE_RETRY(pipe(fds));
+    Socket::SetNonBlocking(fds[0]);
+    Socket::SetBlocking(fds[1]);
+
+    char base_path[PATH_MAX];
+    realpath(path, base_path);
+    CFStringRef path_ref = CFStringCreateWithCString(
+        NULL, base_path, kCFStringEncodingUTF8);
+
+    Node* node = new Node(strlen(base_path), fds[0], fds[1], recursive);
+
+    FSEventStreamContext context;
+    context.version = 0;
+    context.info = reinterpret_cast<void*>(node);
+    context.retain = NULL;
+    context.release = NULL;
+    context.copyDescription = NULL;
+    FSEventStreamRef ref = FSEventStreamCreate(
+        NULL,
+        Callback,
+        &context,
+        CFArrayCreate(NULL, reinterpret_cast<const void**>(&path_ref), 1, NULL),
+        kFSEventStreamEventIdSinceNow,
+        0.10,
+        kFSEventStreamCreateFlagFileEvents);
+
+    node->set_ref(ref);
+
+    FSEventStreamScheduleWithRunLoop(
+        ref,
+        run_loop_,
+        kCFRunLoopDefaultMode);
+
+    return node;
+  }
+
+ private:
+  static void Callback(ConstFSEventStreamRef ref,
+                       void* client,
+                       size_t num_events,
+                       void* event_paths,
+                       const FSEventStreamEventFlags event_flags[],
+                       const FSEventStreamEventId event_ids[]) {
+    Node* node = reinterpret_cast<Node*>(client);
+    for (size_t i = 0; i < num_events; i++) {
+      char *path = reinterpret_cast<char**>(event_paths)[i];
+      path += node->base_path_length() + 1;
+      if (!node->recursive() && strstr(path, "/") != NULL) continue;
+      FSEvent event;
+      event.data.flags = event_flags[i];
+      memmove(event.data.path, path, strlen(path) + 1);
+      write(node->write_fd(), event.bytes, sizeof(event));
+    }
+  }
+
+  CFRunLoopRef run_loop_;
+  int users_;
+};
+
+
+#define kCFCoreFoundationVersionNumber10_7      635.00
+bool FileSystemWatcher::IsSupported() {
+  return kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_7;
+}
+
+
+intptr_t FileSystemWatcher::WatchPath(const char* path,
+                                      int events,
+                                      bool recursive) {
+  MutexLocker lock(watcher_mutex);
+  FSEventsWatcher::Increment();
+
+  FSEventsWatcher::Node* node = watcher->AddPath(path, events, recursive);
+  node->Start();
+  return reinterpret_cast<intptr_t>(node);
+}
+
+
+void FileSystemWatcher::UnwatchPath(intptr_t id) {
+  MutexLocker lock(watcher_mutex);
+
+  FSEventsWatcher::Node* node = reinterpret_cast<FSEventsWatcher::Node*>(id);
+  node->Stop();
+  delete node;
+
+  FSEventsWatcher::Decrement();
+}
+
+
+intptr_t FileSystemWatcher::GetSocketId(intptr_t id) {
+  return reinterpret_cast<FSEventsWatcher::Node*>(id)->read_fd();
+}
+
+
+Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id) {
+  intptr_t fd = GetSocketId(id);
+  intptr_t avail = FDUtils::AvailableBytes(fd);
+  int count = avail / sizeof(FSEvent);
+  if (count <= 0) return Dart_NewList(0);
+  Dart_Handle events = Dart_NewList(count);
+  FSEvent e;
+  for (int i = 0; i < count; i++) {
+    intptr_t bytes = TEMP_FAILURE_RETRY(read(fd, e.bytes, sizeof(e)));
+    if (bytes < 0) {
+      return DartUtils::NewDartOSError();
+    }
+    Dart_Handle event = Dart_NewList(3);
+    int flags = e.data.flags;
+    int mask = 0;
+    if (flags & kFSEventStreamEventFlagItemModified) mask |= kModifyContent;
+    if (flags & kFSEventStreamEventFlagItemRenamed) mask |= kMove;
+    if (flags & kFSEventStreamEventFlagItemXattrMod) mask |= kModefyAttribute;
+    if (flags & kFSEventStreamEventFlagItemCreated) mask |= kCreate;
+    if (flags & kFSEventStreamEventFlagItemRemoved) mask |= kDelete;
+    Dart_ListSetAt(event, 0, Dart_NewInteger(mask));
+    Dart_ListSetAt(event, 1, Dart_NewInteger(1));
+    Dart_ListSetAt(event, 2, Dart_NewStringFromUTF8(
+        reinterpret_cast<uint8_t*>(e.data.path), strlen(e.data.path)));
+    Dart_ListSetAt(events, i, event);
+  }
+  return events;
+}
+
+}  // namespace bin
+}  // namespace dart
+
+#endif  // defined(TARGET_OS_MACOS)
+
+
diff --git a/runtime/bin/file_system_watcher_win.cc b/runtime/bin/file_system_watcher_win.cc
new file mode 100644
index 0000000..014d861
--- /dev/null
+++ b/runtime/bin/file_system_watcher_win.cc
@@ -0,0 +1,106 @@
+// Copyright (c) 2013, 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.
+
+#include "platform/globals.h"
+#if defined(TARGET_OS_WINDOWS)
+
+#include "bin/file_system_watcher.h"
+#include "bin/eventhandler.h"
+
+#include <WinIoCtl.h>  // NOLINT
+
+#include "bin/builtin.h"
+#include "bin/log.h"
+#include "bin/utils.h"
+
+
+namespace dart {
+namespace bin {
+
+bool FileSystemWatcher::IsSupported() {
+  return true;
+}
+
+
+intptr_t FileSystemWatcher::WatchPath(const char* path,
+                                      int events,
+                                      bool recursive) {
+  const wchar_t* name = StringUtils::Utf8ToWide(path);
+  HANDLE dir = CreateFileW(name,
+                           FILE_LIST_DIRECTORY,
+                           FILE_SHARE_READ |
+                               FILE_SHARE_WRITE |
+                               FILE_SHARE_DELETE,
+                           NULL,
+                           OPEN_EXISTING,
+                           FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED,
+                           NULL);
+  free(const_cast<wchar_t*>(name));
+
+  if (dir == INVALID_HANDLE_VALUE) {
+    return -1;
+  }
+
+  int list_events = 0;
+  if (events & (kCreate | kMove | kDelete)) {
+    list_events |= FILE_NOTIFY_CHANGE_FILE_NAME |
+                   FILE_NOTIFY_CHANGE_DIR_NAME;
+  }
+  if (events & kModifyContent) list_events |= FILE_NOTIFY_CHANGE_LAST_WRITE;
+
+  return reinterpret_cast<intptr_t>(
+      new DirectoryWatchHandle(dir, list_events, recursive));
+}
+
+
+void FileSystemWatcher::UnwatchPath(intptr_t id) {
+  // Nothing to do.
+}
+
+
+intptr_t FileSystemWatcher::GetSocketId(intptr_t id) {
+  return id;
+}
+
+
+Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id) {
+  const intptr_t kEventSize = sizeof(FILE_NOTIFY_INFORMATION);
+  DirectoryWatchHandle* dir = reinterpret_cast<DirectoryWatchHandle*>(id);
+  intptr_t available = dir->Available();
+  intptr_t max_count = available / kEventSize + 1;
+  Dart_Handle events = Dart_NewList(max_count);
+  uint8_t* buffer = new uint8_t[available];
+  intptr_t bytes = dir->Read(buffer, available);
+  intptr_t offset = 0;
+  intptr_t i = 0;
+  while (offset < bytes) {
+    FILE_NOTIFY_INFORMATION* e =
+        reinterpret_cast<FILE_NOTIFY_INFORMATION*>(buffer + offset);
+
+    Dart_Handle event = Dart_NewList(3);
+    int mask = 0;
+    if (e->Action == FILE_ACTION_ADDED) mask |= kCreate;
+    if (e->Action == FILE_ACTION_REMOVED) mask |= kDelete;
+    if (e->Action == FILE_ACTION_MODIFIED) mask |= kModifyContent;
+    if (e->Action == FILE_ACTION_RENAMED_OLD_NAME) mask |= kMove;
+    if (e->Action == FILE_ACTION_RENAMED_NEW_NAME) mask |= kMove;
+    Dart_ListSetAt(event, 0, Dart_NewInteger(mask));
+    // Move events come in pairs. Just 'enable' by default.
+    Dart_ListSetAt(event, 1, Dart_NewInteger(1));
+    Dart_ListSetAt(event, 2, Dart_NewStringFromUTF16(
+        reinterpret_cast<uint16_t*>(e->FileName), e->FileNameLength / 2));
+
+    Dart_ListSetAt(events, i, event);
+    i++;
+    if (e->NextEntryOffset == 0) break;
+    offset += e->NextEntryOffset;
+  }
+  delete[] buffer;
+  return events;
+}
+
+}  // namespace bin
+}  // namespace dart
+
+#endif  // defined(TARGET_OS_WINDOWS)
diff --git a/runtime/bin/io_natives.cc b/runtime/bin/io_natives.cc
index 28b5b6d..9d74167 100644
--- a/runtime/bin/io_natives.cc
+++ b/runtime/bin/io_natives.cc
@@ -68,6 +68,7 @@
   V(Socket_NewServicePort, 0)                                                  \
   V(Socket_GetType, 1)                                                         \
   V(Socket_SetOption, 3)                                                       \
+  V(Socket_SetSocketId, 2)                                                     \
   V(Stdin_ReadByte, 1)                                                         \
   V(Stdin_SetEchoMode, 2)                                                      \
   V(Stdin_SetLineMode, 2)                                                      \
diff --git a/runtime/bin/process_android.cc b/runtime/bin/process_android.cc
index 4395076..fd97e7a 100644
--- a/runtime/bin/process_android.cc
+++ b/runtime/bin/process_android.cc
@@ -153,7 +153,6 @@
 
   // Get the write end of the pipe.
   static int WakeUpFd() {
-    ASSERT(initialized_);
     return sig_chld_fds_[1];
   }
 
diff --git a/runtime/bin/process_linux.cc b/runtime/bin/process_linux.cc
index 3ab2072..adf5cd4 100644
--- a/runtime/bin/process_linux.cc
+++ b/runtime/bin/process_linux.cc
@@ -153,7 +153,6 @@
 
   // Get the write end of the pipe.
   static int WakeUpFd() {
-    ASSERT(initialized_);
     return sig_chld_fds_[1];
   }
 
diff --git a/runtime/bin/process_macos.cc b/runtime/bin/process_macos.cc
index 78d3cdb..1a15a39 100644
--- a/runtime/bin/process_macos.cc
+++ b/runtime/bin/process_macos.cc
@@ -151,7 +151,6 @@
 
   // Get the write end of the pipe.
   static int WakeUpFd() {
-    ASSERT(initialized_);
     return sig_chld_fds_[1];
   }
 
diff --git a/runtime/bin/socket.cc b/runtime/bin/socket.cc
index cd582eb..672e333 100644
--- a/runtime/bin/socket.cc
+++ b/runtime/bin/socket.cc
@@ -285,6 +285,15 @@
 }
 
 
+void FUNCTION_NAME(Socket_SetSocketId)(Dart_NativeArguments args) {
+  Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
+  intptr_t id =
+      DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1));
+  Dart_Handle err = Socket::SetSocketIdNativeField(socket_obj, id);
+  if (Dart_IsError(err)) Dart_PropagateError(err);
+}
+
+
 void FUNCTION_NAME(ServerSocket_CreateBindListen)(Dart_NativeArguments args) {
   Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
   Dart_Handle host_obj = Dart_GetNativeArgument(args, 1);
diff --git a/runtime/bin/socket.h b/runtime/bin/socket.h
index 8c6464b..db76f58 100644
--- a/runtime/bin/socket.h
+++ b/runtime/bin/socket.h
@@ -165,7 +165,7 @@
   static bool GetRemotePeer(intptr_t fd, char* host, intptr_t* port);
   static void GetError(intptr_t fd, OSError* os_error);
   static int GetType(intptr_t fd);
-  static intptr_t GetStdioHandle(int num);
+  static intptr_t GetStdioHandle(intptr_t num);
   static void Close(intptr_t fd);
   static bool SetNonBlocking(intptr_t fd);
   static bool SetBlocking(intptr_t fd);
diff --git a/runtime/bin/socket_android.cc b/runtime/bin/socket_android.cc
index 8ef4234..39b142b 100644
--- a/runtime/bin/socket_android.cc
+++ b/runtime/bin/socket_android.cc
@@ -192,8 +192,8 @@
 }
 
 
-intptr_t Socket::GetStdioHandle(int num) {
-  return static_cast<intptr_t>(num);
+intptr_t Socket::GetStdioHandle(intptr_t num) {
+  return num;
 }
 
 
diff --git a/runtime/bin/socket_linux.cc b/runtime/bin/socket_linux.cc
index f247f5d..63fd9c3 100644
--- a/runtime/bin/socket_linux.cc
+++ b/runtime/bin/socket_linux.cc
@@ -192,8 +192,8 @@
 }
 
 
-intptr_t Socket::GetStdioHandle(int num) {
-  return static_cast<intptr_t>(num);
+intptr_t Socket::GetStdioHandle(intptr_t num) {
+  return num;
 }
 
 
diff --git a/runtime/bin/socket_macos.cc b/runtime/bin/socket_macos.cc
index 2e2dbb6..3b52c09 100644
--- a/runtime/bin/socket_macos.cc
+++ b/runtime/bin/socket_macos.cc
@@ -192,8 +192,8 @@
 }
 
 
-intptr_t Socket::GetStdioHandle(int num) {
-  return static_cast<intptr_t>(num);
+intptr_t Socket::GetStdioHandle(intptr_t num) {
+  return num;
 }
 
 
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index 512cdbe..f4f07af 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -368,6 +368,12 @@
     eventHandlers = new List(EVENT_COUNT + 1);
   }
 
+  _NativeSocket.watch(int id) : typeFlags = TYPE_NORMAL_SOCKET {
+    eventHandlers = new List(EVENT_COUNT + 1);
+    isClosedWrite = true;
+    nativeSetSocketId(id);
+  }
+
   int available() {
     if (isClosing || isClosed) return 0;
     var result = nativeAvailable();
@@ -653,6 +659,7 @@
     return nativeSetOption(option._value, enabled);
   }
 
+  void nativeSetSocketId(int id) native "Socket_SetSocketId";
   nativeAvailable() native "Socket_Available";
   nativeRead(int len) native "Socket_Read";
   nativeWrite(List<int> buffer, int offset, int bytes)
diff --git a/runtime/bin/socket_win.cc b/runtime/bin/socket_win.cc
index ef37ad2..696f8cc 100644
--- a/runtime/bin/socket_win.cc
+++ b/runtime/bin/socket_win.cc
@@ -181,7 +181,7 @@
 }
 
 
-intptr_t Socket::GetStdioHandle(int num) {
+intptr_t Socket::GetStdioHandle(intptr_t num) {
   HANDLE handle;
   switch (num) {
     case 0:
diff --git a/runtime/lib/collection_patch.dart b/runtime/lib/collection_patch.dart
index 869a70b..3b3bcc0 100644
--- a/runtime/lib/collection_patch.dart
+++ b/runtime/lib/collection_patch.dart
@@ -3,23 +3,40 @@
 // BSD-style license that can be found in the LICENSE file.
 
 patch class HashMap<K, V> {
+  /* patch */ factory HashMap({ bool equals(K key1, K key2),
+                                int hashCode(K key) }) {
+    if (hashCode == null) {
+      if (equals == null) {
+        return new _HashMapImpl<K, V>();
+      }
+      if (identical(identical, equals)) {
+        return new _IdentityHashMap<K, V>();
+      }
+      hashCode = _defaultHashCode;
+    } else if (equals == null) {
+      equals = _defaultEquals;
+    }
+    return new _CustomHashMap<K, V>(equals, hashCode);
+  }
+}
+
+const int _MODIFICATION_COUNT_MASK = 0x3fffffff;
+
+class _HashMapImpl<K, V> implements HashMap<K, V> {
   static const int _INITIAL_CAPACITY = 8;
-  static const int _MODIFICATION_COUNT_MASK = 0x3fffffff;
 
   int _elementCount = 0;
   List<_HashMapEntry> _buckets = new List(_INITIAL_CAPACITY);
   int _modificationCount = 0;
 
-  /* patch */ HashMap();
+  int get length => _elementCount;
+  bool get isEmpty => _elementCount == 0;
+  bool get isNotEmpty => _elementCount != 0;
 
-  /* patch */ int get length => _elementCount;
-  /* patch */ bool get isEmpty => _elementCount == 0;
-  /* patch */ bool get isNotEmpty => _elementCount != 0;
+  Iterable<K> get keys => new _HashMapKeyIterable<K>(this);
+  Iterable<V> get values => new _HashMapValueIterable<V>(this);
 
-  /* patch */ Iterable<K> get keys => new _HashMapKeyIterable<K>(this);
-  /* patch */ Iterable<V> get values => new _HashMapValueIterable<V>(this);
-
-  /* patch */ bool containsKey(Object key) {
+  bool containsKey(Object key) {
     int hashCode = key.hashCode;
     List buckets = _buckets;
     int index = hashCode & (buckets.length - 1);
@@ -31,7 +48,7 @@
     return false;
   }
 
-  /* patch */ bool containsValue(Object value) {
+  bool containsValue(Object value) {
     List buckets = _buckets;
     int length = buckets.length;
     for (int i = 0; i < length; i++) {
@@ -44,7 +61,7 @@
     return false;
   }
 
-  /* patch */ V operator[](Object key) {
+  V operator[](Object key) {
     int hashCode = key.hashCode;
     List buckets = _buckets;
     int index = hashCode & (buckets.length - 1);
@@ -58,7 +75,7 @@
     return null;
   }
 
-  /* patch */ void operator []=(K key, V value) {
+  void operator []=(K key, V value) {
     int hashCode = key.hashCode;
     List buckets = _buckets;
     int length = buckets.length;
@@ -74,7 +91,7 @@
     _addEntry(buckets, index, length, key, value, hashCode);
   }
 
-  /* patch */ V putIfAbsent(K key, V ifAbsent()) {
+  V putIfAbsent(K key, V ifAbsent()) {
     int hashCode = key.hashCode;
     List buckets = _buckets;
     int length = buckets.length;
@@ -96,13 +113,13 @@
     return value;
   }
 
-  /* patch */ void addAll(Map<K, V> other) {
+  void addAll(Map<K, V> other) {
     other.forEach((K key, V value) {
       this[key] = value;
     });
   }
 
-  /* patch */ void forEach(void action(K key, V value)) {
+  void forEach(void action(K key, V value)) {
     int stamp = _modificationCount;
     List buckets = _buckets;
     int length = buckets.length;
@@ -118,7 +135,7 @@
     }
   }
 
-  /* patch */ V remove(Object key) {
+  V remove(Object key) {
     int hashCode = key.hashCode;
     List buckets = _buckets;
     int index = hashCode & (buckets.length - 1);
@@ -143,7 +160,7 @@
     return null;
   }
 
-  /* patch */ void clear() {
+  void clear() {
     _elementCount = 0;
     _buckets = new List(_INITIAL_CAPACITY);
     _modificationCount = (_modificationCount + 1) & _MODIFICATION_COUNT_MASK;
@@ -180,8 +197,201 @@
     }
     _buckets = newBuckets;
   }
+
+  String toString() => Maps.mapToString(this);
 }
 
+class _CustomHashMap<K, V> extends _HashMapImpl<K, V> {
+  final _Equality<K> _equals;
+  final _Hasher<K> _hashCode;
+  _CustomHashMap(this._equals, this._hashCode);
+
+  bool containsKey(Object key) {
+    int hashCode = _hashCode(key);
+    List buckets = _buckets;
+    int index = hashCode & (buckets.length - 1);
+    _HashMapEntry entry = buckets[index];
+    while (entry != null) {
+      if (hashCode == entry.hashCode && _equals(entry.key, key)) return true;
+      entry = entry.next;
+    }
+    return false;
+  }
+
+  V operator[](Object key) {
+    int hashCode = _hashCode(key);
+    List buckets = _buckets;
+    int index = hashCode & (buckets.length - 1);
+    _HashMapEntry entry = buckets[index];
+    while (entry != null) {
+      if (hashCode == entry.hashCode && _equals(entry.key, key)) {
+        return entry.value;
+      }
+      entry = entry.next;
+    }
+    return null;
+  }
+
+  void operator []=(K key, V value) {
+    int hashCode = _hashCode(key);
+    List buckets = _buckets;
+    int length = buckets.length;
+    int index = hashCode & (length - 1);
+    _HashMapEntry entry = buckets[index];
+    while (entry != null) {
+      if (hashCode == entry.hashCode && _equals(entry.key, key)) {
+        entry.value = value;
+        return;
+      }
+      entry = entry.next;
+    }
+    _addEntry(buckets, index, length, key, value, hashCode);
+  }
+
+  V putIfAbsent(K key, V ifAbsent()) {
+    int hashCode = _hashCode(key);
+    List buckets = _buckets;
+    int length = buckets.length;
+    int index = hashCode & (length - 1);
+    _HashMapEntry entry = buckets[index];
+    while (entry != null) {
+      if (hashCode == entry.hashCode && _equals(entry.key, key)) {
+        return entry.value;
+      }
+      entry = entry.next;
+    }
+    int stamp = _modificationCount;
+    V value = ifAbsent();
+    if (stamp == _modificationCount) {
+      _addEntry(buckets, index, length, key, value, hashCode);
+    } else {
+      this[key] = value;
+    }
+    return value;
+  }
+
+  V remove(Object key) {
+    int hashCode = _hashCode(key);
+    List buckets = _buckets;
+    int index = hashCode & (buckets.length - 1);
+    _HashMapEntry entry = buckets[index];
+    _HashMapEntry previous = null;
+    while (entry != null) {
+      _HashMapEntry next = entry.next;
+      if (hashCode == entry.hashCode && _equals(entry.key, key)) {
+        if (previous == null) {
+          buckets[index] = next;
+        } else {
+          previous.next = next;
+        }
+        _elementCount--;
+        _modificationCount =
+            (_modificationCount + 1) & _MODIFICATION_COUNT_MASK;
+        return entry.value;
+      }
+      previous = entry;
+      entry = next;
+    }
+    return null;
+  }
+
+  String toString() => Maps.mapToString(this);
+}
+
+class _IdentityHashMap<K, V> extends _HashMapImpl<K, V> {
+  bool containsKey(Object key) {
+    int hashCode = key.hashCode;
+    List buckets = _buckets;
+    int index = hashCode & (buckets.length - 1);
+    _HashMapEntry entry = buckets[index];
+    while (entry != null) {
+      if (hashCode == entry.hashCode && identical(entry.key, key)) return true;
+      entry = entry.next;
+    }
+    return false;
+  }
+
+  V operator[](Object key) {
+    int hashCode = key.hashCode;
+    List buckets = _buckets;
+    int index = hashCode & (buckets.length - 1);
+    _HashMapEntry entry = buckets[index];
+    while (entry != null) {
+      if (hashCode == entry.hashCode && identical(entry.key, key)) {
+        return entry.value;
+      }
+      entry = entry.next;
+    }
+    return null;
+  }
+
+  void operator []=(K key, V value) {
+    int hashCode = key.hashCode;
+    List buckets = _buckets;
+    int length = buckets.length;
+    int index = hashCode & (length - 1);
+    _HashMapEntry entry = buckets[index];
+    while (entry != null) {
+      if (hashCode == entry.hashCode && identical(entry.key, key)) {
+        entry.value = value;
+        return;
+      }
+      entry = entry.next;
+    }
+    _addEntry(buckets, index, length, key, value, hashCode);
+  }
+
+  V putIfAbsent(K key, V ifAbsent()) {
+    int hashCode = key.hashCode;
+    List buckets = _buckets;
+    int length = buckets.length;
+    int index = hashCode & (length - 1);
+    _HashMapEntry entry = buckets[index];
+    while (entry != null) {
+      if (hashCode == entry.hashCode && identical(entry.key, key)) {
+        return entry.value;
+      }
+      entry = entry.next;
+    }
+    int stamp = _modificationCount;
+    V value = ifAbsent();
+    if (stamp == _modificationCount) {
+      _addEntry(buckets, index, length, key, value, hashCode);
+    } else {
+      this[key] = value;
+    }
+    return value;
+  }
+
+  V remove(Object key) {
+    int hashCode = key.hashCode;
+    List buckets = _buckets;
+    int index = hashCode & (buckets.length - 1);
+    _HashMapEntry entry = buckets[index];
+    _HashMapEntry previous = null;
+    while (entry != null) {
+      _HashMapEntry next = entry.next;
+      if (hashCode == entry.hashCode && identical(entry.key, key)) {
+        if (previous == null) {
+          buckets[index] = next;
+        } else {
+          previous.next = next;
+        }
+        _elementCount--;
+        _modificationCount =
+            (_modificationCount + 1) & _MODIFICATION_COUNT_MASK;
+        return entry.value;
+      }
+      previous = entry;
+      entry = next;
+    }
+    return null;
+  }
+
+  String toString() => Maps.mapToString(this);
+}
+
+
 class _HashMapEntry {
   final key;
   var value;
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index 17f4e94..3f70c58 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -125,7 +125,7 @@
   const intptr_t index_of_first_named_param =
       non_implicit_param_count - func.NumOptionalNamedParameters();
   const Array& results = Array::Handle(Array::New(non_implicit_param_count));
-  const Array& args = Array::Handle(Array::New(8));
+  const Array& args = Array::Handle(Array::New(9));
 
   // Return for synthetic functions and getters.
   if (func.IsGetterFunction() ||
@@ -140,10 +140,12 @@
   Instance& param = Instance::Handle();
   Bool& is_final = Bool::Handle();
   Object& default_value = Object::Handle();
+  Object& metadata = Object::Handle();
 
   // Reparse the function for the following information:
   // * The default value of a parameter.
   // * Whether a parameters has been deflared as final.
+  // * Any metadata associated with the parameter.
   const Object& result = Object::Handle(Parser::ParseFunctionParameters(func));
   if (result.IsError()) {
     ThrowInvokeError(Error::Cast(result));
@@ -154,12 +156,18 @@
   args.SetAt(2, owner_mirror);
 
   const Array& param_descriptor = Array::Cast(result);
-  ASSERT(param_descriptor.Length() == (2 * non_implicit_param_count));
+  ASSERT(param_descriptor.Length() ==
+         (Parser::kParameterEntrySize * non_implicit_param_count));
   for (intptr_t i = 0; i < non_implicit_param_count; i++) {
     pos ^= Smi::New(i);
     name ^= func.ParameterNameAt(implicit_param_count + i);
-    is_final ^= param_descriptor.At(i * 2);
-    default_value = param_descriptor.At(i * 2 + 1);
+    is_final ^= param_descriptor.At(
+        i * Parser::kParameterEntrySize + Parser::kParameterIsFinalOffset);
+    default_value = param_descriptor.At(
+        i * Parser::kParameterEntrySize + Parser::kParameterDefaultValueOffset);
+    metadata = param_descriptor.At(
+        i * Parser::kParameterEntrySize + Parser::kParameterMetadataOffset);
+
     ASSERT(default_value.IsNull() || default_value.IsInstance());
 
     // Arguments 0 (referent) and 2 (owner) are the same for all parameters. See
@@ -170,6 +178,7 @@
     args.SetAt(5, Bool::Get(i >= index_of_first_named_param));
     args.SetAt(6, is_final);
     args.SetAt(7, default_value);
+    args.SetAt(8, metadata);
     param ^= CreateMirror(Symbols::_LocalParameterMirrorImpl(), args);
     results.SetAt(i, param);
   }
@@ -313,7 +322,7 @@
   // We do not set the names of anonymous mixin applications because the mirrors
   // use a different naming convention than the VM (lib.S with lib.M and S&M
   // respectively).
-  if ((cls.mixin() == Type::null()) || cls.is_mixin_typedef()) {
+  if (!cls.IsMixinApplication() || cls.is_mixin_typedef()) {
     args.SetAt(2, String::Handle(cls.UserVisibleName()));
   }
   args.SetAt(3, is_generic);
@@ -751,24 +760,42 @@
 }
 
 
+DEFINE_NATIVE_ENTRY(InstanceMirror_identityHash, 1) {
+  GET_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(0));
+  ObjectStore* object_store = isolate->object_store();
+  const Class& cls = Class::Handle(isolate, object_store->object_class());
+  const Function& function =
+      Function::Handle(isolate, cls.LookupDynamicFunction(Symbols::hashCode()));
+  const Array& args = Array::Handle(isolate, Array::New(1));
+  args.SetAt(0, reflectee);
+  return DartEntry::InvokeFunction(function, args);
+}
+
+
 // Invoke the function, or noSuchMethod if it is null. Propagate any unhandled
 // exceptions. Wrap and propagate any compilation errors.
-static RawObject* ReflectivelyInvokeDynamicFunction(const Instance& receiver,
-                                                    const Function& function,
-                                                    const String& target_name,
-                                                    const Array& arguments) {
-  // Note "arguments" is already the internal arguments with the receiver as
-  // the first element.
+static RawObject* ReflectivelyInvokeDynamicFunction(
+    const Instance& receiver,
+    const Function& function,
+    const String& target_name,
+    const Array& args,
+    const Array& args_descriptor_array) {
+  // Note "args" is already the internal arguments with the receiver as the
+  // first element.
   Object& result = Object::Handle();
-  if (function.IsNull() || !function.is_visible()) {
-    const Array& arguments_descriptor =
-        Array::Handle(ArgumentsDescriptor::New(arguments.Length()));
+
+  ArgumentsDescriptor args_descriptor(args_descriptor_array);
+  if (function.IsNull() ||
+      !function.is_visible() ||
+      !function.AreValidArguments(args_descriptor, NULL)) {
     result = DartEntry::InvokeNoSuchMethod(receiver,
                                            target_name,
-                                           arguments,
-                                           arguments_descriptor);
+                                           args,
+                                           args_descriptor_array);
   } else {
-    result = DartEntry::InvokeFunction(function, arguments);
+    result = DartEntry::InvokeFunction(function,
+                                       args,
+                                       args_descriptor_array);
   }
 
   if (result.IsError()) {
@@ -778,30 +805,18 @@
   return result.raw();
 }
 
-
-DEFINE_NATIVE_ENTRY(InstanceMirror_invoke, 4) {
+DEFINE_NATIVE_ENTRY(InstanceMirror_invoke, 5) {
   // Argument 0 is the mirror, which is unused by the native. It exists
   // because this native is an instance method in order to be polymorphic
   // with its cousins.
   GET_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(1));
   GET_NON_NULL_NATIVE_ARGUMENT(
       String, function_name, arguments->NativeArgAt(2));
-  GET_NON_NULL_NATIVE_ARGUMENT(
-      Array, positional_args, arguments->NativeArgAt(3));
+  GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(3));
+  GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4));
 
-  intptr_t number_of_arguments = positional_args.Length();
-
-  const Array& args =
-      Array::Handle(Array::New(number_of_arguments + 1));  // Plus receiver.
-  Object& arg = Object::Handle();
-  args.SetAt(0, reflectee);
-  for (int i = 0; i < number_of_arguments; i++) {
-    arg = positional_args.At(i);
-    args.SetAt(i + 1, arg);  // Plus receiver.
-  }
-
-  ArgumentsDescriptor args_desc(
-      Array::Handle(ArgumentsDescriptor::New(args.Length())));
+  const Array& args_descriptor =
+      Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names));
 
   Class& klass = Class::Handle(reflectee.clazz());
   Function& function = Function::Handle();
@@ -813,15 +828,11 @@
     klass = klass.SuperClass();
   }
 
-  if (!function.IsNull() &&
-      !function.AreValidArguments(args_desc, NULL)) {
-    function = Function::null();
-  }
-
   return ReflectivelyInvokeDynamicFunction(reflectee,
                                            function,
                                            function_name,
-                                           args);
+                                           args,
+                                           args_descriptor);
 }
 
 
@@ -851,11 +862,14 @@
   const int kNumArgs = 1;
   const Array& args = Array::Handle(Array::New(kNumArgs));
   args.SetAt(0, reflectee);
+  const Array& args_descriptor =
+      Array::Handle(ArgumentsDescriptor::New(args.Length()));
 
   return ReflectivelyInvokeDynamicFunction(reflectee,
                                            getter,
                                            internal_getter_name,
-                                           args);
+                                           args,
+                                           args_descriptor);
 }
 
 
@@ -896,37 +910,33 @@
   const Array& args = Array::Handle(Array::New(kNumArgs));
   args.SetAt(0, reflectee);
   args.SetAt(1, value);
+  const Array& args_descriptor =
+      Array::Handle(ArgumentsDescriptor::New(args.Length()));
 
   return ReflectivelyInvokeDynamicFunction(reflectee,
                                            setter,
                                            internal_setter_name,
-                                           args);
+                                           args,
+                                           args_descriptor);
 }
 
 
-DEFINE_NATIVE_ENTRY(ClosureMirror_apply, 2) {
+DEFINE_NATIVE_ENTRY(ClosureMirror_apply, 3) {
   GET_NON_NULL_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0));
   ASSERT(!closure.IsNull() && closure.IsCallable(NULL, NULL));
+  GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(1));
+  GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(2));
 
-  const Array& positional_args =
-      Array::CheckedHandle(arguments->NativeArgAt(1));
-  intptr_t number_of_arguments = positional_args.Length();
+  const Array& args_descriptor =
+      Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names));
 
-  // Set up arguments to include the closure as the first argument.
-  const Array& args = Array::Handle(Array::New(number_of_arguments + 1));
-  Object& obj = Object::Handle();
-  args.SetAt(0, closure);
-  for (int i = 0; i < number_of_arguments; i++) {
-    obj = positional_args.At(i);
-    args.SetAt(i + 1, obj);
-  }
-
-  obj = DartEntry::InvokeClosure(args);
-  if (obj.IsError()) {
-    ThrowInvokeError(Error::Cast(obj));
+  const Object& result =
+      Object::Handle(DartEntry::InvokeClosure(args, args_descriptor));
+  if (result.IsError()) {
+    ThrowInvokeError(Error::Cast(result));
     UNREACHABLE();
   }
-  return obj.raw();
+  return result.raw();
 }
 
 
@@ -942,7 +952,7 @@
 }
 
 
-DEFINE_NATIVE_ENTRY(ClassMirror_invoke, 4) {
+DEFINE_NATIVE_ENTRY(ClassMirror_invoke, 5) {
   // Argument 0 is the mirror, which is unused by the native. It exists
   // because this native is an instance method in order to be polymorphic
   // with its cousins.
@@ -950,18 +960,19 @@
   const Class& klass = Class::Handle(ref.GetClassReferent());
   GET_NON_NULL_NATIVE_ARGUMENT(
       String, function_name, arguments->NativeArgAt(2));
-  GET_NON_NULL_NATIVE_ARGUMENT(
-      Array, positional_args, arguments->NativeArgAt(3));
+  GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(3));
+  GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4));
 
-  intptr_t number_of_arguments = positional_args.Length();
+  const Array& args_descriptor_array =
+      Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names));
 
   const Function& function = Function::Handle(
       klass.LookupStaticFunctionAllowPrivate(function_name));
 
+
+  ArgumentsDescriptor args_descriptor(args_descriptor_array);
   if (function.IsNull() ||
-      !function.AreValidArgumentCounts(number_of_arguments,
-                                       /* named_args */ 0,
-                                       NULL) ||
+      !function.AreValidArguments(args_descriptor, NULL) ||
       !function.is_visible()) {
     ThrowNoSuchMethod(AbstractType::Handle(RawTypeOfClass(klass)),
                       function_name,
@@ -971,8 +982,8 @@
     UNREACHABLE();
   }
 
-  Object& result = Object::Handle(DartEntry::InvokeFunction(function,
-                                                            positional_args));
+  Object& result = Object::Handle(
+      DartEntry::InvokeFunction(function, args, args_descriptor_array));
   if (result.IsError()) {
     ThrowInvokeError(Error::Cast(result));
     UNREACHABLE();
@@ -1073,15 +1084,13 @@
 }
 
 
-DEFINE_NATIVE_ENTRY(ClassMirror_invokeConstructor, 3) {
+DEFINE_NATIVE_ENTRY(ClassMirror_invokeConstructor, 4) {
   GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
   const Class& klass = Class::Handle(ref.GetClassReferent());
   GET_NON_NULL_NATIVE_ARGUMENT(
       String, constructor_name, arguments->NativeArgAt(1));
-  GET_NON_NULL_NATIVE_ARGUMENT(
-      Array, positional_args, arguments->NativeArgAt(2));
-
-  intptr_t number_of_arguments = positional_args.Length();
+  GET_NON_NULL_NATIVE_ARGUMENT(Array, explicit_args, arguments->NativeArgAt(2));
+  GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(3));
 
   // By convention, the static function implementing a named constructor 'C'
   // for class 'A' is labeled 'A.C', and the static function implementing the
@@ -1095,42 +1104,100 @@
         String::Concat(internal_constructor_name, constructor_name);
   }
 
-  Function& constructor = Function::Handle(
+  Function& lookup_constructor = Function::Handle(
       klass.LookupFunctionAllowPrivate(internal_constructor_name));
 
-  if (constructor.IsNull() ||
-     (!constructor.IsConstructor() && !constructor.IsFactory()) ||
-     !constructor.AreValidArgumentCounts(number_of_arguments +
-                                         constructor.NumImplicitParameters(),
-                                         /* named args */ 0,
-                                         NULL) ||
-     !constructor.is_visible()) {
+  if (lookup_constructor.IsNull() ||
+      !(lookup_constructor.IsConstructor() || lookup_constructor.IsFactory()) ||
+      !lookup_constructor.is_visible()) {
     // Pretend we didn't find the constructor at all when the arity is wrong
     // so as to produce the same NoSuchMethodError as the non-reflective case.
-    constructor = Function::null();
+    lookup_constructor = Function::null();
     ThrowNoSuchMethod(AbstractType::Handle(RawTypeOfClass(klass)),
                       internal_constructor_name,
-                      constructor,
+                      lookup_constructor,
                       InvocationMirror::kConstructor,
                       InvocationMirror::kMethod);
     UNREACHABLE();
   }
 
-  const Object& result =
-      Object::Handle(DartEntry::InvokeConstructor(klass,
-                                                  constructor,
-                                                  positional_args));
-  if (result.IsError()) {
-    ThrowInvokeError(Error::Cast(result));
+  Class& redirected_klass = Class::Handle(klass.raw());
+  Function& redirected_constructor = Function::Handle(lookup_constructor.raw());
+  if (lookup_constructor.IsRedirectingFactory()) {
+    ClassFinalizer::ResolveRedirectingFactory(klass, lookup_constructor);
+    Type& type = Type::Handle(lookup_constructor.RedirectionType());
+    redirected_constructor = lookup_constructor.RedirectionTarget();
+    ASSERT(!redirected_constructor.IsNull());
+    redirected_klass = type.type_class();
+  }
+
+  const intptr_t num_explicit_args = explicit_args.Length();
+  const intptr_t num_implicit_args =
+      redirected_constructor.IsConstructor() ? 2 : 1;
+  const Array& args =
+      Array::Handle(Array::New(num_implicit_args + num_explicit_args));
+
+  // Copy over the explicit arguments.
+  Object& explicit_argument = Object::Handle();
+  for (int i = 0; i < num_explicit_args; i++) {
+    explicit_argument = explicit_args.At(i);
+    args.SetAt(i + num_implicit_args, explicit_argument);
+  }
+
+  const Array& args_descriptor_array =
+      Array::Handle(ArgumentsDescriptor::New(args.Length(),
+                                             arg_names));
+
+  ArgumentsDescriptor args_descriptor(args_descriptor_array);
+  if (!redirected_constructor.AreValidArguments(args_descriptor, NULL) ||
+      !redirected_constructor.is_visible()) {
+    // Pretend we didn't find the constructor at all when the arity is wrong
+    // so as to produce the same NoSuchMethodError as the non-reflective case.
+    redirected_constructor = Function::null();
+    ThrowNoSuchMethod(AbstractType::Handle(RawTypeOfClass(klass)),
+                      internal_constructor_name,
+                      redirected_constructor,
+                      InvocationMirror::kConstructor,
+                      InvocationMirror::kMethod);
     UNREACHABLE();
   }
+
+  Instance& new_object = Instance::Handle();
+  if (redirected_constructor.IsConstructor()) {
+    // Constructors get the uninitialized object and a constructor phase. Note
+    // we have delayed allocation until after the function type and argument
+    // matching checks.
+    new_object = Instance::New(redirected_klass);
+    args.SetAt(0, new_object);
+    args.SetAt(1, Smi::Handle(Smi::New(Function::kCtorPhaseAll)));
+  } else {
+    // Factories get type arguments.
+    // TODO(12921): Should we allow the user to specify type arguments? Use type
+    // arguments from the mirror?
+    args.SetAt(0, Object::null_abstract_type_arguments());
+  }
+
+  // Invoke the constructor and return the new object.
+  const Object& result =
+      Object::Handle(DartEntry::InvokeFunction(redirected_constructor,
+                                               args,
+                                               args_descriptor_array));
+  if (result.IsError()) {
+    return result.raw();
+  }
+
   // Factories may return null.
   ASSERT(result.IsInstance() || result.IsNull());
-  return result.raw();
+
+  if (redirected_constructor.IsConstructor()) {
+    return new_object.raw();
+  } else {
+    return result.raw();
+  }
 }
 
 
-DEFINE_NATIVE_ENTRY(LibraryMirror_invoke, 4) {
+DEFINE_NATIVE_ENTRY(LibraryMirror_invoke, 5) {
   // Argument 0 is the mirror, which is unused by the native. It exists
   // because this native is an instance method in order to be polymorphic
   // with its cousins.
@@ -1138,10 +1205,11 @@
   const Library& library = Library::Handle(ref.GetLibraryReferent());
   GET_NON_NULL_NATIVE_ARGUMENT(
       String, function_name, arguments->NativeArgAt(2));
-  GET_NON_NULL_NATIVE_ARGUMENT(
-      Array, positional_args, arguments->NativeArgAt(3));
+  GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(3));
+  GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4));
 
-  intptr_t number_of_arguments = positional_args.Length();
+  const Array& args_descriptor_array =
+      Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names));
 
   String& ambiguity_error_msg = String::Handle(isolate);
   const Function& function = Function::Handle(
@@ -1152,11 +1220,10 @@
     UNREACHABLE();
   }
 
+  ArgumentsDescriptor args_descriptor(args_descriptor_array);
   if (function.IsNull() ||
-     !function.AreValidArgumentCounts(number_of_arguments,
-                                      0,
-                                      NULL) ||
-     !function.is_visible()) {
+      !function.AreValidArguments(args_descriptor, NULL) ||
+      !function.is_visible()) {
     ThrowNoSuchMethod(Instance::null_instance(),
                       function_name,
                       function,
@@ -1166,7 +1233,7 @@
   }
 
   const Object& result = Object::Handle(
-      DartEntry::InvokeFunction(function, positional_args));
+      DartEntry::InvokeFunction(function, args, args_descriptor_array));
   if (result.IsError()) {
     ThrowInvokeError(Error::Cast(result));
     UNREACHABLE();
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
index ddf05f0..844b6a8 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -49,24 +49,37 @@
 String _makeSignatureString(TypeMirror returnType,
                             List<ParameterMirror> parameters) {
   StringBuffer buf = new StringBuffer();
-  buf.write(_n(returnType.qualifiedName));
-  buf.write(' (');
-  bool found_optional_param = false;
+  buf.write('(');
+  bool found_optional_positional = false;
+  bool found_optional_named = false;
+
   for (int i = 0; i < parameters.length; i++) {
     var param = parameters[i];
-    if (param.isOptional && !found_optional_param) {
+    if (param.isOptional && param.isNamed && !found_optional_named) {
+      buf.write('{');
+      found_optional_named = true;
+    }
+    if (param.isOptional && !param.isNamed && !found_optional_positional) {
       buf.write('[');
-      found_optional_param = true;
+      found_optional_positional = true;
+    }
+    if (param.isNamed) {
+      buf.write(_n(param.simpleName));
+      buf.write(': ');
     }
     buf.write(_n(param.type.qualifiedName));
     if (i < (parameters.length - 1)) {
       buf.write(', ');
     }
   }
-  if (found_optional_param) {
+  if (found_optional_named) {
+    buf.write('}');
+  }
+  if (found_optional_positional) {
     buf.write(']');
   }
-  buf.write(')');
+  buf.write(') -> ');
+  buf.write(_n(returnType.qualifiedName));
   return buf.toString();
 }
 
@@ -81,7 +94,7 @@
 
 // This will verify the argument types, unwrap them, and ensure we have a fixed
 // array.
-List _unwarpAsyncPositionals(wrappedArgs){
+List _unwarpAsyncPositionals(wrappedArgs) {
   List unwrappedArgs = new List(wrappedArgs.length);
   for(int i = 0; i < wrappedArgs.length; i++){
     var wrappedArg = wrappedArgs[i];
@@ -89,12 +102,28 @@
       unwrappedArgs[i] = wrappedArg;
     } else if(wrappedArg is InstanceMirror) {
       unwrappedArgs[i] = wrappedArg._reflectee;
-    } else { 
-      throw "positional argument $i ($arg) was not a simple value or InstanceMirror";
+    } else {
+      throw "positional argument $i ($wrappedArg) was "
+            "not a simple value or InstanceMirror";
     }
   }
   return unwrappedArgs;
 }
+Map _unwarpAsyncNamed(wrappedArgs) {
+  if (wrappedArgs==null) return null;
+  Map unwrappedArgs = new Map();
+  wrappedArgs.forEach((name, wrappedArg){
+    if(_isSimpleValue(wrappedArg)) {
+      unwrappedArgs[name] = wrappedArg;
+    } else if(wrappedArg is InstanceMirror) {
+      unwrappedArgs[name] = wrappedArg._reflectee;
+    } else {
+      throw "named argument ${_n(name)} ($wrappedArg) was "
+            "not a simple value or InstanceMirror";
+    }
+  });
+  return unwrappedArgs;
+}
 
 class _LocalMirrorSystemImpl extends MirrorSystem {
   // Change parameter back to "this.libraries" when native code is changed.
@@ -155,13 +184,26 @@
   InstanceMirror invoke(Symbol memberName,
                         List positionalArguments,
                         [Map<Symbol, dynamic> namedArguments]) {
-    if (namedArguments != null) {
-      throw new UnimplementedError(
-          'named argument support is not implemented');
+
+    int numPositionalArguments = positionalArguments.length;
+    int numNamedArguments = namedArguments != null ? namedArguments.length : 0;
+    int numArguments = numPositionalArguments + numNamedArguments;
+    List arguments = new List(numArguments);
+    arguments.setRange(0, numPositionalArguments, positionalArguments);
+    List names = new List(numNamedArguments);
+    int argumentIndex = numPositionalArguments;
+    int nameIndex = 0;
+    if (numNamedArguments > 0) {
+      namedArguments.forEach((name, value) {
+        arguments[argumentIndex++] = value;
+        names[nameIndex++] = _n(name);
+      });
     }
+
     return reflect(this._invoke(_reflectee,
                                 _n(memberName),
-                                positionalArguments.toList(growable:false))); 
+                                arguments,
+                                names));
   }
 
   InstanceMirror getField(Symbol memberName) {
@@ -179,19 +221,11 @@
   Future<InstanceMirror> invokeAsync(Symbol memberName,
                                      List positionalArguments,
                                      [Map<Symbol, dynamic> namedArguments]) {
-    if (namedArguments != null) {
-      throw new UnimplementedError(
-          'named argument support is not implemented');
-    }
-
-    try {
-      var result = this._invoke(_reflectee,
-                                _n(memberName),
-                                _unwarpAsyncPositionals(positionalArguments));
-      return new Future.value(reflect(result)); 
-    } catch(e) {
-      return new Future.error(e);
-    }
+    return new Future(() {
+      return this.invoke(memberName,
+                         _unwarpAsyncPositionals(positionalArguments),
+                         _unwarpAsyncNamed(namedArguments));
+    });
   }
 
   Future<InstanceMirror> getFieldAsync(Symbol memberName) {
@@ -283,10 +317,50 @@
            identical(_reflectee, other._reflectee);
   }
 
-  // TODO(12909): Use the reflectee's identity hash.
-  int get hashCode => _reflectee.hashCode;
+  int get hashCode {
+    // If the reflectee is a double or bignum, use the base hashCode to preserve
+    // the illusion that boxed numbers with the same value are identical. If the
+    // reflectee is a Smi, use the base hashCode because Object.hashCode does
+    // not work for non-heap objects. Otherwise, use Object.hashCode to maintain
+    // correctness even if a user-defined hashCode returns different values for
+    // successive invocations.
+    var h = _reflectee is num ? _reflectee.hashCode : _identityHash(_reflectee);
+    // Avoid hash collisions with the reflectee. This constant is in Smi range
+    // and happens to be the inner padding from RFC 2104.
+    return h ^ 0x36363636;
+  }
 
-  _invoke(reflectee, functionName, positionalArguments)
+  static _identityHash(reflectee)
+      native "InstanceMirror_identityHash";
+
+  // Override to include the receiver in the arguments.
+  InstanceMirror invoke(Symbol memberName,
+                        List positionalArguments,
+                        [Map<Symbol, dynamic> namedArguments]) {
+
+    int numPositionalArguments = positionalArguments.length + 1;  // Receiver.
+    int numNamedArguments = namedArguments != null ? namedArguments.length : 0;
+    int numArguments = numPositionalArguments + numNamedArguments;
+    List arguments = new List(numArguments);
+    arguments[0] = _reflectee;  // Receiver.
+    arguments.setRange(1, numPositionalArguments, positionalArguments);
+    List names = new List(numNamedArguments);
+    int argumentIndex = numPositionalArguments;
+    int nameIndex = 0;
+    if (numNamedArguments > 0) {
+      namedArguments.forEach((name, value) {
+        arguments[argumentIndex++] = value;
+        names[nameIndex++] = _n(name);
+      });
+    }
+
+    return reflect(this._invoke(_reflectee,
+                                _n(memberName),
+                                arguments,
+                                names));
+  }
+
+  _invoke(reflectee, functionName, arguments, argumentNames)
       native 'InstanceMirror_invoke';
 
   _invokeGetter(reflectee, getterName)
@@ -318,30 +392,38 @@
 
   InstanceMirror apply(List<Object> positionalArguments,
                        [Map<Symbol, Object> namedArguments]) {
-    if (namedArguments != null) {
-      throw new UnimplementedError(
-          'named argument support is not implemented');
+    // TODO(iposva): When closures get an ordinary call method, this can be
+    // replaced with
+    //   return this.invoke(#call, positionalArguments, namedArguments);
+    // and the native ClosureMirror_apply can be removed.
+    
+    int numPositionalArguments = positionalArguments.length + 1;  // Receiver.
+    int numNamedArguments = namedArguments != null ? namedArguments.length : 0;
+    int numArguments = numPositionalArguments + numNamedArguments;
+    List arguments = new List(numArguments);
+    arguments[0] = _reflectee;  // Receiver.
+    arguments.setRange(1, numPositionalArguments, positionalArguments);
+    List names = new List(numNamedArguments);
+    int argumentIndex = numPositionalArguments;
+    int nameIndex = 0;
+    if (numNamedArguments > 0) {
+      namedArguments.forEach((name, value) {
+        arguments[argumentIndex++] = value;
+        names[nameIndex++] = _n(name);
+      });
     }
+
     // It is tempting to implement this in terms of Function.apply, but then
     // lazy compilation errors would be fatal.
-    return reflect(_apply(_reflectee,
-                          positionalArguments.toList(growable:false)));
+    return reflect(_apply(_reflectee, arguments, names));
   }
 
   Future<InstanceMirror> applyAsync(List positionalArguments,
                                     [Map<Symbol, dynamic> namedArguments]) {
-    if (namedArguments != null) {
-      throw new UnimplementedError(
-          'named argument support is not implemented');
-    }
-
-    try {
-      var result = _apply(_reflectee,
-                          _unwarpAsyncPositionals(positionalArguments));
-      return new Future.value(reflect(result)); 
-    } on MirroredError catch(e) {
-      return new Future.error(e);
-    }
+    return new Future(() {
+      return this.apply(_unwarpAsyncPositionals(positionalArguments),
+                        _unwarpAsyncNamed(namedArguments));
+    });
   }
 
   Future<InstanceMirror> findInContext(Symbol name) {
@@ -351,7 +433,7 @@
 
   String toString() => "ClosureMirror on '${Error.safeToString(_reflectee)}'";
 
-  static _apply(reflectee, positionalArguments)
+  static _apply(reflectee, arguments, argumentNames)
       native 'ClosureMirror_apply';
 
   static _computeFunction(reflectee)
@@ -594,31 +676,37 @@
   InstanceMirror newInstance(Symbol constructorName,
                              List positionalArguments,
                              [Map<Symbol, dynamic> namedArguments]) {
-    if (namedArguments != null) {
-      throw new UnimplementedError(
-          'named argument support is not implemented');
+    // Native code will add the 1 or 2 implicit arguments depending on whether
+    // we end up invoking a factory or constructor respectively.
+    int numPositionalArguments = positionalArguments.length;
+    int numNamedArguments = namedArguments != null ? namedArguments.length : 0;
+    int numArguments = numPositionalArguments + numNamedArguments;
+    List arguments = new List(numArguments);
+    arguments.setRange(0, numPositionalArguments, positionalArguments);
+    List names = new List(numNamedArguments);
+    int argumentIndex = numPositionalArguments;
+    int nameIndex = 0;
+    if (numNamedArguments > 0) {
+      namedArguments.forEach((name, value) {
+        arguments[argumentIndex++] = value;
+        names[nameIndex++] = _n(name);
+      });
     }
+
     return reflect(_invokeConstructor(_reflectee,
                                       _n(constructorName),
-                                      positionalArguments.toList(growable:false)));
+                                      arguments,
+                                      names));
   }
 
   Future<InstanceMirror> newInstanceAsync(Symbol constructorName,
                                           List positionalArguments,
                                           [Map<Symbol, dynamic> namedArguments]) {
-    if (namedArguments != null) {
-      throw new UnimplementedError(
-          'named argument support is not implemented');
-    }
-
-    try {
-      var result = _invokeConstructor(_reflectee,
-                                      _n(constructorName),
-                                      _unwarpAsyncPositionals(positionalArguments));
-      return new Future.value(reflect(result)); 
-    } catch(e) {
-      return new Future.error(e);
-    }
+    return new Future(() {
+      return this.newInstance(constructorName,
+                              _unwarpAsyncPositionals(positionalArguments),
+                              _unwarpAsyncNamed(namedArguments));
+    });
   }
 
   List<InstanceMirror> get metadata {
@@ -656,7 +744,7 @@
   _computeConstructors(reflectee)
       native "ClassMirror_constructors";
 
-  _invoke(reflectee, memberName, positionalArguments)
+  _invoke(reflectee, memberName, arguments, argumentNames)
       native 'ClassMirror_invoke';
 
   _invokeGetter(reflectee, getterName)
@@ -665,7 +753,7 @@
   _invokeSetter(reflectee, setterName, value)
       native 'ClassMirror_invokeSetter';
 
-  static _invokeConstructor(reflectee, constructorName, positionalArguments)
+  static _invokeConstructor(reflectee, constructorName, arguments, argumentNames)
       native 'ClassMirror_invokeConstructor';
 
   static _ClassMirror_type_variables(reflectee)
@@ -955,7 +1043,7 @@
 
   int get hashCode => simpleName.hashCode;
 
-  _invoke(reflectee, memberName, positionalArguments)
+  _invoke(reflectee, memberName, arguments, argumentNames)
       native 'LibraryMirror_invoke';
 
   _invokeGetter(reflectee, getterName)
@@ -1149,7 +1237,8 @@
                             this.isOptional,
                             this.isNamed,
                             bool isFinal,
-                            this._defaultValueReflectee)
+                            this._defaultValueReflectee,
+                            this._unmirroredMetadata)
       : super(reflectee,
               simpleName,
               owner,
@@ -1160,6 +1249,7 @@
   final int _position;
   final bool isOptional;
   final bool isNamed;
+  final List _unmirroredMetadata;
 
   Object _defaultValueReflectee;
   InstanceMirror _defaultValue;
@@ -1175,10 +1265,9 @@
 
   bool get hasDefaultValue => _defaultValueReflectee != null;
 
-  // TODO(11418): Implement.
   List<InstanceMirror> get metadata {
-    throw new UnimplementedError(
-        'ParameterMirror.metadata is not implemented');
+    if ( _unmirroredMetadata == null) return const [];
+    return _unmirroredMetadata.map(reflect).toList(growable:false);
   }
 
   TypeMirror _type = null;
@@ -1190,6 +1279,8 @@
     return _type;
   }
 
+  String toString() => "ParameterMirror on '${_n(simpleName)}'";
+
   static Type _ParameterMirror_type(_reflectee, _position)
       native "ParameterMirror_type";
 }
diff --git a/runtime/lib/stacktrace.cc b/runtime/lib/stacktrace.cc
index 2a8f96e..486d96d 100644
--- a/runtime/lib/stacktrace.cc
+++ b/runtime/lib/stacktrace.cc
@@ -30,71 +30,70 @@
 }
 
 
-// Setup a full stack trace.
-// Arg0: stack trace object.
-// Return value: None.
-DEFINE_NATIVE_ENTRY(Stacktrace_setupFullStacktrace, 1) {
-  const Stacktrace& trace =
-      Stacktrace::CheckedHandle(arguments->NativeArgAt(0));
-  const GrowableObjectArray& func_list =
-      GrowableObjectArray::Handle(GrowableObjectArray::New());
-  const GrowableObjectArray& code_list =
-      GrowableObjectArray::Handle(GrowableObjectArray::New());
-  const GrowableObjectArray& pc_offset_list =
-      GrowableObjectArray::Handle(GrowableObjectArray::New());
+static void IterateFrames(const GrowableObjectArray& code_list,
+                          const GrowableObjectArray& pc_offset_list) {
   StackFrameIterator frames(StackFrameIterator::kDontValidateFrames);
   StackFrame* frame = frames.NextFrame();
   ASSERT(frame != NULL);  // We expect to find a dart invocation frame.
-  Function& func = Function::Handle();
   Code& code = Code::Handle();
   Smi& offset = Smi::Handle();
   bool catch_frame_skipped = false;  // Tracks if catch frame has been skipped.
   while (frame != NULL) {
     if (frame->IsDartFrame()) {
       code = frame->LookupDartCode();
-      if (code.is_optimized()) {
-        // For optimized frames, extract all the inlined functions if any
-        // into the stack trace.
-        for (InlinedFunctionsIterator it(frame); !it.Done(); it.Advance()) {
-          func = it.function();
-          code = it.code();
-          uword pc = it.pc();
-          ASSERT(pc != 0);
-          ASSERT(code.EntryPoint() <= pc);
-          ASSERT(pc < (code.EntryPoint() + code.Size()));
-          if (func.is_visible()) {
-            if (!catch_frame_skipped) {
-              catch_frame_skipped = true;
-            } else {
-              offset = Smi::New(pc - code.EntryPoint());
-              func_list.Add(func);
-              code_list.Add(code);
-              pc_offset_list.Add(offset);
-            }
-          }
+      offset = Smi::New(frame->pc() - code.EntryPoint());
+      if (!catch_frame_skipped) {
+        const Function& func = Function::Handle(code.function());
+        // Skip over hidden native, and mark first visible frame as catch frame.
+        if (func.is_visible()) {
+          catch_frame_skipped = true;
         }
       } else {
-        offset = Smi::New(frame->pc() - code.EntryPoint());
-        func = code.function();
-        if (func.is_visible()) {
-          if (!catch_frame_skipped) {
-            catch_frame_skipped = true;
-          } else {
-            func_list.Add(func);
-            code_list.Add(code);
-            pc_offset_list.Add(offset);
-          }
-        }
+        code_list.Add(code);
+        pc_offset_list.Add(offset);
       }
     }
     frame = frames.NextFrame();
   }
-  const Array& func_array = Array::Handle(Array::MakeArray(func_list));
+}
+
+
+// Setup a full stack trace.
+// Arg0: stack trace object.
+// Return value: None.
+DEFINE_NATIVE_ENTRY(Stacktrace_setupFullStacktrace, 1) {
+  const Stacktrace& trace =
+      Stacktrace::CheckedHandle(arguments->NativeArgAt(0));
+  const GrowableObjectArray& code_list =
+      GrowableObjectArray::Handle(GrowableObjectArray::New());
+  const GrowableObjectArray& pc_offset_list =
+      GrowableObjectArray::Handle(GrowableObjectArray::New());
+  IterateFrames(code_list, pc_offset_list);
   const Array& code_array = Array::Handle(Array::MakeArray(code_list));
   const Array& pc_offset_array =
       Array::Handle(Array::MakeArray(pc_offset_list));
-  trace.SetCatchStacktrace(func_array, code_array, pc_offset_array);
+  trace.SetCatchStacktrace(code_array, pc_offset_array);
   return Object::null();
 }
 
+
+// An utility method for convenient printing of dart stack traces when
+// inside 'gdb'. Note: This function will only work when there is a
+// valid exit frame information. It will not work when a breakpoint is
+// set in dart code and control is got inside 'gdb' without going through
+// the runtime or native transition stub.
+void _printCurrentStacktrace() {
+  const GrowableObjectArray& code_list =
+      GrowableObjectArray::Handle(GrowableObjectArray::New());
+  const GrowableObjectArray& pc_offset_list =
+      GrowableObjectArray::Handle(GrowableObjectArray::New());
+  IterateFrames(code_list, pc_offset_list);
+  const Array& code_array = Array::Handle(Array::MakeArray(code_list));
+  const Array& pc_offset_array =
+      Array::Handle(Array::MakeArray(pc_offset_list));
+  const Stacktrace& stacktrace = Stacktrace::Handle(
+      Stacktrace::New(code_array, pc_offset_array));
+  OS::Print("%s\n", stacktrace.ToCString());
+}
+
 }  // namespace dart
diff --git a/runtime/lib/typed_data.dart b/runtime/lib/typed_data.dart
index 006918c..0a8b0ef 100644
--- a/runtime/lib/typed_data.dart
+++ b/runtime/lib/typed_data.dart
@@ -2826,8 +2826,8 @@
   }
 
   int getInt16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 1 >= length) {
+      _throwRangeError(byteOffset + 1, length);
     }
     var result = _typedData._getInt16(_offset + byteOffset);
     if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -2838,8 +2838,8 @@
   void setInt16(int byteOffset,
                 int value,
                 [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 1 >= length) {
+      _throwRangeError(byteOffset + 1, length);
     }
     var set_value = _toInt16(value);
     if (!identical(endian, Endianness.HOST_ENDIAN)) {
@@ -2849,8 +2849,8 @@
   }
 
   int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 1 >= length) {
+      _throwRangeError(byteOffset + 1, length);
     }
     var result = _typedData._getUint16(_offset + byteOffset);
     if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -2861,8 +2861,8 @@
   void setUint16(int byteOffset,
                  int value,
                  [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 1 >= length) {
+      _throwRangeError(byteOffset + 1, length);
     }
     var set_value = _toUint16(value);
     if (!identical(endian, Endianness.HOST_ENDIAN)) {
@@ -2872,8 +2872,8 @@
   }
 
   int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 3 >= length) {
+      _throwRangeError(byteOffset + 3, length);
     }
     var result = _typedData._getInt32(_offset + byteOffset);
     if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -2884,8 +2884,8 @@
   void setInt32(int byteOffset,
                 int value,
                 [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 3 >= length) {
+      _throwRangeError(byteOffset + 3, length);
     }
     var set_value = _toInt32(value);
     if (!identical(endian, Endianness.HOST_ENDIAN)) {
@@ -2895,8 +2895,8 @@
   }
 
   int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 3 >= length) {
+      _throwRangeError(byteOffset + 3, length);
     }
     var result = _typedData._getUint32(_offset + byteOffset);
     if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -2907,8 +2907,8 @@
   void setUint32(int byteOffset,
                  int value,
                  [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 3 >= length) {
+      _throwRangeError(byteOffset + 3, length);
     }
     var set_value = _toUint32(value);
     if (!identical(endian, Endianness.HOST_ENDIAN)) {
@@ -2918,8 +2918,8 @@
   }
 
   int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 7 >= length) {
+      _throwRangeError(byteOffset + 7, length);
     }
     var result = _typedData._getInt64(_offset + byteOffset);
     if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -2930,8 +2930,8 @@
   void setInt64(int byteOffset,
                 int value,
                 [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 7 >= length) {
+      _throwRangeError(byteOffset + 7, length);
     }
     var set_value = _toInt64(value);
     if (!identical(endian, Endianness.HOST_ENDIAN)) {
@@ -2941,8 +2941,8 @@
   }
 
   int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 7 >= length) {
+      _throwRangeError(byteOffset + 7, length);
     }
     var result = _typedData._getUint64(_offset + byteOffset);
     if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -2953,8 +2953,8 @@
   void setUint64(int byteOffset,
                  int value,
                  [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 7 >= length) {
+      _throwRangeError(byteOffset + 7, length);
     }
     var set_value = _toUint64(value);
     if (!identical(endian, Endianness.HOST_ENDIAN)) {
@@ -2965,8 +2965,8 @@
 
   double getFloat32(int byteOffset,
                     [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 3 >= length) {
+      _throwRangeError(byteOffset + 3, length);
     }
     var result = _typedData._getFloat32(_offset + byteOffset);
     if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -2977,8 +2977,8 @@
   void setFloat32(int byteOffset,
                   double value,
                   [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 3 >= length) {
+      _throwRangeError(byteOffset + 3, length);
     }
     var set_value = value;
     if (!identical(endian, Endianness.HOST_ENDIAN)) {
@@ -2989,8 +2989,8 @@
 
   double getFloat64(int byteOffset,
                     [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 7 >= length) {
+      _throwRangeError(byteOffset + 7, length);
     }
     var result = _typedData._getFloat64(_offset + byteOffset);
     if (identical(endian, Endianness.HOST_ENDIAN)) {
@@ -3001,8 +3001,8 @@
   void setFloat64(int byteOffset,
                   double value,
                   [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 7 >= length) {
+      _throwRangeError(byteOffset + 7, length);
     }
     var set_value = value;
     if (!identical(endian, Endianness.HOST_ENDIAN)) {
@@ -3013,8 +3013,8 @@
 
   Float32x4 getFloat32x4(int byteOffset,
                          [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 3 >= length) {
+      _throwRangeError(byteOffset + 3, length);
     }
     // TODO(johnmccutchan) : Need to resolve this for endianity.
     return _typedData._getFloat32x4(_offset + byteOffset);
@@ -3022,8 +3022,8 @@
   void setFloat32x4(int byteOffset,
                     Float32x4 value,
                     [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      _throwRangeError(byteOffset, length);
+    if (byteOffset < 0 || byteOffset + 3 >= length) {
+      _throwRangeError(byteOffset + 3, length);
     }
     // TODO(johnmccutchan) : Need to resolve this for endianity.
     _typedData._setFloat32x4(_offset + byteOffset, value);
diff --git a/runtime/platform/utils.h b/runtime/platform/utils.h
index b884671..59e66b6 100644
--- a/runtime/platform/utils.h
+++ b/runtime/platform/utils.h
@@ -30,7 +30,7 @@
 
   template<typename T>
   static inline bool IsPowerOfTwo(T x) {
-    return (x & (x - 1)) == 0;
+    return ((x & (x - 1)) == 0) && (x != 0);
   }
 
   template<typename T>
diff --git a/runtime/tools/gyp/nss_configurations.gypi b/runtime/tools/gyp/nss_configurations.gypi
index ac3e612..e3776e0 100644
--- a/runtime/tools/gyp/nss_configurations.gypi
+++ b/runtime/tools/gyp/nss_configurations.gypi
@@ -19,14 +19,7 @@
   },
   'target_defaults': {
     'cflags': [
-      '-Wno-unused-variable',
-      '-Wno-unused-but-set-variable',
-      '-Wno-missing-field-initializers',
-      '-Wno-uninitialized',
-      '-Wno-sign-compare',
-      '-Wno-empty-body',
-      '-Wno-type-limits',
-      '-Wno-pointer-to-int-cast',
+      '-w',
       '-UHAVE_CVAR_BUILT_ON_SEM',
     ],
     # Removes these flags from the list cflags.
@@ -46,6 +39,9 @@
     'configurations': {
       'Dart_Base': {
         'xcode_settings': {
+          'WARNING_CFLAGS': [
+            '-w',
+          ],
           'WARNING_CFLAGS!': [
             '-Wall',
             '-Wextra',
diff --git a/runtime/vm/assembler_arm.cc b/runtime/vm/assembler_arm.cc
index 30b6123..82e5e5c 100644
--- a/runtime/vm/assembler_arm.cc
+++ b/runtime/vm/assembler_arm.cc
@@ -2482,7 +2482,7 @@
   // Reserve space for arguments and align frame before entering
   // the C++ world.
   AddImmediate(SP, -frame_space);
-  if (OS::ActivationFrameAlignment() > 0) {
+  if (OS::ActivationFrameAlignment() > 1) {
     bic(SP, SP, ShifterOperand(OS::ActivationFrameAlignment() - 1));
   }
 }
@@ -2513,13 +2513,13 @@
   // We need to restore it before restoring registers.
   const intptr_t kPushedRegistersSize =
       kDartVolatileCpuRegCount * kWordSize +
-      kDartVolatileFpuRegCount * 2 * kWordSize;
+      kDartVolatileFpuRegCount * kFpuRegisterSize;
   AddImmediate(SP, FP, -kPushedRegistersSize);
 
   // Restore all volatile FPU registers.
   DRegister firstv = EvenDRegisterOf(kDartFirstVolatileFpuReg);
   DRegister lastv = OddDRegisterOf(kDartLastVolatileFpuReg);
-  if ((lastv - firstv + 1) > 16) {
+  if ((lastv - firstv + 1) >= 16) {
     DRegister mid = static_cast<DRegister>(firstv + 16);
     vldmd(IA_W, SP, firstv, 16);
     vldmd(IA_W, SP, mid, lastv - mid + 1);
diff --git a/runtime/vm/assembler_arm_test.cc b/runtime/vm/assembler_arm_test.cc
index 47f656c..a533cc3 100644
--- a/runtime/vm/assembler_arm_test.cc
+++ b/runtime/vm/assembler_arm_test.cc
@@ -1300,6 +1300,8 @@
 // Make sure we can store the D registers using vstmd and
 // load them into a different set using vldmd
 ASSEMBLER_TEST_GENERATE(VstmdVldmd_off, assembler) {
+  // Save used callee-saved FPU registers.
+  __ vstmd(DB_W, SP, D8, 3);
   __ LoadDImmediate(D0, 0.0, R0);
   __ LoadDImmediate(D1, 1.0, R0);
   __ LoadDImmediate(D2, 2.0, R0);
@@ -1343,6 +1345,8 @@
   __ vmstat();
   __ mov(R0, ShifterOperand(0), NE);  // Put failure into R0 if NE
 
+  // Restore used callee-saved FPU registers.
+  __ vldmd(IA_W, SP, D8, 3);
   __ bx(LR);
 }
 
diff --git a/runtime/vm/assembler_ia32.cc b/runtime/vm/assembler_ia32.cc
index 0ac2354..3b9757c 100644
--- a/runtime/vm/assembler_ia32.cc
+++ b/runtime/vm/assembler_ia32.cc
@@ -2131,7 +2131,7 @@
   // Reserve space for arguments and align frame before entering
   // the C++ world.
   AddImmediate(ESP, Immediate(-frame_space));
-  if (OS::ActivationFrameAlignment() > 0) {
+  if (OS::ActivationFrameAlignment() > 1) {
     andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1)));
   }
 }
diff --git a/runtime/vm/assembler_ia32_test.cc b/runtime/vm/assembler_ia32_test.cc
index 2f3087f..04c2915 100644
--- a/runtime/vm/assembler_ia32_test.cc
+++ b/runtime/vm/assembler_ia32_test.cc
@@ -671,9 +671,8 @@
 
 
 static int ComputeStackSpaceReservation(int needed, int fixed) {
-  static const int kFrameAlignment = OS::ActivationFrameAlignment();
-  return (kFrameAlignment > 0)
-      ? Utils::RoundUp(needed + fixed, kFrameAlignment) - fixed
+  return (OS::ActivationFrameAlignment() > 1)
+      ? Utils::RoundUp(needed + fixed, OS::ActivationFrameAlignment()) - fixed
       : needed;
 }
 
diff --git a/runtime/vm/assembler_mips.cc b/runtime/vm/assembler_mips.cc
index 33ede4c..dccef0a 100644
--- a/runtime/vm/assembler_mips.cc
+++ b/runtime/vm/assembler_mips.cc
@@ -830,7 +830,7 @@
   // Reserve space for arguments and align frame before entering
   // the C++ world.
   AddImmediate(SP, -frame_space);
-  if (OS::ActivationFrameAlignment() > 0) {
+  if (OS::ActivationFrameAlignment() > 1) {
     LoadImmediate(TMP1, ~(OS::ActivationFrameAlignment() - 1));
     and_(SP, SP, TMP1);
   }
diff --git a/runtime/vm/assembler_x64.cc b/runtime/vm/assembler_x64.cc
index 0434aef..7b1315d 100644
--- a/runtime/vm/assembler_x64.cc
+++ b/runtime/vm/assembler_x64.cc
@@ -2302,7 +2302,7 @@
   // Reserve space for arguments and align frame before entering
   // the C++ world.
   AddImmediate(RSP, Immediate(-frame_space));
-  if (OS::ActivationFrameAlignment() > 0) {
+  if (OS::ActivationFrameAlignment() > 1) {
     andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1)));
   }
 }
diff --git a/runtime/vm/assembler_x64_test.cc b/runtime/vm/assembler_x64_test.cc
index a735324..cbad36f 100644
--- a/runtime/vm/assembler_x64_test.cc
+++ b/runtime/vm/assembler_x64_test.cc
@@ -1249,9 +1249,8 @@
 
 
 static int ComputeStackSpaceReservation(int needed, int fixed) {
-  static const int kFrameAlignment = OS::ActivationFrameAlignment();
-  return (kFrameAlignment > 0)
-      ? Utils::RoundUp(needed + fixed, kFrameAlignment) - fixed
+  return (OS::ActivationFrameAlignment() > 1)
+      ? Utils::RoundUp(needed + fixed, OS::ActivationFrameAlignment()) - fixed
       : needed;
 }
 
diff --git a/runtime/vm/bigint_operations.cc b/runtime/vm/bigint_operations.cc
index fc54442..7fba196e 100644
--- a/runtime/vm/bigint_operations.cc
+++ b/runtime/vm/bigint_operations.cc
@@ -1500,13 +1500,26 @@
 
 RawBigint* BigintOperations::MultiplyWithDigit(
     const Bigint& bigint, Chunk digit) {
-  // TODO(floitsch): implement MultiplyWithDigit.
   ASSERT(digit <= kDigitMaxValue);
   if (digit == 0) return Zero();
+  if (bigint.IsZero()) return Zero();
 
-  Bigint& tmp = Bigint::Handle(Bigint::Allocate(1));
-  tmp.SetChunkAt(0, digit);
-  return Multiply(bigint, tmp);
+  intptr_t length = bigint.Length();
+  intptr_t result_length = length + 1;
+  const Bigint& result = Bigint::Handle(Bigint::Allocate(result_length));
+
+  Chunk carry = 0;
+  for (intptr_t i = 0; i < length; i++) {
+    Chunk chunk = bigint.GetChunkAt(i);
+    DoubleChunk product = (static_cast<DoubleChunk>(chunk) * digit) + carry;
+    result.SetChunkAt(i, static_cast<Chunk>(product & kDigitMask));
+    carry = static_cast<Chunk>(product >> kDigitBitSize);
+  }
+  result.SetChunkAt(length, carry);
+
+  result.SetSign(bigint.IsNegative());
+  Clamp(result);
+  return result.raw();
 }
 
 
diff --git a/runtime/vm/bootstrap_natives.h b/runtime/vm/bootstrap_natives.h
index 1df9edf..8d807f4 100644
--- a/runtime/vm/bootstrap_natives.h
+++ b/runtime/vm/bootstrap_natives.h
@@ -253,11 +253,12 @@
   V(Mirrors_makeLocalTypeMirror, 1)                                            \
   V(Mirrors_makeLocalMirrorSystem, 0)                                          \
   V(MirrorReference_equals, 2)                                                 \
-  V(InstanceMirror_invoke, 4)                                                  \
+  V(InstanceMirror_identityHash, 1)                                            \
+  V(InstanceMirror_invoke, 5)                                                  \
   V(InstanceMirror_invokeGetter, 3)                                            \
   V(InstanceMirror_invokeSetter, 4)                                            \
   V(ClosureMirror_function, 1)                                                 \
-  V(ClosureMirror_apply, 2)                                                    \
+  V(ClosureMirror_apply, 3)                                                    \
   V(ClassMirror_name, 1)                                                       \
   V(ClassMirror_library, 1)                                                    \
   V(ClassMirror_supertype, 1)                                                  \
@@ -266,13 +267,13 @@
   V(ClassMirror_members, 2)                                                    \
   V(ClassMirror_constructors, 2)                                               \
   V(LibraryMirror_members, 2)                                                  \
-  V(ClassMirror_invoke, 4)                                                     \
+  V(ClassMirror_invoke, 5)                                                     \
   V(ClassMirror_invokeGetter, 3)                                               \
   V(ClassMirror_invokeSetter, 4)                                               \
-  V(ClassMirror_invokeConstructor, 3)                                          \
+  V(ClassMirror_invokeConstructor, 4)                                          \
   V(ClassMirror_type_variables, 1)                                             \
   V(ClassMirror_type_arguments, 1)                                             \
-  V(LibraryMirror_invoke, 4)                                                   \
+  V(LibraryMirror_invoke, 5)                                                   \
   V(LibraryMirror_invokeGetter, 3)                                             \
   V(LibraryMirror_invokeSetter, 4)                                             \
   V(TypeVariableMirror_owner, 1)                                               \
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index cc07f5a..7b216f2 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -511,6 +511,10 @@
 
 
 void ClassFinalizer::FinalizeTypeParameters(const Class& cls) {
+  if (cls.IsMixinApplication()) {
+    // Copy the type parameters to the mixin application.
+    ApplyMixinType(cls);
+  }
   // The type parameter bounds are not finalized here.
   const TypeArguments& type_parameters =
       TypeArguments::Handle(cls.type_parameters());
@@ -1310,14 +1314,14 @@
 // mixin application class. Change type arguments of super type and of
 // interfaces to refer to the respective type parameters of the mixin
 // application class.
-void ClassFinalizer::CloneTypeParameters(const Class& mixapp_class) {
-  ASSERT(mixapp_class.NumTypeParameters() == 0);
+void ClassFinalizer::CloneTypeParameters(const Class& mixin_app_class) {
+  ASSERT(mixin_app_class.type_parameters() == AbstractTypeArguments::null());
 
   const AbstractType& super_type =
-      AbstractType::Handle(mixapp_class.super_type());
+      AbstractType::Handle(mixin_app_class.super_type());
   ASSERT(super_type.IsResolved());
   const Class& super_class = Class::Handle(super_type.type_class());
-  const Type& mixin_type = Type::Handle(mixapp_class.mixin());
+  const Type& mixin_type = Type::Handle(mixin_app_class.mixin());
   const Class& mixin_class = Class::Handle(mixin_type.type_class());
   const int num_super_parameters = super_class.NumTypeParameters();
   const int num_mixin_parameters = mixin_class.NumTypeParameters();
@@ -1346,7 +1350,7 @@
       param_bound = param.bound();
       // TODO(hausner): handle type bounds.
       if (!param_bound.IsObjectType()) {
-        const Script& script = Script::Handle(mixapp_class.script());
+        const Script& script = Script::Handle(mixin_app_class.script());
         ReportError(Error::Handle(),  // No previous error.
                     script, param.token_pos(),
                     "type parameter '%s': type bounds not yet"
@@ -1355,7 +1359,7 @@
       }
       param_name = String::Concat(param_name, Symbols::Backtick());
       param_name = Symbols::New(param_name);
-      cloned_param = TypeParameter::New(mixapp_class,
+      cloned_param = TypeParameter::New(mixin_app_class,
                                         cloned_index,
                                         param_name,
                                         param_bound,
@@ -1389,14 +1393,14 @@
 
       // TODO(hausner): handle type bounds.
       if (!param_bound.IsObjectType()) {
-        const Script& script = Script::Handle(mixapp_class.script());
+        const Script& script = Script::Handle(mixin_app_class.script());
         ReportError(Error::Handle(),  // No previous error.
                     script, param.token_pos(),
                     "type parameter '%s': type bounds not yet"
                     " implemented for mixins\n",
                     param_name.ToCString());
       }
-      cloned_param = TypeParameter::New(mixapp_class,
+      cloned_param = TypeParameter::New(mixin_app_class,
                                         cloned_index,
                                         param_name,
                                         param_bound,
@@ -1408,7 +1412,7 @@
 
     // Lastly, change the type arguments of the single interface type to
     // refer to the cloned type parameters of the mixin application class.
-    Array& interface_types = Array::Handle(mixapp_class.interfaces());
+    Array& interface_types = Array::Handle(mixin_app_class.interfaces());
     ASSERT(interface_types.Length() == 1);
     AbstractType& interface_type = AbstractType::Handle();
     interface_type ^= interface_types.At(0);
@@ -1418,21 +1422,24 @@
     Type::Cast(interface_type).set_arguments(interface_type_args);
     ASSERT(!interface_type.IsFinalized());
   }
-  mixapp_class.set_type_parameters(cloned_type_params);
+  mixin_app_class.set_type_parameters(cloned_type_params);
 }
 
 
-void ClassFinalizer::ApplyMixinTypes(const Class& cls) {
-  const Type& mixin_type = Type::Handle(cls.mixin());
+void ClassFinalizer::ApplyMixinType(const Class& mixin_app_class) {
+  if (mixin_app_class.is_mixin_type_applied()) {
+    return;
+  }
+  const Type& mixin_type = Type::Handle(mixin_app_class.mixin());
   ASSERT(!mixin_type.IsNull());
   ASSERT(mixin_type.HasResolvedTypeClass());
   const Class& mixin_cls = Class::Handle(mixin_type.type_class());
 
   if (FLAG_trace_class_finalization) {
-    OS::Print("Applying mixin type '%s' to '%s' at pos %" Pd "\n",
+    OS::Print("Applying mixin type '%s' to %s at pos %" Pd "\n",
               String::Handle(mixin_type.Name()).ToCString(),
-              cls.ToCString(),
-              cls.token_pos());
+              mixin_app_class.ToCString(),
+              mixin_app_class.token_pos());
   }
 
   // Check that the super class of the mixin class is extending
@@ -1440,24 +1447,26 @@
   const AbstractType& mixin_super_type =
       AbstractType::Handle(mixin_cls.super_type());
   if (!mixin_super_type.IsObjectType()) {
-    const Script& script = Script::Handle(cls.script());
+    const Script& script = Script::Handle(mixin_app_class.script());
     const String& class_name = String::Handle(mixin_cls.Name());
     ReportError(Error::Handle(),  // No previous error.
-                script, cls.token_pos(),
-                "mixin class %s must extend class Object",
+                script, mixin_app_class.token_pos(),
+                "mixin class '%s' must extend class Object",
                 class_name.ToCString());
   }
 
   // Copy type parameters to mixin application class.
-  CloneTypeParameters(cls);
+  CloneTypeParameters(mixin_app_class);
 
   if (FLAG_trace_class_finalization) {
-    OS::Print("Done applying mixin type '%s' to class %s %s extending '%s'\n",
+    OS::Print("Done applying mixin type '%s' to class '%s' %s extending '%s'\n",
               String::Handle(mixin_type.Name()).ToCString(),
-              String::Handle(cls.Name()).ToCString(),
-              TypeArguments::Handle(cls.type_parameters()).ToCString(),
-              AbstractType::Handle(cls.super_type()).ToCString());
+              String::Handle(mixin_app_class.Name()).ToCString(),
+              TypeArguments::Handle(
+                  mixin_app_class.type_parameters()).ToCString(),
+              AbstractType::Handle(mixin_app_class.super_type()).ToCString());
   }
+  mixin_app_class.set_is_mixin_type_applied();
 }
 
 
@@ -1514,7 +1523,7 @@
 }
 
 
-void ClassFinalizer::ApplyMixin(const Class& cls) {
+void ClassFinalizer::ApplyMixinMembers(const Class& cls) {
   Isolate* isolate = Isolate::Current();
   const Type& mixin_type = Type::Handle(isolate, cls.mixin());
   ASSERT(!mixin_type.IsNull());
@@ -1523,8 +1532,8 @@
   mixin_cls.EnsureIsFinalized(isolate);
 
   if (FLAG_trace_class_finalization) {
-    OS::Print("Applying mixin '%s' to '%s' at pos %" Pd "\n",
-              String::Handle(mixin_cls.Name()).ToCString(),
+    OS::Print("Applying mixin members of %s to %s at pos %" Pd "\n",
+              mixin_cls.ToCString(),
               cls.ToCString(),
               cls.token_pos());
   }
@@ -1549,7 +1558,7 @@
         const Script& script = Script::Handle(isolate, cls.script());
         ReportError(Error::Handle(),  // No previous error.
                     script, cls.token_pos(),
-                    "mixin class %s must not have constructors\n",
+                    "mixin class '%s' must not have constructors\n",
                     String::Handle(isolate, mixin_cls.Name()).ToCString());
       }
       continue;  // Skip the implicit constructor.
@@ -1581,10 +1590,9 @@
   cls.SetFields(fields);
 
   if (FLAG_trace_class_finalization) {
-    OS::Print("done mixin appl '%s' '%s' extending '%s'\n",
-              String::Handle(cls.Name()).ToCString(),
-              TypeArguments::Handle(cls.type_parameters()).ToCString(),
-              AbstractType::Handle(cls.super_type()).ToCString());
+    OS::Print("done applying mixin members of %s to %s\n",
+              mixin_cls.ToCString(),
+              cls.ToCString());
   }
 }
 
@@ -1610,10 +1618,6 @@
   if (!super_class.IsNull()) {
     FinalizeTypesInClass(super_class);
   }
-  if (cls.mixin() != Type::null()) {
-    // Copy the type parameters to the mixin application.
-    ApplyMixinTypes(cls);
-  }
   // Finalize type parameters before finalizing the super type.
   FinalizeTypeParameters(cls);
   ResolveUpperBounds(cls);
@@ -1724,11 +1728,11 @@
   if (FLAG_trace_class_finalization) {
     OS::Print("Finalize %s\n", cls.ToCString());
   }
-  if (cls.mixin() != Type::null()) {
+  if (cls.IsMixinApplication()) {
     // Copy instance methods and fields from the mixin class.
     // This has to happen before the check whether the methods of
     // the class conflict with inherited methods.
-    ApplyMixin(cls);
+    ApplyMixinMembers(cls);
   }
   // Ensure super class is finalized.
   const Class& super = Class::Handle(cls.SuperClass());
@@ -1860,6 +1864,7 @@
     if (num_type_arguments != num_type_parameters) {
       const Script& script = Script::Handle(cls.script());
       const String& type_class_name = String::Handle(type_class.Name());
+      // TODO(regis): This should not be a compile time error anymore.
       ReportError(Error::Handle(),  // No previous error.
                   script, type.token_pos(),
                   "wrong number of type arguments for class '%s'",
diff --git a/runtime/vm/class_finalizer.h b/runtime/vm/class_finalizer.h
index cb9df49..5221a2a 100644
--- a/runtime/vm/class_finalizer.h
+++ b/runtime/vm/class_finalizer.h
@@ -93,6 +93,9 @@
   static void ResolveRedirectingFactory(const Class& cls,
                                         const Function& factory);
 
+  // Apply the mixin type to the mixin application class.
+  static void ApplyMixinType(const Class& mixin_app_class);
+
  private:
   static bool IsSuperCycleFree(const Class& cls);
   static bool IsParameterTypeCycleFree(const Class& cls,
@@ -108,9 +111,8 @@
       const Class& cls,
       const Function& factory,
       const GrowableObjectArray& visited_factories);
-  static void CloneTypeParameters(const Class& mixapp_class);
-  static void ApplyMixinTypes(const Class& cls);
-  static void ApplyMixin(const Class& cls);
+  static void CloneTypeParameters(const Class& mixin_app_class);
+  static void ApplyMixinMembers(const Class& cls);
   static void CreateForwardingConstructors(
       const Class& mixin_app,
       const GrowableObjectArray& cloned_funcs);
diff --git a/runtime/vm/constants_arm.h b/runtime/vm/constants_arm.h
index 63a88e9..c1baf8d 100644
--- a/runtime/vm/constants_arm.h
+++ b/runtime/vm/constants_arm.h
@@ -221,8 +221,8 @@
     (1 << R8) | (1 << R9) | (1 << R10);
 const int kAbiPreservedCpuRegCount = 7;
 const QRegister kAbiFirstPreservedFpuReg = Q4;
-const QRegister kAbiLastPreservedFpuReg =
-    static_cast<QRegister>(kNumberOfQRegisters - 1);
+const QRegister kAbiLastPreservedFpuReg = Q7;
+const int kAbiPreservedFpuRegCount = 4;
 
 // CPU registers available to Dart allocator.
 const RegList kDartAvailableCpuRegs =
diff --git a/runtime/vm/constants_mips.h b/runtime/vm/constants_mips.h
index 7c2e59b..eb17c1f 100644
--- a/runtime/vm/constants_mips.h
+++ b/runtime/vm/constants_mips.h
@@ -216,6 +216,7 @@
 const FRegister kAbiFirstPreservedFpuReg = F20;
 const FRegister kAbiLastPreservedFpuReg =
     static_cast<FRegister>(kNumberOfFRegisters - 1);
+const int kAbiPreservedFpuRegCount = 12;
 
 // CPU registers available to Dart allocator.
 const RegList kDartAvailableCpuRegs =
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 3e23ce47..350efa0 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -38,6 +38,8 @@
 
 DECLARE_FLAG(bool, print_class_table);
 DECLARE_FLAG(bool, verify_handles);
+DEFINE_FLAG(bool, trace_api, false,
+            "Trace invocation of API calls (debug mode only)");
 
 ThreadLocalKey Api::api_native_key_ = Thread::kUnsetThreadLocalKey;
 Dart_Handle Api::true_handle_ = NULL;
@@ -279,26 +281,31 @@
 // --- Handles ---
 
 DART_EXPORT bool Dart_IsError(Dart_Handle handle) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return RawObject::IsErrorClassId(Api::ClassId(handle));
 }
 
 
 DART_EXPORT bool Dart_IsApiError(Dart_Handle object) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return Api::ClassId(object) == kApiErrorCid;
 }
 
 
 DART_EXPORT bool Dart_IsUnhandledExceptionError(Dart_Handle object) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return Api::ClassId(object) == kUnhandledExceptionCid;
 }
 
 
 DART_EXPORT bool Dart_IsCompilationError(Dart_Handle object) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return Api::ClassId(object) == kLanguageErrorCid;
 }
 
 
 DART_EXPORT bool Dart_IsFatalError(Dart_Handle object) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return Api::ClassId(object) == kUnwindErrorCid;
 }
 
@@ -793,6 +800,7 @@
                                             const uint8_t* snapshot,
                                             void* callback_data,
                                             char** error) {
+  TRACE_API_CALL(CURRENT_FUNC);
   char* isolate_name = BuildIsolateName(script_uri, main);
   Isolate* isolate = Dart::CreateIsolate(isolate_name);
   free(isolate_name);
@@ -921,6 +929,7 @@
 
 
 DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) {
+  TRACE_API_CALL(CURRENT_FUNC);
   if (isolate == NULL) {
     FATAL1("%s expects argument 'isolate' to be non-null.",  CURRENT_FUNC);
   }
@@ -1230,42 +1239,50 @@
 
 
 DART_EXPORT bool Dart_IsNumber(Dart_Handle object) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return RawObject::IsNumberClassId(Api::ClassId(object));
 }
 
 
 DART_EXPORT bool Dart_IsInteger(Dart_Handle object) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return RawObject::IsIntegerClassId(Api::ClassId(object));
 }
 
 
 DART_EXPORT bool Dart_IsDouble(Dart_Handle object) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return Api::ClassId(object) == kDoubleCid;
 }
 
 
 DART_EXPORT bool Dart_IsBoolean(Dart_Handle object) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return Api::ClassId(object) == kBoolCid;
 }
 
 
 DART_EXPORT bool Dart_IsString(Dart_Handle object) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return RawObject::IsStringClassId(Api::ClassId(object));
 }
 
 
 DART_EXPORT bool Dart_IsStringLatin1(Dart_Handle object) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return RawObject::IsOneByteStringClassId(Api::ClassId(object));
 }
 
 
 DART_EXPORT bool Dart_IsExternalString(Dart_Handle object) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return RawObject::IsExternalStringClassId(Api::ClassId(object));
 }
 
 
 DART_EXPORT bool Dart_IsList(Dart_Handle object) {
   if (RawObject::IsBuiltinListClassId(Api::ClassId(object))) {
+    TRACE_API_CALL(CURRENT_FUNC);
     return true;
   }
 
@@ -1277,11 +1294,13 @@
 
 
 DART_EXPORT bool Dart_IsLibrary(Dart_Handle object) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return Api::ClassId(object) == kLibraryCid;
 }
 
 
 DART_EXPORT bool Dart_IsType(Dart_Handle handle) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return Api::ClassId(handle) == kTypeCid;
 }
 
@@ -1295,16 +1314,19 @@
 
 
 DART_EXPORT bool Dart_IsFunction(Dart_Handle handle) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return Api::ClassId(handle) == kFunctionCid;
 }
 
 
 DART_EXPORT bool Dart_IsVariable(Dart_Handle handle) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return Api::ClassId(handle) == kFieldCid;
 }
 
 
 DART_EXPORT bool Dart_IsTypeVariable(Dart_Handle handle) {
+  TRACE_API_CALL(CURRENT_FUNC);
   return Api::ClassId(handle) == kTypeParameterCid;
 }
 
@@ -2437,6 +2459,7 @@
 
 
 DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfTypedData(Dart_Handle object) {
+  TRACE_API_CALL(CURRENT_FUNC);
   intptr_t class_id = Api::ClassId(object);
   if (RawObject::IsTypedDataClassId(class_id) ||
       RawObject::IsTypedDataViewClassId(class_id)) {
@@ -2448,6 +2471,7 @@
 
 DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfExternalTypedData(
     Dart_Handle object) {
+  TRACE_API_CALL(CURRENT_FUNC);
   intptr_t class_id = Api::ClassId(object);
   if (RawObject::IsExternalTypedDataClassId(class_id) ||
       RawObject::IsTypedDataViewClassId(class_id)) {
@@ -3589,6 +3613,7 @@
 
 DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args,
                                                int index) {
+  TRACE_API_CALL(CURRENT_FUNC);
   NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
   if ((index < 0) || (index >= arguments->NativeArgCount())) {
     return Api::NewError(
@@ -3600,6 +3625,7 @@
 
 
 DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args) {
+  TRACE_API_CALL(CURRENT_FUNC);
   NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
   return arguments->NativeArgCount();
 }
@@ -3692,6 +3718,7 @@
 DART_EXPORT Dart_Handle Dart_GetNativeIntegerArgument(Dart_NativeArguments args,
                                                       int index,
                                                       int64_t* value) {
+  TRACE_API_CALL(CURRENT_FUNC);
   NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
   if ((index < 0) || (index >= arguments->NativeArgCount())) {
     return Api::NewError(
@@ -3730,6 +3757,7 @@
 DART_EXPORT Dart_Handle Dart_GetNativeBooleanArgument(Dart_NativeArguments args,
                                                       int index,
                                                       bool* value) {
+  TRACE_API_CALL(CURRENT_FUNC);
   NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
   if ((index < 0) || (index >= arguments->NativeArgCount())) {
     return Api::NewError(
@@ -3758,6 +3786,7 @@
 DART_EXPORT Dart_Handle Dart_GetNativeDoubleArgument(Dart_NativeArguments args,
                                                      int index,
                                                      double* value) {
+  TRACE_API_CALL(CURRENT_FUNC);
   NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
   if ((index < 0) || (index >= arguments->NativeArgCount())) {
     return Api::NewError(
@@ -3820,6 +3849,7 @@
 
 DART_EXPORT void Dart_SetBooleanReturnValue(Dart_NativeArguments args,
                                             bool retval) {
+  TRACE_API_CALL(CURRENT_FUNC);
   NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
   arguments->SetReturn(Bool::Get(retval));
 }
diff --git a/runtime/vm/dart_api_impl.h b/runtime/vm/dart_api_impl.h
index 6c05c98..7a86b6c 100644
--- a/runtime/vm/dart_api_impl.h
+++ b/runtime/vm/dart_api_impl.h
@@ -11,6 +11,8 @@
 
 namespace dart {
 
+DECLARE_FLAG(bool, trace_api);
+
 class ApiLocalScope;
 class ApiState;
 class FinalizablePersistentHandle;
@@ -21,9 +23,20 @@
 
 #define CURRENT_FUNC CanonicalFunction(__FUNCTION__)
 
+#if defined(DEBUG)
+#define TRACE_API_CALL(name)                                                   \
+  if (FLAG_trace_api) {                                                        \
+    OS::Print("Calling API func: %s\n", name);                                 \
+  }
+#else
+#define TRACE_API_CALL(name)
+#endif
+
+
 // Checks that the current isolate is not NULL.
 #define CHECK_ISOLATE(isolate)                                                 \
   do {                                                                         \
+    TRACE_API_CALL(CURRENT_FUNC);                                              \
     if ((isolate) == NULL) {                                                   \
       FATAL1("%s expects there to be a current isolate. Did you "              \
              "forget to call Dart_CreateIsolate or Dart_EnterIsolate?",        \
@@ -34,6 +47,7 @@
 // Checks that the current isolate is NULL.
 #define CHECK_NO_ISOLATE(isolate)                                              \
   do {                                                                         \
+    TRACE_API_CALL(CURRENT_FUNC);                                              \
     if ((isolate) != NULL) {                                                   \
       FATAL1("%s expects there to be no current isolate. Did you "             \
              "forget to call Dart_ExitIsolate?", CURRENT_FUNC);                \
diff --git a/runtime/vm/dart_entry.cc b/runtime/vm/dart_entry.cc
index b6ba0726..2c018c8 100644
--- a/runtime/vm/dart_entry.cc
+++ b/runtime/vm/dart_entry.cc
@@ -152,61 +152,6 @@
 }
 
 
-RawObject* DartEntry::InvokeConstructor(const Class& klass,
-                                        const Function& constructor,
-                                        const Array& arguments) {
-  Class& ultimate_klass = Class::Handle(klass.raw());
-  Function& ultimate_constructor = Function::Handle(constructor.raw());
-
-  Instance& new_object = Instance::Handle();
-  if (ultimate_constructor.IsRedirectingFactory()) {
-    ClassFinalizer::ResolveRedirectingFactory(klass, ultimate_constructor);
-    Type& type = Type::Handle(ultimate_constructor.RedirectionType());
-    ultimate_constructor = ultimate_constructor.RedirectionTarget();
-    ASSERT(!ultimate_constructor.IsNull());
-    ultimate_klass = type.type_class();
-  }
-  if (ultimate_constructor.IsConstructor()) {
-    // "Constructors" are really instance initializers. They are passed a newly
-    // allocated object as an extra argument.
-    new_object = Instance::New(ultimate_klass);
-  }
-
-  // Create the argument list.
-  intptr_t number_of_arguments = arguments.Length();
-  intptr_t arg_index = 0;
-  int extra_args = (ultimate_constructor.IsConstructor() ? 2 : 1);
-  const Array& args =
-      Array::Handle(Array::New(number_of_arguments + extra_args));
-  if (ultimate_constructor.IsConstructor()) {
-    // Constructors get the uninitialized object and a constructor phase.
-    args.SetAt(arg_index++, new_object);
-    args.SetAt(arg_index++,
-               Smi::Handle(Smi::New(Function::kCtorPhaseAll)));
-  } else {
-    // Factories get type arguments.
-    args.SetAt(arg_index++, TypeArguments::Handle());
-  }
-  Object& argument = Object::Handle();
-  for (int i = 0; i < number_of_arguments; i++) {
-    argument = (arguments.At(i));
-    args.SetAt(arg_index++, argument);
-  }
-
-  // Invoke the constructor and return the new object.
-  const Object& result =
-      Object::Handle(DartEntry::InvokeFunction(ultimate_constructor, args));
-  if (result.IsError()) {
-    return result.raw();
-  }
-  if (ultimate_constructor.IsConstructor()) {
-    return new_object.raw();
-  } else {
-    return result.raw();
-  }
-}
-
-
 ArgumentsDescriptor::ArgumentsDescriptor(const Array& array)
     : array_(array) {
 }
diff --git a/runtime/vm/dart_entry.h b/runtime/vm/dart_entry.h
index 9bce13e..5b3a851 100644
--- a/runtime/vm/dart_entry.h
+++ b/runtime/vm/dart_entry.h
@@ -142,13 +142,6 @@
                                        const String& target_name,
                                        const Array& arguments,
                                        const Array& arguments_descriptor);
-
-  // Invokes a generative constructor, redirecting constructor, factory or
-  // redirecting factory. On success, returns a RawInstance. On failure,
-  // a RawError.
-  static RawObject* InvokeConstructor(const Class& klass,
-                                      const Function &constructor,
-                                      const Array& arguments);
 };
 
 
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index 3c6e44e..68c2654 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -44,8 +44,7 @@
   StacktraceBuilder() { }
   virtual ~StacktraceBuilder() { }
 
-  virtual void AddFrame(const Function& func,
-                        const Code& code,
+  virtual void AddFrame(const Code& code,
                         const Smi& offset,
                         bool is_catch_frame) = 0;
 
@@ -56,14 +55,9 @@
 class RegularStacktraceBuilder : public StacktraceBuilder {
  public:
   explicit RegularStacktraceBuilder(bool full_stacktrace)
-      : func_list_(GrowableObjectArray::Handle(GrowableObjectArray::New())),
-        code_list_(GrowableObjectArray::Handle(GrowableObjectArray::New())),
+      : code_list_(GrowableObjectArray::Handle(GrowableObjectArray::New())),
         pc_offset_list_(
             GrowableObjectArray::Handle(GrowableObjectArray::New())),
-        catch_func_list_(
-            full_stacktrace ?
-                GrowableObjectArray::Handle(GrowableObjectArray::New()) :
-                GrowableObjectArray::Handle()),
         catch_code_list_(
             full_stacktrace ?
                 GrowableObjectArray::Handle(GrowableObjectArray::New()) :
@@ -75,12 +69,8 @@
         full_stacktrace_(full_stacktrace) { }
   ~RegularStacktraceBuilder() { }
 
-  const GrowableObjectArray& func_list() const { return func_list_; }
   const GrowableObjectArray& code_list() const { return code_list_; }
   const GrowableObjectArray& pc_offset_list() const { return pc_offset_list_; }
-  const GrowableObjectArray& catch_func_list() const {
-    return catch_func_list_;
-  }
   const GrowableObjectArray& catch_code_list() const {
     return catch_code_list_;
   }
@@ -89,26 +79,21 @@
   }
   virtual bool FullStacktrace() const { return full_stacktrace_; }
 
-  virtual void AddFrame(const Function& func,
-                        const Code& code,
+  virtual void AddFrame(const Code& code,
                         const Smi& offset,
                         bool is_catch_frame) {
     if (is_catch_frame) {
-      catch_func_list_.Add(func);
       catch_code_list_.Add(code);
       catch_pc_offset_list_.Add(offset);
     } else {
-      func_list_.Add(func);
       code_list_.Add(code);
       pc_offset_list_.Add(offset);
     }
   }
 
  private:
-  const GrowableObjectArray& func_list_;
   const GrowableObjectArray& code_list_;
   const GrowableObjectArray& pc_offset_list_;
-  const GrowableObjectArray& catch_func_list_;
   const GrowableObjectArray& catch_code_list_;
   const GrowableObjectArray& catch_pc_offset_list_;
   bool full_stacktrace_;
@@ -127,8 +112,7 @@
   }
   ~PreallocatedStacktraceBuilder() { }
 
-  virtual void AddFrame(const Function& func,
-                        const Code& code,
+  virtual void AddFrame(const Code& code,
                         const Smi& offset,
                         bool is_catch_frame);
 
@@ -144,13 +128,11 @@
 };
 
 
-void PreallocatedStacktraceBuilder::AddFrame(const Function& func,
-                                             const Code& code,
+void PreallocatedStacktraceBuilder::AddFrame(const Code& code,
                                              const Smi& offset,
                                              bool is_catch_frame) {
   if (cur_index_ >= Stacktrace::kPreallocatedStackdepth) {
     // The number of frames is overflowing the preallocated stack trace object.
-    Function& frame_func = Function::Handle();
     Code& frame_code = Code::Handle();
     Smi& frame_offset = Smi::Handle();
     intptr_t start = Stacktrace::kPreallocatedStackdepth - (kNumTopframes - 1);
@@ -158,41 +140,28 @@
     // Add an empty slot to indicate the overflow so that the toString
     // method can account for the overflow.
     if (stacktrace_.FunctionAtFrame(null_slot) != Function::null()) {
-      stacktrace_.SetFunctionAtFrame(null_slot, frame_func);
       stacktrace_.SetCodeAtFrame(null_slot, frame_code);
     }
     // Move frames one slot down so that we can accomodate the new frame.
     for (intptr_t i = start; i < Stacktrace::kPreallocatedStackdepth; i++) {
       intptr_t prev = (i - 1);
-      frame_func = stacktrace_.FunctionAtFrame(i);
       frame_code = stacktrace_.CodeAtFrame(i);
       frame_offset = stacktrace_.PcOffsetAtFrame(i);
-      stacktrace_.SetFunctionAtFrame(prev, frame_func);
       stacktrace_.SetCodeAtFrame(prev, frame_code);
       stacktrace_.SetPcOffsetAtFrame(prev, frame_offset);
     }
     cur_index_ = (Stacktrace::kPreallocatedStackdepth - 1);
   }
-  stacktrace_.SetFunctionAtFrame(cur_index_, func);
   stacktrace_.SetCodeAtFrame(cur_index_, code);
   stacktrace_.SetPcOffsetAtFrame(cur_index_, offset);
   cur_index_ += 1;
 }
 
 
-static bool ShouldShowFunction(const Function& function) {
-  if (FLAG_verbose_stacktrace) {
-    return true;
-  }
-  return function.is_visible();
-}
-
-
 static void BuildStackTrace(StacktraceBuilder* builder) {
   StackFrameIterator frames(StackFrameIterator::kDontValidateFrames);
   StackFrame* frame = frames.NextFrame();
   ASSERT(frame != NULL);  // We expect to find a dart invocation frame.
-  Function& func = Function::Handle();
   Code& code = Code::Handle();
   Smi& offset = Smi::Handle();
   bool dart_handler_found = false;
@@ -201,28 +170,8 @@
     while (!frame->IsEntryFrame()) {
       if (frame->IsDartFrame()) {
         code = frame->LookupDartCode();
-        if (code.is_optimized()) {
-          // For optimized frames, extract all the inlined functions if any
-          // into the stack trace.
-          for (InlinedFunctionsIterator it(frame); !it.Done(); it.Advance()) {
-            func = it.function();
-            code = it.code();
-            uword pc = it.pc();
-            ASSERT(pc != 0);
-            ASSERT(code.EntryPoint() <= pc);
-            ASSERT(pc < (code.EntryPoint() + code.Size()));
-            if (ShouldShowFunction(func)) {
-              offset = Smi::New(pc - code.EntryPoint());
-              builder->AddFrame(func, code, offset, dart_handler_found);
-            }
-          }
-        } else {
-          offset = Smi::New(frame->pc() - code.EntryPoint());
-          func = code.function();
-          if (ShouldShowFunction(func)) {
-            builder->AddFrame(func, code, offset, dart_handler_found);
-          }
-        }
+        offset = Smi::New(frame->pc() - code.EntryPoint());
+        builder->AddFrame(code, offset, dart_handler_found);
         bool needs_stacktrace = false;
         bool is_catch_all = false;
         uword handler_pc = kUwordMax;
@@ -431,7 +380,6 @@
                                           &handler_sp,
                                           &handler_fp,
                                           &handler_needs_stacktrace);
-    Array& func_array = Array::Handle(isolate, Object::empty_array().raw());
     Array& code_array = Array::Handle(isolate, Object::empty_array().raw());
     Array& pc_offset_array =
         Array::Handle(isolate, Object::empty_array().raw());
@@ -440,22 +388,18 @@
       BuildStackTrace(&frame_builder);
 
       // Create arrays for function, code and pc_offset triplet of each frame.
-      func_array = Array::MakeArray(frame_builder.func_list());
       code_array = Array::MakeArray(frame_builder.code_list());
       pc_offset_array = Array::MakeArray(frame_builder.pc_offset_list());
       if (!stacktrace_field.IsNull()) {
         // This is an error object and we need to capture the full stack trace
         // here implicitly, so we set up the stack trace. The stack trace field
         // is set only once, it is not overriden.
-        const Array& catch_func_array = Array::Handle(isolate,
-            Array::MakeArray(frame_builder.catch_func_list()));
         const Array& catch_code_array = Array::Handle(isolate,
             Array::MakeArray(frame_builder.catch_code_list()));
         const Array& catch_pc_offset_array = Array::Handle(isolate,
             Array::MakeArray(frame_builder.catch_pc_offset_list()));
-        stacktrace = Stacktrace::New(func_array, code_array, pc_offset_array);
-        stacktrace.SetCatchStacktrace(catch_func_array,
-                                      catch_code_array,
+        stacktrace = Stacktrace::New(code_array, pc_offset_array);
+        stacktrace.SetCatchStacktrace(catch_code_array,
                                       catch_pc_offset_array);
         if (exception.GetField(stacktrace_field) == Object::null()) {
           exception.SetField(stacktrace_field, stacktrace);
@@ -463,17 +407,16 @@
       }  // if stacktrace needed.
     }
     if (existing_stacktrace.IsNull()) {
-      stacktrace = Stacktrace::New(func_array, code_array, pc_offset_array);
+      stacktrace = Stacktrace::New(code_array, pc_offset_array);
     } else {
       stacktrace ^= existing_stacktrace.raw();
       if (pc_offset_array.Length() != 0) {
-        stacktrace.Append(func_array, code_array, pc_offset_array);
+        stacktrace.Append(code_array, pc_offset_array);
       }
       // Since we are re throwing and appending to the existing stack trace
       // we clear out the catch trace collected in the existing stack trace
       // as that trace will not be valid anymore.
       stacktrace.SetCatchStacktrace(Object::empty_array(),
-                                    Object::empty_array(),
                                     Object::empty_array());
     }
   }
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index 7033250..46f98b3 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -686,7 +686,7 @@
 
 
 void TestGraphVisitor::MergeBranchWithComparison(ComparisonInstr* comp) {
-  ControlInstruction* branch;
+  BranchInstr* branch;
   if (Token::IsStrictEqualityOperator(comp->kind())) {
     branch = new BranchInstr(new StrictCompareInstr(comp->token_pos(),
                                                     comp->kind(),
@@ -1420,17 +1420,30 @@
     return;
   }
 
+  ZoneGrowableArray<PushArgumentInstr*>* arguments =
+      new ZoneGrowableArray<PushArgumentInstr*>(2);
+
   ValueGraphVisitor for_left_value(owner(), temp_index());
   node->left()->Visit(&for_left_value);
   Append(for_left_value);
+  PushArgumentInstr* push_left = PushArgument(for_left_value.value());
+  arguments->Add(push_left);
+
   ValueGraphVisitor for_right_value(owner(), temp_index());
   node->right()->Visit(&for_right_value);
   Append(for_right_value);
-  RelationalOpInstr* comp = new RelationalOpInstr(node->token_pos(),
-                                                  node->kind(),
-                                                  for_left_value.value(),
-                                                  for_right_value.value(),
-                                                  owner()->ic_data_array());
+  PushArgumentInstr* push_right = PushArgument(for_right_value.value());
+  arguments->Add(push_right);
+
+  ASSERT(Token::IsRelationalOperator(node->kind()));
+  InstanceCallInstr* comp =
+      new InstanceCallInstr(node->token_pos(),
+                            String::ZoneHandle(Symbols::New(node->Name())),
+                            node->kind(),
+                            arguments,
+                            Object::null_array(),
+                            2,
+                            owner()->ic_data_array());
   ReturnDefinition(comp);
 }
 
@@ -1460,8 +1473,7 @@
   arguments->Add(push_value);
   InstanceCallInstr* call =
       new InstanceCallInstr(node->token_pos(),
-                            String::ZoneHandle(
-                                Symbols::New(Token::Str(node->kind()))),
+                            String::ZoneHandle(Symbols::New(node->Name())),
                             node->kind(),
                             arguments,
                             Object::null_array(),
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index 8c305d0..834d0ef 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -128,9 +128,6 @@
         if (current->IsInstanceCall()) {
           ic_data = current->AsInstanceCall()->ic_data();
           ASSERT(ic_data != NULL);
-        } else if (current->IsRelationalOp()) {
-          ic_data = current->AsRelationalOp()->ic_data();
-          ASSERT(ic_data != NULL);
         } else if (current->IsEqualityCompare()) {
           ic_data = current->AsEqualityCompare()->ic_data();
           ASSERT(ic_data != NULL);
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index 05cb407..41385e4 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -1077,6 +1077,66 @@
 }
 
 
+static bool SmiFitsInDouble() { return kSmiBits < 53; }
+
+
+bool FlowGraphOptimizer::TryReplaceWithRelationalOp(InstanceCallInstr* call,
+                                                    Token::Kind op_kind) {
+  const ICData& ic_data = *call->ic_data();
+  ASSERT(ic_data.num_args_tested() == 2);
+
+  ASSERT(call->ArgumentCount() == 2);
+  Definition* left = call->ArgumentAt(0);
+  Definition* right = call->ArgumentAt(1);
+
+  intptr_t cid = kIllegalCid;
+  if (HasOnlyTwoOf(ic_data, kSmiCid)) {
+    InsertBefore(call,
+                 new CheckSmiInstr(new Value(left), call->deopt_id()),
+                 call->env(),
+                 Definition::kEffect);
+    InsertBefore(call,
+                 new CheckSmiInstr(new Value(right), call->deopt_id()),
+                 call->env(),
+                 Definition::kEffect);
+    cid = kSmiCid;
+  } else if (HasTwoMintOrSmi(ic_data) &&
+             FlowGraphCompiler::SupportsUnboxedMints()) {
+    cid = kMintCid;
+  } else if (HasTwoDoubleOrSmi(ic_data)) {
+    // Use double comparison.
+    if (SmiFitsInDouble()) {
+      cid = kDoubleCid;
+    } else {
+      if (ICDataHasReceiverArgumentClassIds(ic_data, kSmiCid, kSmiCid)) {
+        // We cannot use double comparison on two smis. Need polymorphic
+        // call.
+        return false;
+      } else {
+        InsertBefore(call,
+                     new CheckEitherNonSmiInstr(new Value(left),
+                                                new Value(right),
+                                                call->deopt_id()),
+                     call->env(),
+                     Definition::kEffect);
+        cid = kDoubleCid;
+      }
+    }
+  } else {
+    return false;
+  }
+  ASSERT(cid != kIllegalCid);
+  RelationalOpInstr* comp = new RelationalOpInstr(call->token_pos(),
+                                                  op_kind,
+                                                  new Value(left),
+                                                  new Value(right),
+                                                  cid,
+                                                  call->deopt_id());
+  ReplaceCall(call, comp);
+  return true;
+}
+
+
 bool FlowGraphOptimizer::TryReplaceWithBinaryOp(InstanceCallInstr* call,
                                                 Token::Kind op_kind) {
   intptr_t operands_type = kIllegalCid;
@@ -1230,7 +1290,7 @@
     const Object& obj = right->AsConstant()->value();
     if (!obj.IsSmi()) return false;
     const intptr_t value = Smi::Cast(obj).Value();
-    if ((value <= 0) || !Utils::IsPowerOfTwo(value)) return false;
+    if (!Utils::IsPowerOfTwo(value)) return false;
 
     // Insert smi check and attach a copy of the original environment
     // because the smi operation can still deoptimize.
@@ -2610,6 +2670,12 @@
   if ((op_kind == Token::kINDEX) && TryReplaceWithLoadIndexed(instr)) {
     return;
   }
+
+  if (Token::IsRelationalOperator(op_kind) &&
+      TryReplaceWithRelationalOp(instr, op_kind)) {
+    return;
+  }
+
   if (Token::IsBinaryOperator(op_kind) &&
       TryReplaceWithBinaryOp(instr, op_kind)) {
     return;
@@ -2698,7 +2764,7 @@
   } else if ((recognized_kind == MethodRecognizer::kMathMin) ||
              (recognized_kind == MethodRecognizer::kMathMax)) {
     // We can handle only monomorphic min/max call sites with both arguments
-    // being either doubles or Smi-s
+    // being either doubles or smis.
     if (call->HasICData() && (call->ic_data()->NumberOfChecks() == 1)) {
       const ICData& ic_data = *call->ic_data();
       intptr_t result_cid = kIllegalCid;
@@ -2813,64 +2879,6 @@
 }
 
 
-static bool SmiFitsInDouble() { return kSmiBits < 53; }
-
-
-void FlowGraphOptimizer::HandleComparison(ComparisonInstr* comp,
-                                          const ICData& ic_data,
-                                          Instruction* current_instruction) {
-  ASSERT(ic_data.num_args_tested() == 2);
-  ASSERT(comp->operation_cid() == kIllegalCid);
-  if (HasOnlyTwoOf(ic_data, kSmiCid)) {
-    InsertBefore(current_instruction,
-                 new CheckSmiInstr(comp->left()->Copy(), comp->deopt_id()),
-                 current_instruction->env(),
-                 Definition::kEffect);
-    InsertBefore(current_instruction,
-                 new CheckSmiInstr(comp->right()->Copy(), comp->deopt_id()),
-                 current_instruction->env(),
-                 Definition::kEffect);
-    comp->set_operation_cid(kSmiCid);
-  } else if (HasTwoMintOrSmi(ic_data) &&
-             FlowGraphCompiler::SupportsUnboxedMints()) {
-    comp->set_operation_cid(kMintCid);
-  } else if (HasTwoDoubleOrSmi(ic_data)) {
-    // Use double comparison.
-    if (SmiFitsInDouble()) {
-      comp->set_operation_cid(kDoubleCid);
-    } else {
-      if (ICDataHasReceiverArgumentClassIds(ic_data, kSmiCid, kSmiCid)) {
-        // We cannot use double comparison on two Smi-s.
-        ASSERT(comp->operation_cid() == kIllegalCid);
-      } else {
-        InsertBefore(current_instruction,
-                     new CheckEitherNonSmiInstr(comp->left()->Copy(),
-                                                comp->right()->Copy(),
-                                                comp->deopt_id()),
-                     current_instruction->env(),
-                     Definition::kEffect);
-        comp->set_operation_cid(kDoubleCid);
-      }
-    }
-  } else {
-    ASSERT(comp->operation_cid() == kIllegalCid);
-  }
-}
-
-
-void FlowGraphOptimizer::HandleRelationalOp(RelationalOpInstr* comp) {
-  if (!comp->HasICData() || (comp->ic_data()->NumberOfChecks() == 0)) {
-    return;
-  }
-  HandleComparison(comp, *comp->ic_data(), current_iterator()->Current());
-}
-
-
-void FlowGraphOptimizer::VisitRelationalOp(RelationalOpInstr* instr) {
-  HandleRelationalOp(instr);
-}
-
-
 bool FlowGraphOptimizer::CanStrictifyEqualityCompare(
     EqualityCompareInstr* compare) {
   // If one of the inputs is null this is a strict comparison.
@@ -2993,7 +3001,40 @@
   }
 
   const ICData& ic_data = *comp->ic_data();
-  HandleComparison(comp, ic_data, current_instruction);
+  ASSERT(ic_data.num_args_tested() == 2);
+  ASSERT(comp->operation_cid() == kIllegalCid);
+  if (HasOnlyTwoOf(ic_data, kSmiCid)) {
+    InsertBefore(current_instruction,
+                 new CheckSmiInstr(comp->left()->Copy(), comp->deopt_id()),
+                 current_instruction->env(),
+                 Definition::kEffect);
+    InsertBefore(current_instruction,
+                 new CheckSmiInstr(comp->right()->Copy(), comp->deopt_id()),
+                 current_instruction->env(),
+                 Definition::kEffect);
+    comp->set_operation_cid(kSmiCid);
+  } else if (HasTwoMintOrSmi(ic_data) &&
+             FlowGraphCompiler::SupportsUnboxedMints()) {
+    comp->set_operation_cid(kMintCid);
+  } else if (HasTwoDoubleOrSmi(ic_data)) {
+    // Use double comparison.
+    if (SmiFitsInDouble()) {
+      comp->set_operation_cid(kDoubleCid);
+    } else {
+      if (ICDataHasReceiverArgumentClassIds(ic_data, kSmiCid, kSmiCid)) {
+        // We cannot use double comparison on two smis.
+        ASSERT(comp->operation_cid() == kIllegalCid);
+      } else {
+        InsertBefore(current_instruction,
+                     new CheckEitherNonSmiInstr(comp->left()->Copy(),
+                                                comp->right()->Copy(),
+                                                comp->deopt_id()),
+                     current_instruction->env(),
+                     Definition::kEffect);
+        comp->set_operation_cid(kDoubleCid);
+      }
+    }
+  }
 
   if (comp->operation_cid() != kIllegalCid) {
     // Done.
@@ -3045,9 +3086,7 @@
 
 void FlowGraphOptimizer::VisitBranch(BranchInstr* instr) {
   ComparisonInstr* comparison = instr->comparison();
-  if (comparison->IsRelationalOp()) {
-    HandleRelationalOp(comparison->AsRelationalOp());
-  } else if (comparison->IsEqualityCompare()) {
+  if (comparison->IsEqualityCompare()) {
     HandleEqualityCompare(comparison->AsEqualityCompare(), instr);
   } else {
     ASSERT(comparison->IsStrictCompare());
@@ -6947,9 +6986,8 @@
                               comparison->kind(),
                               left,
                               right,
-                              Object::null_array());
-    new_relational_op->set_ic_data(relational_op->ic_data());
-    new_relational_op->set_operation_cid(relational_op->operation_cid());
+                              relational_op->operation_cid(),
+                              relational_op->deopt_id());
     new_comparison = new_relational_op;
   }
   return new BranchInstr(new_comparison, branch->is_checked());
diff --git a/runtime/vm/flow_graph_optimizer.h b/runtime/vm/flow_graph_optimizer.h
index aad40dc..4243eba 100644
--- a/runtime/vm/flow_graph_optimizer.h
+++ b/runtime/vm/flow_graph_optimizer.h
@@ -51,7 +51,6 @@
 
   virtual void VisitStaticCall(StaticCallInstr* instr);
   virtual void VisitInstanceCall(InstanceCallInstr* instr);
-  virtual void VisitRelationalOp(RelationalOpInstr* instr);
   virtual void VisitEqualityCompare(EqualityCompareInstr* instr);
   virtual void VisitBranch(BranchInstr* instr);
   virtual void VisitStrictCompare(StrictCompareInstr* instr);
@@ -82,6 +81,8 @@
   bool TryReplaceWithBinaryOp(InstanceCallInstr* call, Token::Kind op_kind);
   bool TryReplaceWithUnaryOp(InstanceCallInstr* call, Token::Kind op_kind);
 
+  bool TryReplaceWithRelationalOp(InstanceCallInstr* call, Token::Kind op_kind);
+
   bool TryInlineInstanceGetter(InstanceCallInstr* call);
   bool TryInlineInstanceSetter(InstanceCallInstr* call,
                                const ICData& unary_ic_data);
@@ -163,12 +164,6 @@
   void ReplaceWithMathCFunction(InstanceCallInstr* call,
                                 MethodRecognizer::Kind recognized_kind);
 
-  void HandleComparison(ComparisonInstr* comp,
-                        const ICData& ic_data,
-                        Instruction* current_instruction);
-
-  void HandleRelationalOp(RelationalOpInstr* comp);
-
   // Visit an equality compare.  The current instruction can be the
   // comparison itself or a branch on the comparison.
   template <typename T>
diff --git a/runtime/vm/flow_graph_type_propagator.cc b/runtime/vm/flow_graph_type_propagator.cc
index e26e690..3c0c378 100644
--- a/runtime/vm/flow_graph_type_propagator.cc
+++ b/runtime/vm/flow_graph_type_propagator.cc
@@ -810,8 +810,7 @@
 
 
 CompileType RelationalOpInstr::ComputeType() const {
-  return IsInlinedNumericComparison() ? CompileType::Bool()
-                                      : CompileType::Dynamic();
+  return CompileType::Bool();
 }
 
 
diff --git a/runtime/vm/il_printer.cc b/runtime/vm/il_printer.cc
index 715b695..5c442da 100644
--- a/runtime/vm/il_printer.cc
+++ b/runtime/vm/il_printer.cc
@@ -469,9 +469,6 @@
   left()->PrintTo(f);
   f->Print(", ");
   right()->PrintTo(f);
-  if (HasICData()) {
-    PrintICData(f, *ic_data());
-  }
 }
 
 
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index cb7946f..dfa6cd4 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -1126,7 +1126,6 @@
   const Object& constant = right()->definition()->AsConstant()->value();
   if (!constant.IsSmi()) return false;
   const intptr_t int_value = Smi::Cast(constant).Value();
-  if (int_value == 0) return false;
   return Utils::IsPowerOfTwo(Utils::Abs(int_value));
 }
 
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index 67b66e4..bf09939 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -958,6 +958,7 @@
   friend class DoubleToIntegerInstr;
   friend class BranchSimplifier;
   friend class BlockEntryInstr;
+  friend class RelationalOpInstr;
 
   virtual void RawSetInputAt(intptr_t i, Value* value) = 0;
 
@@ -2671,6 +2672,7 @@
     ASSERT(!arguments->is_empty());
     ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap());
     ASSERT(Token::IsBinaryOperator(token_kind) ||
+           Token::IsRelationalOperator(token_kind) ||
            Token::IsPrefixOperator(token_kind) ||
            Token::IsIndexOperator(token_kind) ||
            Token::IsTypeTestOperator(token_kind) ||
@@ -3000,32 +3002,25 @@
                     Token::Kind kind,
                     Value* left,
                     Value* right,
-                    const Array& ic_data_array)
-      : ComparisonInstr(token_pos, kind, left, right),
-        ic_data_(GetICData(ic_data_array)) {
+                    intptr_t cid,
+                    intptr_t deopt_id)
+      : ComparisonInstr(token_pos, kind, left, right) {
     ASSERT(Token::IsRelationalOperator(kind));
+    set_operation_cid(cid);
+    deopt_id_ = deopt_id;  // Override generated deopt-id.
   }
 
   DECLARE_INSTRUCTION(RelationalOp)
   virtual CompileType ComputeType() const;
   virtual bool RecomputeType();
 
-  const ICData* ic_data() const { return ic_data_; }
-  bool HasICData() const {
-    return (ic_data() != NULL) && !ic_data()->IsNull();
-  }
-  void set_ic_data(const ICData* value) { ic_data_ = value; }
-
-  bool IsInlinedNumericComparison() const {
-    return (operation_cid() == kDoubleCid)
-        || (operation_cid() == kMintCid)
-        || (operation_cid() == kSmiCid);
-  }
-
   virtual void PrintOperandsTo(BufferFormatter* f) const;
 
-  virtual bool CanDeoptimize() const {
-    return !IsInlinedNumericComparison();
+  virtual bool CanDeoptimize() const { return false; }
+
+  virtual bool CanBecomeDeoptimizationTarget() const {
+    // RelationalOp can be merged into Branch and thus needs an environment.
+    return true;
   }
 
   virtual void EmitBranchCode(FlowGraphCompiler* compiler,
@@ -3044,14 +3039,12 @@
   }
 
   virtual EffectSet Effects() const {
-    return IsInlinedNumericComparison() ? EffectSet::None() : EffectSet::All();
+    return EffectSet::None();
   }
 
-  virtual bool MayThrow() const { return !IsInlinedNumericComparison(); }
+  virtual bool MayThrow() const { return false; }
 
  private:
-  const ICData* ic_data_;
-
   DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr);
 };
 
diff --git a/runtime/vm/intermediate_language_arm.cc b/runtime/vm/intermediate_language_arm.cc
index a0cc46a..e8c1f2c 100644
--- a/runtime/vm/intermediate_language_arm.cc
+++ b/runtime/vm/intermediate_language_arm.cc
@@ -848,25 +848,18 @@
     summary->set_in(1, Location::RequiresFpuRegister());
     summary->set_out(Location::RequiresRegister());
     return summary;
-  } else if (operation_cid() == kSmiCid) {
-    LocationSummary* summary =
-        new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
-    summary->set_in(0, Location::RegisterOrConstant(left()));
-    // Only one input can be a constant operand. The case of two constant
-    // operands should be handled by constant propagation.
-    summary->set_in(1, summary->in(0).IsConstant()
-                           ? Location::RequiresRegister()
-                           : Location::RegisterOrConstant(right()));
-    summary->set_out(Location::RequiresRegister());
-    return summary;
   }
-  LocationSummary* locs =
-      new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
-  // Pick arbitrary fixed input registers because this is a call.
-  locs->set_in(0, Location::RegisterLocation(R0));
-  locs->set_in(1, Location::RegisterLocation(R1));
-  locs->set_out(Location::RegisterLocation(R0));
-  return locs;
+  ASSERT(operation_cid() == kSmiCid);
+  LocationSummary* summary =
+      new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
+  summary->set_in(0, Location::RegisterOrConstant(left()));
+  // Only one input can be a constant operand. The case of two constant
+  // operands should be handled by constant propagation.
+  summary->set_in(1, summary->in(0).IsConstant()
+                         ? Location::RequiresRegister()
+                         : Location::RegisterOrConstant(right()));
+  summary->set_out(Location::RequiresRegister());
+  return summary;
 }
 
 
@@ -879,70 +872,8 @@
     EmitUnboxedMintComparisonOp(compiler, *locs(), kind(), NULL);
     return;
   }
-  if (operation_cid() == kDoubleCid) {
-    EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL);
-    return;
-  }
-
-  // Push arguments for the call.
-  // TODO(fschneider): Split this instruction into different types to avoid
-  // explicitly pushing arguments to the call here.
-  Register left = locs()->in(0).reg();
-  Register right = locs()->in(1).reg();
-  __ Push(left);
-  __ Push(right);
-  if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
-    Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptRelationalOp);
-    // Load class into R2. Since this is a call, any register except
-    // the fixed input registers would be ok.
-    ASSERT((left != R2) && (right != R2));
-    const intptr_t kNumArguments = 2;
-    LoadValueCid(compiler, R2, left);
-    compiler->EmitTestAndCall(ICData::Handle(ic_data()->AsUnaryClassChecks()),
-                              R2,  // Class id register.
-                              kNumArguments,
-                              Object::null_array(),  // No named arguments.
-                              deopt,  // Deoptimize target.
-                              deopt_id(),
-                              token_pos(),
-                              locs());
-    return;
-  }
-  const String& function_name =
-      String::ZoneHandle(Symbols::New(Token::Str(kind())));
-  if (!compiler->is_optimizing()) {
-    compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
-                                   deopt_id(),
-                                   token_pos());
-  }
-  const intptr_t kNumArguments = 2;
-  const intptr_t kNumArgsChecked = 2;  // Type-feedback.
-  ICData& relational_ic_data = ICData::ZoneHandle(ic_data()->raw());
-  if (compiler->is_optimizing() && FLAG_propagate_ic_data) {
-    ASSERT(!ic_data()->IsNull());
-    if (ic_data()->NumberOfChecks() == 0) {
-      // IC call for reoptimization populates original ICData.
-      relational_ic_data = ic_data()->raw();
-    } else {
-      // Megamorphic call.
-      relational_ic_data = ic_data()->AsUnaryClassChecks();
-    }
-  } else {
-    const Array& arguments_descriptor =
-        Array::Handle(ArgumentsDescriptor::New(kNumArguments,
-                                               Object::null_array()));
-    relational_ic_data = ICData::New(compiler->parsed_function().function(),
-                                     function_name,
-                                     arguments_descriptor,
-                                     deopt_id(),
-                                     kNumArgsChecked);
-  }
-  compiler->GenerateInstanceCall(deopt_id(),
-                                 token_pos(),
-                                 kNumArguments,
-                                 Object::null_array(),  // No optional args.
-                                 locs(),
-                                 relational_ic_data);
+  ASSERT(operation_cid() == kDoubleCid);
+  EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL);
 }
 
 
@@ -956,13 +887,8 @@
     EmitUnboxedMintComparisonOp(compiler, *locs(), kind(), branch);
     return;
   }
-  if (operation_cid() == kDoubleCid) {
-    EmitDoubleComparisonOp(compiler, *locs(), kind(), branch);
-    return;
-  }
-  EmitNativeCode(compiler);
-  __ CompareObject(R0, Bool::True());
-  branch->EmitBranchOnCondition(compiler, EQ);
+  ASSERT(operation_cid() == kDoubleCid);
+  EmitDoubleComparisonOp(compiler, *locs(), kind(), branch);
 }
 
 
@@ -2511,7 +2437,7 @@
           __ rsb(result, left, ShifterOperand(0));
           break;
         }
-        ASSERT((value != 0) && Utils::IsPowerOfTwo(Utils::Abs(value)));
+        ASSERT(Utils::IsPowerOfTwo(Utils::Abs(value)));
         const intptr_t shift_count =
             Utils::ShiftForPowerOfTwo(Utils::Abs(value)) + kSmiTagSize;
         ASSERT(kSmiTagSize == 1);
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index a0aeebf..9341603 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -923,25 +923,18 @@
     summary->set_in(1, Location::RequiresFpuRegister());
     summary->set_out(Location::RequiresRegister());
     return summary;
-  } else if (operation_cid() == kSmiCid) {
-    LocationSummary* summary =
-        new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
-    summary->set_in(0, Location::RegisterOrConstant(left()));
-    // Only one input can be a constant operand. The case of two constant
-    // operands should be handled by constant propagation.
-    summary->set_in(1, summary->in(0).IsConstant()
-                           ? Location::RequiresRegister()
-                           : Location::RegisterOrConstant(right()));
-    summary->set_out(Location::RequiresRegister());
-    return summary;
   }
-  LocationSummary* locs =
-      new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
-  // Pick arbitrary fixed input registers because this is a call.
-  locs->set_in(0, Location::RegisterLocation(EAX));
-  locs->set_in(1, Location::RegisterLocation(ECX));
-  locs->set_out(Location::RegisterLocation(EAX));
-  return locs;
+  ASSERT(operation_cid() == kSmiCid);
+  LocationSummary* summary =
+      new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
+  summary->set_in(0, Location::RegisterOrConstant(left()));
+  // Only one input can be a constant operand. The case of two constant
+  // operands should be handled by constant propagation.
+  summary->set_in(1, summary->in(0).IsConstant()
+                         ? Location::RequiresRegister()
+                         : Location::RegisterOrConstant(right()));
+  summary->set_out(Location::RequiresRegister());
+  return summary;
 }
 
 
@@ -954,70 +947,8 @@
     EmitUnboxedMintComparisonOp(compiler, *locs(), kind(), NULL);
     return;
   }
-  if (operation_cid() == kDoubleCid) {
-    EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL);
-    return;
-  }
-
-  // Push arguments for the call.
-  // TODO(fschneider): Split this instruction into different types to avoid
-  // explicitly pushing arguments to the call here.
-  Register left = locs()->in(0).reg();
-  Register right = locs()->in(1).reg();
-  __ pushl(left);
-  __ pushl(right);
-  if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
-    Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptRelationalOp);
-    // Load class into EDI. Since this is a call, any register except
-    // the fixed input registers would be ok.
-    ASSERT((left != EDI) && (right != EDI));
-    const intptr_t kNumArguments = 2;
-    LoadValueCid(compiler, EDI, left);
-    compiler->EmitTestAndCall(ICData::Handle(ic_data()->AsUnaryClassChecks()),
-                              EDI,  // Class id register.
-                              kNumArguments,
-                              Object::null_array(),  // No named arguments.
-                              deopt,  // Deoptimize target.
-                              deopt_id(),
-                              token_pos(),
-                              locs());
-    return;
-  }
-  const String& function_name =
-      String::ZoneHandle(Symbols::New(Token::Str(kind())));
-  if (!compiler->is_optimizing()) {
-    compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
-                                   deopt_id(),
-                                   token_pos());
-  }
-  const intptr_t kNumArguments = 2;
-  const intptr_t kNumArgsChecked = 2;  // Type-feedback.
-  ICData& relational_ic_data = ICData::ZoneHandle(ic_data()->raw());
-  if (compiler->is_optimizing() && FLAG_propagate_ic_data) {
-    ASSERT(!ic_data()->IsNull());
-    if (ic_data()->NumberOfChecks() == 0) {
-      // IC call for reoptimization populates original ICData.
-      relational_ic_data = ic_data()->raw();
-    } else {
-      // Megamorphic call.
-      relational_ic_data = ic_data()->AsUnaryClassChecks();
-    }
-  } else {
-    const Array& arguments_descriptor =
-        Array::Handle(ArgumentsDescriptor::New(kNumArguments,
-                                               Object::null_array()));
-    relational_ic_data = ICData::New(compiler->parsed_function().function(),
-                                     function_name,
-                                     arguments_descriptor,
-                                     deopt_id(),
-                                     kNumArgsChecked);
-  }
-  compiler->GenerateInstanceCall(deopt_id(),
-                                 token_pos(),
-                                 kNumArguments,
-                                 Object::null_array(),  // No optional args.
-                                 locs(),
-                                 relational_ic_data);
+  ASSERT(operation_cid() == kDoubleCid);
+  EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL);
 }
 
 
@@ -1031,13 +962,8 @@
     EmitUnboxedMintComparisonOp(compiler, *locs(), kind(), branch);
     return;
   }
-  if (operation_cid() == kDoubleCid) {
-    EmitDoubleComparisonOp(compiler, *locs(), kind(), branch);
-    return;
-  }
-  EmitNativeCode(compiler);
-  __ CompareObject(EAX, Bool::True());
-  branch->EmitBranchOnCondition(compiler, EQUAL);
+  ASSERT(operation_cid() == kDoubleCid);
+  EmitDoubleComparisonOp(compiler, *locs(), kind(), branch);
 }
 
 
@@ -2615,7 +2541,7 @@
           __ negl(left);
           break;
         }
-        ASSERT((value != 0) && Utils::IsPowerOfTwo(Utils::Abs(value)));
+        ASSERT(Utils::IsPowerOfTwo(Utils::Abs(value)));
         const intptr_t shift_count =
             Utils::ShiftForPowerOfTwo(Utils::Abs(value)) + kSmiTagSize;
         ASSERT(kSmiTagSize == 1);
diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc
index aa59591..8fc1040 100644
--- a/runtime/vm/intermediate_language_mips.cc
+++ b/runtime/vm/intermediate_language_mips.cc
@@ -902,25 +902,18 @@
     summary->set_in(1, Location::RequiresFpuRegister());
     summary->set_out(Location::RequiresRegister());
     return summary;
-  } else if (operation_cid() == kSmiCid) {
-    LocationSummary* summary =
-        new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
-    summary->set_in(0, Location::RegisterOrConstant(left()));
-    // Only one input can be a constant operand. The case of two constant
-    // operands should be handled by constant propagation.
-    summary->set_in(1, summary->in(0).IsConstant()
-                           ? Location::RequiresRegister()
-                           : Location::RegisterOrConstant(right()));
-    summary->set_out(Location::RequiresRegister());
-    return summary;
   }
-  LocationSummary* locs =
-      new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
-  // Pick arbitrary fixed input registers because this is a call.
-  locs->set_in(0, Location::RegisterLocation(A0));
-  locs->set_in(1, Location::RegisterLocation(A1));
-  locs->set_out(Location::RegisterLocation(V0));
-  return locs;
+  ASSERT(operation_cid() == kSmiCid);
+  LocationSummary* summary =
+      new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
+  summary->set_in(0, Location::RegisterOrConstant(left()));
+  // Only one input can be a constant operand. The case of two constant
+  // operands should be handled by constant propagation.
+  summary->set_in(1, summary->in(0).IsConstant()
+                         ? Location::RequiresRegister()
+                         : Location::RegisterOrConstant(right()));
+  summary->set_out(Location::RequiresRegister());
+  return summary;
 }
 
 
@@ -934,69 +927,9 @@
     EmitUnboxedMintComparisonOp(compiler, *locs(), kind(), NULL);
     return;
   }
-  if (operation_cid() == kDoubleCid) {
-    EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL);
-    return;
-  }
-
-  // Push arguments for the call.
-  // TODO(fschneider): Split this instruction into different types to avoid
-  // explicitly pushing arguments to the call here.
-  Register left = locs()->in(0).reg();
-  Register right = locs()->in(1).reg();
-  __ addiu(SP, SP, Immediate(-2 * kWordSize));
-  __ sw(left, Address(SP, 1 * kWordSize));
-  __ sw(right, Address(SP, 0 * kWordSize));
-  if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
-    Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptRelationalOp);
-    // Load class into A2.
-    const intptr_t kNumArguments = 2;
-    LoadValueCid(compiler, A2, left);
-    compiler->EmitTestAndCall(ICData::Handle(ic_data()->AsUnaryClassChecks()),
-                              A2,  // Class id register.
-                              kNumArguments,
-                              Object::null_array(),  // No named arguments.
-                              deopt,  // Deoptimize target.
-                              deopt_id(),
-                              token_pos(),
-                              locs());
-    return;
-  }
-  const String& function_name =
-      String::ZoneHandle(Symbols::New(Token::Str(kind())));
-  if (!compiler->is_optimizing()) {
-    compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
-                                   deopt_id(),
-                                   token_pos());
-  }
-  const intptr_t kNumArguments = 2;
-  const intptr_t kNumArgsChecked = 2;  // Type-feedback.
-  ICData& relational_ic_data = ICData::ZoneHandle(ic_data()->raw());
-  if (compiler->is_optimizing() && FLAG_propagate_ic_data) {
-    ASSERT(!ic_data()->IsNull());
-    if (ic_data()->NumberOfChecks() == 0) {
-      // IC call for reoptimization populates original ICData.
-      relational_ic_data = ic_data()->raw();
-    } else {
-      // Megamorphic call.
-      relational_ic_data = ic_data()->AsUnaryClassChecks();
-    }
-  } else {
-    const Array& arguments_descriptor =
-        Array::Handle(ArgumentsDescriptor::New(kNumArguments,
-                                               Object::null_array()));
-    relational_ic_data = ICData::New(compiler->parsed_function().function(),
-                                     function_name,
-                                     arguments_descriptor,
-                                     deopt_id(),
-                                     kNumArgsChecked);
-  }
-  compiler->GenerateInstanceCall(deopt_id(),
-                                 token_pos(),
-                                 kNumArguments,
-                                 Object::null_array(),  // No optional args.
-                                 locs(),
-                                 relational_ic_data);
+  ASSERT(operation_cid() == kDoubleCid);
+  EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL);
+  return;
 }
 
 
@@ -1011,13 +944,8 @@
     EmitUnboxedMintComparisonOp(compiler, *locs(), kind(), branch);
     return;
   }
-  if (operation_cid() == kDoubleCid) {
-    EmitDoubleComparisonOp(compiler, *locs(), kind(), branch);
-    return;
-  }
-  EmitNativeCode(compiler);
-  __ CompareObject(CMPRES1, CMPRES2, V0, Bool::True());
-  branch->EmitBranchOnCondition(compiler, EQ);
+  ASSERT(operation_cid() == kDoubleCid);
+  EmitDoubleComparisonOp(compiler, *locs(), kind(), branch);
 }
 
 
@@ -2623,7 +2551,7 @@
           __ subu(result, ZR, left);
           break;
         }
-        ASSERT((value != 0) && Utils::IsPowerOfTwo(Utils::Abs(value)));
+        ASSERT(Utils::IsPowerOfTwo(Utils::Abs(value)));
         const intptr_t shift_count =
             Utils::ShiftForPowerOfTwo(Utils::Abs(value)) + kSmiTagSize;
         ASSERT(kSmiTagSize == 1);
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
index 8935d30..d03bbb9 100644
--- a/runtime/vm/intermediate_language_x64.cc
+++ b/runtime/vm/intermediate_language_x64.cc
@@ -927,25 +927,18 @@
     summary->set_in(1, Location::RequiresFpuRegister());
     summary->set_out(Location::RequiresRegister());
     return summary;
-  } else if (operation_cid() == kSmiCid) {
-    LocationSummary* summary =
-        new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
-    summary->set_in(0, Location::RegisterOrConstant(left()));
-    // Only one input can be a constant operand. The case of two constant
-    // operands should be handled by constant propagation.
-    summary->set_in(1, summary->in(0).IsConstant()
-                           ? Location::RequiresRegister()
-                           : Location::RegisterOrConstant(right()));
-    summary->set_out(Location::RequiresRegister());
-    return summary;
   }
-  LocationSummary* locs =
-      new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
-  // Pick arbitrary fixed input registers because this is a call.
-  locs->set_in(0, Location::RegisterLocation(RAX));
-  locs->set_in(1, Location::RegisterLocation(RCX));
-  locs->set_out(Location::RegisterLocation(RAX));
-  return locs;
+  ASSERT(operation_cid() == kSmiCid);
+  LocationSummary* summary =
+      new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
+  summary->set_in(0, Location::RegisterOrConstant(left()));
+  // Only one input can be a constant operand. The case of two constant
+  // operands should be handled by constant propagation.
+  summary->set_in(1, summary->in(0).IsConstant()
+                         ? Location::RequiresRegister()
+                         : Location::RegisterOrConstant(right()));
+  summary->set_out(Location::RequiresRegister());
+  return summary;
 }
 
 
@@ -954,71 +947,8 @@
     EmitSmiComparisonOp(compiler, *locs(), kind(), NULL);
     return;
   }
-  if (operation_cid() == kDoubleCid) {
-    EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL);
-    return;
-  }
-
-  // Push arguments for the call.
-  // TODO(fschneider): Split this instruction into different types to avoid
-  // explicitly pushing arguments to the call here.
-  Register left = locs()->in(0).reg();
-  Register right = locs()->in(1).reg();
-  __ pushq(left);
-  __ pushq(right);
-  if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
-    Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptRelationalOp);
-
-    // Load class into RDI. Since this is a call, any register except
-    // the fixed input registers would be ok.
-    ASSERT((left != RDI) && (right != RDI));
-    LoadValueCid(compiler, RDI, left);
-    const intptr_t kNumArguments = 2;
-    compiler->EmitTestAndCall(ICData::Handle(ic_data()->AsUnaryClassChecks()),
-                              RDI,  // Class id register.
-                              kNumArguments,
-                              Object::null_array(),  // No named arguments.
-                              deopt,  // Deoptimize target.
-                              deopt_id(),
-                              token_pos(),
-                              locs());
-    return;
-  }
-  const String& function_name =
-      String::ZoneHandle(Symbols::New(Token::Str(kind())));
-  if (!compiler->is_optimizing()) {
-    compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
-                                   deopt_id(),
-                                   token_pos());
-  }
-  const intptr_t kNumArguments = 2;
-  const intptr_t kNumArgsChecked = 2;  // Type-feedback.
-  ICData& relational_ic_data = ICData::ZoneHandle(ic_data()->raw());
-  if (compiler->is_optimizing() && FLAG_propagate_ic_data) {
-    ASSERT(!ic_data()->IsNull());
-    if (ic_data()->NumberOfChecks() == 0) {
-      // IC call for reoptimization populates original ICData.
-      relational_ic_data = ic_data()->raw();
-    } else {
-      // Megamorphic call.
-      relational_ic_data = ic_data()->AsUnaryClassChecks();
-    }
-  } else {
-    const Array& arguments_descriptor =
-        Array::Handle(ArgumentsDescriptor::New(kNumArguments,
-                                               Object::null_array()));
-    relational_ic_data = ICData::New(compiler->parsed_function().function(),
-                                     function_name,
-                                     arguments_descriptor,
-                                     deopt_id(),
-                                     kNumArgsChecked);
-  }
-  compiler->GenerateInstanceCall(deopt_id(),
-                                 token_pos(),
-                                 kNumArguments,
-                                 Object::null_array(),  // No optional args.
-                                 locs(),
-                                 relational_ic_data);
+  ASSERT(operation_cid() == kDoubleCid);
+  EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL);
 }
 
 
@@ -1028,13 +958,8 @@
     EmitSmiComparisonOp(compiler, *locs(), kind(), branch);
     return;
   }
-  if (operation_cid() == kDoubleCid) {
-    EmitDoubleComparisonOp(compiler, *locs(), kind(), branch);
-    return;
-  }
-  EmitNativeCode(compiler);
-  __ CompareObject(RAX, Bool::True());
-  branch->EmitBranchOnCondition(compiler, EQUAL);
+  ASSERT(operation_cid() == kDoubleCid);
+  EmitDoubleComparisonOp(compiler, *locs(), kind(), branch);
 }
 
 
@@ -2606,7 +2531,7 @@
           break;
         }
 
-        ASSERT((value != 0) && Utils::IsPowerOfTwo(Utils::Abs(value)));
+        ASSERT(Utils::IsPowerOfTwo(Utils::Abs(value)));
         const intptr_t shift_count =
             Utils::ShiftForPowerOfTwo(Utils::Abs(value)) + kSmiTagSize;
         ASSERT(kSmiTagSize == 1);
diff --git a/runtime/vm/intrinsifier_arm.cc b/runtime/vm/intrinsifier_arm.cc
index 1050a0d..6bae006 100644
--- a/runtime/vm/intrinsifier_arm.cc
+++ b/runtime/vm/intrinsifier_arm.cc
@@ -1192,7 +1192,7 @@
 // Left is double right is integer (Bigint, Mint or Smi)
 void Intrinsifier::Double_mulFromInteger(Assembler* assembler) {
   Label fall_through;
-  // Only Smi-s allowed.
+  // Only smis allowed.
   __ ldr(R0, Address(SP, 0 * kWordSize));
   __ tst(R0, ShifterOperand(kSmiTagMask));
   __ b(&fall_through, NE);
diff --git a/runtime/vm/intrinsifier_ia32.cc b/runtime/vm/intrinsifier_ia32.cc
index 2b9c95c..251ba78 100644
--- a/runtime/vm/intrinsifier_ia32.cc
+++ b/runtime/vm/intrinsifier_ia32.cc
@@ -723,7 +723,7 @@
   __ subl(EAX, EBX);
 
   __ Bind(&done);
-  // The remainder of two Smi-s is always a Smi, no overflow check needed.
+  // The remainder of two smis is always a smi, no overflow check needed.
   __ SmiTag(EAX);
   __ ret();
 
@@ -1213,7 +1213,7 @@
 // Left is double right is integer (Bigint, Mint or Smi)
 void Intrinsifier::Double_mulFromInteger(Assembler* assembler) {
   Label fall_through;
-  // Only Smi-s allowed.
+  // Only smis allowed.
   __ movl(EAX, Address(ESP, + 1 * kWordSize));
   __ testl(EAX, Immediate(kSmiTagMask));
   __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
diff --git a/runtime/vm/intrinsifier_mips.cc b/runtime/vm/intrinsifier_mips.cc
index 44c895f..6eb52e8 100644
--- a/runtime/vm/intrinsifier_mips.cc
+++ b/runtime/vm/intrinsifier_mips.cc
@@ -1240,7 +1240,7 @@
 // Left is double right is integer (Bigint, Mint or Smi)
 void Intrinsifier::Double_mulFromInteger(Assembler* assembler) {
   Label fall_through;
-  // Only Smi-s allowed.
+  // Only smis allowed.
   __ lw(T0, Address(SP, 0 * kWordSize));
   __ andi(CMPRES, T0, Immediate(kSmiTagMask));
   __ bne(CMPRES, ZR, &fall_through);
diff --git a/runtime/vm/intrinsifier_x64.cc b/runtime/vm/intrinsifier_x64.cc
index 89b9622..8b23532 100644
--- a/runtime/vm/intrinsifier_x64.cc
+++ b/runtime/vm/intrinsifier_x64.cc
@@ -1124,7 +1124,7 @@
 
 void Intrinsifier::Double_mulFromInteger(Assembler* assembler) {
   Label fall_through;
-  // Only Smi-s allowed.
+  // Only smis allowed.
   __ movq(RAX, Address(RSP, + 1 * kWordSize));
   __ testq(RAX, Immediate(kSmiTagMask));
   __ j(NOT_ZERO, &fall_through, Assembler::kNearJump);
diff --git a/runtime/vm/native_arguments.h b/runtime/vm/native_arguments.h
index 281e224..20335cc 100644
--- a/runtime/vm/native_arguments.h
+++ b/runtime/vm/native_arguments.h
@@ -29,8 +29,7 @@
 #if defined(USING_SIMULATOR)
 #define CHECK_STACK_ALIGNMENT {                                                \
   uword current_sp = Simulator::Current()->get_register(SPREG);                \
-  ASSERT((OS::ActivationFrameAlignment() == 0) ||                              \
-         (Utils::IsAligned(current_sp, OS::ActivationFrameAlignment())));      \
+  ASSERT(Utils::IsAligned(current_sp, OS::ActivationFrameAlignment()));        \
 }
 #elif defined(TARGET_OS_WINDOWS)
 // The compiler may dynamically align the stack on Windows, so do not check.
@@ -40,8 +39,7 @@
   uword (*func)() =                                                            \
       reinterpret_cast<uword (*)()>(StubCode::GetStackPointerEntryPoint());    \
   uword current_sp = func();                                                   \
-  ASSERT((OS::ActivationFrameAlignment() == 0) ||                              \
-         (Utils::IsAligned(current_sp, OS::ActivationFrameAlignment())));      \
+  ASSERT(Utils::IsAligned(current_sp, OS::ActivationFrameAlignment()));        \
 }
 #endif
 
@@ -50,9 +48,9 @@
     VerifyPointersVisitor::VerifyPointers();                                   \
     Isolate::Current()->heap()->Verify();                                      \
   }
-#define TRACE_NATIVES(name)                                                    \
+#define TRACE_NATIVE_CALL(format, name)                                        \
   if (FLAG_trace_natives) {                                                    \
-    OS::Print("Calling native: %s\n", name);                                   \
+    OS::Print("Calling native: " format "\n", name);                           \
   }
 #define DEOPTIMIZE_ALOT                                                        \
   if (FLAG_deoptimize_alot) {                                                  \
@@ -63,7 +61,7 @@
 
 #define CHECK_STACK_ALIGNMENT { }
 #define VERIFY_ON_TRANSITION { }
-#define TRACE_NATIVES(name) { }
+#define TRACE_NATIVE_CALL(format, name) { }
 #define DEOPTIMIZE_ALOT { }
 
 #endif
diff --git a/runtime/vm/native_entry.cc b/runtime/vm/native_entry.cc
index 25b0697..c16af33 100644
--- a/runtime/vm/native_entry.cc
+++ b/runtime/vm/native_entry.cc
@@ -11,7 +11,8 @@
 
 namespace dart {
 
-DEFINE_FLAG(bool, trace_natives, false, "Trace invocation of natives");
+DEFINE_FLAG(bool, trace_natives, false,
+            "Trace invocation of natives (debug mode only)");
 
 
 static ExternalLabel native_call_label(
@@ -53,6 +54,7 @@
   ASSERT(state != NULL);
   ApiLocalScope* current_top_scope = state->top_scope();
   ApiLocalScope* scope = state->reusable_scope();
+  TRACE_NATIVE_CALL("0x%" Px "", reinterpret_cast<uintptr_t>(func));
   if (scope == NULL) {
     scope = new ApiLocalScope(current_top_scope,
                               isolate->top_exit_frame_info());
diff --git a/runtime/vm/native_entry.h b/runtime/vm/native_entry.h
index e6d6c8c..e2dc1cd 100644
--- a/runtime/vm/native_entry.h
+++ b/runtime/vm/native_entry.h
@@ -43,7 +43,7 @@
     VERIFY_ON_TRANSITION;                                                      \
     NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);     \
     ASSERT(arguments->NativeArgCount() == argument_count);                     \
-    TRACE_NATIVES(""#name);                                                    \
+    TRACE_NATIVE_CALL("%s", ""#name);                                          \
     {                                                                          \
       StackZone zone(arguments->isolate());                                    \
       SET_NATIVE_RETVAL(arguments,                                             \
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 05169e6..29725c7 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -44,25 +44,26 @@
 
 namespace dart {
 
+DEFINE_FLAG(int, huge_method_cutoff_in_code_size, 200000,
+    "Huge method cutoff in unoptimized code size (in bytes).");
+DEFINE_FLAG(int, huge_method_cutoff_in_tokens, 20000,
+    "Huge method cutoff in tokens: Disables optimizations for huge methods.");
 DEFINE_FLAG(bool, show_internal_names, false,
     "Show names of internal classes (e.g. \"OneByteString\") in error messages "
     "instead of showing the corresponding interface names (e.g. \"String\")");
 DEFINE_FLAG(bool, trace_disabling_optimized_code, false,
     "Trace disabling optimized code.");
-DEFINE_FLAG(int, huge_method_cutoff_in_tokens, 20000,
-    "Huge method cutoff in tokens: Disables optimizations for huge methods.");
-DEFINE_FLAG(int, huge_method_cutoff_in_code_size, 200000,
-    "Huge method cutoff in unoptimized code size (in bytes).");
 DEFINE_FLAG(bool, throw_on_javascript_int_overflow, false,
     "Throw an exception when the result of an integer calculation will not "
     "fit into a javascript integer.");
-DECLARE_FLAG(bool, trace_compiler);
 DECLARE_FLAG(bool, eliminate_type_checks);
 DECLARE_FLAG(bool, enable_type_checks);
+DECLARE_FLAG(bool, error_on_bad_override);
+DECLARE_FLAG(bool, error_on_bad_type);
+DECLARE_FLAG(bool, trace_compiler);
 DECLARE_FLAG(bool, trace_deoptimization);
 DECLARE_FLAG(bool, trace_deoptimization_verbose);
-DECLARE_FLAG(bool, error_on_bad_type);
-DECLARE_FLAG(bool, error_on_bad_override);
+DECLARE_FLAG(bool, verbose_stacktrace);
 
 static const char* kGetterPrefix = "get:";
 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix);
@@ -1640,14 +1641,6 @@
 }
 
 
-void Class::set_class_state(RawClass::ClassState state) const {
-  ASSERT((state == RawClass::kAllocated) ||
-         (state == RawClass::kPreFinalized) ||
-         (state == RawClass::kFinalized));
-  set_state_bits(StateBits::update(state, raw_ptr()->state_bits_));
-}
-
-
 void Class::set_state_bits(intptr_t bits) const {
   raw_ptr()->state_bits_ = static_cast<uint16_t>(bits);
 }
@@ -1664,6 +1657,9 @@
 
 
 intptr_t Class::NumTypeParameters() const {
+  if (IsMixinApplication() && !is_mixin_type_applied()) {
+    ClassFinalizer::ApplyMixinType(*this);
+  }
   if (type_parameters() == TypeArguments::null()) {
     return 0;
   }
@@ -1674,7 +1670,8 @@
 
 intptr_t Class::NumTypeArguments() const {
   // To work properly, this call requires the super class of this class to be
-  // resolved, which is checked by the SuperClass() call.
+  // resolved, which is checked by the type_class() call on the super type.
+  // Note that calling type_class() on a MixinAppType fails.
   Isolate* isolate = Isolate::Current();
   ReusableHandleScope reused_handles(isolate);
   Class& cls = reused_handles.ClassHandle();
@@ -1692,7 +1689,9 @@
         cls = signature_fun.Owner();
       }
     }
-    if (cls.type_parameters() != TypeArguments::null()) {
+    // Calling NumTypeParameters() on a mixin application class will setup the
+    // type parameters if not already done.
+    if (cls.NumTypeParameters() > 0) {
       type_params ^= cls.type_parameters();
       num_type_args += type_params.Length();
     }
@@ -2354,17 +2353,22 @@
 }
 
 
+void Class::set_is_mixin_type_applied() const {
+  set_state_bits(MixinTypeAppliedBit::update(true, raw_ptr()->state_bits_));
+}
+
+
 void Class::set_is_finalized() const {
   ASSERT(!is_finalized());
-  set_state_bits(StateBits::update(RawClass::kFinalized,
-                                   raw_ptr()->state_bits_));
+  set_state_bits(ClassFinalizedBits::update(RawClass::kFinalized,
+                                            raw_ptr()->state_bits_));
 }
 
 
 void Class::set_is_prefinalized() const {
   ASSERT(!is_finalized());
-  set_state_bits(StateBits::update(RawClass::kPreFinalized,
-                                   raw_ptr()->state_bits_));
+  set_state_bits(ClassFinalizedBits::update(RawClass::kPreFinalized,
+                                            raw_ptr()->state_bits_));
 }
 
 
@@ -2392,6 +2396,11 @@
 }
 
 
+bool Class::IsMixinApplication() const {
+  return mixin() != Type::null();
+}
+
+
 void Class::set_patch_class(const Class& cls) const {
   ASSERT(patch_class() == Class::null());
   StorePointer(&raw_ptr()->patch_class_, cls.raw());
@@ -7654,6 +7663,17 @@
 
 
 bool Namespace::HidesName(const String& name) const {
+  // Quick check for common case with no combinators.
+  if (hide_names() == show_names()) {
+    ASSERT(hide_names() == Array::null());
+    return false;
+  }
+  const String* plain_name = &name;
+  if (Field::IsGetterName(name)) {
+    plain_name = &String::Handle(Field::NameFromGetter(name));
+  } else if (Field::IsSetterName(name)) {
+    plain_name = &String::Handle(Field::NameFromSetter(name));
+  }
   // Check whether the name is in the list of explicitly hidden names.
   if (hide_names() != Array::null()) {
     const Array& names = Array::Handle(hide_names());
@@ -7661,7 +7681,7 @@
     intptr_t num_names = names.Length();
     for (intptr_t i = 0; i < num_names; i++) {
       hidden ^= names.At(i);
-      if (name.Equals(hidden)) {
+      if (plain_name->Equals(hidden)) {
         return true;
       }
     }
@@ -7674,7 +7694,7 @@
     intptr_t num_names = names.Length();
     for (intptr_t i = 0; i < num_names; i++) {
       shown ^= names.At(i);
-      if (name.Equals(shown)) {
+      if (plain_name->Equals(shown)) {
         return false;
       }
     }
@@ -7693,11 +7713,12 @@
   intptr_t ignore = 0;
   // Lookup the name in the library's symbols.
   Object& obj = Object::Handle(isolate, lib.LookupEntry(name, &ignore));
-  if (obj.IsNull()) {
+  // Library prefixes are not exported.
+  if (obj.IsNull() || obj.IsLibraryPrefix()) {
     // Lookup in the re-exported symbols.
     obj = lib.LookupExport(name);
   }
-  if (obj.IsNull() || HidesName(name)) {
+  if (obj.IsNull() || HidesName(name) || obj.IsLibraryPrefix()) {
     return Object::null();
   }
   return obj.raw();
@@ -14485,15 +14506,8 @@
 
 
 RawFunction* Stacktrace::FunctionAtFrame(intptr_t frame_index) const {
-  const Array& function_array = Array::Handle(raw_ptr()->function_array_);
-  return reinterpret_cast<RawFunction*>(function_array.At(frame_index));
-}
-
-
-void Stacktrace::SetFunctionAtFrame(intptr_t frame_index,
-                                    const Function& func) const {
-  const Array& function_array = Array::Handle(raw_ptr()->function_array_);
-  function_array.SetAt(frame_index, func);
+  const Code& code = Code::Handle(CodeAtFrame(frame_index));
+  return code.IsNull() ? Function::null() : code.function();
 }
 
 
@@ -14523,11 +14537,6 @@
 }
 
 
-void Stacktrace::set_function_array(const Array& function_array) const {
-  StorePointer(&raw_ptr()->function_array_, function_array.raw());
-}
-
-
 void Stacktrace::set_code_array(const Array& code_array) const {
   StorePointer(&raw_ptr()->code_array_, code_array.raw());
 }
@@ -14538,11 +14547,6 @@
 }
 
 
-void Stacktrace::set_catch_func_array(const Array& function_array) const {
-  StorePointer(&raw_ptr()->catch_func_array_, function_array.raw());
-}
-
-
 void Stacktrace::set_catch_code_array(const Array& code_array) const {
   StorePointer(&raw_ptr()->catch_code_array_, code_array.raw());
 }
@@ -14553,8 +14557,17 @@
 }
 
 
-RawStacktrace* Stacktrace::New(const Array& func_array,
-                               const Array& code_array,
+void Stacktrace::set_expand_inlined(bool value) const {
+  raw_ptr()->expand_inlined_ = value;
+}
+
+
+bool Stacktrace::expand_inlined() const {
+  return raw_ptr()->expand_inlined_;
+}
+
+
+RawStacktrace* Stacktrace::New(const Array& code_array,
                                const Array& pc_offset_array,
                                Heap::Space space) {
   ASSERT(Isolate::Current()->object_store()->stacktrace_class() !=
@@ -14567,41 +14580,33 @@
     NoGCScope no_gc;
     result ^= raw;
   }
-  result.set_function_array(func_array);
   result.set_code_array(code_array);
   result.set_pc_offset_array(pc_offset_array);
   result.SetCatchStacktrace(Object::empty_array(),
-                            Object::empty_array(),
                             Object::empty_array());
+  result.set_expand_inlined(true);  // default.
   return result.raw();
 }
 
 
-void Stacktrace::Append(const Array& func_list,
-                        const Array& code_list,
+void Stacktrace::Append(const Array& code_list,
                         const Array& pc_offset_list) const {
   intptr_t old_length = Length();
   intptr_t new_length = old_length + pc_offset_list.Length();
-  ASSERT(pc_offset_list.Length() == func_list.Length());
   ASSERT(pc_offset_list.Length() == code_list.Length());
 
   // Grow the arrays for function, code and pc_offset triplet to accommodate
   // the new stack frames.
-  Array& function_array = Array::Handle(raw_ptr()->function_array_);
   Array& code_array = Array::Handle(raw_ptr()->code_array_);
   Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_);
-  function_array = Array::Grow(function_array, new_length);
   code_array = Array::Grow(code_array, new_length);
   pc_offset_array = Array::Grow(pc_offset_array, new_length);
-  set_function_array(function_array);
   set_code_array(code_array);
   set_pc_offset_array(pc_offset_array);
   // Now append the new function and code list to the existing arrays.
   intptr_t j = 0;
   Object& obj = Object::Handle();
   for (intptr_t i = old_length; i < new_length; i++, j++) {
-    obj = func_list.At(j);
-    function_array.SetAt(i, obj);
     obj = code_list.At(j);
     code_array.SetAt(i, obj);
     obj = pc_offset_list.At(j);
@@ -14610,23 +14615,20 @@
 }
 
 
-void Stacktrace::SetCatchStacktrace(const Array& func_array,
-                                    const Array& code_array,
+void Stacktrace::SetCatchStacktrace(const Array& code_array,
                                     const Array& pc_offset_array) const {
-  StorePointer(&raw_ptr()->catch_func_array_, func_array.raw());
   StorePointer(&raw_ptr()->catch_code_array_, code_array.raw());
   StorePointer(&raw_ptr()->catch_pc_offset_array_, pc_offset_array.raw());
 }
 
 
 RawString* Stacktrace::FullStacktrace() const {
-  const Array& func_array = Array::Handle(raw_ptr()->catch_func_array_);
-  if (!func_array.IsNull() && (func_array.Length() > 0)) {
-    const Array& code_array = Array::Handle(raw_ptr()->catch_code_array_);
+  const Array& code_array = Array::Handle(raw_ptr()->catch_code_array_);
+  if (!code_array.IsNull() && (code_array.Length() > 0)) {
     const Array& pc_offset_array =
         Array::Handle(raw_ptr()->catch_pc_offset_array_);
     const Stacktrace& catch_trace = Stacktrace::Handle(
-        Stacktrace::New(func_array, code_array, pc_offset_array));
+        Stacktrace::New(code_array, pc_offset_array));
     intptr_t idx = Length();
     const String& trace =
         String::Handle(String::New(catch_trace.ToCStringInternal(idx)));
@@ -14650,20 +14652,48 @@
 }
 
 
+static intptr_t PrintOneStacktrace(Isolate* isolate,
+                                   GrowableArray<char*>* frame_strings,
+                                   uword pc,
+                                   const Function& function,
+                                   const Code& code,
+                                   intptr_t frame_index) {
+  const char* kFormat = "#%-6d %s (%s:%d:%d)\n";
+  const intptr_t token_pos = code.GetTokenIndexOfPC(pc);
+  const Script& script = Script::Handle(isolate, function.script());
+  const String& function_name =
+      String::Handle(isolate, function.QualifiedUserVisibleName());
+  const String& url = String::Handle(isolate, script.url());
+  intptr_t line = -1;
+  intptr_t column = -1;
+  if (token_pos >= 0) {
+    script.GetTokenLocation(token_pos, &line, &column);
+  }
+  intptr_t len = OS::SNPrint(NULL, 0, kFormat,
+                             frame_index,
+                             function_name.ToCString(),
+                             url.ToCString(),
+                             line, column);
+  char* chars = isolate->current_zone()->Alloc<char>(len + 1);
+  OS::SNPrint(chars, (len + 1), kFormat,
+              frame_index,
+              function_name.ToCString(),
+              url.ToCString(),
+              line, column);
+  frame_strings->Add(chars);
+  return len;
+}
+
+
 const char* Stacktrace::ToCStringInternal(intptr_t frame_index) const {
   Isolate* isolate = Isolate::Current();
   Function& function = Function::Handle();
   Code& code = Code::Handle();
-  Script& script = Script::Handle();
-  String& function_name = String::Handle();
-  String& url = String::Handle();
-
   // Iterate through the stack frames and create C string description
   // for each frame.
   intptr_t total_len = 0;
-  const char* kFormat = "#%-6d %s (%s:%d:%d)\n";
   GrowableArray<char*> frame_strings;
-  char* chars;
+  intptr_t current_frame_index = frame_index;
   for (intptr_t i = 0; i < Length(); i++) {
     function = FunctionAtFrame(i);
     if (function.IsNull()) {
@@ -14672,40 +14702,38 @@
           (FunctionAtFrame(i + 1) != Function::null())) {
         const char* kTruncated = "...\n...\n";
         intptr_t truncated_len = strlen(kTruncated) + 1;
-        chars = isolate->current_zone()->Alloc<char>(truncated_len);
+        char* chars = isolate->current_zone()->Alloc<char>(truncated_len);
         OS::SNPrint(chars, truncated_len, "%s", kTruncated);
         frame_strings.Add(chars);
       }
-      continue;
+    } else if (function.is_visible() || FLAG_verbose_stacktrace) {
+      code = CodeAtFrame(i);
+      ASSERT(function.raw() == code.function());
+      uword pc = code.EntryPoint() + Smi::Value(PcOffsetAtFrame(i));
+      if (code.is_optimized() && expand_inlined()) {
+        // Traverse inlined frames.
+        for (InlinedFunctionsIterator it(code, pc); !it.Done(); it.Advance()) {
+          function = it.function();
+          code = it.code();
+          ASSERT(function.raw() == code.function());
+          uword pc = it.pc();
+          ASSERT(pc != 0);
+          ASSERT(code.EntryPoint() <= pc);
+          ASSERT(pc < (code.EntryPoint() + code.Size()));
+          total_len += PrintOneStacktrace(
+              isolate, &frame_strings, pc, function, code, current_frame_index);
+          current_frame_index++;  // To account for inlined frames.
+        }
+      } else {
+        total_len += PrintOneStacktrace(
+            isolate, &frame_strings, pc, function, code, current_frame_index);
+        current_frame_index++;
+      }
     }
-    code = CodeAtFrame(i);
-    uword pc = code.EntryPoint() + Smi::Value(PcOffsetAtFrame(i));
-    intptr_t token_pos = code.GetTokenIndexOfPC(pc);
-    script = function.script();
-    function_name = function.QualifiedUserVisibleName();
-    url = script.url();
-    intptr_t line = -1;
-    intptr_t column = -1;
-    if (token_pos >= 0) {
-      script.GetTokenLocation(token_pos, &line, &column);
-    }
-    intptr_t len = OS::SNPrint(NULL, 0, kFormat,
-                               (frame_index + i),
-                               function_name.ToCString(),
-                               url.ToCString(),
-                               line, column);
-    total_len += len;
-    chars = isolate->current_zone()->Alloc<char>(len + 1);
-    OS::SNPrint(chars, (len + 1), kFormat,
-                (frame_index + i),
-                function_name.ToCString(),
-                url.ToCString(),
-                line, column);
-    frame_strings.Add(chars);
   }
 
   // Now concatenate the frame descriptions into a single C string.
-  chars = isolate->current_zone()->Alloc<char>(total_len + 1);
+  char* chars = isolate->current_zone()->Alloc<char>(total_len + 1);
   intptr_t index = 0;
   for (intptr_t i = 0; i < frame_strings.length(); i++) {
     index += OS::SNPrint((chars + index),
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 4728639..dd06b66 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -767,6 +767,8 @@
   RawType* mixin() const { return raw_ptr()->mixin_; }
   void set_mixin(const Type& value) const;
 
+  bool IsMixinApplication() const;
+
   RawClass* patch_class() const {
     return raw_ptr()->patch_class_;
   }
@@ -903,12 +905,14 @@
   void set_is_synthesized_class() const;
 
   bool is_finalized() const {
-    return StateBits::decode(raw_ptr()->state_bits_) == RawClass::kFinalized;
+    return ClassFinalizedBits::decode(raw_ptr()->state_bits_)
+        == RawClass::kFinalized;
   }
   void set_is_finalized() const;
 
   bool is_prefinalized() const {
-    return StateBits::decode(raw_ptr()->state_bits_) == RawClass::kPreFinalized;
+    return ClassFinalizedBits::decode(raw_ptr()->state_bits_)
+        == RawClass::kPreFinalized;
   }
 
   void set_is_prefinalized() const;
@@ -927,6 +931,11 @@
   }
   void set_is_mixin_typedef() const;
 
+  bool is_mixin_type_applied() const {
+    return MixinTypeAppliedBit::decode(raw_ptr()->state_bits_);
+  }
+  void set_is_mixin_type_applied() const;
+
   int num_native_fields() const {
     return raw_ptr()->num_native_fields_;
   }
@@ -1019,10 +1028,11 @@
     kPatchBit = 3,
     kSynthesizedClassBit = 4,
     kTypeFinalizedBit = 5,
-    kStateTagBit = 6,
-    kStateTagSize = 2,
+    kClassFinalizedBits = 6,
+    kClassFinalizedSize = 2,
     kMarkedForParsingBit = 8,
     kMixinTypedefBit = 9,
+    kMixinTypeAppliedBit = 10,
   };
   class ConstBit : public BitField<bool, kConstBit, 1> {};
   class ImplementedBit : public BitField<bool, kImplementedBit, 1> {};
@@ -1030,15 +1040,15 @@
   class PatchBit : public BitField<bool, kPatchBit, 1> {};
   class SynthesizedClassBit : public BitField<bool, kSynthesizedClassBit, 1> {};
   class TypeFinalizedBit : public BitField<bool, kTypeFinalizedBit, 1> {};
-  class StateBits : public BitField<RawClass::ClassState,
-                                    kStateTagBit, kStateTagSize> {};  // NOLINT
+  class ClassFinalizedBits : public BitField<RawClass::ClassFinalizedState,
+      kClassFinalizedBits, kClassFinalizedSize> {};  // NOLINT
   class MarkedForParsingBit : public BitField<bool, kMarkedForParsingBit, 1> {};
   class MixinTypedefBit : public BitField<bool, kMixinTypedefBit, 1> {};
+  class MixinTypeAppliedBit : public BitField<bool, kMixinTypeAppliedBit, 1> {};
 
   void set_name(const String& value) const;
   void set_signature_function(const Function& value) const;
   void set_signature_type(const AbstractType& value) const;
-  void set_class_state(RawClass::ClassState state) const;
   void set_state_bits(intptr_t bits) const;
 
   void set_constants(const Array& value) const;
@@ -5846,26 +5856,22 @@
   intptr_t Length() const;
 
   RawFunction* FunctionAtFrame(intptr_t frame_index) const;
-  void SetFunctionAtFrame(intptr_t frame_index, const Function& func) const;
 
   RawCode* CodeAtFrame(intptr_t frame_index) const;
   void SetCodeAtFrame(intptr_t frame_index, const Code& code) const;
 
   RawSmi* PcOffsetAtFrame(intptr_t frame_index) const;
   void SetPcOffsetAtFrame(intptr_t frame_index, const Smi& pc_offset) const;
-  void SetCatchStacktrace(const Array& func_array,
-                          const Array& code_array,
+  void SetCatchStacktrace(const Array& code_array,
                           const Array& pc_offset_array) const;
+  void set_expand_inlined(bool value) const;
 
-  void Append(const Array& func_list,
-              const Array& code_list,
-              const Array& pc_offset_list) const;
+  void Append(const Array& code_list, const Array& pc_offset_list) const;
 
   static intptr_t InstanceSize() {
     return RoundedAllocationSize(sizeof(RawStacktrace));
   }
-  static RawStacktrace* New(const Array& func_array,
-                            const Array& code_array,
+  static RawStacktrace* New(const Array& code_array,
                             const Array& pc_offset_array,
                             Heap::Space space = Heap::kNew);
 
@@ -5873,12 +5879,11 @@
   const char* ToCStringInternal(intptr_t frame_index) const;
 
  private:
-  void set_function_array(const Array& function_array) const;
   void set_code_array(const Array& code_array) const;
   void set_pc_offset_array(const Array& pc_offset_array) const;
-  void set_catch_func_array(const Array& function_array) const;
   void set_catch_code_array(const Array& code_array) const;
   void set_catch_pc_offset_array(const Array& pc_offset_array) const;
+  bool expand_inlined() const;
 
   FINAL_HEAP_OBJECT_IMPLEMENTATION(Stacktrace, Instance);
   friend class Class;
diff --git a/runtime/vm/object_store.cc b/runtime/vm/object_store.cc
index a4b7ec6..ce35ea8 100644
--- a/runtime/vm/object_store.cc
+++ b/runtime/vm/object_store.cc
@@ -129,17 +129,18 @@
     return false;
   }
   set_out_of_memory(Instance::Cast(result));
-  const Array& func_array = Array::Handle(
-      isolate,
-      Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld));
   const Array& code_array = Array::Handle(
       isolate,
       Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld));
   const Array& pc_offset_array = Array::Handle(
       isolate,
       Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld));
-  result = Stacktrace::New(func_array, code_array, pc_offset_array);
-  set_preallocated_stack_trace(Stacktrace::Cast(result));
+  const Stacktrace& stack_trace =
+      Stacktrace::Handle(Stacktrace::New(code_array, pc_offset_array));
+  // Expansion of inlined functions requires additional memory at run time,
+  // avoid it.
+  stack_trace.set_expand_inlined(false);
+  set_preallocated_stack_trace(stack_trace);
 
   return true;
 }
diff --git a/runtime/vm/os.h b/runtime/vm/os.h
index 92c0c3b..0363b50 100644
--- a/runtime/vm/os.h
+++ b/runtime/vm/os.h
@@ -60,7 +60,7 @@
   // Frees a pointer returned from AlignedAllocate.
   static void AlignedFree(void* ptr);
 
-  // Returns the activation frame alignment constraint or zero if
+  // Returns the activation frame alignment constraint or one if
   // the platform doesn't care. Guaranteed to be a power of two.
   static word ActivationFrameAlignment();
 
diff --git a/runtime/vm/os_win.cc b/runtime/vm/os_win.cc
index b69dd83..2062314 100644
--- a/runtime/vm/os_win.cc
+++ b/runtime/vm/os_win.cc
@@ -136,7 +136,7 @@
   return 16;
 #else
   // No requirements on Win32.
-  return 0;
+  return 1;
 #endif
 }
 
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 447c7bb..5a6219a 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -432,12 +432,14 @@
         name_pos(0),
         name(NULL),
         default_value(NULL),
+        metadata(NULL),
         is_final(false),
         is_field_initializer(false) { }
   const AbstractType* type;
   intptr_t name_pos;
   const String* name;
   const Object* default_value;  // NULL if not an optional parameter.
+  const Object* metadata;  // NULL if no metadata or metadata not evaluated.
   bool is_final;
   bool is_field_initializer;
 };
@@ -778,17 +780,25 @@
     parser.set_current_class(owner);
     parser.SkipFunctionPreamble();
     ParamList params;
-    parser.ParseFormalParameterList(true, &params);
+    parser.ParseFormalParameterList(true, true, &params);
     ParamDesc* param = params.parameters->data();
     const int param_cnt = params.num_fixed_parameters +
                           params.num_optional_parameters;
-    Array& param_descriptor = Array::Handle(isolate, Array::New(param_cnt * 2));
-    for (int i = 0, j = 0; i < param_cnt; i++, j += 2) {
-      param_descriptor.SetAt(j, param[i].is_final ? Bool::True() :
-                                                    Bool::False());
-      param_descriptor.SetAt(j + 1,
+    const Array& param_descriptor =
+        Array::Handle(Array::New(param_cnt * kParameterEntrySize));
+    for (int i = 0, j = 0; i < param_cnt; i++, j += kParameterEntrySize) {
+      param_descriptor.SetAt(j + kParameterIsFinalOffset,
+                             param[i].is_final ? Bool::True() : Bool::False());
+      param_descriptor.SetAt(j + kParameterDefaultValueOffset,
           (param[i].default_value == NULL) ? Object::null_instance() :
                                              *(param[i].default_value));
+      const Object* metadata = param[i].metadata;
+      if ((metadata != NULL) && (*metadata).IsError()) {
+        return (*metadata).raw();  // Error evaluating the metadata.
+      }
+      param_descriptor.SetAt(j + kParameterMetadataOffset,
+          (param[i].metadata == NULL) ? Object::null_instance() :
+                                        *(param[i].metadata));
     }
     isolate->set_long_jump_base(base);
     return param_descriptor.raw();
@@ -1366,13 +1376,19 @@
 
 
 void Parser::ParseFormalParameter(bool allow_explicit_default_value,
+                                  bool evaluate_metadata,
                                   ParamList* params) {
   TRACE_PARSER("ParseFormalParameter");
   ParamDesc parameter;
   bool var_seen = false;
   bool this_seen = false;
 
-  SkipMetadata();
+  if (evaluate_metadata && (CurrentToken() == Token::kAT)) {
+    parameter.metadata = &Array::ZoneHandle(EvaluateMetadata());
+  } else {
+    SkipMetadata();
+  }
+
   if (CurrentToken() == Token::kFINAL) {
     ConsumeToken();
     parameter.is_final = true;
@@ -1472,7 +1488,7 @@
           &Type::ZoneHandle(Type::DynamicType()));
 
       const bool no_explicit_default_values = false;
-      ParseFormalParameterList(no_explicit_default_values, &func_params);
+      ParseFormalParameterList(no_explicit_default_values, false, &func_params);
 
       // The field 'is_static' has no meaning for signature functions.
       const Function& signature_function = Function::Handle(
@@ -1556,6 +1572,7 @@
 
 // Parses a sequence of normal or optional formal parameters.
 void Parser::ParseFormalParameters(bool allow_explicit_default_values,
+                                   bool evaluate_metadata,
                                    ParamList* params) {
   TRACE_PARSER("ParseFormalParameters");
   do {
@@ -1574,23 +1591,30 @@
       params->has_optional_named_parameters = true;
       return;
     }
-    ParseFormalParameter(allow_explicit_default_values, params);
+    ParseFormalParameter(allow_explicit_default_values,
+                         evaluate_metadata,
+                         params);
   } while (CurrentToken() == Token::kCOMMA);
 }
 
 
 void Parser::ParseFormalParameterList(bool allow_explicit_default_values,
+                                      bool evaluate_metadata,
                                       ParamList* params) {
   TRACE_PARSER("ParseFormalParameterList");
   ASSERT(CurrentToken() == Token::kLPAREN);
 
   if (LookaheadToken(1) != Token::kRPAREN) {
     // Parse fixed parameters.
-    ParseFormalParameters(allow_explicit_default_values, params);
+    ParseFormalParameters(allow_explicit_default_values,
+                          evaluate_metadata,
+                          params);
     if (params->has_optional_positional_parameters ||
         params->has_optional_named_parameters) {
       // Parse optional parameters.
-      ParseFormalParameters(allow_explicit_default_values, params);
+      ParseFormalParameters(allow_explicit_default_values,
+                            evaluate_metadata,
+                            params);
       if (params->has_optional_positional_parameters) {
         if (CurrentToken() != Token::kRBRACK) {
           ErrorMsg("',' or ']' expected");
@@ -2376,7 +2400,7 @@
   // expressions and then calls the respective super constructor with
   // the same name and number of parameters.
   ArgumentListNode* forwarding_args = NULL;
-  if (current_class().mixin() != Type::null()) {
+  if (current_class().IsMixinApplication()) {
     // At this point we don't support forwarding constructors
     // that have optional parameters because we don't know the default
     // values of the optional parameters. We would have to compile the super
@@ -2481,7 +2505,7 @@
   if (func.is_const()) {
     params.SetImplicitlyFinal();
   }
-  ParseFormalParameterList(allow_explicit_default_values, &params);
+  ParseFormalParameterList(allow_explicit_default_values, false, &params);
 
   SetupDefaultsForOptionalParams(&params, default_parameter_values);
   ASSERT(AbstractType::Handle(func.result_type()).IsResolved());
@@ -2737,7 +2761,7 @@
     // we are compiling a getter this will at most populate the receiver.
     AddFormalParamsToScope(&params, current_block_->scope);
   } else {
-    ParseFormalParameterList(allow_explicit_default_values, &params);
+    ParseFormalParameterList(allow_explicit_default_values, false, &params);
 
     // The number of parameters and their type are not yet set in local
     // functions, since they are not 'top-level' parsed.
@@ -2887,7 +2911,7 @@
                                   *(qual_ident->ident),
                                   NULL)) {
       LibraryPrefix& lib_prefix = LibraryPrefix::ZoneHandle();
-      if (current_class().mixin() == Type::null()) {
+      if (!current_class().IsMixinApplication()) {
         lib_prefix = current_class().LookupLibraryPrefix(*(qual_ident->ident));
       } else {
         // TODO(hausner): Should we resolve the prefix via the library scope
@@ -2968,7 +2992,9 @@
     method->params.SetImplicitlyFinal();
   }
   if (!method->IsGetter()) {
-    ParseFormalParameterList(allow_explicit_default_values, &method->params);
+    ParseFormalParameterList(allow_explicit_default_values,
+                             false,
+                             &method->params);
   }
 
   // Now that we know the parameter list, we can distinguish between the
@@ -4025,7 +4051,7 @@
       &Type::ZoneHandle(Type::DynamicType()));
 
   const bool no_explicit_default_values = false;
-  ParseFormalParameterList(no_explicit_default_values, &func_params);
+  ParseFormalParameterList(no_explicit_default_values, false, &func_params);
   ExpectSemicolon();
   // The field 'is_static' has no meaning for signature functions.
   Function& signature_function = Function::Handle(
@@ -4474,7 +4500,7 @@
   const intptr_t function_pos = TokenPos();
   ParamList params;
   const bool allow_explicit_default_values = true;
-  ParseFormalParameterList(allow_explicit_default_values, &params);
+  ParseFormalParameterList(allow_explicit_default_values, false, &params);
 
   intptr_t function_end_pos = function_pos;
   if (is_external) {
@@ -4563,7 +4589,7 @@
 
   if (!is_getter) {
     const bool allow_explicit_default_values = true;
-    ParseFormalParameterList(allow_explicit_default_values, &params);
+    ParseFormalParameterList(allow_explicit_default_values, false, &params);
   }
   String& accessor_name = String::ZoneHandle();
   int expected_num_parameters = -1;
@@ -8688,7 +8714,7 @@
   // If the current class is the result of a mixin application, we must
   // use the class scope of the class from which the function originates.
   Class& cls = Class::Handle(isolate());
-  if (current_class().mixin() == Type::null()) {
+  if (!current_class().IsMixinApplication()) {
     cls = current_class().raw();
   } else {
     cls = parsed_function()->function().origin();
@@ -10111,12 +10137,12 @@
       ErrorMsg("class '%s' does not have a superclass",
                String::Handle(current_class().Name()).ToCString());
     }
-    if (current_class().mixin() != Type::null()) {
+    if (current_class().IsMixinApplication()) {
       const Type& mixin_type = Type::Handle(current_class().mixin());
       if (mixin_type.type_class() == current_function().origin()) {
-        ErrorMsg("class '%s' may not use super "
-                 "because it is used as mixin class",
-                 String::Handle(current_class().Name()).ToCString());
+        ErrorMsg("method of mixin class '%s' may not refer to 'super'",
+                 String::Handle(Class::Handle(
+                     current_function().origin()).Name()).ToCString());
       }
     }
     ConsumeToken();
@@ -10185,7 +10211,7 @@
     const bool allow_explicit_default_values = true;
     ParamList params;
     params.skipped = true;
-    ParseFormalParameterList(allow_explicit_default_values, &params);
+    ParseFormalParameterList(allow_explicit_default_values, false, &params);
   }
   if (CurrentToken() == Token::kLBRACE) {
     SkipBlock();
diff --git a/runtime/vm/parser.h b/runtime/vm/parser.h
index f729cc9..832cd99 100644
--- a/runtime/vm/parser.h
+++ b/runtime/vm/parser.h
@@ -144,13 +144,19 @@
   // class if the metadata is at the top-level).
   static RawObject* ParseMetadata(const Class& cls, intptr_t token_pos);
 
-  // Parse a function func and retrieve parameter information that can not be
-  // found in its function object. Returns either an error if the parser fails
-  // (which could be the case for local functions), or a flat array of the size
-  // (2*number_of_parameters). For each parameter i in this array, (2*i)
-  // contains a bool indicating whether the parameter has been final, and
-  // (2*i+1) contains an array of its default values (or null if it has no
-  // default values).
+  // Parse a function to retrieve parameter information that is not retained in
+  // the dart::Function object. Returns either an error if the parse fails
+  // (which could be the case for local functions), or a flat array of entries
+  // for each parameter. Each parameter entry contains:
+  // * a Dart bool indicating whether the parameter was declared final
+  // * its default value (or null if none was declared)
+  // * an array of metadata (or null if no metadata was declared).
+  enum {
+    kParameterIsFinalOffset,
+    kParameterDefaultValueOffset,
+    kParameterMetadataOffset,
+    kParameterEntrySize,
+  };
   static RawObject* ParseFunctionParameters(const Function& func);
 
   // Format and print a message with source location.
@@ -382,10 +388,13 @@
   void ParseClassMemberDefinition(ClassDesc* members,
                                   intptr_t metadata_pos);
   void ParseFormalParameter(bool allow_explicit_default_value,
+                            bool evaluate_metadata,
                             ParamList* params);
   void ParseFormalParameters(bool allow_explicit_default_values,
+                             bool evaluate_metadata,
                              ParamList* params);
   void ParseFormalParameterList(bool allow_explicit_default_values,
+                                bool evaluate_metadata,
                                 ParamList* params);
   void CheckConstFieldsInitialized(const Class& cls);
   void CheckConstructors(ClassDesc* members);
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 1746366..8bbd4b2 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -463,10 +463,10 @@
 
 class RawClass : public RawObject {
  public:
-  enum ClassState {
+  enum ClassFinalizedState {
     kAllocated = 0,  // Initial state.
     kPreFinalized,  // VM classes: size precomputed, but no checks done.
-    kFinalized,     // Class parsed, finalized and ready for use.
+    kFinalized,  // Class parsed, finalized and ready for use.
   };
 
  private:
@@ -501,7 +501,7 @@
   intptr_t next_field_offset_in_words_;  // Offset of the next instance field.
   intptr_t num_native_fields_;  // Number of native fields in class.
   intptr_t token_pos_;
-  uint16_t state_bits_;  // state, is_[const|implemented|synthesized|abstract].
+  uint16_t state_bits_;
 
   friend class Instance;
   friend class Object;
@@ -1473,17 +1473,17 @@
   RAW_HEAP_OBJECT_IMPLEMENTATION(Stacktrace);
 
   RawObject** from() {
-    return reinterpret_cast<RawObject**>(&ptr()->function_array_);
+    return reinterpret_cast<RawObject**>(&ptr()->code_array_);
   }
-  RawArray* function_array_;  // Function for each frame in the stack trace.
   RawArray* code_array_;  // Code object for each frame in the stack trace.
   RawArray* pc_offset_array_;  // Offset of PC for each frame.
-  RawArray* catch_func_array_;  // Func for each frame in catch stack trace.
   RawArray* catch_code_array_;  // Code for each frame in catch stack trace.
   RawArray* catch_pc_offset_array_;  // Offset of PC for each catch stack frame.
   RawObject** to() {
     return reinterpret_cast<RawObject**>(&ptr()->catch_pc_offset_array_);
   }
+  // False for pre-allocated stack trace (used in OOM and Stack overflow).
+  bool expand_inlined_;
 };
 
 
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index cd5edf9..bf7f27e 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -2489,15 +2489,11 @@
     // Read all the object pointer fields.
     Array& array = Array::Handle(reader->isolate());
     array ^= reader->ReadObjectRef();
-    result.set_function_array(array);
-    array ^= reader->ReadObjectRef();
     result.set_code_array(array);
     array ^= reader->ReadObjectRef();
     result.set_pc_offset_array(array);
 
     array ^= reader->ReadObjectRef();
-    result.set_catch_func_array(array);
-    array ^= reader->ReadObjectRef();
     result.set_catch_code_array(array);
     array ^= reader->ReadObjectRef();
     result.set_catch_pc_offset_array(array);
diff --git a/runtime/vm/scanner.cc b/runtime/vm/scanner.cc
index 0d6e5d0..ec87bd7 100644
--- a/runtime/vm/scanner.cc
+++ b/runtime/vm/scanner.cc
@@ -365,7 +365,10 @@
         ReadChar();
       }
     }
-    if ((c0_ == 'e') || (c0_ == 'E')) {
+    if (((c0_ == 'e') || (c0_ == 'E')) &&
+        (IsDecimalDigit(LookaheadChar(1)) ||
+         (LookaheadChar(1) == '-') ||
+         (LookaheadChar(1) == '+'))) {
       Recognize(Token::kDOUBLE);
       if ((c0_ == '-') || (c0_ == '+')) {
         ReadChar();
@@ -377,9 +380,6 @@
       while (IsDecimalDigit(c0_)) {
         ReadChar();
       }
-    } else if (IsIdentStartChar(c0_)) {
-      ErrorMsg("illegal character in number");
-      return;
     }
   }
   if (current_token_.kind != Token::kILLEGAL) {
diff --git a/runtime/vm/simulator_arm.cc b/runtime/vm/simulator_arm.cc
index 9135e2c..45a9b7f 100644
--- a/runtime/vm/simulator_arm.cc
+++ b/runtime/vm/simulator_arm.cc
@@ -322,7 +322,7 @@
       if (code.is_optimized()) {
         // For optimized frames, extract all the inlined functions if any
         // into the stack trace.
-        InlinedFunctionsIterator it(frame);
+        InlinedFunctionsIterator it(code, frame->pc());
         while (!it.Done()) {
           // Print each inlined frame with its pc in the corresponding
           // unoptimized frame.
@@ -3564,9 +3564,9 @@
 
   // Make sure the activation frames are properly aligned.
   int32_t stack_pointer = sp_before_call;
-  static const int kFrameAlignment = OS::ActivationFrameAlignment();
-  if (kFrameAlignment > 0) {
-    stack_pointer = Utils::RoundDown(stack_pointer, kFrameAlignment);
+  if (OS::ActivationFrameAlignment() > 1) {
+    stack_pointer =
+        Utils::RoundDown(stack_pointer, OS::ActivationFrameAlignment());
   }
   set_register(SP, stack_pointer);
 
@@ -3589,6 +3589,15 @@
   int32_t r10_val = get_register(R10);
   int32_t r11_val = get_register(R11);
 
+  double d8_val = get_dregister(D8);
+  double d9_val = get_dregister(D9);
+  double d10_val = get_dregister(D10);
+  double d11_val = get_dregister(D11);
+  double d12_val = get_dregister(D12);
+  double d13_val = get_dregister(D13);
+  double d14_val = get_dregister(D14);
+  double d15_val = get_dregister(D15);
+
   // Setup the callee-saved registers with a known value. To be able to check
   // that they are preserved properly across dart execution.
   int32_t callee_saved_value = icount_;
@@ -3601,6 +3610,16 @@
   set_register(R10, callee_saved_value);
   set_register(R11, callee_saved_value);
 
+  double callee_saved_dvalue = static_cast<double>(icount_);
+  set_dregister(D8, callee_saved_dvalue);
+  set_dregister(D9, callee_saved_dvalue);
+  set_dregister(D10, callee_saved_dvalue);
+  set_dregister(D11, callee_saved_dvalue);
+  set_dregister(D12, callee_saved_dvalue);
+  set_dregister(D13, callee_saved_dvalue);
+  set_dregister(D14, callee_saved_dvalue);
+  set_dregister(D15, callee_saved_dvalue);
+
   // Start the simulation
   Execute();
 
@@ -3614,6 +3633,15 @@
   ASSERT(callee_saved_value == get_register(R10));
   ASSERT(callee_saved_value == get_register(R11));
 
+  ASSERT(callee_saved_dvalue == get_dregister(D8));
+  ASSERT(callee_saved_dvalue == get_dregister(D9));
+  ASSERT(callee_saved_dvalue == get_dregister(D10));
+  ASSERT(callee_saved_dvalue == get_dregister(D11));
+  ASSERT(callee_saved_dvalue == get_dregister(D12));
+  ASSERT(callee_saved_dvalue == get_dregister(D13));
+  ASSERT(callee_saved_dvalue == get_dregister(D14));
+  ASSERT(callee_saved_dvalue == get_dregister(D15));
+
   // Restore callee-saved registers with the original value.
   set_register(R4, r4_val);
   set_register(R5, r5_val);
@@ -3624,6 +3652,15 @@
   set_register(R10, r10_val);
   set_register(R11, r11_val);
 
+  set_dregister(D8, d8_val);
+  set_dregister(D9, d9_val);
+  set_dregister(D10, d10_val);
+  set_dregister(D11, d11_val);
+  set_dregister(D12, d12_val);
+  set_dregister(D13, d13_val);
+  set_dregister(D14, d14_val);
+  set_dregister(D15, d15_val);
+
   // Restore the SP register and return R1:R0.
   set_register(SP, sp_before_call);
   int64_t return_value;
diff --git a/runtime/vm/simulator_mips.cc b/runtime/vm/simulator_mips.cc
index 7efabfa..c8f2caf 100644
--- a/runtime/vm/simulator_mips.cc
+++ b/runtime/vm/simulator_mips.cc
@@ -2113,9 +2113,9 @@
 
   // Make sure the activation frames are properly aligned.
   int32_t stack_pointer = sp_before_call;
-  static const int kFrameAlignment = OS::ActivationFrameAlignment();
-  if (kFrameAlignment > 0) {
-    stack_pointer = Utils::RoundDown(stack_pointer, kFrameAlignment);
+  if (OS::ActivationFrameAlignment() > 1) {
+    stack_pointer =
+        Utils::RoundDown(stack_pointer, OS::ActivationFrameAlignment());
   }
   set_register(SP, stack_pointer);
 
diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc
index fd9a5c9..a7af7e8 100644
--- a/runtime/vm/stack_frame.cc
+++ b/runtime/vm/stack_frame.cc
@@ -343,26 +343,24 @@
 }
 
 
-InlinedFunctionsIterator::InlinedFunctionsIterator(StackFrame* frame)
+InlinedFunctionsIterator::InlinedFunctionsIterator(const Code& code, uword pc)
   : index_(0),
-    code_(Code::Handle()),
+    code_(Code::Handle(code.raw())),
     deopt_info_(DeoptInfo::Handle()),
     function_(Function::Handle()),
-    pc_(0),
+    pc_(pc),
     deopt_instructions_(),
     object_table_(Array::Handle()) {
-  ASSERT(frame != NULL);
-  code_ = frame->LookupDartCode();
   ASSERT(code_.is_optimized());
+  ASSERT(pc_ != 0);
+  ASSERT(code.ContainsInstructionAt(pc));
   intptr_t deopt_reason = kDeoptUnknown;
-  deopt_info_ = code_.GetDeoptInfoAtPc(frame->pc(), &deopt_reason);
+  deopt_info_ = code_.GetDeoptInfoAtPc(pc, &deopt_reason);
   if (deopt_info_.IsNull()) {
     // This is the case when a call without deopt info in optimized code
     // throws an exception. (e.g. in the parameter copying prologue).
     // In that case there won't be any inlined frames.
     function_ = code_.function();
-    pc_ = frame->pc();
-    ASSERT(pc_ != 0);
   } else {
     // Unpack deopt info into instructions (translate away suffixes).
     const Array& deopt_table = Array::Handle(code_.deopt_info_array());
diff --git a/runtime/vm/stack_frame.h b/runtime/vm/stack_frame.h
index 83a93e5..deb8fe3 100644
--- a/runtime/vm/stack_frame.h
+++ b/runtime/vm/stack_frame.h
@@ -261,7 +261,7 @@
 // other functions).
 class InlinedFunctionsIterator : public ValueObject {
  public:
-  explicit InlinedFunctionsIterator(StackFrame* frame);
+  InlinedFunctionsIterator(const Code& code, uword pc);
   bool Done() const { return index_ == -1; }
   void Advance();
 
diff --git a/runtime/vm/stack_frame_arm.h b/runtime/vm/stack_frame_arm.h
index 5ddbc82..3bae90f 100644
--- a/runtime/vm/stack_frame_arm.h
+++ b/runtime/vm/stack_frame_arm.h
@@ -38,8 +38,8 @@
 static const int kCallerSpSlotFromFp = 3;
 
 // Entry and exit frame layout.
-static const int kSavedContextSlotFromEntryFp = -10;
-static const int kExitLinkSlotFromEntryFp = -9;
+static const int kSavedContextSlotFromEntryFp = -26;
+static const int kExitLinkSlotFromEntryFp = -25;
 
 }  // namespace dart
 
diff --git a/runtime/vm/stack_frame_mips.h b/runtime/vm/stack_frame_mips.h
index c3e9122..caeed8d 100644
--- a/runtime/vm/stack_frame_mips.h
+++ b/runtime/vm/stack_frame_mips.h
@@ -36,8 +36,8 @@
 static const int kCallerSpSlotFromFp = 3;
 
 // Entry and exit frame layout.
-static const int kSavedContextSlotFromEntryFp = -11;
-static const int kExitLinkSlotFromEntryFp = -10;
+static const int kSavedContextSlotFromEntryFp = -23;
+static const int kExitLinkSlotFromEntryFp = -22;
 
 }  // namespace dart
 
diff --git a/runtime/vm/stub_code_arm.cc b/runtime/vm/stub_code_arm.cc
index 111c91a..596af42 100644
--- a/runtime/vm/stub_code_arm.cc
+++ b/runtime/vm/stub_code_arm.cc
@@ -782,10 +782,15 @@
   __ EnterStubFrame();
 
   // Save new context and C++ ABI callee-saved registers.
-  const intptr_t kNewContextOffset =
+  const intptr_t kNewContextOffsetFromFp =
       -(1 + kAbiPreservedCpuRegCount) * kWordSize;
   __ PushList((1 << R3) | kAbiPreservedCpuRegs);
 
+  const DRegister firstd = EvenDRegisterOf(kAbiFirstPreservedFpuReg);
+  ASSERT(2 * kAbiPreservedFpuRegCount < 16);
+  // Save FPU registers. 2 D registers per Q register.
+  __ vstmd(DB_W, SP, firstd, 2 * kAbiPreservedFpuRegCount);
+
   // The new Context structure contains a pointer to the current Isolate
   // structure. Cache the Context pointer in the CTX register so that it is
   // available in generated code and calls to Isolate::Current() need not be
@@ -813,13 +818,10 @@
 
   // The constants kSavedContextSlotFromEntryFp and
   // kExitLinkSlotFromEntryFp must be kept in sync with the code below.
-  ASSERT(kExitLinkSlotFromEntryFp == -9);
-  ASSERT(kSavedContextSlotFromEntryFp == -10);
+  ASSERT(kExitLinkSlotFromEntryFp == -25);
+  ASSERT(kSavedContextSlotFromEntryFp == -26);
   __ PushList((1 << R4) | (1 << R5));
 
-  // The stack pointer is restored after the call to this location.
-  const intptr_t kSavedContextSlotFromEntryFp = -10 * kWordSize;
-
   // Load arguments descriptor array into R4, which is passed to Dart code.
   __ ldr(R4, Address(R1, VMHandles::kOffsetOfRawPtrInHandle));
 
@@ -850,11 +852,11 @@
   __ blx(R0);  // R4 is the arguments descriptor array.
 
   // Read the saved new Context pointer.
-  __ ldr(CTX, Address(FP, kNewContextOffset));
+  __ ldr(CTX, Address(FP, kNewContextOffsetFromFp));
   __ ldr(CTX, Address(CTX, VMHandles::kOffsetOfRawPtrInHandle));
 
   // Get rid of arguments pushed on the stack.
-  __ AddImmediate(SP, FP, kSavedContextSlotFromEntryFp);
+  __ AddImmediate(SP, FP, kSavedContextSlotFromEntryFp * kWordSize);
 
   // Load Isolate pointer from Context structure into CTX. Drop Context.
   __ ldr(CTX, FieldAddress(CTX, Context::isolate_offset()));
@@ -868,6 +870,9 @@
   __ StoreToOffset(kWord, R5, CTX, Isolate::top_exit_frame_info_offset());
 
   // Restore C++ ABI callee-saved registers.
+  // Restore FPU registers. 2 D registers per Q register.
+  __ vldmd(IA_W, SP, firstd, 2 * kAbiPreservedFpuRegCount);
+  // Restore CPU registers.
   __ PopList((1 << R3) | kAbiPreservedCpuRegs);  // Ignore restored R3.
 
   // Restore the frame pointer and return.
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
index 927f612..f2ba2ea 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -59,7 +59,7 @@
 
   // Reserve space for arguments and align frame before entering C++ world.
   __ AddImmediate(ESP, Immediate(-sizeof(NativeArguments)));
-  if (OS::ActivationFrameAlignment() > 0) {
+  if (OS::ActivationFrameAlignment() > 1) {
     __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1)));
   }
 
@@ -151,7 +151,7 @@
   // (pointer to the native arguments structure, the C function entry point)
   // and align frame before entering the C++ world.
   __ AddImmediate(ESP, Immediate(-sizeof(NativeArguments) - (2 * kWordSize)));
-  if (OS::ActivationFrameAlignment() > 0) {
+  if (OS::ActivationFrameAlignment() > 1) {
     __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1)));
   }
 
@@ -222,7 +222,7 @@
   // (pointer to the native arguments structure) and align frame before
   // entering the C++ world.
   __ AddImmediate(ESP, Immediate(-sizeof(NativeArguments) - kWordSize));
-  if (OS::ActivationFrameAlignment() > 0) {
+  if (OS::ActivationFrameAlignment() > 1) {
     __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1)));
   }
 
diff --git a/runtime/vm/stub_code_mips.cc b/runtime/vm/stub_code_mips.cc
index ceef26f..83990b8 100644
--- a/runtime/vm/stub_code_mips.cc
+++ b/runtime/vm/stub_code_mips.cc
@@ -910,14 +910,31 @@
   __ EnterStubFrame();
 
   // Save new context and C++ ABI callee-saved registers.
-  const intptr_t kNewContextOffset =
-      -(1 + kAbiPreservedCpuRegCount) * kWordSize;
 
-  __ addiu(SP, SP, Immediate(-(3 + kAbiPreservedCpuRegCount) * kWordSize));
+  // The new context, the top exit frame, and the old context.
+  const intptr_t kPreservedContextSlots = 3;
+  const intptr_t kNewContextOffsetFromFp =
+      -(1 + kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount) * kWordSize;
+  const intptr_t kPreservedRegSpace =
+      kWordSize * (kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount +
+                   kPreservedContextSlots);
+
+  __ addiu(SP, SP, Immediate(-kPreservedRegSpace));
   for (int i = S0; i <= S7; i++) {
     Register r = static_cast<Register>(i);
-    __ sw(r, Address(SP, (i - S0 + 3) * kWordSize));
+    const intptr_t slot = i - S0 + kPreservedContextSlots;
+    __ sw(r, Address(SP, slot * kWordSize));
   }
+
+  for (intptr_t i = kAbiFirstPreservedFpuReg;
+       i <= kAbiLastPreservedFpuReg; i++) {
+    FRegister r = static_cast<FRegister>(i);
+    const intptr_t slot =
+        kAbiPreservedCpuRegCount + kPreservedContextSlots + i -
+        kAbiFirstPreservedFpuReg;
+    __ swc1(r, Address(SP, slot * kWordSize));
+  }
+
   __ sw(A3, Address(SP, 2 * kWordSize));
 
   // The new Context structure contains a pointer to the current Isolate
@@ -946,13 +963,13 @@
 
   // The constants kSavedContextSlotFromEntryFp and
   // kExitLinkSlotFromEntryFp must be kept in sync with the code below.
-  ASSERT(kExitLinkSlotFromEntryFp == -10);
-  ASSERT(kSavedContextSlotFromEntryFp == -11);
+  ASSERT(kExitLinkSlotFromEntryFp == -22);
+  ASSERT(kSavedContextSlotFromEntryFp == -23);
   __ sw(T0, Address(SP, 1 * kWordSize));
   __ sw(T1, Address(SP, 0 * kWordSize));
 
   // After the call, The stack pointer is restored to this location.
-  // Pushed A3, S0-7, T0, T1 = 11.
+  // Pushed A3, S0-7, F20-31, T0, T1 = 23.
 
   // Load arguments descriptor array into S4, which is passed to Dart code.
   __ lw(S4, Address(A1, VMHandles::kOffsetOfRawPtrInHandle));
@@ -985,7 +1002,7 @@
   __ TraceSimMsg("InvokeDartCodeStub return");
 
   // Read the saved new Context pointer.
-  __ lw(CTX, Address(FP, kNewContextOffset));
+  __ lw(CTX, Address(FP, kNewContextOffsetFromFp));
   __ lw(CTX, Address(CTX, VMHandles::kOffsetOfRawPtrInHandle));
 
   // Get rid of arguments pushed on the stack.
@@ -1006,10 +1023,21 @@
   // Restore C++ ABI callee-saved registers.
   for (int i = S0; i <= S7; i++) {
     Register r = static_cast<Register>(i);
-    __ lw(r, Address(SP, (i - S0 + 3) * kWordSize));
+    const intptr_t slot = i - S0 + kPreservedContextSlots;
+    __ lw(r, Address(SP, slot * kWordSize));
   }
+
+  for (intptr_t i = kAbiFirstPreservedFpuReg;
+       i <= kAbiLastPreservedFpuReg; i++) {
+    FRegister r = static_cast<FRegister>(i);
+    const intptr_t slot =
+        kAbiPreservedCpuRegCount + kPreservedContextSlots + i -
+        kAbiFirstPreservedFpuReg;
+    __ lwc1(r, Address(SP, slot * kWordSize));
+  }
+
   __ lw(A3, Address(SP, 2 * kWordSize));
-  __ addiu(SP, SP, Immediate((3 + kAbiPreservedCpuRegCount) * kWordSize));
+  __ addiu(SP, SP, Immediate(kPreservedRegSpace));
 
   // Restore the frame pointer and return.
   __ LeaveStubFrameAndReturn();
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index 87163a7..3039a97 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -61,7 +61,7 @@
 
   // Reserve space for arguments and align frame before entering C++ world.
   __ AddImmediate(RSP, Immediate(-sizeof(NativeArguments)));
-  if (OS::ActivationFrameAlignment() > 0) {
+  if (OS::ActivationFrameAlignment() > 1) {
     __ andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1)));
   }
 
@@ -151,7 +151,7 @@
   // outgoing pointer parameter to the native arguments structure is passed in
   // RDI) and align frame before entering the C++ world.
   __ AddImmediate(RSP, Immediate(-sizeof(NativeArguments)));
-  if (OS::ActivationFrameAlignment() > 0) {
+  if (OS::ActivationFrameAlignment() > 1) {
     __ andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1)));
   }
 
@@ -220,7 +220,7 @@
   // outgoing pointer parameter to the native arguments structure is passed in
   // RDI) and align frame before entering the C++ world.
   __ AddImmediate(RSP, Immediate(-sizeof(NativeArguments)));
-  if (OS::ActivationFrameAlignment() > 0) {
+  if (OS::ActivationFrameAlignment() > 1) {
     __ andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1)));
   }
 
diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h
index c892cbe..4f4a670 100644
--- a/runtime/vm/symbols.h
+++ b/runtime/vm/symbols.h
@@ -284,6 +284,7 @@
   V(_LocalMirrorSystemImpl, "_LocalMirrorSystemImpl")                          \
   V(_LocalTypedefMirrorImpl, "_LocalTypedefMirrorImpl")                        \
   V(_LocalTypeVariableMirrorImpl, "_LocalTypeVariableMirrorImpl")              \
+  V(hashCode, "get:hashCode")                                                  \
   V(_leftShiftWithMask32, "_leftShiftWithMask32")                              \
 
 
diff --git a/runtime/vm/utils_test.cc b/runtime/vm/utils_test.cc
index 1e86f7a..a287172 100644
--- a/runtime/vm/utils_test.cc
+++ b/runtime/vm/utils_test.cc
@@ -39,7 +39,7 @@
 
 
 UNIT_TEST_CASE(IsPowerOfTwo) {
-  EXPECT(Utils::IsPowerOfTwo(0));
+  EXPECT(!Utils::IsPowerOfTwo(0));
   EXPECT(Utils::IsPowerOfTwo(1));
   EXPECT(Utils::IsPowerOfTwo(2));
   EXPECT(!Utils::IsPowerOfTwo(3));
@@ -59,7 +59,6 @@
 
 
 UNIT_TEST_CASE(IsAligned) {
-  EXPECT(Utils::IsAligned(0, 0));
   EXPECT(Utils::IsAligned(0, 1));
   EXPECT(Utils::IsAligned(1, 1));
 
@@ -74,7 +73,6 @@
 
 
 UNIT_TEST_CASE(RoundDown) {
-  EXPECT_EQ(0, Utils::RoundDown(0, 0));
   EXPECT_EQ(0, Utils::RoundDown(22, 32));
   EXPECT_EQ(32, Utils::RoundDown(33, 32));
   EXPECT_EQ(32, Utils::RoundDown(63, 32));
@@ -85,8 +83,6 @@
 
 
 UNIT_TEST_CASE(RoundUp) {
-  EXPECT_EQ(0, Utils::RoundUp(0, 0));
-  EXPECT_EQ(0, Utils::RoundUp(1, 0));
   EXPECT_EQ(32, Utils::RoundUp(22, 32));
   EXPECT_EQ(64, Utils::RoundUp(33, 32));
   EXPECT_EQ(64, Utils::RoundUp(63, 32));
diff --git a/sdk/lib/_internal/compiler/compiler.dart b/sdk/lib/_internal/compiler/compiler.dart
index abeb36c..215f248 100644
--- a/sdk/lib/_internal/compiler/compiler.dart
+++ b/sdk/lib/_internal/compiler/compiler.dart
@@ -92,19 +92,21 @@
                                    libraryRoot,
                                    packageRoot,
                                    options);
-  compiler.run(script);
-  String code = compiler.assembledCode;
-  if (code != null && outputProvider != null) {
-    String outputType = 'js';
-    if (options.contains('--output-type=dart')) {
-      outputType = 'dart';
+  // TODO(ahe): Use the value of the future (which signals success or failure).
+  return compiler.run(script).then((_) {
+    String code = compiler.assembledCode;
+    if (code != null && outputProvider != null) {
+      String outputType = 'js';
+      if (options.contains('--output-type=dart')) {
+        outputType = 'dart';
+      }
+      outputProvider('', outputType)
+          ..add(code)
+          ..close();
+      code = ''; // Non-null signals success.
     }
-    outputProvider('', outputType)
-        ..add(code)
-        ..close();
-    code = ''; // Non-null signals success.
-  }
-  return new Future.value(code);
+    return code;
+  });
 }
 
 /**
diff --git a/sdk/lib/_internal/compiler/implementation/apiimpl.dart b/sdk/lib/_internal/compiler/implementation/apiimpl.dart
index b15631a..d211e94 100644
--- a/sdk/lib/_internal/compiler/implementation/apiimpl.dart
+++ b/sdk/lib/_internal/compiler/implementation/apiimpl.dart
@@ -133,12 +133,10 @@
     return "lib/$path";
   }
 
-  elements.LibraryElement scanBuiltinLibrary(String path) {
+  Future<elements.LibraryElement> scanBuiltinLibrary(String path) {
     Uri uri = libraryRoot.resolve(lookupLibraryPath(path));
     Uri canonicalUri = new Uri(scheme: "dart", path: path);
-    elements.LibraryElement library =
-        libraryLoader.loadLibrary(uri, null, canonicalUri);
-    return library;
+    return libraryLoader.loadLibrary(uri, null, canonicalUri);
   }
 
   void log(message) {
@@ -157,30 +155,37 @@
   /**
    * Reads the script designated by [readableUri].
    */
-  leg.Script readScript(Uri readableUri, [tree.Node node]) {
+  Future<leg.Script> readScript(Uri readableUri,
+                                [elements.Element element, tree.Node node]) {
     if (!readableUri.isAbsolute) {
       internalError('Relative uri $readableUri provided to readScript(Uri)',
                     node: node);
     }
-    return fileReadingTask.measure(() {
-      Uri resourceUri = translateUri(readableUri, node);
-      String text = "";
-      try {
-        // TODO(ahe): We expect the future to be complete and call value
-        // directly. In effect, we don't support truly asynchronous API.
-        text = deprecatedFutureValue(provider(resourceUri));
-      } catch (exception) {
+
+    // TODO(johnniwinther): Add [:report(..., {Element element}):] to
+    // report methods in Compiler.
+    void reportReadError(String exception) {
+      withCurrentElement(element, () {
         reportError(node,
                     leg.MessageKind.READ_SCRIPT_ERROR,
                     {'uri': readableUri, 'exception': exception});
-        return null;
-      }
+      });
+    }
+
+    Uri resourceUri = translateUri(readableUri, node);
+    // TODO(johnniwinther): Wrap the result from [provider] in a specialized
+    // [Future] to ensure that we never execute an asynchronous action without setting
+    // up the current element of the compiler.
+    return new Future.sync(() => provider(resourceUri)).then((String text) {
       SourceFile sourceFile = new SourceFile(resourceUri.toString(), text);
       // We use [readableUri] as the URI for the script since need to preserve
       // the scheme in the script because [Script.uri] is used for resolving
       // relative URIs mentioned in the script. See the comment on
       // [LibraryLoader] for more details.
       return new leg.Script(readableUri, sourceFile);
+    }).catchError((error) {
+      reportReadError(error);
+      return null;
     });
   }
 
@@ -254,18 +259,19 @@
     return packageRoot.resolve(uri.path);
   }
 
-  bool run(Uri uri) {
+  Future<bool> run(Uri uri) {
     log('Allowed library categories: $allowedLibraryCategories');
-    bool success = super.run(uri);
-    int cumulated = 0;
-    for (final task in tasks) {
-      cumulated += task.timing;
-      log('${task.name} took ${task.timing}msec');
-    }
-    int total = totalCompileTime.elapsedMilliseconds;
-    log('Total compile-time ${total}msec;'
-        ' unaccounted ${total - cumulated}msec');
-    return success;
+    return super.run(uri).then((bool success) {
+      int cumulated = 0;
+      for (final task in tasks) {
+        cumulated += task.timing;
+        log('${task.name} took ${task.timing}msec');
+      }
+      int total = totalCompileTime.elapsedMilliseconds;
+      log('Total compile-time ${total}msec;'
+          ' unaccounted ${total - cumulated}msec');
+      return success;
+    });
   }
 
   void reportDiagnostic(leg.SourceSpan span, String message,
diff --git a/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart b/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
index 89e783b..4d43a2a 100644
--- a/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
+++ b/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
@@ -475,6 +475,16 @@
     return constantSystem.createString(accumulator, node);
   }
 
+  Constant visitLiteralSymbol(LiteralSymbol node) {
+    InterfaceType type = compiler.symbolClass.computeType(compiler);
+    List<Constant> createArguments(_) {
+      return [constantSystem.createString(
+        new DartString.literal(node.slowNameString), node)];
+    }
+    return makeConstructedConstant(
+        node, type, compiler.symbolConstructor, createArguments);
+  }
+
   Constant makeTypeConstant(Element element) {
     DartType elementType = element.computeType(compiler).asRaw();
     compiler.backend.registerTypeLiteral(element, elements);
@@ -687,6 +697,17 @@
     compiler.analyzeElement(constructor.declaration);
 
     InterfaceType type = elements.getType(node);
+    List<Constant> evaluateArguments(FunctionElement constructor) {
+      Selector selector = elements.getSelector(send);
+      return evaluateArgumentsToConstructor(
+          node, selector, send.arguments, constructor);
+    }
+    return makeConstructedConstant(node, type, constructor, evaluateArguments);
+  }
+
+  Constant makeConstructedConstant(
+      Node node, InterfaceType type, FunctionElement constructor,
+      List<Constant> getArguments(FunctionElement constructor)) {
     if (constructor.isRedirectingFactory) {
       type = constructor.computeTargetType(compiler, type);
     }
@@ -698,9 +719,7 @@
     constructor = constructor.implementation;
     assert(invariant(node, constructor.isImplementation));
 
-    Selector selector = elements.getSelector(send);
-    List<Constant> arguments = evaluateArgumentsToConstructor(
-        node, selector, send.arguments, constructor);
+    List<Constant> arguments = getArguments(constructor);
     ConstructorEvaluator evaluator =
         new ConstructorEvaluator(constructor, handler, compiler);
     evaluator.evaluateConstructorFieldValues(arguments);
diff --git a/sdk/lib/_internal/compiler/implementation/compiler.dart b/sdk/lib/_internal/compiler/implementation/compiler.dart
index 7e543d0..fe2403e 100644
--- a/sdk/lib/_internal/compiler/implementation/compiler.dart
+++ b/sdk/lib/_internal/compiler/implementation/compiler.dart
@@ -36,7 +36,6 @@
     assert(invariant(element, element.isDeclaration));
   }
 
-
   void run(Compiler compiler, Enqueuer world);
 }
 
@@ -81,11 +80,6 @@
   PostProcessTask(this.element, this.action);
 }
 
-class ReadingFilesTask extends CompilerTask {
-  ReadingFilesTask(Compiler compiler) : super(compiler);
-  String get name => 'Reading input files';
-}
-
 abstract class Backend {
   final Compiler compiler;
   final ConstantSystem constantSystem;
@@ -224,6 +218,8 @@
 
   void registerConstSymbol(String name, TreeElements elements) {}
   void registerNewSymbol(TreeElements elements) {}
+  /// Called when resolving the `Symbol` constructor.
+  void registerSymbolConstructor(TreeElements elements) {}
 
   bool isNullImplementation(ClassElement cls) {
     return cls == compiler.nullClass;
@@ -253,7 +249,9 @@
 
   void registerStaticUse(Element element, Enqueuer enqueuer) {}
 
-  void onLibraryLoaded(LibraryElement library, Uri uri) {}
+  Future onLibraryLoaded(LibraryElement library, Uri uri) {
+    return new Future.value();
+  }
 
   void registerMetadataInstantiatedType(DartType type, TreeElements elements) {}
   void registerMetadataStaticUse(Element element) {}
@@ -427,7 +425,7 @@
   ClassElement stackTraceClass;
   ClassElement typedDataClass;
 
-  // Initialized after mirrorSystemClass has been resolved.
+  // Initialized after symbolClass has been resolved.
   FunctionElement symbolConstructor;
 
   // Initialized when dart:mirrors is loaded.
@@ -512,7 +510,6 @@
   ConstantHandler constantHandler;
   ConstantHandler metadataHandler;
   EnqueueTask enqueuer;
-  CompilerTask fileReadingTask;
   DeferredLoadTask deferredLoadTask;
   MirrorUsageAnalyzerTask mirrorUsageAnalyzerTask;
   ContainerTracer containerTracer;
@@ -614,7 +611,6 @@
     validator = new TreeValidatorTask(this);
 
     tasks = [
-      fileReadingTask = new ReadingFilesTask(this),
       libraryLoader = new LibraryLoaderTask(this),
       scanner = new ScannerTask(this),
       dietParser = new DietParserTask(this),
@@ -731,14 +727,15 @@
     reportDiagnostic(null, message, api.Diagnostic.VERBOSE_INFO);
   }
 
-  bool run(Uri uri) {
+  Future<bool> run(Uri uri) {
     totalCompileTime.start();
-    try {
-      runCompiler(uri);
-    } on CompilerCancelledException catch (exception) {
-      log('Error: $exception');
-      return false;
-    } catch (exception) {
+
+    return new Future.sync(() => runCompiler(uri)).catchError((error) {
+      if (error is CompilerCancelledException) {
+        log('Error: $error');
+        return false;
+      }
+
       try {
         if (!hasCrashed) {
           hasCrashed = true;
@@ -750,12 +747,13 @@
       } catch (doubleFault) {
         // Ignoring exceptions in exception handling.
       }
-      rethrow;
-    } finally {
+      throw error;
+    }).whenComplete(() {
       tracer.close();
       totalCompileTime.stop();
-    }
-    return !compilationFailed;
+    }).then((_) {
+      return !compilationFailed;
+    });
   }
 
   bool hasIsolateSupport() => isolateLibrary != null;
@@ -764,7 +762,7 @@
    * This method is called before [library] import and export scopes have been
    * set up.
    */
-  void onLibraryLoaded(LibraryElement library, Uri uri) {
+  Future onLibraryLoaded(LibraryElement library, Uri uri) {
     if (dynamicClass != null) {
       // When loading the built-in libraries, dynamicClass is null. We
       // take advantage of this as core imports js_helper and sees [dynamic]
@@ -791,12 +789,12 @@
           findRequiredElement(library, const SourceString('DeferredLibrary'));
     } else if (isolateHelperLibrary == null
 	       && (uri == new Uri(scheme: 'dart', path: '_isolate_helper'))) {
-      isolateHelperLibrary = scanBuiltinLibrary('_isolate_helper');
+      isolateHelperLibrary = library;
     } else if (foreignLibrary == null
 	       && (uri == new Uri(scheme: 'dart', path: '_foreign_helper'))) {
-      foreignLibrary = scanBuiltinLibrary('_foreign_helper');
+      foreignLibrary = library;
     }
-    backend.onLibraryLoaded(library, uri);
+    return backend.onLibraryLoaded(library, uri);
   }
 
   Element findRequiredElement(LibraryElement library, SourceString name) {
@@ -824,7 +822,7 @@
     }
   }
 
-  LibraryElement scanBuiltinLibrary(String filename);
+  Future<LibraryElement> scanBuiltinLibrary(String filename);
 
   void initializeSpecialClasses() {
     final List missingCoreClasses = [];
@@ -902,26 +900,32 @@
         listClass.lookupConstructor(callConstructor);
   }
 
-  void scanBuiltinLibraries() {
-    jsHelperLibrary = scanBuiltinLibrary('_js_helper');
-    interceptorsLibrary = scanBuiltinLibrary('_interceptors');
-    assertMethod = jsHelperLibrary.find(const SourceString('assertHelper'));
-    identicalFunction = coreLibrary.find(const SourceString('identical'));
+  Future scanBuiltinLibraries() {
+    return scanBuiltinLibrary('_js_helper').then((LibraryElement library) {
+      jsHelperLibrary = library;
+      return scanBuiltinLibrary('_interceptors');
+    }).then((LibraryElement library) {
+      interceptorsLibrary = library;
 
-    initializeSpecialClasses();
+      assertMethod = jsHelperLibrary.find(const SourceString('assertHelper'));
+      identicalFunction = coreLibrary.find(const SourceString('identical'));
 
-    functionClass.ensureResolved(this);
-    functionApplyMethod =
-        functionClass.lookupLocalMember(const SourceString('apply'));
-    jsInvocationMirrorClass.ensureResolved(this);
-    invokeOnMethod = jsInvocationMirrorClass.lookupLocalMember(INVOKE_ON);
+      initializeSpecialClasses();
 
-    if (preserveComments) {
-      var uri = new Uri(scheme: 'dart', path: 'mirrors');
-      LibraryElement libraryElement =
-          libraryLoader.loadLibrary(uri, null, uri);
-      documentClass = libraryElement.find(const SourceString('Comment'));
-    }
+      functionClass.ensureResolved(this);
+      functionApplyMethod =
+          functionClass.lookupLocalMember(const SourceString('apply'));
+      jsInvocationMirrorClass.ensureResolved(this);
+      invokeOnMethod = jsInvocationMirrorClass.lookupLocalMember(INVOKE_ON);
+
+      if (preserveComments) {
+        var uri = new Uri(scheme: 'dart', path: 'mirrors');
+        return libraryLoader.loadLibrary(uri, null, uri).then(
+            (LibraryElement libraryElement) {
+          documentClass = libraryElement.find(const SourceString('Comment'));
+        });
+      }
+    });
   }
 
   void importHelperLibrary(LibraryElement library) {
@@ -936,28 +940,39 @@
    */
   Uri resolvePatchUri(String dartLibraryPath);
 
-  void runCompiler(Uri uri) {
+  Future runCompiler(Uri uri) {
     // TODO(ahe): This prevents memory leaks when invoking the compiler
     // multiple times.  Implement a better mechanism where StringWrapper
     // instances are shared on a per library basis.
     SourceString.canonicalizedValues.clear();
 
     assert(uri != null || analyzeOnly);
-    scanBuiltinLibraries();
-    if (librariesToAnalyzeWhenRun != null) {
-      for (Uri libraryUri in librariesToAnalyzeWhenRun) {
-        log('analyzing $libraryUri ($buildId)');
-        libraryLoader.loadLibrary(libraryUri, null, libraryUri);
+    return scanBuiltinLibraries().then((_) {
+      if (librariesToAnalyzeWhenRun != null) {
+        return Future.forEach(librariesToAnalyzeWhenRun, (libraryUri) {
+          log('analyzing $libraryUri ($buildId)');
+          return libraryLoader.loadLibrary(libraryUri, null, libraryUri);
+        });
       }
-    }
-    if (uri != null) {
-      if (analyzeOnly) {
-        log('analyzing $uri ($buildId)');
-      } else {
-        log('compiling $uri ($buildId)');
+    }).then((_) {
+      if (uri != null) {
+        if (analyzeOnly) {
+          log('analyzing $uri ($buildId)');
+        } else {
+          log('compiling $uri ($buildId)');
+        }
+        return libraryLoader.loadLibrary(uri, null, uri)
+            .then((LibraryElement library) {
+          mainApp = library;
+        });
       }
-      mainApp = libraryLoader.loadLibrary(uri, null, uri);
-    }
+    }).then((_) {
+      compileLoadedLibraries();
+    });
+  }
+
+  /// Performs the compilation when all libraries have been loaded.
+  void compileLoadedLibraries() {
     Element main = null;
     if (mainApp != null) {
       main = mainApp.find(MAIN);
@@ -973,8 +988,8 @@
               mainApp,
               MessageKind.GENERIC,
               {'text': 'Error: Could not find "${MAIN.slowToString()}". '
-                  'No source will be analyzed. '
-                  'Use "--analyze-all" to analyze all code in the library.'});
+              'No source will be analyzed. '
+              'Use "--analyze-all" to analyze all code in the library.'});
         }
       } else {
         if (!main.isFunction()) {
@@ -990,7 +1005,7 @@
               parameter,
               MessageKind.GENERIC,
               {'text':
-                  'Error: "${MAIN.slowToString()}" cannot have parameters.'});
+                'Error: "${MAIN.slowToString()}" cannot have parameters.'});
         });
       }
 
@@ -1046,7 +1061,8 @@
       backend.enableNoSuchMethod(enqueuer.codegen);
     }
     if (compileAll) {
-      libraries.forEach((_, lib) => fullyEnqueueLibrary(lib, enqueuer.codegen));
+      libraries.forEach((_, lib) => fullyEnqueueLibrary(lib,
+          enqueuer.codegen));
     }
     processQueue(enqueuer.codegen, main);
     enqueuer.codegen.logSummary(log);
@@ -1373,7 +1389,7 @@
    *
    * See [LibraryLoader] for terminology on URIs.
    */
-  Script readScript(Uri readableUri, [Node node]) {
+  Future<Script> readScript(Uri readableUri, [Element element, Node node]) {
     unimplemented('Compiler.readScript');
   }
 
@@ -1517,10 +1533,14 @@
 bool invariant(Spannable spannable, var condition, {var message: null}) {
   // TODO(johnniwinther): Use [spannable] and [message] to provide better
   // information on assertion errors.
+  if (spannable == null) {
+    throw new SpannableAssertionFailure(CURRENT_ELEMENT_SPANNABLE,
+        "Spannable was null for invariant. Use CURRENT_ELEMENT_SPANNABLE.");
+  }
   if (condition is Function){
     condition = condition();
   }
-  if (spannable == null || !condition) {
+  if (!condition) {
     if (message is Function) {
       message = message();
     }
diff --git a/sdk/lib/_internal/compiler/implementation/dart2js.dart b/sdk/lib/_internal/compiler/implementation/dart2js.dart
index 6b24057..d4dfd77 100644
--- a/sdk/lib/_internal/compiler/implementation/dart2js.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart2js.dart
@@ -91,7 +91,7 @@
   }
 }
 
-void compile(List<String> argv) {
+Future compile(List<String> argv) {
   bool isWindows = (Platform.operatingSystem == 'windows');
   stackTraceFilePrefix = '$currentDirectory';
   Uri libraryRoot = currentDirectory;
@@ -105,6 +105,7 @@
   String outputLanguage = 'JavaScript';
   bool stripArgumentSet = false;
   bool analyzeOnly = false;
+  // TODO(johnniwinther): Measure time for reading files.
   SourceFileProvider inputProvider = new SourceFileProvider();
   FormattingDiagnosticHandler diagnosticHandler =
       new FormattingDiagnosticHandler(inputProvider);
@@ -287,11 +288,6 @@
     helpAndFail('Error: Extra arguments: ${extra.join(" ")}');
   }
 
-  void handler(Uri uri, int begin, int end, String message,
-               api.Diagnostic kind) {
-    diagnosticHandler.diagnosticHandler(uri, begin, end, message, kind);
-  }
-
   Uri uri = currentDirectory.resolve(arguments[0]);
   if (packageRoot == null) {
     packageRoot = uri.resolve('./packages/');
@@ -386,10 +382,10 @@
     return new EventSinkWrapper(writeStringSync, onDone);
   }
 
-  api.compile(uri, libraryRoot, packageRoot,
-              inputProvider.readStringFromUri, handler,
+  return api.compile(uri, libraryRoot, packageRoot,
+              inputProvider, diagnosticHandler,
               options, outputProvider)
-      .then(compilationDone);
+            .then(compilationDone);
 }
 
 class EventSinkWrapper extends EventSink<String> {
@@ -424,11 +420,11 @@
   exit(1);
 }
 
-void compilerMain(Options options) {
+Future compilerMain(Options options) {
   var root = uriPathToNative("/$LIBRARY_ROOT");
   List<String> argv = ['--library-root=${options.script}$root'];
   argv.addAll(options.arguments);
-  compile(argv);
+  return compile(argv);
 }
 
 void help() {
@@ -566,20 +562,22 @@
 }
 
 void mainWithErrorHandler(Options options) {
-  try {
-    compilerMain(options);
-  } catch (exception, trace) {
+  new Future.sync(() => compilerMain(options)).catchError((exception) {
     try {
       print('Internal error: $exception');
     } catch (ignored) {
       print('Internal error: error while printing exception');
     }
+
     try {
-      print(trace);
+      var trace = getAttachedStackTrace(exception);
+      if (trace != null) {
+        print(trace);
+      }
     } finally {
       exit(253); // 253 is recognized as a crash by our test scripts.
     }
-  }
+  });
 }
 
 void main() {
diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
index aaab842..13a21595 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
@@ -505,15 +505,19 @@
 
   log(String message) => compiler.log('[DartBackend] $message');
 
-  void onLibraryLoaded(LibraryElement library, Uri uri) {
+  Future onLibraryLoaded(LibraryElement library, Uri uri) {
     if (useMirrorHelperLibrary && library == compiler.mirrorsLibrary) {
-      mirrorHelperLibrary = compiler.scanBuiltinLibrary(
-          MirrorRenamer.MIRROR_HELPER_LIBRARY_NAME);
-      mirrorHelperGetNameFunction = mirrorHelperLibrary.find(
-          const SourceString(MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION));
-      mirrorHelperSymbolsMap = mirrorHelperLibrary.find(
-          const SourceString(MirrorRenamer.MIRROR_HELPER_SYMBOLS_MAP_NAME));
+      return compiler.scanBuiltinLibrary(
+          MirrorRenamer.MIRROR_HELPER_LIBRARY_NAME).
+          then((LibraryElement element) {
+        mirrorHelperLibrary = element;
+        mirrorHelperGetNameFunction = mirrorHelperLibrary.find(
+            const SourceString(MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION));
+        mirrorHelperSymbolsMap = mirrorHelperLibrary.find(
+            const SourceString(MirrorRenamer.MIRROR_HELPER_SYMBOLS_MAP_NAME));
+      });
     }
+    return new Future.value();
   }
 
   void registerStaticSend(Element element, Node node) {
diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/dart_backend.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/dart_backend.dart
index 29d4b4d..a4410d4 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/dart_backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/dart_backend.dart
@@ -4,6 +4,7 @@
 
 library dart_backend;
 
+import 'dart:async' show Future;
 import '../elements/elements.dart';
 import '../elements/modelx.dart' show SynthesizedConstructorElementX;
 import '../dart2jslib.dart';
diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/utils.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/utils.dart
index 61bad39..57ee07a 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/utils.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/utils.dart
@@ -193,6 +193,9 @@
       visit(node.parenthesizedExpression), visit(node.cases),
       node.switchKeyword);
 
+  visitLiteralSymbol(LiteralSymbol node) => new LiteralSymbol(
+      node.hashToken, visit(node.identifiers));
+
   visitThrow(Throw node) => new Throw(
       visit(node.expression), node.throwToken, node.endToken);
 
diff --git a/sdk/lib/_internal/compiler/implementation/dart_types.dart b/sdk/lib/_internal/compiler/implementation/dart_types.dart
index f7a4385..f301f9b 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_types.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_types.dart
@@ -1193,6 +1193,150 @@
     if (typeVariable == null) return null;
     return typeVariable.element.enclosingElement;
   }
+
+  /**
+   * A `compareTo` function that globally orders types using
+   * [Elements.compareByPosition] to order types defined by a declaration.
+   *
+   * The order is:
+   * * void
+   * * dynamic
+   * * interface, typedef, type variables ordered by element order
+   *   - interface and typedef of the same element are ordered by
+   *     the order of their type arguments
+   * * function types, ordered by
+   *   - return type
+   *   - required parameter types
+   *   - optional parameter types
+   *   - named parameter names
+   *   - named parameter types
+   * * malformed types
+   * * statement types
+   */
+  static int compare(DartType a, DartType b) {
+    if (a == b) return 0;
+    if (a.kind == TypeKind.VOID) {
+      // [b] is not void => a < b.
+      return -1;
+    } else if (b.kind == TypeKind.VOID) {
+      // [a] is not void => a > b.
+      return 1;
+    }
+    if (a.isDynamic) {
+      // [b] is not dynamic => a < b.
+      return -1;
+    } else if (b.isDynamic) {
+      // [a] is not dynamic => a > b.
+      return 1;
+    }
+    bool isDefinedByDeclaration(DartType type) {
+      return type.kind == TypeKind.INTERFACE ||
+             type.kind == TypeKind.TYPEDEF ||
+             type.kind == TypeKind.TYPE_VARIABLE;
+    }
+
+    if (isDefinedByDeclaration(a)) {
+      if (isDefinedByDeclaration(b)) {
+        int result = Elements.compareByPosition(a.element, b.element);
+        if (result != 0) return result;
+        if (a.kind == TypeKind.TYPE_VARIABLE) {
+          return b.kind == TypeKind.TYPE_VARIABLE
+              ? 0
+              : 1; // [b] is not a type variable => a > b.
+        } else {
+          if (b.kind == TypeKind.TYPE_VARIABLE) {
+            // [a] is not a type variable => a < b.
+            return -1;
+          } else {
+            return compareList((a as GenericType).typeArguments,
+                               (b as GenericType).typeArguments);
+          }
+        }
+      } else {
+        // [b] is neither an interface, typedef, type variable, dynamic,
+        // nor void => a < b.
+        return -1;
+      }
+    } else if (isDefinedByDeclaration(b)) {
+      // [a] is neither an interface, typedef, type variable, dynamic,
+      // nor void => a > b.
+      return 1;
+    }
+    if (a.kind == TypeKind.FUNCTION) {
+      if (b.kind == TypeKind.FUNCTION) {
+        FunctionType aFunc = a;
+        FunctionType bFunc = b;
+        int result = compare(aFunc.returnType, bFunc.returnType);
+        if (result != 0) return result;
+        result = compareList(aFunc.parameterTypes, bFunc.parameterTypes);
+        if (result != 0) return result;
+        result = compareList(aFunc.optionalParameterTypes,
+                             bFunc.optionalParameterTypes);
+        if (result != 0) return result;
+        Link<SourceString> aNames = aFunc.namedParameters;
+        Link<SourceString> bNames = bFunc.namedParameters;
+        while (!aNames.isEmpty && !bNames.isEmpty) {
+          int result = aNames.head.slowToString().compareTo(
+                       bNames.head.slowToString());
+          if (result != 0) return result;
+          aNames = aNames.tail;
+          bNames = bNames.tail;
+        }
+        if (!aNames.isEmpty) {
+          // [aNames] is longer that [bNames] => a > b.
+          return 1;
+        } else if (!bNames.isEmpty) {
+          // [bNames] is longer that [aNames] => a < b.
+          return -1;
+        }
+        return compareList(aFunc.namedParameterTypes,
+                           bFunc.namedParameterTypes);
+      } else {
+        // [b] is a malformed or statement type => a < b.
+        return -1;
+      }
+    } else if (b.kind == TypeKind.FUNCTION) {
+      // [b] is a malformed or statement type => a > b.
+      return 1;
+    }
+    if (a.kind == TypeKind.STATEMENT) {
+      if (b.kind == TypeKind.STATEMENT) {
+        return (a as StatementType).stringName.compareTo(
+               (b as StatementType).stringName);
+      } else {
+        // [b] is a malformed type => a > b.
+        return 1;
+      }
+    } else if (b.kind == TypeKind.STATEMENT) {
+      // [a] is a malformed type => a < b.
+      return -1;
+    }
+    assert (a.kind == TypeKind.MALFORMED_TYPE);
+    assert (b.kind == TypeKind.MALFORMED_TYPE);
+    // TODO(johnniwinther): Can we do this better?
+    return Elements.compareByPosition(a.element, b.element);
+  }
+
+  static int compareList(Link<DartType> a, Link<DartType> b) {
+    while (!a.isEmpty && !b.isEmpty) {
+      int result = compare(a.head, b.head);
+      if (result != 0) return result;
+      a = a.tail;
+      b = b.tail;
+    }
+    if (!a.isEmpty) {
+      // [a] is longer than [b] => a > b.
+      return 1;
+    } else if (!b.isEmpty) {
+      // [b] is longer than [a] => a < b.
+      return -1;
+    }
+    return 0;
+  }
+
+  static List<DartType> sorted(Iterable<DartType> types) {
+    return types.toList()..sort(compare);
+  }
 }
 
 /**
diff --git a/sdk/lib/_internal/compiler/implementation/deferred_load.dart b/sdk/lib/_internal/compiler/implementation/deferred_load.dart
index 4ecf03f..bba00f6 100644
--- a/sdk/lib/_internal/compiler/implementation/deferred_load.dart
+++ b/sdk/lib/_internal/compiler/implementation/deferred_load.dart
@@ -47,8 +47,6 @@
   /// should become obsolete.
   final Set<Element> allDeferredElements = new LinkedHashSet<Element>();
 
-  ClassElement cachedDeferredLibraryClass;
-
   DeferredLoadTask(Compiler compiler) : super(compiler);
 
   String get name => 'Deferred Loading';
diff --git a/sdk/lib/_internal/compiler/implementation/elements/elements.dart b/sdk/lib/_internal/compiler/implementation/elements/elements.dart
index 65a4c56..cf456b6 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/elements.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/elements.dart
@@ -495,6 +495,7 @@
   /// A `compareTo` function that places [Element]s in a consistent order based
   /// on the source code order.
   static int compareByPosition(Element a, Element b) {
+    if (identical(a, b)) return 0;
     int r = a.getLibrary().compareTo(b.getLibrary());
     if (r != 0) return r;
     r = a.getCompilationUnit().compareTo(b.getCompilationUnit());
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
index a067322..e834e1a 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
@@ -341,6 +341,9 @@
   /// List of elements that the backend may use.
   final Set<Element> helpersUsed = new Set<Element>();
 
+  /// Set of typedefs that are used as type literals.
+  final Set<TypedefElement> typedefTypeLiterals = new Set<TypedefElement>();
+
   JavaScriptBackend(Compiler compiler, bool generateSourceMap, bool disableEval)
       : namer = determineNamer(compiler),
         oneShotInterceptors = new Map<String, Selector>(),
@@ -366,6 +369,7 @@
     if (element.isParameter()
         || element.isFieldParameter()
         || element.isField()) {
+      if (hasInsufficientMirrorsUsed && compiler.enabledInvokeOn) return false;
       if (!canBeUsedForGlobalOptimizations(element.enclosingElement)) {
         return false;
       }
@@ -809,6 +813,9 @@
     // TODO(ahe): Might want to register [element] as an instantiated class
     // when reflection is used.  However, as long as we disable tree-shaking
     // eagerly it doesn't matter.
+    if (element.isTypedef()) {
+      typedefTypeLiterals.add(element);
+    }
   }
 
   void registerStackTraceInCatch(TreeElements elements) {
@@ -1462,6 +1469,13 @@
   void registerNewSymbol(TreeElements elements) {
   }
 
+  /// Called when resolving the `Symbol` constructor.
+  void registerSymbolConstructor(TreeElements elements) {
+    // Make sure that collection_dev.Symbol.validated is registered.
+    assert(compiler.symbolValidatedConstructor != null);
+    enqueueInResolution(compiler.symbolValidatedConstructor, elements);
+  }
+
   /// Should [element] (a getter) be retained for reflection?
   bool shouldRetainGetter(Element element) => isNeededForReflection(element);
 
@@ -1489,7 +1503,7 @@
     return false;
   }
 
-  void onLibraryLoaded(LibraryElement library, Uri uri) {
+  Future onLibraryLoaded(LibraryElement library, Uri uri) {
     if (uri == Uri.parse('dart:_js_mirrors')) {
       disableTreeShakingMarker =
           library.find(const SourceString('disableTreeShaking'));
@@ -1499,6 +1513,7 @@
       preserveNamesMarker =
           library.find(const SourceString('preserveNames'));
     }
+    return new Future.value();
   }
 
   void registerMetadataInstantiatedType(DartType type, TreeElements elements) {
@@ -1607,9 +1622,7 @@
 
   jsAst.Call generateIsJsIndexableCall(jsAst.Expression use1,
                                        jsAst.Expression use2) {
-    Element dispatchProperty =
-        compiler.findInterceptor(const SourceString('dispatchPropertyName'));
-    String dispatchPropertyName = namer.isolateAccess(dispatchProperty);
+    String dispatchPropertyName = 'init.dispatchPropertyName';
 
     // We pass the dispatch property record to the isJsIndexable
     // helper rather than reading it inside the helper to increase the
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
index 2b3fe3a..3118874 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -339,9 +339,9 @@
           js('var body = "return " + receiver + "." + field'),
           js('prototype["${namer.getterPrefix}" + accessorName] = '
                  'new Function(args, body)'),
-          js.if_('!reflectable', [
+          js.if_('reflectable', [
                  js('prototype["${namer.getterPrefix}" + accessorName].'
-                    '$reflectableField = false')])
+                    '$reflectableField = 1')])
         ]),
 
         // if (needsSetter) {
@@ -353,9 +353,9 @@
           js('var body = receiver + "." + field + "$_=$_$valueParamName"'),
           js('prototype["${namer.setterPrefix}" + accessorName] = '
                  'new Function(args, body)'),
-          js.if_('!reflectable', [
+          js.if_('reflectable', [
                  js('prototype["${namer.setterPrefix}" + accessorName].'
-                    '$reflectableField = false')])
+                    '$reflectableField = 1')])
         ]),
 
       ]),
@@ -1653,6 +1653,21 @@
     }
   }
 
+  void generateReflectionDataForFieldGetterOrSetter(Element member,
+                                                    String name,
+                                                    ClassBuilder builder,
+                                                    {bool isGetter}) {
+    Selector selector = isGetter
+        ? new Selector.getter(member.name, member.getLibrary())
+        : new Selector.setter(member.name, member.getLibrary());
+    String reflectionName = getReflectionName(selector, name);
+    if (reflectionName != null) {
+      var reflectable =
+          js(backend.isAccessibleByReflection(member) ? '1' : '0');
+      builder.addProperty('+$reflectionName', reflectable);
+    }
+  }
+
   void generateGetter(Element member, String fieldName, String accessorName,
                       ClassBuilder builder) {
     String getterName = namer.getterNameFromAccessorName(accessorName);
@@ -1663,6 +1678,8 @@
         : [];
     builder.addProperty(getterName,
         js.fun(args, js.return_(js('$receiver.$fieldName'))));
+    generateReflectionDataForFieldGetterOrSetter(
+        member, getterName, builder, isGetter: true);
   }
 
   void generateSetter(Element member, String fieldName, String accessorName,
@@ -1675,6 +1692,8 @@
         : ['v'];
     builder.addProperty(setterName,
         js.fun(args, js('$receiver.$fieldName = v')));
+    generateReflectionDataForFieldGetterOrSetter(
+        member, setterName, builder, isGetter: false);
   }
 
   bool canGenerateCheckedSetter(VariableElement field) {
@@ -1720,6 +1739,8 @@
     builder.addProperty(setterName,
         js.fun(args,
             js('$receiver.$fieldName = #', js(helperName)(arguments))));
+    generateReflectionDataForFieldGetterOrSetter(
+        member, setterName, builder, isGetter: false);
   }
 
   void emitClassConstructor(ClassElement classElement, ClassBuilder builder) {
@@ -2006,8 +2027,8 @@
     }
     buffer.write('$className:$_');
     buffer.write(jsAst.prettyPrint(builder.toObjectInitializer(), compiler));
-    if (backend.shouldRetainName(classElement.name)) {
-      String reflectionName = getReflectionName(classElement, className);
+    String reflectionName = getReflectionName(classElement, className);
+    if (reflectionName != null) {
       List<int> interfaces = <int>[];
       for (DartType interface in classElement.interfaces) {
         interfaces.add(reifyType(interface));
@@ -2880,8 +2901,10 @@
 
       String methodName = selector.invocationMirrorMemberName;
       String internalName = namer.invocationMirrorInternalName(selector);
+      String reflectionName = getReflectionName(selector, internalName);
       if (!haveVeryFewNoSuchMemberHandlers &&
-          isTrivialNsmHandler(type, argNames, selector, internalName)) {
+          isTrivialNsmHandler(type, argNames, selector, internalName) &&
+          reflectionName == null) {
         trivialNsmHandlers.add(selector);
         return null;
       }
@@ -2909,7 +2932,15 @@
     for (String jsName in addedJsNames.keys.toList()..sort()) {
       Selector selector = addedJsNames[jsName];
       jsAst.Expression method = generateMethod(jsName, selector);
-      if (method != null) defineStub(jsName, method);
+      if (method != null) {
+        defineStub(jsName, method);
+        String reflectionName = getReflectionName(selector, jsName);
+        if (reflectionName != null) {
+          bool accessible = compiler.world.allFunctions.filter(selector).any(
+              (Element e) => backend.isAccessibleByReflection(e));
+          defineStub('+$reflectionName', js(accessible ? '1' : '0'));
+        }
+      }
     }
   }
 
@@ -3661,7 +3692,19 @@
   }
 
   void emitMetadata(CodeBuffer buffer) {
-    buffer.write('init.metadata$_=$_[');
+    var literals = backend.typedefTypeLiterals.toList();
+    Elements.sortedByPosition(literals);
+    var properties = [];
+    for (TypedefElement literal in literals) {
+      var key = namer.getName(literal);
+      var value = js.toExpression(reifyType(literal.rawType));
+      properties.add(new jsAst.Property(js.string(key), value));
+    }
+    var map = new jsAst.ObjectInitializer(properties);
+    buffer.write(
+        jsAst.prettyPrint(
+            js('init.functionAliases = #', map).toStatement(), compiler));
+    buffer.write('${N}init.metadata$_=$_[');
     for (var metadata in globalMetadata) {
       if (metadata is String) {
         if (metadata != 'null') {
@@ -4111,8 +4154,8 @@
         var previousProperty;
         if (firstChar === "+") {
           mangledGlobalNames[previousProperty] = property.substring(1);
-          descriptor[previousProperty].''' // Break long line.
-'''$reflectableField = (descriptor[property] == 1);
+          if (descriptor[property] == 1) ''' // Break long line.
+'''descriptor[previousProperty].$reflectableField = 1;
           if (element && element.length) ''' // Break long line.
 '''init.interfaces[previousProperty] = element;
         } else if (firstChar === "@") {
@@ -4132,8 +4175,8 @@
               processStatics(init.statics[property] = element[prop]);
             } else if (firstChar === "+") {
               mangledNames[previousProp] = prop.substring(1);
-              element[previousProp].''' // Break long line.
-'''$reflectableField = (element[prop] == 1);
+              if (element[prop] == 1) ''' // Break long line.
+'''element[previousProp].$reflectableField = 1;
             } else if (firstChar === "@" && prop !== "@") {
               newDesc[prop.substring(1)][$metadataField] = element[prop];
             } else {
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart
index 325ad0a..ff65688 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart
@@ -34,13 +34,13 @@
   }
 
 
-  bool emitFields(ClassElement classElement,
+  bool emitFields(Element element,
                   ClassBuilder builder,
                   String superName,
                   { bool classIsNative: false,
                     bool emitStatics: false,
                     bool onlyForRti: false }) {
-    // Class fields are dynamically generated so they have to be
+    // Class and library fields are dynamically generated so they have to be
     // emitted using getters and setters instead.
     return false;
   }
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/js_backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/js_backend.dart
index 4f7b499..2d9888b 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/js_backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/js_backend.dart
@@ -4,6 +4,7 @@
 
 library js_backend;
 
+import 'dart:async' show Future;
 import 'dart:collection' show LinkedHashMap, Queue;
 
 import '../closure.dart';
diff --git a/sdk/lib/_internal/compiler/implementation/library_loader.dart b/sdk/lib/_internal/compiler/implementation/library_loader.dart
index 55031d2..3c515a1 100644
--- a/sdk/lib/_internal/compiler/implementation/library_loader.dart
+++ b/sdk/lib/_internal/compiler/implementation/library_loader.dart
@@ -113,12 +113,13 @@
    */
   // TODO(johnniwinther): Remove [canonicalUri] together with
   // [Compiler.scanBuiltinLibrary].
-  LibraryElement loadLibrary(Uri resolvedUri, Node node, Uri canonicalUri);
+  Future<LibraryElement> loadLibrary(Uri resolvedUri, Node node,
+                                     Uri canonicalUri);
 
   // TODO(johnniwinther): Remove this when patches don't need special parsing.
-  void registerLibraryFromTag(LibraryDependencyHandler handler,
-                              LibraryElement library,
-                              LibraryDependency tag);
+  Future registerLibraryFromTag(LibraryDependencyHandler handler,
+                                LibraryElement library,
+                                LibraryDependency tag);
 
   /**
    * Adds the elements in the export scope of [importedLibrary] to the import
@@ -227,18 +228,25 @@
 
   LibraryDependencyHandler currentHandler;
 
-  LibraryElement loadLibrary(Uri resolvedUri, Node node, Uri canonicalUri) {
+  Future<LibraryElement> loadLibrary(Uri resolvedUri, Node node,
+      Uri canonicalUri) {
     return measure(() {
       assert(currentHandler == null);
+      // TODO(johnniwinther): Ensure that currentHandler correctly encloses the
+      // loading of a library cluster.
       currentHandler = new LibraryDependencyHandler(compiler);
-      LibraryElement library =
-          createLibrary(currentHandler, null, resolvedUri, node, canonicalUri);
-      currentHandler.computeExports();
-      currentHandler = null;
-      var workList = onLibraryLoadedCallbacks;
-      onLibraryLoadedCallbacks = [];
-      workList.forEach((f) => f());
-      return library;
+      return createLibrary(currentHandler, null, resolvedUri, node,
+          canonicalUri).then((LibraryElement library) {
+        return compiler.withCurrentElement(library, () {
+          return measure(() {
+            currentHandler.computeExports();
+            currentHandler = null;
+            var workList = onLibraryLoadedCallbacks;
+            onLibraryLoadedCallbacks = [];
+            return Future.forEach(workList, (f) => f()).then((_) => library);
+          });
+        });
+      });
     });
   }
 
@@ -248,8 +256,8 @@
    * The imported/exported libraries are loaded and processed recursively but
    * the import/export scopes are not set up.
    */
-  void processLibraryTags(LibraryDependencyHandler handler,
-                          LibraryElement library) {
+  Future processLibraryTags(LibraryDependencyHandler handler,
+                            LibraryElement library) {
     int tagState = TagState.NO_TAG_SEEN;
 
     /**
@@ -270,49 +278,62 @@
     bool importsDartCore = false;
     var libraryDependencies = new LinkBuilder<LibraryDependency>();
     Uri base = library.entryCompilationUnit.script.uri;
-    for (LibraryTag tag in library.tags.reverse()) {
-      if (tag.isImport) {
-        Import import = tag;
-        tagState = checkTag(TagState.IMPORT_OR_EXPORT, import);
-        if (import.uri.dartString.slowToString() == 'dart:core') {
-          importsDartCore = true;
-        }
-        libraryDependencies.addLast(import);
-      } else if (tag.isExport) {
-        tagState = checkTag(TagState.IMPORT_OR_EXPORT, tag);
-        libraryDependencies.addLast(tag);
-      } else if (tag.isLibraryName) {
-        tagState = checkTag(TagState.LIBRARY, tag);
-        if (library.libraryTag != null) {
-          compiler.cancel("duplicated library declaration", node: tag);
+
+    // TODO(rnystrom): Remove .toList() here if #11523 is fixed.
+    return Future.forEach(library.tags.reverse().toList(), (LibraryTag tag) {
+      compiler.withCurrentElement(library, () {
+        if (tag.isImport) {
+          Import import = tag;
+          tagState = checkTag(TagState.IMPORT_OR_EXPORT, import);
+          if (import.uri.dartString.slowToString() == 'dart:core') {
+            importsDartCore = true;
+          }
+          libraryDependencies.addLast(import);
+        } else if (tag.isExport) {
+          tagState = checkTag(TagState.IMPORT_OR_EXPORT, tag);
+          libraryDependencies.addLast(tag);
+        } else if (tag.isLibraryName) {
+          tagState = checkTag(TagState.LIBRARY, tag);
+          if (library.libraryTag != null) {
+            compiler.cancel("duplicated library declaration", node: tag);
+          } else {
+            library.libraryTag = tag;
+          }
+          checkDuplicatedLibraryName(library);
+        } else if (tag.isPart) {
+          Part part = tag;
+          StringNode uri = part.uri;
+          Uri resolvedUri = base.resolve(uri.dartString.slowToString());
+          tagState = checkTag(TagState.SOURCE, part);
+          return scanPart(part, resolvedUri, library);
         } else {
-          library.libraryTag = tag;
+          compiler.internalError("Unhandled library tag.", node: tag);
         }
-        checkDuplicatedLibraryName(library);
-      } else if (tag.isPart) {
-        Part part = tag;
-        StringNode uri = part.uri;
-        Uri resolvedUri = base.resolve(uri.dartString.slowToString());
-        tagState = checkTag(TagState.SOURCE, part);
-        scanPart(part, resolvedUri, library);
-      } else {
-        compiler.internalError("Unhandled library tag.", node: tag);
-      }
-    }
-
-    // Apply patch, if any.
-    if (library.isPlatformLibrary) {
-      patchDartLibrary(handler, library, library.canonicalUri.path);
-    }
-
-    // Import dart:core if not already imported.
-    if (!importsDartCore && !isDartCore(library.canonicalUri)) {
-      handler.registerDependency(library, null, loadCoreLibrary(handler));
-    }
-
-    for (LibraryDependency tag in libraryDependencies.toLink()) {
-      registerLibraryFromTag(handler, library, tag);
-    }
+      });
+    }).then((_) {
+      return compiler.withCurrentElement(library, () {
+        // Apply patch, if any.
+        if (library.isPlatformLibrary) {
+          return patchDartLibrary(handler, library, library.canonicalUri.path);
+        }
+      });
+    }).then((_) {
+      return compiler.withCurrentElement(library, () {
+        // Import dart:core if not already imported.
+        if (!importsDartCore && !isDartCore(library.canonicalUri)) {
+          return loadCoreLibrary(handler).then((LibraryElement coreLibrary) {
+            handler.registerDependency(library, null, coreLibrary);
+          });
+        }
+      });
+    }).then((_) {
+      // TODO(rnystrom): Remove .toList() here if #11523 is fixed.
+      return Future.forEach(libraryDependencies.toLink().toList(), (tag) {
+        return compiler.withCurrentElement(library, () {
+          return registerLibraryFromTag(handler, library, tag);
+        });
+      });
+    });
   }
 
   void checkDuplicatedLibraryName(LibraryElement library) {
@@ -341,42 +362,48 @@
   /**
    * Lazily loads and returns the [LibraryElement] for the dart:core library.
    */
-  LibraryElement loadCoreLibrary(LibraryDependencyHandler handler) {
-    if (compiler.coreLibrary == null) {
-      Uri coreUri = new Uri(scheme: 'dart', path: 'core');
-      compiler.coreLibrary
-          = createLibrary(handler, null, coreUri, null, coreUri);
+  Future<LibraryElement> loadCoreLibrary(LibraryDependencyHandler handler) {
+    if (compiler.coreLibrary != null) {
+      return new Future.value(compiler.coreLibrary);
     }
-    return compiler.coreLibrary;
+
+    Uri coreUri = new Uri(scheme: 'dart', path: 'core');
+    return createLibrary(handler, null, coreUri, null, coreUri)
+        .then((LibraryElement library) {
+      compiler.coreLibrary = library;
+      return library;
+    });
   }
 
-  void patchDartLibrary(LibraryDependencyHandler handler,
+  Future patchDartLibrary(LibraryDependencyHandler handler,
                         LibraryElement library, String dartLibraryPath) {
-    if (library.isPatched) return;
+    if (library.isPatched) return new Future.value();
     Uri patchUri = compiler.resolvePatchUri(dartLibraryPath);
-    if (patchUri != null) {
-      compiler.patchParser.patchLibrary(handler, patchUri, library);
-    }
+    if (patchUri == null) return new Future.value();
+
+    return compiler.patchParser.patchLibrary(handler, patchUri, library);
   }
 
   /**
    * Handle a part tag in the scope of [library]. The [resolvedUri] given is
    * used as is, any URI resolution should be done beforehand.
    */
-  void scanPart(Part part, Uri resolvedUri, LibraryElement library) {
+  Future scanPart(Part part, Uri resolvedUri, LibraryElement library) {
     if (!resolvedUri.isAbsolute) throw new ArgumentError(resolvedUri);
     Uri readableUri = compiler.translateResolvedUri(library, resolvedUri, part);
-    if (readableUri == null) return;
-    Script sourceScript = compiler.readScript(readableUri, part);
-    if (sourceScript == null) return;
-    CompilationUnitElement unit =
-        new CompilationUnitElementX(sourceScript, library);
-    compiler.withCurrentElement(unit, () {
-      compiler.scanner.scan(unit);
-      if (unit.partTag == null) {
-        compiler.reportError(unit, MessageKind.MISSING_PART_OF_TAG);
-      }
-    });
+    if (readableUri == null) return new Future.value();
+    return compiler.readScript(readableUri, library, part).
+        then((Script sourceScript) {
+          if (sourceScript == null) return;
+          CompilationUnitElement unit =
+              new CompilationUnitElementX(sourceScript, library);
+          compiler.withCurrentElement(unit, () {
+            compiler.scanner.scan(unit);
+            if (unit.partTag == null) {
+              compiler.reportError(unit, MessageKind.MISSING_PART_OF_TAG);
+            }
+          });
+        });
   }
 
   /**
@@ -384,25 +411,27 @@
    * registering its dependency in [handler] for the computation of the import/
    * export scope.
    */
-  void registerLibraryFromTag(LibraryDependencyHandler handler,
-                              LibraryElement library,
-                              LibraryDependency tag) {
+  Future registerLibraryFromTag(LibraryDependencyHandler handler,
+                                LibraryElement library,
+                                LibraryDependency tag) {
     Uri base = library.entryCompilationUnit.script.uri;
     Uri resolvedUri = base.resolve(tag.uri.dartString.slowToString());
-    LibraryElement loadedLibrary =
-        createLibrary(handler, library, resolvedUri, tag.uri, resolvedUri);
-    if (loadedLibrary == null) return;
-    handler.registerDependency(library, tag, loadedLibrary);
+    return createLibrary(handler, library, resolvedUri, tag.uri, resolvedUri)
+        .then((LibraryElement loadedLibrary) {
+          if (loadedLibrary == null) return;
+          compiler.withCurrentElement(library, () {
+            handler.registerDependency(library, tag, loadedLibrary);
 
-    if (!loadedLibrary.hasLibraryName()) {
-      compiler.withCurrentElement(library, () {
-        compiler.reportFatalError(
-            tag == null ? null : tag.uri,
-            MessageKind.GENERIC,
-            {'text':
-             'Error: No library name found in ${loadedLibrary.canonicalUri}.'});
-      });
-    }
+            if (!loadedLibrary.hasLibraryName()) {
+              compiler.reportFatalError(
+                  tag == null ? null : tag.uri,
+                  MessageKind.GENERIC,
+                  {'text':
+                   'Error: No library name found in '
+                      '${loadedLibrary.canonicalUri}.'});
+            }
+          });
+        });
   }
 
   /**
@@ -413,38 +442,42 @@
    */
   // TODO(johnniwinther): Remove [canonicalUri] and make [resolvedUri] the
   // canonical uri when [Compiler.scanBuiltinLibrary] is removed.
-  LibraryElement createLibrary(LibraryDependencyHandler handler,
+  Future<LibraryElement> createLibrary(LibraryDependencyHandler handler,
                                LibraryElement importingLibrary,
                                Uri resolvedUri, Node node, Uri canonicalUri) {
     // TODO(johnniwinther): Create erroneous library elements for missing
     // libraries.
     Uri readableUri =
         compiler.translateResolvedUri(importingLibrary, resolvedUri, node);
-    if (readableUri == null) return null;
+    if (readableUri == null) return new Future.value();
     LibraryElement library;
     if (canonicalUri != null) {
       library = compiler.libraries[canonicalUri.toString()];
     }
-    if (library == null) {
-      Script script = compiler.readScript(readableUri, node);
-      if (script == null) return null;
-
-      library = new LibraryElementX(script, canonicalUri);
-      handler.registerNewLibrary(library);
-      native.maybeEnableNative(compiler, library);
-      if (canonicalUri != null) {
-        compiler.libraries[canonicalUri.toString()] = library;
-      }
-      
-      compiler.withCurrentElement(library, () {
-        compiler.scanner.scanLibrary(library);
-        processLibraryTags(handler, library);
-        handler.registerLibraryExports(library);
-        onLibraryLoadedCallbacks.add(
-            () => compiler.onLibraryLoaded(library, resolvedUri));
-      });
+    if (library != null) {
+      return new Future.value(library);
     }
-    return library;
+    return compiler.readScript(readableUri, importingLibrary, node)
+        .then((Script script) {
+          if (script == null) return null;
+          LibraryElement element = new LibraryElementX(script, canonicalUri);
+          compiler.withCurrentElement(element, () {
+            handler.registerNewLibrary(element);
+            native.maybeEnableNative(compiler, element);
+            if (canonicalUri != null) {
+              compiler.libraries[canonicalUri.toString()] = element;
+            }
+            compiler.scanner.scanLibrary(element);
+          });
+          return processLibraryTags(handler, element).then((_) {
+            compiler.withCurrentElement(element, () {
+              handler.registerLibraryExports(element);
+              onLibraryLoadedCallbacks.add(
+                  () => compiler.onLibraryLoaded(element, resolvedUri));
+            });
+            return element;
+          });
+        });
   }
 
   // TODO(johnniwinther): Remove this method when 'js_helper' is handled by
diff --git a/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart b/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
index 74b6e56..5431753 100644
--- a/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
+++ b/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
@@ -227,12 +227,13 @@
                                            internalDiagnosticHandler,
                                            libraryRoot, packageRoot, options);
   compiler.librariesToAnalyzeWhenRun = libraries;
-  bool success = compiler.run(null);
-  if (success && !compilationFailed) {
-    return new Future<MirrorSystem>.value(new Dart2JsMirrorSystem(compiler));
-  } else {
-    return new Future<MirrorSystem>.error('Failed to create mirror system.');
-  }
+  return compiler.run(null).then((bool success) {
+    if (success && !compilationFailed) {
+      return new Dart2JsMirrorSystem(compiler);
+    } else {
+      throw new StateError('Failed to create mirror system.');
+    }
+  });
 }
 
 //------------------------------------------------------------------------------
@@ -382,7 +383,7 @@
       // Lookup [: prefix.id :].
       String prefix = name.substring(0, index);
       String id = name.substring(index+1);
-      result = scope.lookup(new SourceString(prefix)); 
+      result = scope.lookup(new SourceString(prefix));
       if (result != null && result.isPrefix()) {
         PrefixElement prefix = result;
         result = prefix.lookupLocalMember(new SourceString(id));
diff --git a/sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart b/sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart
index d6b2553..700d8a8 100644
--- a/sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart
+++ b/sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart
@@ -60,7 +60,7 @@
    * the simple name of the setter is 'foo='. For operators the simple name is
    * the operator itself, for example '+' for [:operator +:].
    *
-   * The simple name for the unary minus operator is [UNARY_MINUS].
+   * The simple name for the unary minus operator is [Mirror.UNARY_MINUS].
    */
   String get simpleName;
 
diff --git a/sdk/lib/_internal/compiler/implementation/patch_parser.dart b/sdk/lib/_internal/compiler/implementation/patch_parser.dart
index d21e842..42d036f 100644
--- a/sdk/lib/_internal/compiler/implementation/patch_parser.dart
+++ b/sdk/lib/_internal/compiler/implementation/patch_parser.dart
@@ -114,6 +114,8 @@
 
 library patchparser;
 
+import 'dart:async';
+
 import "tree/tree.dart" as tree;
 import "dart2jslib.dart" as leg;  // CompilerTask, Compiler.
 import "../compiler.dart" as api;
@@ -131,28 +133,31 @@
    * injections to the library, and returns a list of class
    * patches.
    */
-  void patchLibrary(leg.LibraryDependencyHandler handler,
+  Future patchLibrary(leg.LibraryDependencyHandler handler,
                     Uri patchUri, LibraryElement originLibrary) {
-
-    leg.Script script = compiler.readScript(patchUri, null);
-    var patchLibrary = new LibraryElementX(script, null, originLibrary);
-    compiler.withCurrentElement(patchLibrary, () {
-      handler.registerNewLibrary(patchLibrary);
-      LinkBuilder<tree.LibraryTag> imports = new LinkBuilder<tree.LibraryTag>();
-      compiler.withCurrentElement(patchLibrary.entryCompilationUnit, () {
-        // This patches the elements of the patch library into [library].
-        // Injected elements are added directly under the compilation unit.
-        // Patch elements are stored on the patched functions or classes.
-        scanLibraryElements(patchLibrary.entryCompilationUnit, imports);
+    return compiler.readScript(patchUri, null).then((leg.Script script) {
+      var patchLibrary = new LibraryElementX(script, null, originLibrary);
+      return compiler.withCurrentElement(patchLibrary, () {
+        handler.registerNewLibrary(patchLibrary);
+        var imports = new LinkBuilder<tree.LibraryTag>();
+        compiler.withCurrentElement(patchLibrary.entryCompilationUnit, () {
+          // This patches the elements of the patch library into [library].
+          // Injected elements are added directly under the compilation unit.
+          // Patch elements are stored on the patched functions or classes.
+          scanLibraryElements(patchLibrary.entryCompilationUnit, imports);
+        });
+        // After scanning declarations, we handle the import tags in the patch.
+        // TODO(lrn): These imports end up in the original library and are in
+        // scope for the original methods too. This should be fixed.
+        compiler.importHelperLibrary(originLibrary);
+        // TODO(rnystrom): Remove .toList() here if #11523 is fixed.
+        return Future.forEach(imports.toLink().toList(), (tag) {
+          return compiler.withCurrentElement(patchLibrary, () {
+            return compiler.libraryLoader.registerLibraryFromTag(
+                handler, patchLibrary, tag);
+          });
+        });
       });
-      // After scanning declarations, we handle the import tags in the patch.
-      // TODO(lrn): These imports end up in the original library and are in
-      // scope for the original methods too. This should be fixed.
-      compiler.importHelperLibrary(originLibrary);
-      for (tree.LibraryTag tag in imports.toLink()) {
-        compiler.libraryLoader.registerLibraryFromTag(
-            handler, patchLibrary, tag);
-      }
     });
   }
 
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index 89bb3e7..4aed80b 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -361,11 +361,17 @@
           error(tree, MessageKind.PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION);
           return;
         }
-        if (isConstructor) {
+        if (isConstructor || element.isFactoryConstructor()) {
           if (tree.returnType != null) {
             error(tree, MessageKind.CONSTRUCTOR_WITH_RETURN_TYPE);
           }
+          if (element.modifiers.isConst() &&
+              tree.hasBody() &&
+              !tree.isRedirectingFactory) {
+            compiler.reportError(tree, MessageKind.CONST_CONSTRUCTOR_HAS_BODY);
+          }
         }
+
         ResolverVisitor visitor = visitorFor(element);
         visitor.useElement(tree, element);
         visitor.setupFunction(tree, element);
@@ -662,6 +668,8 @@
     if (cls.isObject(compiler)) return;
     // TODO(johnniwinther): Should this be done on the implementation element as
     // well?
+    List<Element> constConstructors = <Element>[];
+    List<Element> nonFinalInstanceFields = <Element>[];
     cls.forEachMember((holder, member) {
       compiler.withCurrentElement(member, () {
         // Perform various checks as side effect of "computing" the type.
@@ -684,12 +692,38 @@
                 MessageKind.ILLEGAL_CONSTRUCTOR_MODIFIERS,
                 {'modifiers': mismatchedFlags});
           }
+          if (member.modifiers.isConst()) {
+            constConstructors.add(member);
+          }
+        }
+        if (member.isField()) {
+          if (!member.modifiers.isStatic() &&
+              !member.modifiers.isFinal()) {
+            nonFinalInstanceFields.add(member);
+          }
         }
         checkAbstractField(member);
         checkValidOverride(member, cls.lookupSuperMember(member.name));
         checkUserDefinableOperator(member);
       });
     });
+    if (!constConstructors.isEmpty && !nonFinalInstanceFields.isEmpty) {
+      Spannable span = constConstructors.length > 1
+          ? cls : constConstructors[0];
+      compiler.reportError(span,
+          MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS,
+          {'className': cls.name});
+      if (constConstructors.length > 1) {
+        for (Element constructor in constConstructors) {
+          compiler.reportInfo(constructor,
+              MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR);
+        }
+      }
+      for (Element field in nonFinalInstanceFields) {
+        compiler.reportInfo(field,
+            MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD);
+      }
+    }
   }
 
   void checkAbstractField(Element member) {
@@ -1238,8 +1272,10 @@
           resolveSuperOrThisForSend(constructor, functionNode, call);
           resolvedSuper = true;
         } else if (Initializers.isConstructorRedirect(call)) {
-          // Check that there is no body (Language specification 7.5.1).
-          if (functionNode.hasBody()) {
+          // Check that there is no body (Language specification 7.5.1).  If the
+          // constructor is also const, we already reported an error in
+          // [resolveMethodElement].
+          if (functionNode.hasBody() && !constructor.modifiers.isConst()) {
             error(functionNode, MessageKind.REDIRECTING_CONSTRUCTOR_HAS_BODY);
           }
           // Check that there are no other initializers.
@@ -2488,6 +2524,16 @@
     world.registerInstantiatedClass(compiler.nullClass, mapping);
   }
 
+  visitLiteralSymbol(LiteralSymbol node) {
+    world.registerInstantiatedClass(compiler.symbolClass, mapping);
+    world.registerStaticUse(compiler.symbolConstructor.declaration);
+    world.registerConstSymbol(node.slowNameString, mapping);
+    if (!validateSymbol(node, node.slowNameString, reportError: false)) {
+      compiler.reportError(node, MessageKind.UNSUPPORTED_LITERAL_SYMBOL,
+                           {'value': node.slowNameString});
+    }
+  }
+
   visitStringJuxtaposition(StringJuxtaposition node) {
     world.registerInstantiatedClass(compiler.stringClass, mapping);
     node.visitChildren(this);
@@ -2513,6 +2559,15 @@
     if (node.isRedirectingFactoryBody) {
       handleRedirectingFactoryBody(node);
     } else {
+      Node expression = node.expression;
+      if (expression != null &&
+          enclosingElement.isGenerativeConstructor()) {
+        // It is a compile-time error if a return statement of the form
+        // `return e;` appears in a generative constructor.  (Dart Language
+        // Specification 13.12.)
+        compiler.reportError(expression,
+                             MessageKind.CANNOT_RETURN_FROM_CONSTRUCTOR);
+      }
       visit(node.expression);
     }
   }
@@ -2575,9 +2630,7 @@
     world.registerInstantiatedClass(
         redirectionTarget.enclosingElement.declaration, mapping);
     if (isSymbolConstructor) {
-      // Make sure that collection_dev.Symbol.validated is registered.
-      assert(invariant(node, compiler.symbolValidatedConstructor != null));
-      world.registerStaticUse(compiler.symbolValidatedConstructor);
+      compiler.backend.registerSymbolConstructor(mapping);
     }
   }
 
@@ -2679,22 +2732,25 @@
     return null;
   }
 
-  bool validateSymbol(Node node, String name) {
+  bool validateSymbol(Node node, String name, {bool reportError: true}) {
     if (name.isEmpty) return true;
     if (name.startsWith('_')) {
-      compiler.reportError(node, MessageKind.PRIVATE_IDENTIFIER,
-                               {'value': name});
+      if (reportError) {
+        compiler.reportError(node, MessageKind.PRIVATE_IDENTIFIER,
+                             {'value': name});
+      }
       return false;
     }
     if (!symbolValidationPattern.hasMatch(name)) {
-      compiler.reportError(node, MessageKind.INVALID_SYMBOL,
-                               {'value': name});
+      if (reportError) {
+        compiler.reportError(node, MessageKind.INVALID_SYMBOL,
+                             {'value': name});
+      }
       return false;
     }
     return true;
   }
 
-
   /**
    * Try to resolve the constructor that is referred to by [node].
    * Note: this function may return an ErroneousFunctionElement instead of
diff --git a/sdk/lib/_internal/compiler/implementation/scanner/listener.dart b/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
index 314e8d7..1e8f36a 100644
--- a/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
+++ b/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
@@ -311,6 +311,12 @@
   void endSwitchBlock(int caseCount, Token beginToken, Token endToken) {
   }
 
+  void beginLiteralSymbol(Token token) {
+  }
+
+  void endLiteralSymbol(Token hashToken, int identifierCount) {
+  }
+
   void beginThrowExpression(Token token) {
   }
 
@@ -486,6 +492,9 @@
   void handleNoTypeVariables(Token token) {
   }
 
+  void handleOperator(Token token) {
+  }
+
   void handleOperatorName(Token operatorKeyword, Token token) {
   }
 
@@ -1351,6 +1360,11 @@
     pushNode(new LiteralNull(token));
   }
 
+  void endLiteralSymbol(Token hashToken, int identifierCount) {
+    NodeList identifiers = makeNodeList(identifierCount, null, null, '.');
+    pushNode(new LiteralSymbol(hashToken, identifiers));
+  }
+
   void handleBinaryExpression(Token token) {
     Node argument = popNode();
     Node receiver = popNode();
@@ -1642,6 +1656,10 @@
     handleNewExpression(token);
   }
 
+  void handleOperator(Token token) {
+    pushNode(new Operator(token));
+  }
+
   void handleOperatorName(Token operatorKeyword, Token token) {
     Operator op = new Operator(token);
     pushNode(new Send(new Identifier(operatorKeyword), op, null));
diff --git a/sdk/lib/_internal/compiler/implementation/scanner/parser.dart b/sdk/lib/_internal/compiler/implementation/scanner/parser.dart
index 064136f..dcfbc59 100644
--- a/sdk/lib/_internal/compiler/implementation/scanner/parser.dart
+++ b/sdk/lib/_internal/compiler/implementation/scanner/parser.dart
@@ -1672,6 +1672,8 @@
       return parseLiteralDouble(token);
     } else if (identical(kind, STRING_TOKEN)) {
       return parseLiteralString(token);
+    } else if (identical(kind, HASH_TOKEN)) {
+      return parseLiteralSymbol(token);
     } else if (identical(kind, KEYWORD_TOKEN)) {
       final value = token.stringValue;
       if ((identical(value, 'true')) || (identical(value, 'false'))) {
@@ -1892,6 +1894,26 @@
     return token;
   }
 
+  Token parseLiteralSymbol(Token token) {
+    Token hashToken = token;
+    listener.beginLiteralSymbol(hashToken);
+    token = token.next;
+    if (isUserDefinableOperator(token.stringValue)) {
+      listener.handleOperator(token);
+      listener.endLiteralSymbol(hashToken, 1);
+      return token.next;
+    } else {
+      int count = 1;
+      token = parseIdentifier(token);
+      while (identical(token.stringValue, '.')) {
+        count++;
+        token = parseIdentifier(token.next);
+      }
+      listener.endLiteralSymbol(hashToken, count);
+      return token;
+    }
+  }
+
   /**
    * Only called when [:token.kind === STRING_TOKEN:].
    */
diff --git a/sdk/lib/_internal/compiler/implementation/source_file_provider.dart b/sdk/lib/_internal/compiler/implementation/source_file_provider.dart
index ca48fda..352f03c 100644
--- a/sdk/lib/_internal/compiler/implementation/source_file_provider.dart
+++ b/sdk/lib/_internal/compiler/implementation/source_file_provider.dart
@@ -38,8 +38,9 @@
     try {
       source = readAll(uriPathToNative(resourceUri.path));
     } on FileException catch (ex) {
-      throw "Error reading '${relativize(cwd, resourceUri, isWindows)}' "
-            "(${ex.osError})";
+      return new Future.error(
+          "Error reading '${relativize(cwd, resourceUri, isWindows)}' "
+          "(${ex.osError})");
     }
     dartCharactersRead += source.length;
     sourceFiles[resourceUri.toString()] = new SourceFile(
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/bailout.dart b/sdk/lib/_internal/compiler/implementation/ssa/bailout.dart
index 8895637..2548c6a 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/bailout.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/bailout.dart
@@ -123,7 +123,7 @@
         return true;
       } else if (user.selector != null
                  && user.getDartReceiver(compiler) == instruction
-                 && !speculativeType.computeMask(compiler).willHit(
+                 && !speculativeType.computeMask(compiler).understands(
                         user.selector, compiler)) {
         return true;
       }
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index 5e34fcd..a747014 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -4074,6 +4074,14 @@
     stack.add(graph.addConstantString(node.dartString, node, compiler));
   }
 
+  void visitLiteralSymbol(LiteralSymbol node) {
+    ConstantHandler handler = compiler.constantHandler;
+    ConstructedConstant constant =
+        handler.compileNodeWithDefinitions(node, elements);
+    stack.add(graph.addConstant(constant, compiler));
+    compiler.enqueuer.codegen.registerConstSymbol(node.slowNameString, elements);
+  }
+
   void visitStringJuxtaposition(StringJuxtaposition node) {
     if (!node.isInterpolation) {
       // This is a simple string with no interpolations.
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
index 4c175a7..868b361 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
@@ -917,13 +917,20 @@
           use(condition.conditionExpression);
         }
         js.Expression jsCondition = pop();
-        if (hasPhiUpdates) {
-          updateBody.statements.add(new js.Continue(null));
-          body.statements.add(
-              new js.If(jsCondition, updateBody, new js.Break(null)));
-          jsCondition = newLiteralBool(true);
+        if (jsCondition == null) {
+          // If the condition is dead code, we turn the do-while into
+          // a simpler while because we will never reach the condition
+          // at the end of the loop anyway.
+          loop = new js.While(newLiteralBool(true), unwrapStatement(body));
+        } else {
+          if (hasPhiUpdates) {
+            updateBody.statements.add(new js.Continue(null));
+            body.statements.add(
+                new js.If(jsCondition, updateBody, new js.Break(null)));
+            jsCondition = newLiteralBool(true);
+          }
+          loop = new js.Do(unwrapStatement(body), jsCondition);
         }
-        loop = new js.Do(unwrapStatement(body), jsCondition);
         currentContainer = oldContainer;
         break;
       default:
@@ -1068,6 +1075,8 @@
   }
 
   void visitBasicBlock(HBasicBlock node) {
+    if (!node.isLive) return;
+
     // Abort traversal if we are leaving the currently active sub-graph.
     if (!subGraph.contains(node)) return;
 
@@ -2450,7 +2459,7 @@
       js.Expression arrayTest = pop();
       checkImmutableArray(input);
       js.Binary notArrayOrImmutable = new js.Binary('||', arrayTest, pop());
-      
+
       js.Binary notIndexing = checkIndexingBehavior(input, negative: true)
           ? new js.Binary('&&', notArrayOrImmutable, pop())
           : notArrayOrImmutable;
@@ -2462,7 +2471,7 @@
       js.Expression objectTest = pop();
       checkArray(input, '!==');
       js.Expression arrayTest = pop();
-      
+
       js.Expression notIndexing = checkIndexingBehavior(input, negative: true)
           ? new js.Binary('&&', arrayTest, pop())
           : arrayTest;
@@ -2477,7 +2486,7 @@
       js.Expression objectTest = pop();
       checkArray(input, '!==');
       js.Expression arrayTest = pop();
-      
+
       js.Binary notIndexingTest = checkIndexingBehavior(input, negative: true)
           ? new js.Binary('&&', arrayTest, pop())
           : arrayTest;
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart b/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
index ab9121e..ff83098 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
@@ -50,7 +50,7 @@
   R visitMultiply(HMultiply node);
   R visitNegate(HNegate node);
   R visitNot(HNot node);
-  R visitOneShotInterceptor(HOneShotInterceptor);
+  R visitOneShotInterceptor(HOneShotInterceptor node);
   R visitParameterValue(HParameterValue node);
   R visitPhi(HPhi node);
   R visitRangeConversion(HRangeConversion node);
@@ -465,6 +465,7 @@
   HBlockFlow blockFlow = null;
   HBasicBlock parentLoopHeader = null;
   List<HBailoutTarget> bailoutTargets;
+  bool isLive = true;
 
   final List<HBasicBlock> predecessors;
   List<HBasicBlock> successors;
@@ -967,39 +968,37 @@
     }
   }
 
-  /** Removes all occurrences of [user] from [usedBy]. */
-  void removeUser(HInstruction user) {
-    List<HInstruction> users = usedBy;
-    int length = users.length;
-    for (int i = 0; i < length; i++) {
-      if (identical(users[i], user)) {
-        users[i] = users[length - 1];
+  /** Removes all occurrences of [instruction] from [list]. */
+  void removeFromList(List<HInstruction> list, HInstruction instruction) {
+    int length = list.length;
+    int i = 0;
+    while (i < length) {
+      if (instruction == list[i]) {
+        list[i] = list[length - 1];
         length--;
+      } else {
+        i++;
       }
     }
-    users.length = length;
+    list.length = length;
+  }
+
+  /** Removes all occurrences of [user] from [usedBy]. */
+  void removeUser(HInstruction user) {
+    removeFromList(usedBy, user);
   }
 
   // Change all uses of [oldInput] by [this] to [newInput]. Also
   // updates the [usedBy] of [oldInput] and [newInput].
   void changeUse(HInstruction oldInput, HInstruction newInput) {
-    assert(newInput != null);
+    assert(newInput != null && !identical(oldInput, newInput));
     for (int i = 0; i < inputs.length; i++) {
       if (identical(inputs[i], oldInput)) {
         inputs[i] = newInput;
         newInput.usedBy.add(this);
       }
     }
-    List<HInstruction> oldInputUsers = oldInput.usedBy;
-    int i = 0;
-    while (i < oldInputUsers.length) {
-      if (oldInputUsers[i] == this) {
-        oldInputUsers[i] = oldInputUsers[oldInput.usedBy.length - 1];
-        oldInputUsers.length--;
-      } else {
-        i++;
-      }
-    }
+    removeFromList(oldInput.usedBy, this);
   }
 
   // Compute the set of users of this instruction that is dominated by
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart b/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
index 791866a..33bab0b 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
@@ -33,6 +33,7 @@
     ConstantSystem constantSystem = compiler.backend.constantSystem;
     JavaScriptItemCompilationContext context = work.compilationContext;
     measure(() {
+      SsaDeadCodeEliminator dce;
       List<OptimizationPhase> phases = <OptimizationPhase>[
           // Run trivial instruction simplification first to optimize
           // some patterns useful for type conversion.
@@ -49,7 +50,7 @@
           new SsaNonSpeculativeTypePropagator(compiler),
           // Run a dead code eliminator before LICM because dead
           // interceptors are often in the way of LICM'able instructions.
-          new SsaDeadCodeEliminator(),
+          new SsaDeadCodeEliminator(compiler),
           new SsaGlobalValueNumberer(compiler),
           new SsaCodeMotion(),
           new SsaValueRangeAnalyzer(compiler, constantSystem, work),
@@ -57,7 +58,16 @@
           // opportunities for instruction simplification.
           new SsaInstructionSimplifier(constantSystem, backend, work),
           new SsaSimplifyInterceptors(compiler, constantSystem, work),
-          new SsaDeadCodeEliminator()];
+          dce = new SsaDeadCodeEliminator(compiler)];
+      runPhases(graph, phases);
+      if (!dce.eliminatedSideEffects) return;
+      phases = <OptimizationPhase>[
+          new SsaGlobalValueNumberer(compiler),
+          new SsaCodeMotion(),
+          new SsaValueRangeAnalyzer(compiler, constantSystem, work),
+          new SsaInstructionSimplifier(constantSystem, backend, work),
+          new SsaSimplifyInterceptors(compiler, constantSystem, work),
+          new SsaDeadCodeEliminator(compiler)];
       runPhases(graph, phases);
     });
   }
@@ -529,6 +539,40 @@
     return (combinedType == value.instructionType) ? value : node;
   }
 
+  void simplifyCondition(HBasicBlock block,
+                         HInstruction condition,
+                         bool value) {
+    condition.dominatedUsers(block.first).forEach((user) {
+      HInstruction newCondition = graph.addConstantBool(value, compiler);
+      user.changeUse(condition, newCondition);
+    });
+  }
+
+  HInstruction visitIf(HIf node) {
+    HInstruction condition = node.condition;
+    if (condition.isConstant()) return node;
+    bool isNegated = condition is HNot;
+
+    if (isNegated) {
+      condition = condition.inputs[0];
+    } else {
+      // It is possible for LICM to move a negated version of the
+      // condition out of the loop where it used. We still want to
+      // simplify the nested use of the condition in that case, so
+      // we look for all dominating negated conditions and replace
+      // nested uses of them with true or false.
+      Iterable<HInstruction> dominating = condition.usedBy.where((user) =>
+          user is HNot && user.dominates(node));
+      dominating.forEach((hoisted) {
+        simplifyCondition(node.thenBlock, hoisted, false);
+        simplifyCondition(node.elseBlock, hoisted, true);
+      });
+    }
+    simplifyCondition(node.thenBlock, condition, !isNegated);
+    simplifyCondition(node.elseBlock, condition, isNegated);
+    return node;
+  }
+
   HInstruction visitIs(HIs node) {
     DartType type = node.typeExpression;
     Element element = type.element;
@@ -578,6 +622,10 @@
         // We cannot just return false, because the expression may be of
         // type int or double.
       }
+    } else if (expressionType.canBePrimitiveNumber(compiler)
+               && identical(element, compiler.intClass)) {
+      // We let the JS semantics decide for that check.
+      return node;
     // We need the [:hasTypeArguments:] check because we don't have
     // the notion of generics in the backend. For example, [:this:] in
     // a class [:A<T>:], is currently always considered to have the
@@ -870,7 +918,17 @@
 class SsaDeadCodeEliminator extends HGraphVisitor implements OptimizationPhase {
   final String name = "SsaDeadCodeEliminator";
 
-  SsaDeadCodeEliminator();
+  final Compiler compiler;
+  SsaLiveBlockAnalyzer analyzer;
+  bool eliminatedSideEffects = false;
+  SsaDeadCodeEliminator(this.compiler);
+
+  HInstruction zapInstructionCache;
+  HInstruction get zapInstruction {
+    return (zapInstructionCache == null)
+        ? zapInstructionCache = analyzer.graph.addConstantInt(0, compiler)
+        : zapInstructionCache;
+  }
 
   bool isDeadCode(HInstruction instruction) {
     return !instruction.sideEffects.hasSideEffects()
@@ -878,22 +936,118 @@
            && instruction.usedBy.isEmpty
            && instruction is !HTypeGuard
            && instruction is !HParameterValue
-           && instruction is !HLocalSet
-           && !instruction.isControlFlow();
+           && instruction is !HLocalSet;
   }
 
   void visitGraph(HGraph graph) {
+    analyzer = new SsaLiveBlockAnalyzer(graph);
+    analyzer.analyze();
     visitPostDominatorTree(graph);
+    cleanPhis(graph);
   }
 
   void visitBasicBlock(HBasicBlock block) {
-    HInstruction instruction = block.last;
+    bool isDeadBlock = analyzer.isDeadBlock(block);
+    block.isLive = !isDeadBlock;
+    // Start from the last non-control flow instruction in the block.
+    HInstruction instruction = block.last.previous;
     while (instruction != null) {
       var previous = instruction.previous;
-      if (isDeadCode(instruction)) block.remove(instruction);
+      if (isDeadBlock) {
+        eliminatedSideEffects = eliminatedSideEffects ||
+            instruction.sideEffects.hasSideEffects();
+        removeUsers(instruction);
+        block.remove(instruction);
+      } else if (isDeadCode(instruction)) {
+        block.remove(instruction);
+      }
       instruction = previous;
     }
   }
+
+  void cleanPhis(HGraph graph) {
+    L: for (HBasicBlock block in graph.blocks) {
+      List<HBasicBlock> predecessors = block.predecessors;
+      if (predecessors.length < 2) continue L;
+      // Find the index of the single live predecessor if it exists.
+      int indexOfLive = -1;
+      for (int i = 0; i < predecessors.length; i++) {
+        if (predecessors[i].isLive) {
+          if (indexOfLive >= 0) continue L;
+          indexOfLive = i;
+        }
+      }
+      // Run through the phis of the block and replace them with their input
+      // that comes from the only live predecessor if that dominates the phi.
+      block.forEachPhi((HPhi phi) {
+        HInstruction replacement = (indexOfLive >= 0)
+            ? phi.inputs[indexOfLive] : zapInstruction;
+        if (replacement.dominates(phi)) {
+          block.rewrite(phi, replacement);
+          block.removePhi(phi);
+        }
+      });
+    }
+  }
+
+  void removeUsers(HInstruction instruction) {
+    instruction.usedBy.forEach((user) {
+      removeInput(user, instruction);
+    });
+    instruction.usedBy.clear();
+  }
+
+  void removeInput(HInstruction user, HInstruction input) {
+    List<HInstruction> inputs = user.inputs;
+    for (int i = 0, length = inputs.length; i < length; i++) {
+      if (input == inputs[i]) {
+        HInstruction zap = zapInstruction;
+        inputs[i] = zap;
+        zap.usedBy.add(user);
+      }
+    }
+  }
+}
+
+class SsaLiveBlockAnalyzer extends HBaseVisitor {
+  final HGraph graph;
+  final Set<HBasicBlock> live = new Set<HBasicBlock>();
+  final List<HBasicBlock> worklist = <HBasicBlock>[];
+  SsaLiveBlockAnalyzer(this.graph);
+
+  bool isDeadBlock(HBasicBlock block) => !live.contains(block);
+
+  void analyze() {
+    markBlockLive(graph.entry);
+    while (!worklist.isEmpty) {
+      HBasicBlock live = worklist.removeLast();
+      live.last.accept(this);
+    }
+  }
+
+  void markBlockLive(HBasicBlock block) {
+    if (!live.contains(block)) {
+      worklist.add(block);
+      live.add(block);
+    }
+  }
+
+  void visitControlFlow(HControlFlow instruction) {
+    instruction.block.successors.forEach(markBlockLive);
+  }
+
+  void visitIf(HIf instruction) {
+    HInstruction condition = instruction.condition;
+    if (condition.isConstant()) {
+      if (condition.isConstantTrue()) {
+        markBlockLive(instruction.thenBlock);
+      } else {
+        markBlockLive(instruction.elseBlock);
+      }
+    } else {
+      visitControlFlow(instruction);
+    }
+  }
 }
 
 class SsaDeadPhiEliminator implements OptimizationPhase {
diff --git a/sdk/lib/_internal/compiler/implementation/tree/nodes.dart b/sdk/lib/_internal/compiler/implementation/tree/nodes.dart
index 210ebe5..372b4ae 100644
--- a/sdk/lib/_internal/compiler/implementation/tree/nodes.dart
+++ b/sdk/lib/_internal/compiler/implementation/tree/nodes.dart
@@ -76,6 +76,7 @@
   }
   R visitSwitchCase(SwitchCase node) => visitNode(node);
   R visitSwitchStatement(SwitchStatement node) => visitStatement(node);
+  R visitLiteralSymbol(LiteralSymbol node) => visitExpression(node);
   R visitThrow(Throw node) => visitExpression(node);
   R visitTryStatement(TryStatement node) => visitStatement(node);
   R visitTypeAnnotation(TypeAnnotation node) => visitNode(node);
@@ -947,6 +948,27 @@
   Token getEndToken() => elements.getEndToken();
 }
 
+class LiteralSymbol extends Expression {
+  final Token hashToken;
+  final NodeList identifiers;
+
+  LiteralSymbol(this.hashToken, this.identifiers);
+
+  LiteralSymbol asLiteralSymbol() => this;
+
+  void visitChildren(Visitor visitor) {
+    if (identifiers != null) identifiers.accept(visitor);
+  }
+
+  accept(Visitor visitor) => visitor.visitLiteralSymbol(this);
+
+  Token getBeginToken() => hashToken;
+
+  Token getEndToken() => identifiers.getEndToken();
+
+  String get slowNameString => '${identifiers}';
+}
+
 class Identifier extends Expression {
   final Token token;
 
diff --git a/sdk/lib/_internal/compiler/implementation/tree/prettyprint.dart b/sdk/lib/_internal/compiler/implementation/tree/prettyprint.dart
index 60f4807..86a7ee6 100644
--- a/sdk/lib/_internal/compiler/implementation/tree/prettyprint.dart
+++ b/sdk/lib/_internal/compiler/implementation/tree/prettyprint.dart
@@ -367,6 +367,12 @@
     visitNodeWithChildren(node, "SwitchStatement");
   }
 
+  visitLiteralSymbol(LiteralSymbol node) {
+    openNode(node, "LiteralSymbol");
+    visitChildNode(node.identifiers, "identifiers");
+    closeNode();
+  }
+
   visitThrow(Throw node) {
     visitNodeWithChildren(node, "Throw");
   }
diff --git a/sdk/lib/_internal/compiler/implementation/tree/unparser.dart b/sdk/lib/_internal/compiler/implementation/tree/unparser.dart
index 92d10e3..259d4d0 100644
--- a/sdk/lib/_internal/compiler/implementation/tree/unparser.dart
+++ b/sdk/lib/_internal/compiler/implementation/tree/unparser.dart
@@ -222,6 +222,11 @@
     add(node.token.value);
   }
 
+  visitLiteralSymbol(LiteralSymbol node) {
+    add(node.hashToken.value);
+    visit(node.identifiers);
+  }
+
   visitNewExpression(NewExpression node) {
     addToken(node.newToken);
     visit(node.send);
diff --git a/sdk/lib/_internal/compiler/implementation/typechecker.dart b/sdk/lib/_internal/compiler/implementation/typechecker.dart
index 4b31459..3c8bae6 100644
--- a/sdk/lib/_internal/compiler/implementation/typechecker.dart
+++ b/sdk/lib/_internal/compiler/implementation/typechecker.dart
@@ -966,6 +966,10 @@
     return types.dynamicType;
   }
 
+  DartType visitLiteralSymbol(LiteralSymbol node) {
+    return compiler.symbolClass.computeType(compiler);
+  }
+
   DartType computeConstructorType(Element constructor, DartType type) {
     if (Elements.isUnresolved(constructor)) return types.dynamicType;
     DartType constructorType = constructor.computeType(compiler);
@@ -1047,7 +1051,10 @@
     // immediately enclosing function.
     if (expression != null) {
       final expressionType = analyze(expression);
-      if (isVoidFunction
+      Element element = elements.currentElement;
+      if (element != null && element.isGenerativeConstructor()) {
+        // The resolver already emitted an error for this expression.
+      } else if (isVoidFunction
           && !types.isAssignable(expressionType, types.voidType)) {
         reportTypeWarning(expression, MessageKind.RETURN_VALUE_IN_VOID);
       } else {
diff --git a/sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart b/sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart
index 487ed93..aa6512e 100644
--- a/sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart
+++ b/sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart
@@ -561,7 +561,7 @@
     throw new UnsupportedError("");
   }
 
-  bool willHit(Selector selector, Compiler compiler) {
+  bool understands(Selector selector, Compiler compiler) {
     throw new UnsupportedError("");
   }
 
@@ -1065,6 +1065,12 @@
     return result == const DynamicTypeMask() ? null : result;
   }
 
+  void clear() {}
+
+  Iterable<Element> getCallersOf(Element element) {
+    throw "Don't use me";
+  }
+
   // --- analysis ---
 
   /**
diff --git a/sdk/lib/_internal/compiler/implementation/types/container_tracer.dart b/sdk/lib/_internal/compiler/implementation/types/container_tracer.dart
index caf28f0..22271b5 100644
--- a/sdk/lib/_internal/compiler/implementation/types/container_tracer.dart
+++ b/sdk/lib/_internal/compiler/implementation/types/container_tracer.dart
@@ -10,7 +10,7 @@
 import '../universe/universe.dart';
 import '../util/util.dart' show Link;
 import 'simple_types_inferrer.dart'
-    show InferrerEngine, InferrerVisitor, LocalsHandler;
+    show InferrerEngine, InferrerVisitor, LocalsHandler, TypeMaskSystem;
 import 'types.dart';
 import 'inferrer_visitor.dart';
 
@@ -136,6 +136,38 @@
 
 bool _VERBOSE = false;
 
+class InferrerEngineForContainerTracer
+    implements MinimalInferrerEngine<TypeMask> {
+  final Compiler compiler;
+
+  InferrerEngineForContainerTracer(this.compiler);
+
+  TypeMask typeOfElement(Element element) {
+    return compiler.typesTask.getGuaranteedTypeOfElement(element);
+  }
+
+  TypeMask returnTypeOfElement(Element element) {
+    return compiler.typesTask.getGuaranteedReturnTypeOfElement(element);
+  }
+
+  TypeMask returnTypeOfSelector(Selector selector) {
+    return compiler.typesTask.getGuaranteedTypeOfSelector(selector);
+  }
+
+  TypeMask typeOfNode(Node node) {
+    return compiler.typesTask.getGuaranteedTypeOfNode(null, node);
+  }
+
+  Iterable<Element> getCallersOf(Element element) {
+    return compiler.typesTask.typesInferrer.getCallersOf(element);
+  }
+
+  void recordTypeOfNonFinalField(Node node,
+                                 Element field,
+                                 TypeMask type,
+                                 CallSite constraint) {}
+}
+
 /**
  * Global analysis phase that traces container instantiations in order to
  * find their element type.
@@ -147,13 +179,15 @@
 
   bool analyze() {
     measure(() {
-      InferrerEngine<TypeMask> inferrer =
-          compiler.typesTask.typesInferrer.internal;
+      TypesInferrer inferrer = compiler.typesTask.typesInferrer;
+      InferrerEngineForContainerTracer engine =
+          new InferrerEngineForContainerTracer(compiler);
+
       // Walk over all created [ContainerTypeMask].
-      inferrer.concreteTypes.values.forEach((ContainerTypeMask mask) {
+      inferrer.containerTypes.forEach((ContainerTypeMask mask) {
         // The element type has already been set for const containers.
         if (mask.elementType != null) return;
-        new TracerForConcreteContainer(mask, this, compiler, inferrer).run();
+        new TracerForConcreteContainer(mask, this, compiler, engine).run();
       });
     });
   }
@@ -165,7 +199,7 @@
 class TracerForConcreteContainer {
   final Compiler compiler;
   final ContainerTracer tracer;
-  final InferrerEngine<TypeMask> inferrer;
+  final InferrerEngineForContainerTracer inferrer;
   final ContainerTypeMask mask;
 
   final Node analyzedNode;
@@ -337,13 +371,13 @@
 }
 
 class ContainerTracerVisitor
-    extends InferrerVisitor<TypeMask, InferrerEngine<TypeMask>> {
+    extends InferrerVisitor<TypeMask, InferrerEngineForContainerTracer> {
   final Element analyzedElement;
   final TracerForConcreteContainer tracer;
   final bool visitingClosure;
 
   ContainerTracerVisitor(element, tracer, [LocalsHandler<TypeMask> locals])
-      : super(element, tracer.inferrer, tracer.inferrer.types,
+      : super(element, tracer.inferrer, new TypeMaskSystem(tracer.compiler),
               tracer.compiler, locals),
         this.analyzedElement = element,
         this.tracer = tracer,
@@ -444,7 +478,7 @@
 
   TypeMask visitLiteralList(LiteralList node) {
     if (node.isConst()) {
-      return inferrer.concreteTypes[node];
+      return inferrer.typeOfNode(node);
     }
     if (tracer.couldBeTheList(node)) {
       escaping = true;
@@ -620,7 +654,7 @@
       if (tracer.couldBeTheList(node)) {
         escaping = true;
       }
-      return inferrer.concreteTypes[node];
+      return inferrer.typeOfNode(node);
     } else if (Elements.isFixedListConstructorCall(element, node, compiler)) {
       visitArguments(node.arguments, element);
       if (tracer.couldBeTheList(node)) {
@@ -631,7 +665,7 @@
           tracer.setPotentialLength(length.value);
         }
       }
-      return inferrer.concreteTypes[node];
+      return inferrer.typeOfNode(node);
     } else if (Elements.isFilledListConstructorCall(element, node, compiler)) {
       if (tracer.couldBeTheList(node)) {
         escaping = true;
@@ -645,7 +679,7 @@
       } else {
         visitArguments(node.arguments, element);
       }
-      return inferrer.concreteTypes[node];
+      return inferrer.typeOfNode(node);
     }
 
     bool isEscaping = visitArguments(node.arguments, element);
diff --git a/sdk/lib/_internal/compiler/implementation/types/flat_type_mask.dart b/sdk/lib/_internal/compiler/implementation/types/flat_type_mask.dart
index 069de64..81ee4b3 100644
--- a/sdk/lib/_internal/compiler/implementation/types/flat_type_mask.dart
+++ b/sdk/lib/_internal/compiler/implementation/types/flat_type_mask.dart
@@ -461,11 +461,10 @@
   }
 
   /**
-   * Returns whether a [selector] call will hit a method at runtime,
-   * and not go through [noSuchMethod].
+   * Returns whether this [TypeMask] understands [selector].
    */
-  bool willHit(Selector selector, Compiler compiler) {
-    Element cls;
+  bool understands(Selector selector, Compiler compiler) {
+    ClassElement cls;
     if (isEmpty) {
       if (!isNullable) return false;
       cls = compiler.backend.nullImplementation;
@@ -473,31 +472,15 @@
       cls = base.element;
     }
 
-    if (!cls.isAbstract(compiler)) {
-      return hasConcreteMatch(cls, selector, compiler);
-    }
-
-    Set<ClassElement> subtypesToCheck;
-    if (isExact) {
-      return false;
-    } else if (isSubtype) {
-      subtypesToCheck = compiler.world.subtypesOf(cls);
-    } else {
-      assert(isSubclass);
-      subtypesToCheck = compiler.world.subclassesOf(cls);
-    }
-
-    return subtypesToCheck != null
-        && subtypesToCheck.every((ClassElement cls) {
-              return cls.isAbstract(compiler)
-                ? true
-                : hasConcreteMatch(cls, selector, compiler);
-           });
+    // Use [lookupMember] because finding abstract members is okay.
+    Element element = cls.implementation.lookupMember(selector.name);
+    return element != null && selector.appliesUntyped(element, compiler);
   }
 
   bool needsNoSuchMethodHandling(Selector selector, Compiler compiler) {
-    // A call on an empty type mask is dead code.
-    if (isEmpty && !isNullable) return false;
+    // A call on an empty type mask is either dead code, or a call on
+    // `null`.
+    if (isEmpty) return false;
     // A call on an exact mask for an abstract class is dead code.
     if (isExact && base.element.isAbstract(compiler)) return false;
     // If the receiver is guaranteed to have a member that
@@ -541,7 +524,29 @@
     // If we're calling bar on an object of type A we do need the
     // handler because we may have to call B.noSuchMethod since B
     // does not implement bar.
-    return !willHit(selector, compiler);
+
+    Element cls = base.element;
+    bool hasMatch = hasConcreteMatch(cls, selector, compiler);
+    if (isExact) return !hasMatch;
+    if (!cls.isAbstract(compiler) && !hasMatch) return true;
+
+    Set<ClassElement> subtypesToCheck;
+    if (isSubtype) {
+      subtypesToCheck = compiler.world.subtypesOf(cls);
+    } else {
+      assert(isSubclass);
+      subtypesToCheck = compiler.world.subclassesOf(cls);
+    }
+
+    return subtypesToCheck != null
+        && subtypesToCheck.any((ClassElement cls) {
+              // We can just skip abstract classes because we know no
+              // instance of them will be created at runtime, and
+              // therefore there is no instance that will require
+              // [noSuchMethod] handling.
+              return !cls.isAbstract(compiler)
+                  && !hasConcreteMatch(cls, selector, compiler);
+           });
   }
 
   Element locateSingleElement(Selector selector, Compiler compiler) {
diff --git a/sdk/lib/_internal/compiler/implementation/types/forwarding_type_mask.dart b/sdk/lib/_internal/compiler/implementation/types/forwarding_type_mask.dart
index cd3a071..a8aebb6 100644
--- a/sdk/lib/_internal/compiler/implementation/types/forwarding_type_mask.dart
+++ b/sdk/lib/_internal/compiler/implementation/types/forwarding_type_mask.dart
@@ -86,8 +86,8 @@
     return forwardTo.intersection(other, compiler);
   }
 
-  bool willHit(Selector selector, Compiler compiler) {
-    return forwardTo.willHit(selector, compiler);
+  bool understands(Selector selector, Compiler compiler) {
+    return forwardTo.understands(selector, compiler);
   }
 
   bool needsNoSuchMethodHandling(Selector selector, Compiler compiler) {
diff --git a/sdk/lib/_internal/compiler/implementation/types/inferrer_visitor.dart b/sdk/lib/_internal/compiler/implementation/types/inferrer_visitor.dart
index e835be0..a4d3936 100644
--- a/sdk/lib/_internal/compiler/implementation/types/inferrer_visitor.dart
+++ b/sdk/lib/_internal/compiler/implementation/types/inferrer_visitor.dart
@@ -35,7 +35,6 @@
   T nonNullSubclass(DartType type);
   T nonNullExact(DartType type);
   T nonNullEmpty();
-  T nullable(T type);
   Selector newTypedSelector(T receiver, Selector selector);
 
   T allocateContainer(T type,
@@ -248,6 +247,11 @@
   bool hasOnePositionalArgumentWithType(T type) {
     return named.isEmpty && positional.length == 1 && positional[0] == type;
   }
+
+  void forEach(void f(T type)) {
+    positional.forEach(f);
+    named.values.forEach(f);
+  }
 }
 
 class CallSite {
@@ -347,9 +351,11 @@
       // of the try block so that, at exit of the try block, we get
       // the right phi for it.
       T existing = tryBlock.locals.parent[local];
-      T phiType = types.allocatePhi(tryBlock.locals.block, local, existing);
-      T inputType = types.addPhiInput(local, phiType, type);
-      tryBlock.locals.parent[local] = inputType;
+      if (existing != null) {
+        T phiType = types.allocatePhi(tryBlock.locals.block, local, existing);
+        T inputType = types.addPhiInput(local, phiType, type);
+        tryBlock.locals.parent[local] = inputType;
+      }
       // Update the current handler unconditionnally with the new
       // type.
       locals[local] = type;
@@ -414,8 +420,7 @@
   }
 
   /**
-   * Merge all [LocalsHandler] in [handlers] into [:this:]. Returns
-   * whether a local in [:this:] has changed.
+   * Merge all [LocalsHandler] in [handlers] into [:this:].
    *
    * If [keepOwnLocals] is true, the types of locals in this
    * [LocalsHandler] are being used in the merge. [keepOwnLocals]
@@ -433,30 +438,16 @@
    * types of locals at entry of the switch have to take part to the
    * merge.
    */
-  bool mergeAll(List<LocalsHandler<T>> handlers,
-                {bool keepOwnLocals: true}) {
-    bool changed = false;
+  void mergeAfterBreaks(List<LocalsHandler<T>> handlers,
+                        {bool keepOwnLocals: true}) {
     Node level = locals.block;
-
-    void mergeHandler(LocalsHandler<T> other) {
-      if (other.seenReturnOrThrow) return;
-      other.locals.forEachLocalUntilNode(level, (local, otherType) {
-        T myType = locals[local];
-        if (myType == null) return;
-        T newType = types.addPhiInput(local, myType, otherType);
-        if (newType != myType) {
-          changed = true;
-          locals[local] = newType;
-        }
-      });
-    }
-
+    LocalsHandler<T> startWith;
+    int index = 0;
     if (keepOwnLocals && !seenReturnOrThrow) {
-      handlers.forEach(mergeHandler);
+      startWith = this;
+      index--;
     } else {
       // Find the first handler that does not abort.
-      int index = 0;
-      LocalsHandler<T> startWith;
       while (index < handlers.length
              && (startWith = handlers[index]).seenReturnOrThrow) {
         index++;
@@ -465,24 +456,62 @@
         // If we haven't found a handler that does not abort, we know
         // this handler aborts.
         seenReturnOrThrow = true;
+        return;
       } else {
         // Otherwise, this handler does not abort.
         seenReturnOrThrow = false;
-        // Use [startWith] to initialize the types of locals.
-        startWith.locals.forEachLocalUntilNode(level, (local, otherType) {
-          T myType = locals[local];
-          if (myType == null) return;
-          if (myType != otherType) {
-            changed = true;
-            locals[local] = otherType;
-          }
-        });
-        // Merge all other handlers.
-        for (int i = index + 1; i < handlers.length; i++) {
-          mergeHandler(handlers[i]);
-        }
       }
     }
+    // Use [startWith] to initialize the types of locals.
+    locals.forEachLocal((local, myType) {
+      T otherType = startWith.locals[local];
+      T newType = types.allocatePhi(level, local, otherType);
+      if (myType != newType) {
+        locals[local] = newType;
+      }
+    });
+    // Merge all other handlers.
+    for (int i = index + 1; i < handlers.length; i++) {
+      mergeHandler(handlers[i]);
+    }
+
+    locals.forEachLocal((Element element, T type) {
+      T newType = types.simplifyPhi(level, element, type);
+      if (newType != type) {
+        locals[element] = newType;
+      }
+    });
+  }
+
+  /**
+   * Merge [other] into this handler. Returns whether a local in this
+   * has changed.
+   */
+  bool mergeHandler(LocalsHandler<T> other) {
+    if (other.seenReturnOrThrow) return false;
+    bool changed = false;
+    other.locals.forEachLocalUntilNode(locals.block, (local, otherType) {
+      T myType = locals[local];
+      if (myType == null) return;
+      T newType = types.addPhiInput(local, myType, otherType);
+      if (newType != myType) {
+        changed = true;
+        locals[local] = newType;
+      }
+    });
+    return changed;
+  }
+
+  /**
+   * Merge all [LocalsHandler] in [handlers] into this handler.
+   * Returns whether a local in this handler has changed.
+   */
+  bool mergeAll(List<LocalsHandler<T>> handlers) {
+    bool changed = false;
+    assert(!seenReturnOrThrow);
+    handlers.forEach((other) {
+      changed = mergeHandler(other) || changed;
+    });
     return changed;
   }
 
@@ -490,7 +519,7 @@
     locals.forEachLocal((Element element, T type) {
       T newType = types.allocatePhi(loop, element, type);
       if (newType != type) {
-        locals[element] = type;
+        locals[element] = newType;
       }
     });
   }
@@ -499,7 +528,7 @@
     locals.forEachLocal((Element element, T type) {
       T newType = types.simplifyPhi(loop, element, type);
       if (newType != type) {
-        locals[element] = type;
+        locals[element] = newType;
       }
     });
   }
@@ -611,7 +640,13 @@
   }
 
   T visitLiteralDouble(LiteralDouble node) {
-    return types.doubleType;
+    ConstantSystem constantSystem = compiler.backend.constantSystem;
+    Constant constant = constantSystem.createDouble(node.value);
+    // The JavaScript backend may turn this literal into an integer at
+    // runtime.
+    return constantSystem.isDouble(constant)
+        ? types.doubleType
+        : types.intType;
   }
 
   T visitLiteralInt(LiteralInt node) {
@@ -638,6 +673,10 @@
     return types.nullType;
   }
 
+  T visitLiteralSymbol(LiteralSymbol node) {
+    return types.nonNullExact(compiler.symbolClass.rawType);
+  }
+
   T visitTypeReferenceSend(Send node) {
     return types.typeType;
   }
@@ -720,10 +759,11 @@
       return types.boolType;
     } else if (const SourceString("||") == op.source) {
       conditionIsSimple = false;
-      visit(node.receiver);
+      List<Send> tests = <Send>[];
+      handleCondition(node.receiver, tests);
       LocalsHandler<T> saved = locals;
       locals = new LocalsHandler<T>.from(locals, node);
-      updateIsChecks(isChecks, usePositive: false);
+      updateIsChecks(tests, usePositive: false);
       bool oldAccumulateIsChecks = accumulateIsChecks;
       accumulateIsChecks = false;
       visit(node.arguments.head);
@@ -854,28 +894,22 @@
     loopLevel++;
     bool changed = false;
     TargetElement target = elements[node];
-    locals.startLoop(node);
-    LocalsHandler<T> saved;
-    bool keepOwnLocals = node.asDoWhile() == null;
+    LocalsHandler<T> saved = locals;
+    saved.startLoop(node);
     do {
       // Setup (and clear in case of multiple iterations of the loop)
       // the lists of breaks and continues seen in the loop.
       setupBreaksAndContinues(target);
-      saved = locals;
-      locals = new LocalsHandler<T>.from(locals, node);
+      locals = new LocalsHandler<T>.from(saved, node);
       logic();
-      changed = saved.mergeAll(getLoopBackEdges(target),
-                               keepOwnLocals: keepOwnLocals);
-      // Now that we have done the initial merge, following merges to
-      // reach a fixed point must use the previously computed types of
-      // locals at entry of the loop.
-      keepOwnLocals = true;
-      locals = saved;
+      changed = saved.mergeAll(getLoopBackEdges(target));
     } while (changed);
     loopLevel--;
-    saved.mergeAll(getBreaks(target));
+    saved.endLoop(node);
+    bool keepOwnLocals = node.asDoWhile() == null;
+    saved.mergeAfterBreaks(
+        getBreaks(target), keepOwnLocals: keepOwnLocals);
     locals = saved;
-    locals.endLoop(node);
     clearBreaksAndContinues(target);
   }
 
@@ -971,7 +1005,7 @@
       TargetElement targetElement = elements[body];
       setupBreaksAndContinues(targetElement);
       visit(body);
-      locals.mergeAll(getBreaks(targetElement));
+      locals.mergeAfterBreaks(getBreaks(targetElement));
       clearBreaksAndContinues(targetElement);
     }
   }
@@ -1050,7 +1084,7 @@
         visit(switchCase);
         localsToMerge.add(locals);
       }
-      saved.mergeAll(localsToMerge, keepOwnLocals: !hasDefaultCase);
+      saved.mergeAfterBreaks(localsToMerge, keepOwnLocals: !hasDefaultCase);
       locals = saved;
     }
     clearBreaksAndContinues(elements[node]);
diff --git a/sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart b/sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart
index e7061a9..7d305fd 100644
--- a/sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart
+++ b/sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart
@@ -93,10 +93,6 @@
   TypeMask nonNullExact(DartType type) => new TypeMask.nonNullExact(type);
   TypeMask nonNullEmpty() => new TypeMask.nonNullEmpty();
 
-  TypeMask nullable(TypeMask type) {
-    return type.nullable();
-  }
-
   TypeMask allocateContainer(TypeMask type,
                              Node node,
                              Element enclosing,
@@ -293,23 +289,29 @@
     if (compiler.disableTypeInference) return compiler.typesTask.dynamicType;
     return internal.getReturnTypeOfElement(element.implementation);
   }
+
   TypeMask getTypeOfElement(Element element) {
     if (compiler.disableTypeInference) return compiler.typesTask.dynamicType;
     return internal.getTypeOfElement(element.implementation);
   }
+
   TypeMask getTypeOfNode(Element owner, Node node) {
     if (compiler.disableTypeInference) return compiler.typesTask.dynamicType;
     return internal.getTypeOfNode(owner, node);
   }
+
   TypeMask getTypeOfSelector(Selector selector) {
     if (compiler.disableTypeInference) return compiler.typesTask.dynamicType;
     return internal.getTypeOfSelector(selector);
   }
+
   Iterable<Element> getCallersOf(Element element) {
     if (compiler.disableTypeInference) throw "Don't use me";
     return internal.getCallersOf(element.implementation);
   }
 
+  Iterable<TypeMask> get containerTypes => internal.containerTypes;
+
   bool analyzeMain(Element element) {
     if (compiler.disableTypeInference) return true;
     bool result = internal.analyzeMain(element);
@@ -419,14 +421,14 @@
    *
    * [inLoop] tells whether the call happens in a loop.
    */
-  void registerCalledElement(Spannable node,
-                             Selector selector,
-                             Element caller,
-                             Element callee,
-                             ArgumentsTypes<T> arguments,
-                             CallSite constraint,
-                             SideEffects sideEffects,
-                             bool inLoop);
+  T registerCalledElement(Spannable node,
+                          Selector selector,
+                          Element caller,
+                          Element callee,
+                          ArgumentsTypes<T> arguments,
+                          CallSite constraint,
+                          SideEffects sideEffects,
+                          bool inLoop);
 
   /**
    * Registers that [caller] calls [selector] with [receiverType] as
@@ -611,6 +613,8 @@
    */
   final Map<Node, TypeMask> concreteTypes = new Map<Node, TypeMask>();
 
+  Iterable<TypeMask> get containerTypes => concreteTypes.values;
+
   /**
    * A map of constraints on a setter. When computing the type
    * of a field, these [Node] are initially discarded, and once the
@@ -1259,20 +1263,20 @@
    * [arguments]. [constraint] is a setter constraint (see
    * [setterConstraints] documentation).
    */
-  void registerCalledElement(Spannable node,
-                             Selector selector,
-                             Element caller,
-                             Element callee,
-                             ArgumentsTypes arguments,
-                             CallSite constraint,
-                             SideEffects sideEffects,
-                             bool inLoop) {
+  TypeMask registerCalledElement(Spannable node,
+                                 Selector selector,
+                                 Element caller,
+                                 Element callee,
+                                 ArgumentsTypes arguments,
+                                 CallSite constraint,
+                                 SideEffects sideEffects,
+                                 bool inLoop) {
     updateSideEffects(sideEffects, selector, callee);
 
     // Bailout for closure calls. We're not tracking types of
     // arguments for closures.
     if (callee.isInstanceMember() && selector.isClosureCall()) {
-      return;
+      return types.dynamicType;
     }
     if (inLoop) {
       // For instance methods, we only register a selector called in a
@@ -1297,29 +1301,32 @@
           callee,
           arguments.positional[0],
           constraint);
-      return;
+      return arguments.positional[0];
     } else if (selector != null && selector.isGetter()) {
       assert(arguments == null);
       if (callee.isFunction()) {
         FunctionTypeInformation functionInfo = typeInformationOf(callee);
         functionInfo.canBeClosurized = true;
+        return types.functionType;
       }
-      return;
-    } else if (callee.isField()) {
+      return callee.isGetter()
+          ? returnTypeOfElement(callee)
+          : typeOfElement(callee);
+    } else if (callee.isField() || callee.isGetter()) {
       // We're not tracking closure calls.
-      return;
-    } else if (callee.isGetter()) {
-      // Getters don't have arguments.
-      return;
+      return types.dynamicType;
     }
     FunctionElement function = callee;
-    if (function.computeSignature(compiler).parameterCount == 0) return;
+    if (function.computeSignature(compiler).parameterCount == 0) {
+      return returnTypeOfElement(callee);
+    }
 
     assert(arguments != null);
     bool isUseful = addArguments(node, callee, arguments);
     if (hasAnalyzedAll && isUseful) {
       enqueueAgain(callee);
     }
+    return returnTypeOfElement(callee);
   }
 
   void unregisterCalledElement(Node node,
@@ -1329,7 +1336,8 @@
     typeInformationOf(callee).removeCall(caller);
     if (callee.isField()) {
       if (selector.isSetter()) {
-        Map<Spannable, TypeMask> assignments = typeInformationOf(callee).assignments;
+        Map<Spannable, TypeMask> assignments =
+            typeInformationOf(callee).assignments;
         if (assignments == null || !assignments.containsKey(node)) return;
         assignments.remove(node);
         if (hasAnalyzedAll) updateNonFinalFieldType(callee);
@@ -1419,7 +1427,9 @@
         registerCalledElement(
             node, selector, caller, element, arguments,
             constraint, sideEffects, inLoop);
-
+        // We cannot use the type returned by [registerCalledElement]
+        // here because it does not handle [noSuchMethod]
+        // targets, unlike [typeOfElementWithSelector].
         if (!selector.isSetter()) {
           TypeMask type = handleIntrisifiedSelector(selector, arguments);
           if (type == null) type = typeOfElementWithSelector(element, selector);
@@ -1817,6 +1827,16 @@
     });
   }
 
+  bool get inInstanceContext {
+    return (outermostElement.isInstanceMember() && !outermostElement.isField())
+        || outermostElement.isGenerativeConstructor();
+  }
+
+  bool treatAsInstanceMember(Element element) {
+    return (Elements.isUnresolved(element) && inInstanceContext)
+        || (element != null && element.isInstanceMember());
+  }
+
   T visitSendSet(SendSet node) {
     Element element = elements[node];
     if (!Elements.isUnresolved(element) && element.impliesType()) {
@@ -1835,14 +1855,14 @@
 
     T receiverType;
     bool isCallOnThis = false;
-    if (node.receiver == null
-        && element != null
-        && element.isInstanceMember()) {
-      receiverType = thisType;
-      isCallOnThis = true;
+    if (node.receiver == null) {
+      if (treatAsInstanceMember(element)) {
+        receiverType = thisType;
+        isCallOnThis = true;
+      }
     } else {
       receiverType = visit(node.receiver);
-      isCallOnThis = node.receiver != null && isThisOrSuper(node.receiver);
+      isCallOnThis = isThisOrSuper(node.receiver);
     }
 
     T rhsType;
@@ -1868,6 +1888,10 @@
       if (!isThisExposed && isCallOnThis) {
         checkIfExposesThis(
             types.newTypedSelector(receiverType, setterSelector));
+        if (getterSelector != null) {
+          checkIfExposesThis(
+              types.newTypedSelector(receiverType, getterSelector));
+        }
       }
     }
 
@@ -1918,11 +1942,13 @@
       }
       T getterType;
       T newType;
-      if (Elements.isStaticOrTopLevelField(element)) {
+      if (Elements.isErroneousElement(element)) {
+        getterType = types.dynamicType;
+        newType = types.dynamicType;
+      } else if (Elements.isStaticOrTopLevelField(element)) {
         Element getterElement = elements[node.selector];
         getterType =
-            inferrer.typeOfElementWithSelector(getterElement, getterSelector);
-        handleStaticSend(node, getterSelector, getterElement, null);
+            handleStaticSend(node, getterSelector, getterElement, null);
         newType = handleDynamicSend(
             node, operatorSelector, getterType, operatorArguments);
         handleStaticSend(
@@ -1981,7 +2007,9 @@
       }
     }
     ArgumentsTypes arguments = new ArgumentsTypes<T>([rhsType], null);
-    if (Elements.isStaticOrTopLevelField(element)) {
+    if (Elements.isErroneousElement(element)) {
+      // Code will always throw.
+    } else if (Elements.isStaticOrTopLevelField(element)) {
       handleStaticSend(node, setterSelector, element, arguments);
     } else if (Elements.isUnresolved(element) || element.isSetter()) {
       handleDynamicSend(
@@ -2018,13 +2046,11 @@
     // are calling does not expose this.
     isThisExposed = true;
     if (node.isPropertyAccess) {
-      handleStaticSend(node, selector, element, null);
-      return inferrer.typeOfElementWithSelector(element, selector);
+      return handleStaticSend(node, selector, element, null);
     } else if (element.isFunction()) {
       if (!selector.applies(element, compiler)) return types.dynamicType;
       ArgumentsTypes arguments = analyzeArguments(node.arguments);
-      handleStaticSend(node, selector, element, arguments);
-      return inferrer.returnTypeOfElement(element);
+      return handleStaticSend(node, selector, element, arguments);
     } else {
       analyzeArguments(node.arguments);
       // Closure call on a getter. We don't have function types yet,
@@ -2045,7 +2071,7 @@
     ArgumentsTypes arguments = analyzeArguments(node.arguments);
     if (!selector.applies(element, compiler)) return types.dynamicType;
 
-    handleStaticSend(node, selector, element, arguments);
+    T returnType = handleStaticSend(node, selector, element, arguments);
     if (Elements.isGrowableListConstructorCall(element, node, compiler)) {
       return inferrer.concreteTypes.putIfAbsent(
           node, () => types.allocateContainer(
@@ -2056,7 +2082,7 @@
           node, () => types.allocateContainer(
               types.fixedListType, node, outermostElement));
     } else if (element.isFunction() || element.isConstructor()) {
-      return inferrer.returnTypeOfElement(element);
+      return returnType;
     } else {
       assert(element.isField() || element.isGetter());
       // Closure call.
@@ -2106,8 +2132,7 @@
     Element element = elements[node];
     Selector selector = elements.getSelector(node);
     if (Elements.isStaticOrTopLevelField(element)) {
-      handleStaticSend(node, selector, element, null);
-      return inferrer.typeOfElementWithSelector(element, selector);
+      return handleStaticSend(node, selector, element, null);
     } else if (Elements.isInstanceSend(node, elements)) {
       return visitDynamicSend(node);
     } else if (Elements.isStaticOrTopLevelFunction(element)) {
@@ -2141,12 +2166,12 @@
     return types.dynamicType;
   }
 
-  void handleStaticSend(Node node,
-                        Selector selector,
-                        Element element,
-                        ArgumentsTypes arguments) {
-    if (Elements.isUnresolved(element)) return;
-    inferrer.registerCalledElement(
+  T handleStaticSend(Node node,
+                     Selector selector,
+                     Element element,
+                     ArgumentsTypes arguments) {
+    if (Elements.isUnresolved(element)) return types.dynamicType;
+    return inferrer.registerCalledElement(
         node, selector, outermostElement, element, arguments, null,
         sideEffects, inLoop);
   }
@@ -2181,6 +2206,7 @@
                       T receiverType,
                       ArgumentsTypes arguments,
                       [CallSite constraint]) {
+    assert(receiverType != null);
     if (selector.mask != receiverType) {
       selector = (receiverType == types.dynamicType)
           ? selector.asUntyped
@@ -2212,8 +2238,10 @@
     T receiverType;
     bool isCallOnThis = false;
     if (node.receiver == null) {
-      isCallOnThis = true;
-      receiverType = thisType;
+      if (treatAsInstanceMember(element)) {
+        isCallOnThis = true;
+        receiverType = thisType;
+      }
     } else {
       Node receiver = node.receiver;
       isCallOnThis = isThisOrSuper(receiver);
@@ -2298,10 +2326,6 @@
     T currentType =
         handleDynamicSend(node, currentSelector, iteratorType, null);
 
-    // We nullify the type in case there is no element in the
-    // iterable.
-    currentType = types.nullable(currentType);
-
     if (node.expression.isThis()) {
       // Any reasonable implementation of an iterator would expose
       // this, so we play it safe and assume it will.
diff --git a/sdk/lib/_internal/compiler/implementation/types/type_mask.dart b/sdk/lib/_internal/compiler/implementation/types/type_mask.dart
index f5f473f..37f42d8 100644
--- a/sdk/lib/_internal/compiler/implementation/types/type_mask.dart
+++ b/sdk/lib/_internal/compiler/implementation/types/type_mask.dart
@@ -97,10 +97,9 @@
   TypeMask intersection(TypeMask other, Compiler compiler);
 
   /**
-   * Returns whether a [selector] call will hit a method at runtime,
-   * and not go through [noSuchMethod].
+   * Returns whether this [TypeMask] understands [selector].
    */
-  bool willHit(Selector selector, Compiler compiler);
+  bool understands(Selector selector, Compiler compiler);
 
   /**
    * Returns whether this [TypeMask] applied to [selector] can hit a
diff --git a/sdk/lib/_internal/compiler/implementation/types/types.dart b/sdk/lib/_internal/compiler/implementation/types/types.dart
index 3e2178a..201a697 100644
--- a/sdk/lib/_internal/compiler/implementation/types/types.dart
+++ b/sdk/lib/_internal/compiler/implementation/types/types.dart
@@ -25,11 +25,14 @@
  * Common super class for our type inferrers.
  */
 abstract class TypesInferrer {
-  analyzeMain(Element element);
+  void analyzeMain(Element element);
   TypeMask getReturnTypeOfElement(Element element);
   TypeMask getTypeOfElement(Element element);
   TypeMask getTypeOfNode(Element owner, Node node);
   TypeMask getTypeOfSelector(Selector selector);
+  Iterable<TypeMask> get containerTypes;
+  void clear();
+  Iterable<Element> getCallersOf(Element element);
 }
 
 /**
diff --git a/sdk/lib/_internal/compiler/implementation/types/union_type_mask.dart b/sdk/lib/_internal/compiler/implementation/types/union_type_mask.dart
index 1167e6d..fc294dd 100644
--- a/sdk/lib/_internal/compiler/implementation/types/union_type_mask.dart
+++ b/sdk/lib/_internal/compiler/implementation/types/union_type_mask.dart
@@ -231,12 +231,8 @@
         (TypeMask mask) => mask.containedClasses(compiler));
   }
 
-  /**
-   * Returns whether a [selector] call will hit a method at runtime,
-   * and not go through [noSuchMethod].
-   */
-  bool willHit(Selector selector, Compiler compiler) {
-    return disjointMasks.every((e) => e.willHit(selector, compiler));
+  bool understands(Selector selector, Compiler compiler) {
+    return disjointMasks.any((e) => e.understands(selector, compiler));
   }
 
   bool needsNoSuchMethodHandling(Selector selector, Compiler compiler) {
@@ -267,15 +263,26 @@
 
   bool operator==(other) {
     if (identical(this, other)) return true;
+
+    bool containsAll() {
+      return other.disjointMasks.every((e) {
+        var map = disjointMasks.map((e) => e.nonNullable());
+        return map.contains(e.nonNullable());
+      });
+    }
+
     return other is UnionTypeMask
+        && other.isNullable == isNullable
         && other.disjointMasks.length == disjointMasks.length
-        && other.disjointMasks.every((e) => disjointMasks.contains(e));
+        && containsAll();
   }
 
   int get hashCode {
-    int hashCode = 43;
+    int hashCode = isNullable ? 86 : 43;
+    // The order of the masks in [disjointMasks] must not affect the
+    // hashCode.
     for (var mask in disjointMasks) {
-      hashCode = (hashCode ^ mask.hashCode) & 0x3fffffff;
+      hashCode = (hashCode ^ mask.nonNullable().hashCode) & 0x3fffffff;
     }
     return hashCode;
   }
diff --git a/sdk/lib/_internal/compiler/implementation/util/util.dart b/sdk/lib/_internal/compiler/implementation/util/util.dart
index 3e60f24..2638fd8 100644
--- a/sdk/lib/_internal/compiler/implementation/util/util.dart
+++ b/sdk/lib/_internal/compiler/implementation/util/util.dart
@@ -35,7 +35,7 @@
   final String message;
   SpannableAssertionFailure(this.node, this.message);
 
-  String toString() => 'Compiler crashed: $message.';
+  String toString() => 'Compiler crashed: $message';
 }
 
 /**
diff --git a/sdk/lib/_internal/compiler/implementation/warnings.dart b/sdk/lib/_internal/compiler/implementation/warnings.dart
index 2fe05d7..c108cf8 100644
--- a/sdk/lib/_internal/compiler/implementation/warnings.dart
+++ b/sdk/lib/_internal/compiler/implementation/warnings.dart
@@ -241,7 +241,17 @@
       'Error: Cyclic constructor redirection.');
 
   static const MessageKind REDIRECTING_CONSTRUCTOR_HAS_BODY = const MessageKind(
-      'Error: Redirecting constructor cannot have a body.');
+      "Error: Redirecting constructor can't have a body.");
+
+  static const MessageKind CONST_CONSTRUCTOR_HAS_BODY = const MessageKind(
+      "Error: Const constructor or factory can't have a body.",
+      howToFix: "Remove the 'const' keyword or the body",
+      examples: const ["""
+class C {
+  const C() {}
+}
+
+main() => new C();"""]);
 
   static const MessageKind REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER =
       const MessageKind(
@@ -272,6 +282,29 @@
   static const MessageKind CONST_CALLS_NON_CONST = const MessageKind(
       'Error: "const" constructor cannot call a non-const constructor.');
 
+  static const MessageKind CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS =
+      const MessageKind(
+          "Error: Can't declare constructor 'const' on class #{className} "
+          "because the class contains non-final instance fields.",
+          howToFix: "Try making all fields final.",
+          examples: const ["""
+class C {
+  // 'a' must be declared final to allow for the const constructor.
+  var a;
+  const C(this.a);
+}
+
+main() => new C(0);"""]);
+
+  static const MessageKind CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD =
+      const MessageKind('Info: This non-final field prevents using const '
+                        'constructors.');
+
+  static const MessageKind CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR =
+      const MessageKind('Info: This const constructor is not allowed due to '
+                        'non-final fields.');
+
+
   static const MessageKind INITIALIZING_FORMAL_NOT_ALLOWED = const MessageKind(
       'Error: Initializing formal parameter only allowed in generative '
       'constructor.');
@@ -500,6 +533,18 @@
   static const MessageKind CONSTRUCTOR_WITH_RETURN_TYPE = const MessageKind(
       'Error: Cannot have return type for constructor.');
 
+  static const MessageKind CANNOT_RETURN_FROM_CONSTRUCTOR = const MessageKind(
+      "Error: Constructors can't return values.",
+      howToFix: "Remove the return statement or use a factory constructor.",
+      examples: const ["""
+class C {
+  C() {
+    return 1;
+  }
+}
+
+main() => new C();"""]);
+
   static const MessageKind ILLEGAL_FINAL_METHOD_MODIFIER = const MessageKind(
       'Error: Cannot have final modifier on method.');
 
@@ -615,6 +660,9 @@
       'Error: "#{value}" is not a valid Symbol name because it starts with '
       '"_".');
 
+  static const MessageKind UNSUPPORTED_LITERAL_SYMBOL = const MessageKind(
+      'Internal Error: Symbol literal "##{value}" is currently unsupported.');
+
   static const MessageKind INVALID_SYMBOL = const MessageKind('''
 Error: "#{value}" is not a valid Symbol name because is not:
  * an empty String,
diff --git a/sdk/lib/_internal/compiler/samples/leap/leap_leg.dart b/sdk/lib/_internal/compiler/samples/leap/leap_leg.dart
index 137c236..87ba938 100644
--- a/sdk/lib/_internal/compiler/samples/leap/leap_leg.dart
+++ b/sdk/lib/_internal/compiler/samples/leap/leap_leg.dart
@@ -125,6 +125,8 @@
 
   String init() {
     Stopwatch sw = new Stopwatch()..start();
+    // TODO(rnystrom): This is broken now that scanBuiltInLibraries is async.
+    // Delete this sample.
     compiler.scanBuiltinLibraries();
     sw.stop();
     return 'Scanned core libraries in ${sw.elapsedMilliseconds}ms';
@@ -221,10 +223,14 @@
 
   String get legDirectory => libDir;
 
+  // TODO(rnystrom): This is broken now that scanBuiltInLibraries is async.
+  // Delete this sample.
   LibraryElement scanBuiltinLibrary(String path) {
     Uri base = Uri.parse(html.window.location.toString());
     Uri libraryRoot = base.resolve(libDir);
     Uri resolved = libraryRoot.resolve(DART2JS_LIBRARY_MAP[path]);
+    // TODO(rnystrom): This is broken now that scanBuiltInLibraries is async.
+    // Delete this sample.
     LibraryElement library = scanner.loadLibrary(resolved, null);
     return library;
   }
@@ -237,6 +243,8 @@
     return compilationUnit.script;
   }
 
+  // TODO(rnystrom): This is broken now that scanBuiltInLibraries is async.
+  // Delete this sample.
   Script readScript(Uri uri, [ScriptTag node]) {
     String text = "";
     try {
diff --git a/sdk/lib/_internal/dartdoc/lib/src/json_serializer.dart b/sdk/lib/_internal/dartdoc/lib/src/json_serializer.dart
index 8bfa7bb..c218b6c 100755
--- a/sdk/lib/_internal/dartdoc/lib/src/json_serializer.dart
+++ b/sdk/lib/_internal/dartdoc/lib/src/json_serializer.dart
@@ -54,8 +54,7 @@
   // TODO(jacobr): this code works only because futures for mirrors return
   // immediately.
   for(String memberName in members) {
-    var result =
-        deprecatedFutureValue(mirror.getFieldAsync(new Symbol(memberName)));
+    var result = mirror.getField(new Symbol(memberName));
     _serialize(memberName, result.reflectee, printer);
   }
   printer.endObject();
diff --git a/sdk/lib/_internal/lib/collection_patch.dart b/sdk/lib/_internal/lib/collection_patch.dart
index 3fb0f45..c5fa69c 100644
--- a/sdk/lib/_internal/lib/collection_patch.dart
+++ b/sdk/lib/_internal/lib/collection_patch.dart
@@ -6,6 +6,23 @@
 import 'dart:_foreign_helper' show JS;
 
 patch class HashMap<K, V> {
+  patch factory HashMap({ bool equals(K key1, K key2), int hashCode(K key) }) {
+    if (hashCode == null) {
+      if (equals == null) {
+        return new _HashMapImpl<K, V>();
+      }
+      if (identical(identical, equals)) {
+        return new _IdentityHashMap<K, V>();
+      }
+      hashCode = _defaultHashCode;
+    } else if (equals == null) {
+      equals = _defaultEquals;
+    }
+    return new _CustomHashMap<K, V>(equals, hashCode);
+  }
+}
+
+class _HashMapImpl<K, V> implements HashMap<K, V> {
   int _length = 0;
 
   // The hash map contents are divided into three parts: one part for
@@ -26,21 +43,21 @@
   // guard against concurrent modifications.
   List _keys;
 
-  patch HashMap();
+  _HashMapImpl();
 
-  patch int get length => _length;
-  patch bool get isEmpty => _length == 0;
-  patch bool get isNotEmpty => !isEmpty;
+  int get length => _length;
+  bool get isEmpty => _length == 0;
+  bool get isNotEmpty => !isEmpty;
 
-  patch Iterable<K> get keys {
+  Iterable<K> get keys {
     return new HashMapKeyIterable<K>(this);
   }
 
-  patch Iterable<V> get values {
+  Iterable<V> get values {
     return keys.map((each) => this[each]);
   }
 
-  patch bool containsKey(Object key) {
+  bool containsKey(Object key) {
     if (_isStringKey(key)) {
       var strings = _strings;
       return (strings == null) ? false : _hasTableEntry(strings, key);
@@ -55,17 +72,17 @@
     }
   }
 
-  patch bool containsValue(Object value) {
+  bool containsValue(Object value) {
     return _computeKeys().any((each) => this[each] == value);
   }
 
-  patch void addAll(Map<K, V> other) {
+  void addAll(Map<K, V> other) {
     other.forEach((K key, V value) {
       this[key] = value;
     });
   }
 
-  patch V operator[](Object key) {
+  V operator[](Object key) {
     if (_isStringKey(key)) {
       var strings = _strings;
       return (strings == null) ? null : _getTableEntry(strings, key);
@@ -81,7 +98,7 @@
     }
   }
 
-  patch void operator[]=(K key, V value) {
+  void operator[]=(K key, V value) {
     if (_isStringKey(key)) {
       var strings = _strings;
       if (strings == null) _strings = strings = _newHashTable();
@@ -112,14 +129,14 @@
     }
   }
 
-  patch V putIfAbsent(K key, V ifAbsent()) {
+  V putIfAbsent(K key, V ifAbsent()) {
     if (containsKey(key)) return this[key];
     V value = ifAbsent();
     this[key] = value;
     return value;
   }
 
-  patch V remove(Object key) {
+  V remove(Object key) {
     if (_isStringKey(key)) {
       return _removeHashTableEntry(_strings, key);
     } else if (_isNumericKey(key)) {
@@ -140,14 +157,14 @@
     }
   }
 
-  patch void clear() {
+  void clear() {
     if (_length > 0) {
       _strings = _nums = _rest = _keys = null;
       _length = 0;
     }
   }
 
-  patch void forEach(void action(K key, V value)) {
+  void forEach(void action(K key, V value)) {
     List keys = _computeKeys();
     for (int i = 0, length = keys.length; i < length; i++) {
       var key = JS('var', '#[#]', keys, i);
@@ -240,7 +257,7 @@
     return key is num && JS('bool', '(# & 0x3ffffff) === #', key, key);
   }
 
-  static int _computeHashCode(var key) {
+  int _computeHashCode(var key) {
     // We force the hash codes to be unsigned 30-bit integers to avoid
     // issues with problematic keys like '__proto__'. Another option
     // would be to throw an exception if the hash code isn't a number.
@@ -280,12 +297,12 @@
     JS('void', 'delete #[#]', table, key);
   }
 
-  static List _getBucket(var table, var key) {
+  List _getBucket(var table, var key) {
     var hash = _computeHashCode(key);
     return JS('var', '#[#]', table, hash);
   }
 
-  static int _findBucketIndex(var bucket, var key) {
+  int _findBucketIndex(var bucket, var key) {
     if (bucket == null) return -1;
     int length = JS('int', '#.length', bucket);
     for (int i = 0; i < length; i += 2) {
@@ -308,6 +325,41 @@
   }
 }
 
+class _IdentityHashMap<K, V> extends _HashMapImpl<K, V> {
+  int _findBucketIndex(var bucket, var key) {
+    if (bucket == null) return -1;
+    int length = JS('int', '#.length', bucket);
+    for (int i = 0; i < length; i += 2) {
+      if (identical(JS('var', '#[#]', bucket, i), key)) return i;
+    }
+    return -1;
+  }
+}
+
+class _CustomHashMap<K, V> extends _HashMapImpl<K, V> {
+  final _Equality<K> _equals;
+  final _Hasher<K> _hashCode;
+  _CustomHashMap(this._equals, this._hashCode);
+
+  int _computeHashCode(var key) {
+    // We force the hash codes to be unsigned 30-bit integers to avoid
+    // issues with problematic keys like '__proto__'. Another option
+    // would be to throw an exception if the hash code isn't a number.
+    return JS('int', '# & 0x3ffffff', _hashCode(key));
+  }
+
+  int _findBucketIndex(var bucket, var key) {
+    if (bucket == null) return -1;
+    int length = JS('int', '#.length', bucket);
+    for (int i = 0; i < length; i += 2) {
+      if (_equals(JS('var', '#[#]', bucket, i), key)) return i;
+    }
+    return -1;
+  }
+
+  String toString() => Maps.mapToString(this);
+}
+
 class HashMapKeyIterable<E> extends IterableBase<E> {
   final _map;
   HashMapKeyIterable(this._map);
diff --git a/sdk/lib/_internal/lib/foreign_helper.dart b/sdk/lib/_internal/lib/foreign_helper.dart
index a45d9bf..165a0a4 100644
--- a/sdk/lib/_internal/lib/foreign_helper.dart
+++ b/sdk/lib/_internal/lib/foreign_helper.dart
@@ -266,6 +266,6 @@
  * $.JS_CONST_1 = typeof window != "undefined";
  */
 class JS_CONST {
-  String code;
+  final String code;
   const JS_CONST(this.code);
 }
diff --git a/sdk/lib/_internal/lib/interceptors.dart b/sdk/lib/_internal/lib/interceptors.dart
index 149814b..9dff6fb 100644
--- a/sdk/lib/_internal/lib/interceptors.dart
+++ b/sdk/lib/_internal/lib/interceptors.dart
@@ -57,14 +57,6 @@
   return JS('', 'void 0');
 }
 
-/**
- * The name of the property used on native classes and `Object.prototype` to get
- * the interceptor for a native class instance.  The value is initialized on
- * isolate startup to ensure no two Dart programs in the same page use the same
- * property.
- */
-var dispatchPropertyName = null;
-
 getDispatchProperty(object) {
   return JS('', '#[#]', object, JS('String', 'init.dispatchPropertyName'));
 }
diff --git a/sdk/lib/_internal/lib/io_patch.dart b/sdk/lib/_internal/lib/io_patch.dart
index 0bd68ac..04ee3a9 100644
--- a/sdk/lib/_internal/lib/io_patch.dart
+++ b/sdk/lib/_internal/lib/io_patch.dart
@@ -18,8 +18,8 @@
   patch static _create(String path) {
     throw new UnsupportedError("Directory._create");
   }
-  patch static _delete(String path, bool recursive) {
-    throw new UnsupportedError("Directory._delete");
+  patch static _deleteNative(String path, bool recursive) {
+    throw new UnsupportedError("Directory._deleteNative");
   }
   patch static _rename(String path, String newPath) {
     throw new UnsupportedError("Directory._rename");
@@ -74,11 +74,11 @@
   patch static _linkTarget(String path) {
     throw new UnsupportedError("File._linkTarget");
   }
-  patch static _delete(String path) {
-    throw new UnsupportedError("File._delete");
+  patch static _deleteNative(String path) {
+    throw new UnsupportedError("File._deleteNative");
   }
-  patch static _deleteLink(String path) {
-    throw new UnsupportedError("File._deleteLink");
+  patch static _deleteLinkNative(String path) {
+    throw new UnsupportedError("File._deleteLinkNative");
   }
   patch static _rename(String oldPath, String newPath) {
     throw new UnsupportedError("File._rename");
@@ -349,3 +349,12 @@
     throw new UnsupportedError("Stdin.lineMode");
   }
 }
+
+patch class _FileSystemWatcher {
+  patch factory _FileSystemWatcher(String path, int events, bool recursive) {
+    throw new UnsupportedError("_FileSystemWatcher._FileSystemWatcher");
+  }
+  patch static bool get isSupported {
+    throw new UnsupportedError("_FileSystemWatcher.isSupported");
+  }
+}
diff --git a/sdk/lib/_internal/lib/js_helper.dart b/sdk/lib/_internal/lib/js_helper.dart
index 4374eae..fe0fcc1 100644
--- a/sdk/lib/_internal/lib/js_helper.dart
+++ b/sdk/lib/_internal/lib/js_helper.dart
@@ -91,6 +91,10 @@
       'which is not included by a @MirrorsUsed annotation');
 }
 
+bool hasReflectableProperty(var jsFunction) {
+  return JS('bool', '# in #', JS_GET_NAME("REFLECTABLE"), jsFunction);
+}
+
 class JSInvocationMirror implements Invocation {
   static const METHOD = 0;
   static const GETTER = 1;
@@ -175,7 +179,7 @@
     }
     var method = JS('var', '#[#]', receiver, name);
     if (JS('String', 'typeof #', method) == 'function') {
-      if (JS('bool', '#[#] == false', method, JS_GET_NAME("REFLECTABLE"))) {
+      if (!hasReflectableProperty(method)) {
         throwInvalidReflectionError(memberName);
       }
       return new CachedInvocation(method, isIntercepted, interceptor);
diff --git a/sdk/lib/_internal/lib/js_mirrors.dart b/sdk/lib/_internal/lib/js_mirrors.dart
index d8408a6..deb2faa 100644
--- a/sdk/lib/_internal/lib/js_mirrors.dart
+++ b/sdk/lib/_internal/lib/js_mirrors.dart
@@ -26,6 +26,7 @@
     createUnmangledInvocationMirror,
     getMangledTypeName,
     throwInvalidReflectionError,
+    hasReflectableProperty,
     runtimeTypeToString;
 import 'dart:_interceptors' show
     Interceptor,
@@ -430,6 +431,13 @@
   var constructorOrInterceptor =
       Primitives.getConstructorOrInterceptor(mangledName);
   if (constructorOrInterceptor == null) {
+    int index = JS('int|Null', 'init.functionAliases[#]', mangledName);
+    if (index != null) {
+      mirror = new JsTypedefMirror(
+          symbol, mangledName, JS('=Object', 'init.metadata[#]', index));
+      JsCache.update(classMirrors, mangledName, mirror);
+      return mirror;
+    }
     // Probably an intercepted class.
     // TODO(ahe): How to handle intercepted classes?
     throw new UnsupportedError('Cannot find class for: ${n(symbol)}');
@@ -490,6 +498,7 @@
     implements ClassMirror {
   final ClassMirror superclass;
   final ClassMirror mixin;
+  Symbol _cachedSimpleName;
 
   JsMixinApplication(ClassMirror superclass, ClassMirror mixin,
                      String mangledName)
@@ -500,7 +509,11 @@
   String get _prettyName => 'ClassMirror';
 
   Symbol get simpleName {
-    return s('${n(mixin.qualifiedName)}(${n(superclass.qualifiedName)})');
+    if (_cachedSimpleName != null) return _cachedSimpleName;
+    String superName = n(superclass.qualifiedName);
+    return _cachedSimpleName = (superName.contains(' with '))
+        ? s('$superName, ${n(mixin.qualifiedName)}')
+        : s('$superName with ${n(mixin.qualifiedName)}');
   }
 
   Symbol get qualifiedName => simpleName;
@@ -676,6 +689,26 @@
     return JSInvocationMirror.invokeFromMirror(invocation, reflectee);
   }
 
+  operator ==(other) {
+    return other is JsInstanceMirror &&
+           identical(reflectee, other.reflectee);
+  }
+
+  int get hashCode {
+    // If the reflectee is a built-in type, use the base-level hashCode to
+    // preserve the illusion that, e.g. doubles, with the same value are
+    // identical. Otherwise, use the primitive identity hash to maintain
+    // correctness even if a user-defined hashCode returns different values for
+    // successive invocations.
+    var h = ((JS('bool', 'typeof # != "object"', reflectee)) || 
+             (reflectee == null))
+        ? reflectee.hashCode
+        : Primitives.objectHashCode(reflectee);
+    // Avoid hash collisions with the reflectee. This constant is in Smi range
+    // and happens to be the inner padding from RFC 2104.
+    return h ^ 0x36363636;
+  }
+
   String toString() => 'InstanceMirror on ${Error.safeToString(reflectee)}';
 
   // TODO(ahe): Remove this method from the API.
@@ -1273,7 +1306,7 @@
   }
 
   bool canInvokeReflectively() {
-    return JS('bool', '#[#] != false', _jsFunction, JS_GET_NAME("REFLECTABLE"));
+    return hasReflectableProperty(_jsFunction);
   }
 
   DeclarationMirror get owner => _owner;
@@ -1365,7 +1398,7 @@
 }
 
 class JsParameterMirror extends JsDeclarationMirror implements ParameterMirror {
-  final JsMethodMirror owner;
+  final DeclarationMirror owner;
   // A JS object representing the type.
   final _type;
 
@@ -1376,7 +1409,8 @@
 
   TypeMirror get type => typeMirrorFromRuntimeTypeRepresentation(_type);
 
-  bool get isStatic => owner.isStatic;
+  // Only true for static fields, never for a parameter.
+  bool get isStatic => false;
 
   // TODO(ahe): Implement this.
   bool get isFinal => false;
@@ -1397,6 +1431,119 @@
   List<InstanceMirror> get metadata => throw new UnimplementedError();
 }
 
+class JsTypedefMirror extends JsDeclarationMirror implements TypedefMirror {
+  final String _mangledName;
+  final JsFunctionTypeMirror referent;
+
+  JsTypedefMirror(Symbol simpleName,  this._mangledName, _typeData)
+      : referent = new JsFunctionTypeMirror(_typeData),
+        super(simpleName);
+
+  JsFunctionTypeMirror get value => referent;
+
+  String get _prettyName => 'TypedefMirror';
+}
+
+class JsFunctionTypeMirror implements FunctionTypeMirror {
+  final _typeData;
+  String _cachedToString;
+  TypeMirror _cachedReturnType;
+  UnmodifiableListView<ParameterMirror> _cachedParameters;
+
+  JsFunctionTypeMirror(this._typeData);
+
+  bool get _hasReturnType => JS('bool', '"ret" in #', _typeData);
+  get _returnType => JS('', '#.ret', _typeData);
+
+  bool get _isVoid => JS('bool', '!!#.void', _typeData);
+
+  bool get _hasArguments => JS('bool', '"args" in #', _typeData);
+  List get _arguments => JS('JSExtendableArray', '#.args', _typeData);
+
+  bool get _hasOptionalArguments => JS('bool', '"opt" in #', _typeData);
+  List get _optionalArguments => JS('JSExtendableArray', '#.opt', _typeData);
+
+  bool get _hasNamedArguments => JS('bool', '"named" in #', _typeData);
+  get _namedArguments => JS('=Object', '#.named', _typeData);
+
+  TypeMirror get returnType {
+    if (_cachedReturnType != null) return _cachedReturnType;
+    if (_isVoid) return _cachedReturnType = JsMirrorSystem._voidType;
+    if (!_hasReturnType) return _cachedReturnType = JsMirrorSystem._dynamicType;
+    return _cachedReturnType =
+        typeMirrorFromRuntimeTypeRepresentation(_returnType);
+  }
+
+  List<ParameterMirror> get parameters {
+    if (_cachedParameters != null) return _cachedParameters;
+    List result = [];
+    int parameterCount = 0;
+    if (_hasArguments) {
+      for (var type in _arguments) {
+        result.add(
+            new JsParameterMirror('argument${parameterCount++}', this, type));
+      }
+    }
+    if (_hasOptionalArguments) {
+      for (var type in _optionalArguments) {
+        result.add(
+            new JsParameterMirror('argument${parameterCount++}', this, type));
+      }
+    }
+    if (_hasNamedArguments) {
+      for (var name in extractKeys(_namedArguments)) {
+        var type = JS('', '#[#]', _namedArguments, name);
+        result.add(new JsParameterMirror(name, this, type));
+      }
+    }
+    return _cachedParameters = new UnmodifiableListView<ParameterMirror>(
+        result);
+  }
+
+  String toString() {
+    if (_cachedToString != null) return _cachedToString;
+    var s = "FunctionTypeMirror on '(";
+    var sep = '';
+    if (_hasArguments) {
+      for (var argument in _arguments) {
+        s += sep;
+        s += runtimeTypeToString(argument);
+        sep = ', ';
+      }
+    }
+    if (_hasOptionalArguments) {
+      s += '$sep[';
+      sep = '';
+      for (var argument in _optionalArguments) {
+        s += sep;
+        s += runtimeTypeToString(argument);
+        sep = ', ';
+      }
+      s += ']';
+    }
+    if (_hasNamedArguments) {
+      s += '$sep{';
+      sep = '';
+      for (var name in extractKeys(_namedArguments)) {
+        s += sep;
+        s += '$name: ';
+        s += runtimeTypeToString(JS('', '#[#]', _namedArguments, name));
+        sep = ', ';
+      }
+      s += '}';
+    }
+    s += ') -> ';
+    if (_isVoid) {
+      s += 'void';
+    } else if (_hasReturnType) {
+      s += runtimeTypeToString(_returnType);
+    } else {
+      s += 'dynamic';
+    }
+    return _cachedToString = "$s'";
+  }
+}
+
 TypeMirror typeMirrorFromRuntimeTypeRepresentation(type) {
   if (type == null) return JsMirrorSystem._dynamicType;
   String representation = runtimeTypeToString(type);
diff --git a/sdk/lib/_internal/lib/native_helper.dart b/sdk/lib/_internal/lib/native_helper.dart
index 5470611..54073c3 100644
--- a/sdk/lib/_internal/lib/native_helper.dart
+++ b/sdk/lib/_internal/lib/native_helper.dart
@@ -167,7 +167,7 @@
     return typeNameInChrome;
   } else if (contains(userAgent, 'Firefox')) {
     return typeNameInFirefox;
-  } else if (contains(userAgent, 'MSIE')) {
+  } else if (contains(userAgent, 'Trident/')) {
     return typeNameInIE;
   } else if (contains(userAgent, 'Opera')) {
     return typeNameInOpera;
diff --git a/sdk/lib/_internal/libraries.dart b/sdk/lib/_internal/libraries.dart
index bf796ac..fee473e 100644
--- a/sdk/lib/_internal/libraries.dart
+++ b/sdk/lib/_internal/libraries.dart
@@ -24,32 +24,39 @@
 
   "async": const LibraryInfo(
       "async/async.dart",
+      maturity: Maturity.STABLE,
       dart2jsPatchPath: "_internal/lib/async_patch.dart"),
 
   "chrome": const LibraryInfo(
       "chrome/dart2js/chrome_dart2js.dart",
+      maturity: Maturity.DEPRECATED,
       category: "Client"),
 
   "collection": const LibraryInfo(
       "collection/collection.dart",
+      maturity: Maturity.STABLE,
       dart2jsPatchPath: "_internal/lib/collection_patch.dart"),
 
   "convert": const LibraryInfo(
       "convert/convert.dart",
+      maturity: Maturity.STABLE,
       dart2jsPatchPath: "_internal/lib/convert_patch.dart"),
 
   "core": const LibraryInfo(
       "core/core.dart",
+      maturity: Maturity.STABLE,
       dart2jsPatchPath: "_internal/lib/core_patch.dart"),
 
   "html": const LibraryInfo(
       "html/dartium/html_dartium.dart",
       category: "Client",
+      maturity: Maturity.WEB_STABLE,
       dart2jsPath: "html/dart2js/html_dart2js.dart"),
 
   "html_common": const LibraryInfo(
       "html/html_common/html_common.dart",
       category: "Client",
+      maturity: Maturity.WEB_STABLE,
       dart2jsPath: "html/html_common/html_common_dart2js.dart",
       documented: false,
       implementation: true),
@@ -57,31 +64,38 @@
   "indexed_db": const LibraryInfo(
       "indexed_db/dartium/indexed_db_dartium.dart",
       category: "Client",
+      maturity: Maturity.WEB_STABLE,
       dart2jsPath: "indexed_db/dart2js/indexed_db_dart2js.dart"),
 
   "io": const LibraryInfo(
       "io/io.dart",
       category: "Server",
+      maturity: Maturity.STABLE,
       dart2jsPatchPath: "_internal/lib/io_patch.dart"),
 
   "isolate": const LibraryInfo(
       "isolate/isolate.dart",
+      maturity: Maturity.UNSTABLE,
       dart2jsPatchPath: "_internal/lib/isolate_patch.dart"),
 
   "js": const LibraryInfo(
       "js/dartium/js_dartium.dart",
       category: "Client",
+      maturity: Maturity.STABLE,
       dart2jsPath: "js/dart2js/js_dart2js.dart"),
 
   "json": const LibraryInfo(
-      "json/json.dart"),
+      "json/json.dart",
+      maturity: Maturity.DEPRECATED),
 
   "math": const LibraryInfo(
       "math/math.dart",
+      maturity: Maturity.STABLE,
       dart2jsPatchPath: "_internal/lib/math_patch.dart"),
 
   "mirrors": const LibraryInfo(
       "mirrors/mirrors.dart",
+      maturity: Maturity.UNSTABLE, 
       dart2jsPatchPath: "_internal/lib/mirrors_patch.dart"),
 
   "nativewrappers": const LibraryInfo(
@@ -93,30 +107,36 @@
 
   "typed_data": const LibraryInfo(
       "typed_data/typed_data.dart",
+      maturity: Maturity.STABLE,
       dart2jsPath: "typed_data/dart2js/typed_data_dart2js.dart"),
 
   "svg": const LibraryInfo(
-        "svg/dartium/svg_dartium.dart",
-        category: "Client",
-        dart2jsPath: "svg/dart2js/svg_dart2js.dart"),
+      "svg/dartium/svg_dartium.dart",
+      category: "Client",
+      maturity: Maturity.WEB_STABLE,
+      dart2jsPath: "svg/dart2js/svg_dart2js.dart"),
 
   "utf": const LibraryInfo(
-      "utf/utf.dart"),
+      "utf/utf.dart",
+      maturity: Maturity.DEPRECATED),
 
   "web_audio": const LibraryInfo(
-        "web_audio/dartium/web_audio_dartium.dart",
-        category: "Client",
-        dart2jsPath: "web_audio/dart2js/web_audio_dart2js.dart"),
+      "web_audio/dartium/web_audio_dartium.dart",
+      category: "Client",
+      maturity: Maturity.WEB_STABLE,
+      dart2jsPath: "web_audio/dart2js/web_audio_dart2js.dart"),
 
   "web_gl": const LibraryInfo(
-        "web_gl/dartium/web_gl_dartium.dart",
-        category: "Client",
-        dart2jsPath: "web_gl/dart2js/web_gl_dart2js.dart"),
+      "web_gl/dartium/web_gl_dartium.dart",
+      category: "Client",
+      maturity: Maturity.WEB_STABLE,
+      dart2jsPath: "web_gl/dart2js/web_gl_dart2js.dart"),
 
   "web_sql": const LibraryInfo(
-        "web_sql/dartium/web_sql_dartium.dart",
-        category: "Client",
-        dart2jsPath: "web_sql/dart2js/web_sql_dart2js.dart"),
+      "web_sql/dartium/web_sql_dartium.dart",
+      category: "Client",
+      maturity: Maturity.WEB_STABLE,
+      dart2jsPath: "web_sql/dart2js/web_sql_dart2js.dart"),
 
   "_collection-dev": const LibraryInfo(
       "_collection_dev/collection_dev.dart",
@@ -219,14 +239,62 @@
    */
   final bool implementation;
 
+  /**
+   * States the current maturity of this library.
+   */
+  final Maturity maturity;
+
   const LibraryInfo(this.path, {
                     this.category: "Shared",
                     this.dart2jsPath,
                     this.dart2jsPatchPath,
                     this.implementation: false,
                     this.documented: true,
+                    this.maturity: Maturity.UNSPECIFIED,
                     this.platforms: DART2JS_PLATFORM | VM_PLATFORM});
 
   bool get isDart2jsLibrary => (platforms & DART2JS_PLATFORM) != 0;
   bool get isVmLibrary => (platforms & VM_PLATFORM) != 0;
 }
+
+
+
+/**
+ * Abstraction to capture the maturity of a library.
+ */
+class Maturity {
+  final int level;
+  final String name;
+  final String description;
+  
+  const Maturity(this.level, this.name, this.description);
+  
+  String toString() => "$name: $level\n$description\n";
+
+  static const Maturity DEPRECATED = const Maturity(0, "Deprecated",
+    "This library will be remove before next major release.");
+  
+  static const Maturity EXPERIMENTAL = const Maturity(1, "Experimental",
+    "This library is experimental and will likely change or be removed\n"
+    "in future versions.");
+  
+  static const Maturity UNSTABLE = const Maturity(2, "Unstable",
+    "This library is in still changing and have not yet endured\n"
+    "sufficient real-world testing.\n"
+    "Backwards-compatibility is NOT guaranteed.");
+  
+  static const Maturity WEB_STABLE = const Maturity(3, "Web Stable",
+    "This library is tracking the DOM evolution as defined by WC3.\n"
+    "Backwards-compatibility is NOT guaranteed.");
+
+  static const Maturity STABLE = const Maturity(4, "Stable",
+    "The library is stable. API backwards-compatibility is guaranteed.\n"
+    "However implementation details might change.");
+  
+  static const Maturity LOCKED = const Maturity(5, "Locked",
+    "This library will not change except when serious bugs are encountered.");
+
+  static const Maturity UNSPECIFIED = const Maturity(-1, "Unspecified",
+    "The maturity for this library has not been specified.");
+}
+
diff --git a/sdk/lib/_internal/pub/lib/src/barback.dart b/sdk/lib/_internal/pub/lib/src/barback.dart
new file mode 100644
index 0000000..36de8dc
--- /dev/null
+++ b/sdk/lib/_internal/pub/lib/src/barback.dart
@@ -0,0 +1,106 @@
+// Copyright (c) 2013, 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 pub.barback;
+
+import 'dart:async';
+
+import 'package:barback/barback.dart';
+
+import 'barback/load_transformers.dart';
+import 'barback/pub_package_provider.dart';
+import 'barback/rewrite_import_transformer.dart';
+import 'barback/server.dart';
+import 'barback/watch_sources.dart';
+import 'utils.dart';
+
+/// Creates a [BarbackServer] serving on [host] and [port].
+///
+/// This transforms and serves all library and asset files in all packages in
+/// [graph]. It loads any transformer plugins defined in packages in [graph] and
+/// re-runs them as necessary when any input files change.
+Future<BarbackServer> createServer(String host, int port, PackageGraph graph) {
+  var provider = new PubPackageProvider(graph);
+  var barback = new Barback(provider);
+  return BarbackServer.bind(host, port, barback, graph.entrypoint.root.name)
+      .then((server) {
+    watchSources(graph, barback);
+
+    var completer = new Completer();
+
+    // If any errors get emitted either by barback or by the server, including
+    // non-programmatic barback errors, they should take down the whole program.
+    var subscriptions = [
+      server.barback.errors.listen((error) {
+        if (error is TransformerException) error = error.error;
+        if (!completer.isCompleted) completer.completeError(error);
+      }),
+      server.barback.results.listen((_) {}, onError: (error) {
+        if (!completer.isCompleted) completer.completeError(error);
+      }),
+      server.results.listen((_) {}, onError: (error) {
+        if (!completer.isCompleted) completer.completeError(error);
+      })
+    ];
+
+    _loadTransformers(server, graph).then((_) {
+      if (!completer.isCompleted) completer.complete(server);
+    }).catchError((error) {
+      if (!completer.isCompleted) completer.completeError(error);
+    });
+
+    return completer.future.whenComplete(() {
+      for (var subscription in subscriptions) {
+        subscription.cancel();
+      }
+    });
+  });
+}
+
+/// Loads all transformers depended on by packages in [graph].
+///
+/// This uses [server] to serve the Dart files from which transformers are
+/// loaded, then adds the transformers to `server.barback`.
+Future _loadTransformers(BarbackServer server, PackageGraph graph) {
+  // Add a rewrite transformer for each package, so that we can resolve
+  // "package:" imports while loading transformers.
+  var rewrite = new RewriteImportTransformer();
+  for (var package in graph.packages.values) {
+    server.barback.updateTransformers(package.name, [[rewrite]]);
+  }
+
+  // A map from each transformer id to the set of packages that use it.
+  var idsToPackages = new Map<AssetId, Set<String>>();
+  for (var package in graph.packages.values) {
+    for (var id in unionAll(package.pubspec.transformers)) {
+      idsToPackages.putIfAbsent(id, () => new Set<String>()).add(package.name);
+    }
+  }
+
+  // TODO(nweiz): support transformers that (possibly transitively)
+  // depend on other transformers.
+  var transformersForId = new Map<AssetId, Set<Transformer>>();
+  return Future.wait(idsToPackages.keys.map((id) {
+    return loadTransformers(server, id).then((transformers) {
+      if (transformers.isEmpty) {
+        var path = id.path.replaceFirst('lib/', '');
+        // Ensure that packages are listed in a deterministic order.
+        var packages = idsToPackages[id].toList();
+        packages.sort();
+        throw new ApplicationException(
+            "No transformers were defined in package:${id.package}/$path,\n"
+            "required by ${packages.join(', ')}.");
+      }
+
+      transformersForId[id] = transformers;
+    });
+  })).then((_) {
+    for (var package in graph.packages.values) {
+      var phases = package.pubspec.transformers.map((phase) {
+        return unionAll(phase.map((id) => transformersForId[id]));
+      });
+      server.barback.updateTransformers(package.name, phases);
+    }
+  });
+}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart b/sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart
new file mode 100644
index 0000000..72634bc
--- /dev/null
+++ b/sdk/lib/_internal/pub/lib/src/barback/load_transformers.dart
@@ -0,0 +1,398 @@
+// Copyright (c) 2013, 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 pub.serialize_transformer;
+
+import 'dart:async';
+import 'dart:isolate';
+
+import 'package:barback/barback.dart';
+import 'package:stack_trace/stack_trace.dart';
+
+import '../dart.dart' as dart;
+import '../log.dart' as log;
+import '../utils.dart';
+
+/// A Dart script to run in an isolate.
+///
+/// This script serializes one or more transformers defined in a Dart library and
+/// marhsals calls to and from them with the host isolate.
+const _TRANSFORMER_ISOLATE = """
+import 'dart:async';
+import 'dart:isolate';
+import 'dart:mirrors';
+
+import 'http://localhost:<<PORT>>/packages/barback/barback.dart';
+
+/// Sets up the initial communication with the host isolate.
+void main() {
+  port.receive((uri, replyTo) {
+    _sendFuture(replyTo, new Future.sync(() {
+      return initialize(Uri.parse(uri)).map(_serializeTransformer).toList();
+    }));
+  });
+}
+
+/// Loads all the transformers defined in [uri] and adds them to [transformers].
+///
+/// We then load the library, find any Transformer subclasses in it, instantiate
+/// them, and return them.
+Iterable<Transformer> initialize(Uri uri) {
+  var mirrors = currentMirrorSystem();
+  // TODO(nweiz): look this up by name once issue 5897 is fixed.
+  var transformerUri = Uri.parse(
+      'http://localhost:<<PORT>>/packages/barback/src/transformer.dart');
+  var transformerClass = mirrors.libraries[transformerUri]
+      .classes[const Symbol('Transformer')];
+
+  return mirrors.libraries[uri].classes.values.where((classMirror) {
+    if (classMirror.isPrivate) return false;
+    if (isAbstract(classMirror)) return false;
+    if (!classIsA(classMirror, transformerClass)) return false;
+    var constructor = classMirror.constructors[classMirror.simpleName];
+    if (constructor == null) return false;
+    if (!constructor.parameters.isEmpty) return false;
+    return true;
+  }).map((classMirror) {
+    return classMirror.newInstance(const Symbol(''), []).reflectee;
+  });
+}
+
+/// A wrapper for a [Transform] that's in the host isolate.
+///
+/// This retrieves inputs from and sends outputs and logs to the host isolate.
+class ForeignTransform implements Transform {
+  /// The port with which we communicate with the host isolate.
+  ///
+  /// This port and all messages sent across it are specific to this transform.
+  final SendPort _port;
+
+  final Asset primaryInput;
+
+  // TODO(nweiz): implement this
+  TransformLogger get logger {
+    throw new UnimplementedError('ForeignTranform.logger is not yet '
+      'implemented.');
+  }
+
+  /// Creates a transform from a serializable map sent from the host isolate.
+  ForeignTransform(Map transform)
+      : _port = transform['port'],
+        primaryInput = _deserializeAsset(transform['primaryInput']);
+
+  Future<Asset> getInput(AssetId id) {
+    return _receiveFuture(_port.call({
+      'type': 'getInput',
+      'id': _serializeId(id)
+    })).then(_deserializeAsset);
+  }
+
+  void addOutput(Asset output) {
+    _port.send({
+      'type': 'addOutput',
+      'output': _serializeAsset(output)
+    });
+  }
+}
+
+/// Returns the mirror for the root Object type.
+ClassMirror get objectMirror {
+  if (_objectMirror == null) {
+    _objectMirror = currentMirrorSystem()
+        .libraries[Uri.parse('dart:core')]
+        .classes[const Symbol('Object')];
+  }
+  return _objectMirror;
+}
+ClassMirror _objectMirror;
+
+// TODO(nweiz): get rid of this when issue 12439 is fixed.
+/// Returns whether or not [mirror] is a subtype of [superclass].
+///
+/// This includes [superclass] being mixed in to or implemented by [mirror].
+bool classIsA(ClassMirror mirror, ClassMirror superclass) {
+  if (mirror == superclass) return true;
+  if (mirror == objectMirror) return false;
+  return classIsA(mirror.superclass, superclass) ||
+      mirror.superinterfaces.any((int) => classIsA(int, superclass));
+}
+
+// TODO(nweiz): get rid of this when issue 12826 is fixed.
+/// Returns whether or not [mirror] is an abstract class.
+bool isAbstract(ClassMirror mirror) => mirror.members.values
+    .any((member) => member is MethodMirror && member.isAbstract);
+
+/// Converts [transformer] into a serializable map.
+Map _serializeTransformer(Transformer transformer) {
+  var port = new ReceivePort();
+  port.receive((message, replyTo) {
+    _sendFuture(replyTo, new Future.sync(() {
+      if (message['type'] == 'isPrimary') {
+        return transformer.isPrimary(_deserializeAsset(message['asset']));
+      } else {
+        assert(message['type'] == 'apply');
+        return transformer.apply(
+            new ForeignTransform(message['transform']));
+      }
+    }));
+  });
+
+  return {
+    'toString': transformer.toString(),
+    'port': port.toSendPort()
+  };
+}
+
+/// Converts a serializable map into an [Asset].
+Asset _deserializeAsset(Map asset) {
+  var box = new MessageBox();
+  asset['sink'].add(box.sink);
+  return new Asset.fromStream(_deserializeId(asset['id']), box.stream);
+}
+
+/// Converts a serializable map into an [AssetId].
+AssetId _deserializeId(Map id) => new AssetId(id['package'], id['path']);
+
+/// Converts [asset] into a serializable map.
+Map _serializeAsset(Asset asset) {
+  // We can't send IsolateStreams (issue 12437), so instead we send a sink and
+  // get the isolate to send us back another sink.
+  var box = new MessageBox();
+  box.stream.first.then((sink) {
+    asset.read().listen(sink.add,
+        onError: sink.addError,
+        onDone: sink.close);
+  });
+
+  return {
+    'id': _serializeId(asset.id),
+    'sink': box.sink
+  };
+}
+
+/// Converts [id] into a serializable map.
+Map _serializeId(AssetId id) => {'package': id.package, 'path': id.path};
+
+/// Sends the result of [future] through [port].
+///
+/// This should be received on the other end using [_receiveFuture]. It
+/// re-raises any exceptions on the other side as [CrossIsolateException]s.
+void _sendFuture(SendPort port, Future future) {
+  future.then((result) {
+    port.send({'success': result});
+  }).catchError((error) {
+    // TODO(nweiz): at least MissingInputException should be preserved here.
+    port.send({'error': CrossIsolateException.serialize(error)});
+  });
+}
+
+/// Receives the result of [_sendFuture] from [portCall], which should be the
+/// return value of [SendPort.call].
+Future _receiveFuture(Future portCall) {
+  return portCall.then((response) {
+    if (response.containsKey('success')) return response['success'];
+    return new Future.error(
+        new CrossIsolateException.deserialize(response['error']));
+  });
+}
+
+/// An exception that was originally raised in another isolate.
+///
+/// Exception objects can't cross isolate boundaries in general, so this class
+/// wraps as much information as can be consistently serialized.
+class CrossIsolateException implements Exception {
+  /// The name of the type of exception thrown.
+  ///
+  /// This is the return value of [error.runtimeType.toString()]. Keep in mind
+  /// that objects in different libraries may have the same type name.
+  final String type;
+
+  /// The exception's message, or its [toString] if it didn't expose a `message`
+  /// property.
+  final String message;
+
+  /// The exception's stack trace, or `null` if no stack trace was available.
+  final Trace stackTrace;
+
+  /// Loads a [CrossIsolateException] from a map.
+  ///
+  /// [error] should be the result of [CrossIsolateException.serialize].
+  CrossIsolateException.deserialize(Map error)
+      : type = error['type'],
+        message = error['message'],
+        stackTrace = error['stack'] == null ? null :
+            new Trace.parse(error['stack']);
+
+  /// Serializes [error] to a map that can safely be passed across isolate
+  /// boundaries.
+  static Map serialize(error, [StackTrace stack]) {
+    if (stack == null) stack = getAttachedStackTrace(error);
+    return {
+      'type': error.runtimeType.toString(),
+      'message': getErrorMessage(error),
+      'stack': stack == null ? null : stack.toString()
+    };
+  }
+
+  String toString() => "\$message\\n\$stackTrace";
+}
+
+// Get a string description of an exception.
+//
+// Most exception types have a "message" property. We prefer this since
+// it skips the "Exception:", "HttpException:", etc. prefix that calling
+// toString() adds. But, alas, "message" isn't actually defined in the
+// base Exception type so there's no easy way to know if it's available
+// short of a giant pile of type tests for each known exception type.
+//
+// So just try it. If it throws, default to toString().
+String getErrorMessage(error) {
+  try {
+    return error.message;
+  } on NoSuchMethodError catch (_) {
+    return error.toString();
+  }
+}
+""";
+
+/// Load and return all transformers from the library identified by [library].
+///
+/// [server] is used to serve [library] and any Dart files it imports.
+Future<Set<Transformer>> loadTransformers(BarbackServer server,
+    AssetId library) {
+  var path = library.path.replaceFirst('lib/', '');
+  // TODO(nweiz): load from a "package:" URI when issue 12474 is fixed.
+  var uri = 'http://localhost:${server.port}/packages/${library.package}/$path';
+  var code = 'import "$uri";' +
+      _TRANSFORMER_ISOLATE.replaceAll('<<PORT>>', server.port.toString());
+  log.fine("Loading transformers from $library");
+  return dart.runInIsolate(code).then((sendPort) {
+    return _receiveFuture(sendPort.call(uri)).then((transformers) {
+      transformers = transformers
+          .map((transformer) => new _ForeignTransformer(transformer))
+          .toSet();
+      log.fine("Transformers from $library: $transformers");
+      return transformers;
+    });
+  }).catchError((error) {
+    if (error is! CrossIsolateException) throw error;
+    if (error.type != 'IsolateSpawnException') throw error;
+    // TODO(nweiz): don't parse this as a string once issues 12617 and 12689 are
+    // fixed.
+    if (!error.message.split('\n')[1].startsWith('import "$uri";')) {
+      throw error;
+    }
+
+    // If there was an IsolateSpawnException and the import that actually failed
+    // was the one we were loading transformers from, throw an application
+    // exception with a more user-friendly message.
+    fail('Transformer library "package:${library.package}/$path" not found.');
+  });
+}
+
+/// A wrapper for a transformer that's in a different isolate.
+class _ForeignTransformer implements Transformer {
+  /// The port with which we communicate with the child isolate.
+  ///
+  /// This port and all messages sent across it are specific to this
+  /// transformer.
+  final SendPort _port;
+
+  /// The result of calling [toString] on the transformer in the isolate.
+  final String _toString;
+
+  _ForeignTransformer(Map map)
+      : _port = map['port'],
+        _toString = map['toString'];
+
+  Future<bool> isPrimary(Asset asset) {
+    return _receiveFuture(_port.call({
+      'type': 'isPrimary',
+      'asset': _serializeAsset(asset)
+    }));
+  }
+
+  Future apply(Transform transform) {
+    return _receiveFuture(_port.call({
+      'type': 'apply',
+      'transform': _serializeTransform(transform)
+    }));
+  }
+
+  String toString() => _toString;
+}
+
+/// Converts [transform] into a serializable map.
+Map _serializeTransform(Transform transform) {
+  var receivePort = new ReceivePort();
+  receivePort.receive((message, replyTo) {
+    if (message['type'] == 'getInput') {
+      _sendFuture(replyTo, transform.getInput(_deserializeId(message['id']))
+          .then(_serializeAsset));
+    } else {
+      assert(message['type'] == 'addOutput');
+      transform.addOutput(_deserializeAsset(message['output']));
+    }
+  });
+
+  return {
+    'port': receivePort.toSendPort(),
+    'primaryInput': _serializeAsset(transform.primaryInput)
+  };
+}
+
+/// Converts a serializable map into an [Asset].
+Asset _deserializeAsset(Map asset) {
+  var box = new MessageBox();
+  asset['sink'].add(box.sink);
+  return new Asset.fromStream(_deserializeId(asset['id']), box.stream);
+}
+
+/// Converts a serializable map into an [AssetId].
+AssetId _deserializeId(Map id) => new AssetId(id['package'], id['path']);
+
+// TODO(nweiz): add custom serialization code for assets that can be more
+// efficiently serialized.
+/// Converts [asset] into a serializable map.
+Map _serializeAsset(Asset asset) {
+  // We can't send IsolateStreams (issue 12437), so instead we send a sink and
+  // get the isolate to send us back another sink.
+  var box = new MessageBox();
+  box.stream.first.then((sink) {
+    asset.read().listen(sink.add,
+        onError: sink.addError,
+        onDone: sink.close);
+  });
+
+  return {
+    'id': _serializeId(asset.id),
+    'sink': box.sink
+  };
+}
+
+/// Converts [id] into a serializable map.
+Map _serializeId(AssetId id) => {'package': id.package, 'path': id.path};
+
+/// Sends the result of [future] through [port].
+///
+/// This should be received on the other end using [_receiveFuture]. It
+/// re-raises any exceptions on the other side as [CrossIsolateException]s.
+void _sendFuture(SendPort port, Future future) {
+  future.then((result) {
+    port.send({'success': result});
+  }).catchError((error) {
+    // TODO(nweiz): at least MissingInputException should be preserved here.
+    port.send({'error': CrossIsolateException.serialize(error)});
+  });
+}
+
+/// Receives the result of [_sendFuture] from [portCall], which should be the
+/// return value of [SendPort.call].
+Future _receiveFuture(Future portCall) {
+  return portCall.then((response) {
+    if (response.containsKey('success')) return response['success'];
+    return new Future.error(
+        new dart.CrossIsolateException.deserialize(response['error']));
+  });
+}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/pub_package_provider.dart b/sdk/lib/_internal/pub/lib/src/barback/pub_package_provider.dart
new file mode 100644
index 0000000..9e1d7b4
--- /dev/null
+++ b/sdk/lib/_internal/pub/lib/src/barback/pub_package_provider.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2013, 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 pub.pub_package_provider;
+
+import 'dart:async';
+
+import 'package:barback/barback.dart';
+import 'package:path/path.dart' as path;
+
+import '../package_graph.dart';
+
+/// An implementation of barback's [PackageProvider] interface so that barback
+/// can find assets within pub packages.
+class PubPackageProvider implements PackageProvider {
+  final PackageGraph _graph;
+
+  PubPackageProvider(this._graph);
+
+  Iterable<String> get packages => _graph.packages.keys;
+
+  Future<Asset> getAsset(AssetId id) {
+    var file = path.join(_graph.packages[id.package].dir, id.path);
+    return new Future.value(new Asset.fromPath(id, file));
+  }
+}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/rewrite_import_transformer.dart b/sdk/lib/_internal/pub/lib/src/barback/rewrite_import_transformer.dart
new file mode 100644
index 0000000..66fda92
--- /dev/null
+++ b/sdk/lib/_internal/pub/lib/src/barback/rewrite_import_transformer.dart
@@ -0,0 +1,45 @@
+// Copyright (c) 2013, 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 pub.rewrite_import_transformer;
+
+import 'package:barback/barback.dart';
+import 'package:analyzer_experimental/analyzer.dart';
+
+/// A transformer used internally to rewrite "package:" imports so they point to
+/// the barback server rather than to pub's package root.
+class RewriteImportTransformer extends Transformer {
+  String get allowedExtensions => '.dart';
+
+  Future apply(Transform transform) {
+    return transform.primaryInput.readAsString().then((contents) {
+      var collector = new _DirectiveCollector();
+      parseCompilationUnit(contents, name: transform.primaryInput.id.toString())
+          .accept(collector);
+
+      var buffer = new StringBuffer();
+      var index = 0;
+      for (var directive in collector.directives) {
+        var uri = Uri.parse(directive.uri.stringValue);
+        if (uri.scheme != 'package') continue;
+
+        buffer
+          ..write(contents.substring(index, directive.uri.literal.offset))
+          ..write('"/packages/${uri.path}"');
+        index = directive.uri.literal.end;
+      }
+      buffer.write(contents.substring(index, contents.length));
+
+      transform.addOutput(
+          new Asset.fromString(transform.primaryInput.id, buffer.toString()));
+    });
+  }
+}
+
+/// A simple visitor that collects import and export nodes.
+class _DirectiveCollector extends GeneralizingASTVisitor {
+  final directives = <UriBasedDirective>[];
+
+  visitUriBasedDirective(UriBasedDirective node) => directives.add(node);
+}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/server.dart b/sdk/lib/_internal/pub/lib/src/barback/server.dart
new file mode 100644
index 0000000..3db42e5
--- /dev/null
+++ b/sdk/lib/_internal/pub/lib/src/barback/server.dart
@@ -0,0 +1,227 @@
+// Copyright (c) 2013, 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 pub.barback.server;
+
+import 'dart:async';
+import 'dart:io';
+
+import 'package:barback/barback.dart';
+import 'package:path/path.dart' as path;
+import 'package:stack_trace/stack_trace.dart';
+
+import '../log.dart' as log;
+import '../utils.dart';
+
+/// A server that serves assets transformed by barback.
+class BarbackServer {
+  /// The underlying HTTP server.
+  final HttpServer _server;
+
+  /// The name of the root package, from whose `web` directory root assets will
+  /// be served.
+  final String _rootPackage;
+
+  /// The barback instance from which this serves assets.
+  final Barback barback;
+
+  /// The server's port.
+  final int port;
+
+  /// The results of requests handled by the server.
+  ///
+  /// These can be used to provide visual feedback for the server's processing.
+  /// This stream is also used to emit any programmatic errors that occur in the
+  /// server.
+  Stream<BarbackServerResult> get results => _resultsController.stream;
+  final _resultsController =
+      new StreamController<BarbackServerResult>.broadcast();
+
+  /// Creates a new server and binds it to [port] of [host].
+  ///
+  /// This server will serve assets from [barback], and use [rootPackage] as the
+  /// root package.
+  static Future<BarbackServer> bind(String host, int port, Barback barback,
+      String rootPackage) {
+    return HttpServer.bind(host, port)
+        .then((server) => new BarbackServer._(server, barback, rootPackage));
+  }
+
+  BarbackServer._(HttpServer server, this.barback, this._rootPackage)
+      : _server = server,
+        port = server.port {
+    _server.listen(_handleRequest, onError: (error) {
+      _resultsController.addError(error);
+      close();
+    });
+  }
+
+  /// Closes this server.
+  Future close() {
+    _server.close();
+    _resultsController.close();
+  }
+
+  /// Handles an HTTP request.
+  void _handleRequest(HttpRequest request) {
+    if (request.method != "GET" && request.method != "HEAD") {
+      _methodNotAllowed(request);
+      return;
+    }
+
+    var id = _getIdFromUri(request.uri);
+    if (id == null) {
+      _notFound(request, "Path ${request.uri.path} is not valid.");
+      return;
+    }
+
+    _logRequest(request, "Loading $id");
+    barback.getAssetById(id).then((asset) {
+      return validateStream(asset.read()).then((stream) {
+        _resultsController.add(
+            new BarbackServerResult._success(request.uri, id));
+        // TODO(rnystrom): Set content-type based on asset type.
+        return request.response.addStream(stream).then((_) {
+          // Log successful requests both so we can provide debugging
+          // information and so scheduled_test knows we haven't timed out while
+          // loading transformers.
+          _logRequest(request, "Served $id");
+          request.response.close();
+        });
+      }).catchError((error) {
+        _resultsController.add(
+            new BarbackServerResult._failure(request.uri, id, error));
+
+        // If we couldn't read the asset, handle the error gracefully.
+        if (error is FileException) {
+          // Assume this means the asset was a file-backed source asset
+          // and we couldn't read it, so treat it like a missing asset.
+          _notFound(request, error);
+          return;
+        }
+
+        var trace = new Trace.from(getAttachedStackTrace(error));
+        _logRequest(request, "$error\n$trace");
+
+        // Otherwise, it's some internal error.
+        request.response.statusCode = 500;
+        request.response.reasonPhrase = "Internal Error";
+        request.response.write(error);
+        request.response.close();
+      });
+    }).catchError((error) {
+      if (error is! AssetNotFoundException) {
+        var trace = new Trace.from(getAttachedStackTrace(error));
+        _logRequest(request, "$error\n$trace");
+
+        _resultsController.addError(error);
+        close();
+        return;
+      }
+
+      _resultsController.add(
+          new BarbackServerResult._failure(request.uri, id, error));
+      _notFound(request, error);
+    });
+  }
+
+  /// Responds to [request] with a 405 response and closes it.
+  void _methodNotAllowed(HttpRequest request) {
+    _logRequest(request, "405 Method Not Allowed");
+    request.response.statusCode = 405;
+    request.response.reasonPhrase = "Method Not Allowed";
+    request.response.headers.add('Allow', 'GET, HEAD');
+    request.response.write(
+        "The ${request.method} method is not allowed for ${request.uri}.");
+    request.response.close();
+  }
+
+  /// Responds to [request] with a 404 response and closes it.
+  void _notFound(HttpRequest request, message) {
+    _logRequest(request, "404 Not Found");
+    request.response.statusCode = 404;
+    request.response.reasonPhrase = "Not Found";
+    request.response.write(message);
+    request.response.close();
+  }
+
+  /// Converts a request [uri] into an [AssetId] that can be requested from
+  /// barback.
+  AssetId _getIdFromUri(Uri uri) {
+    var parts = path.url.split(uri.path);
+
+    // Strip the leading "/" from the URL.
+    parts.removeAt(0);
+
+    var isSpecial = false;
+
+    // Checks to see if [uri]'s path contains a special directory [name] that
+    // identifies an asset within some package. If so, maps the package name
+    // and path following that to be within [dir] inside that package.
+    AssetId _trySpecialUrl(String name, String dir) {
+      // Find the package name and the relative path in the package.
+      var index = parts.indexOf(name);
+      if (index == -1) return null;
+
+      // If we got here, the path *did* contain the special directory, which
+      // means we should not interpret it as a regular path, even if it's
+      // missing the package name after it, which makes it invalid here.
+      isSpecial = true;
+      if (index + 1 >= parts.length) return null;
+
+      var package = parts[index + 1];
+      var assetPath = path.url.join(dir,
+          path.url.joinAll(parts.skip(index + 2)));
+      return new AssetId(package, assetPath);
+    }
+
+    // See if it's "packages" URL.
+    var id = _trySpecialUrl("packages", "lib");
+    if (id != null) return id;
+
+    // See if it's an "assets" URL.
+    id = _trySpecialUrl("assets", "asset");
+    if (id != null) return id;
+
+    // If we got here, we had a path like "/packages" which is a special
+    // directory, but not a valid path since it lacks a following package name.
+    if (isSpecial) return null;
+
+    // Otherwise, it's a path in current package's web directory.
+    return new AssetId(_rootPackage,
+        path.url.join("web", path.url.joinAll(parts)));
+  }
+
+  /// Log [message] at [log.Level.FINE] with metadata about [request].
+  void _logRequest(HttpRequest request, String message) =>
+    log.fine("BarbackServer ${request.method} ${request.uri}\n$message");
+}
+
+/// The result of the server handling a URL.
+///
+/// Only requests for which an asset was requested from barback will emit a
+/// result. Malformed requests will be handled internally.
+class BarbackServerResult {
+  /// The requested url.
+  final Url url;
+
+  /// The id that [url] identifies.
+  final AssetId id;
+
+  /// The error thrown by barback.
+  ///
+  /// If the request was served successfully, this will be null.
+  final error;
+
+  /// Whether the request was served successfully.
+  bool get isSuccess => error == null;
+
+  /// Whether the request was served unsuccessfully.
+  bool get isFailure => !isSuccess;
+
+  BarbackServerResult._success(this.url, this.id)
+      : error = null;
+
+  BarbackServerResult._failure(this.url, this.id, this.error);
+}
diff --git a/sdk/lib/_internal/pub/lib/src/barback/watch_sources.dart b/sdk/lib/_internal/pub/lib/src/barback/watch_sources.dart
new file mode 100644
index 0000000..dc29294
--- /dev/null
+++ b/sdk/lib/_internal/pub/lib/src/barback/watch_sources.dart
@@ -0,0 +1,73 @@
+// Copyright (c) 2013, 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 pub.barback.watch_sources;
+
+import 'package:barback/barback.dart';
+import 'package:path/path.dart' as path;
+import 'package:watcher/watcher.dart';
+
+import '../entrypoint.dart';
+import '../io.dart';
+import '../package_graph.dart';
+
+/// Adds all of the source assets in the provided packages to barback and
+/// then watches the public directories for changes.
+void watchSources(PackageGraph graph, Barback barback) {
+  for (var package in graph.packages.values) {
+    // Add the initial sources.
+    barback.updateSources(_listAssets(graph.entrypoint, package));
+
+    // Watch the visible package directories for changes.
+    for (var name in _getPublicDirectories(graph.entrypoint, package)) {
+      var subdirectory = path.join(package.dir, name);
+      // TODO(nweiz): close these watchers when [barback] is closed.
+      var watcher = new DirectoryWatcher(subdirectory);
+      watcher.events.listen((event) {
+        var id = new AssetId(package.name,
+            path.relative(event.path, from: package.dir));
+        if (event.type == ChangeType.REMOVE) {
+          barback.removeSources([id]);
+        } else {
+          barback.updateSources([id]);
+        }
+      });
+    }
+  }
+}
+
+/// Lists all of the visible files in [package].
+///
+/// This is the recursive contents of the "asset" and "lib" directories (if
+/// present). If [package] is the entrypoint package, it also includes the
+/// contents of "web".
+List<AssetId> _listAssets(Entrypoint entrypoint, Package package) {
+  var files = <AssetId>[];
+
+  for (var dirPath in _getPublicDirectories(entrypoint, package)) {
+    var dir = path.join(package.dir, dirPath);
+    if (!dirExists(dir)) continue;
+    for (var entry in listDir(dir, recursive: true)) {
+      // Ignore "packages" symlinks if there.
+      if (path.split(entry).contains("packages")) continue;
+
+      // Skip directories.
+      if (!fileExists(entry)) continue;
+
+      var id = new AssetId(package.name,
+          path.relative(entry, from: package.dir));
+      files.add(id);
+    }
+  }
+
+  return files;
+}
+
+/// Gets the names of the top-level directories in [package] whose contents
+/// should be provided as source assets.
+Iterable<String> _getPublicDirectories(Entrypoint entrypoint, Package package) {
+  var directories = ["asset", "lib"];
+  if (package.name == entrypoint.root.name) directories.add("web");
+  return directories;
+}
diff --git a/sdk/lib/_internal/pub/lib/src/command.dart b/sdk/lib/_internal/pub/lib/src/command.dart
index 5c72d58..9689cc6 100644
--- a/sdk/lib/_internal/pub/lib/src/command.dart
+++ b/sdk/lib/_internal/pub/lib/src/command.dart
@@ -9,6 +9,7 @@
 
 import 'package:args/args.dart';
 import 'package:path/path.dart' as path;
+import 'package:stack_trace/stack_trace.dart';
 
 import 'command/cache.dart';
 import 'command/deploy.dart';
@@ -90,26 +91,13 @@
       // spew a stack trace on our users.
       var message;
 
-      try {
-        // Most exception types have a "message" property. We prefer this since
-        // it skips the "Exception:", "HttpException:", etc. prefix that calling
-        // toString() adds. But, alas, "message" isn't actually defined in the
-        // base Exception type so there's no easy way to know if it's available
-        // short of a giant pile of type tests for each known exception type.
-        //
-        // So just try it. If it throws, default to toString().
-        message = error.message;
-      } on NoSuchMethodError catch (_) {
-        message = error.toString();
-      }
-
-      log.error(message);
+      log.error(getErrorMessage(error));
 
       if (trace != null) {
         if (options['trace'] || !isUserFacingException(error)) {
-          log.error(trace);
+          log.error(new Trace.from(trace).terse);
         } else {
-          log.fine(trace);
+          log.fine(new Trace.from(trace).terse);
         }
       }
 
diff --git a/sdk/lib/_internal/pub/lib/src/command/serve.dart b/sdk/lib/_internal/pub/lib/src/command/serve.dart
index 6393428..d1149bc 100644
--- a/sdk/lib/_internal/pub/lib/src/command/serve.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/serve.dart
@@ -7,21 +7,17 @@
 import 'dart:async';
 import 'dart:io';
 
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as path;
-import 'package:watcher/watcher.dart';
-
+import '../barback.dart' as barback;
 import '../command.dart';
 import '../entrypoint.dart';
 import '../exit_codes.dart' as exit_codes;
-import '../io.dart';
 import '../log.dart' as log;
-import '../pub_package_provider.dart';
 import '../utils.dart';
 
-final _green = getPlatformString('\u001b[32m');
-final _red = getPlatformString('\u001b[31m');
-final _none = getPlatformString('\u001b[0m');
+final _green = getSpecial('\u001b[32m');
+final _red = getSpecial('\u001b[31m');
+final _none = getSpecial('\u001b[0m');
+final _arrow = getSpecial('\u2192', '=>');
 
 /// Handles the `serve` pub command.
 class ServeCommand extends PubCommand {
@@ -29,13 +25,6 @@
   String get usage => 'pub serve';
 
   PubPackageProvider _provider;
-  Barback _barback;
-
-  /// The completer for the top-level future returned by the command.
-  ///
-  /// Only used to keep pub running (by not completing) and to pipe fatal
-  /// errors to pub's top-level error-handling machinery.
-  final _commandCompleter = new Completer();
 
   ServeCommand() {
     commandParser.addOption('port', defaultsTo: '8080',
@@ -45,35 +34,53 @@
   Future onRun() {
     var port = parsePort();
 
-    return ensureLockFileIsUpToDate().then((_) {
-      return PubPackageProvider.create(entrypoint);
-    }).then((provider) {
-      _provider = provider;
+    return ensureLockFileIsUpToDate()
+        .then((_) => entrypoint.loadPackageGraph())
+        .then((graph) => barback.createServer("localhost", port, graph))
+        .then((server) {
+      /// This completer is used to keep pub running (by not completing) and
+      /// to pipe fatal errors to pub's top-level error-handling machinery.
+      var completer = new Completer();
 
-      initBarback();
-
-      HttpServer.bind("localhost", port).then((server) {
-        watchSources();
-
-        log.message("Serving ${entrypoint.root.name} "
-            "on http://localhost:${server.port}");
-
-        server.listen(handleRequest);
+      server.barback.errors.listen((error) {
+        log.error("${_red}Build error:\n$error$_none");
       });
 
-      return _commandCompleter.future;
-    });
-  }
+      server.barback.results.listen((result) {
+        if (result.succeeded) {
+          // TODO(rnystrom): Report using growl/inotify-send where available.
+          log.message("Build completed ${_green}successfully$_none");
+        } else {
+          log.message("Build completed with "
+              "${_red}${result.errors.length}$_none errors.");
+        }
+      }, onError: (error) {
+        if (!completer.isCompleted) completer.completeError(error);
+      });
 
-  /// Parses the `--port` command-line argument and exits if it isn't valid.
-  int parsePort() {
-    try {
-      return int.parse(commandOptions['port']);
-    } on FormatException catch(_) {
-      log.error('Could not parse port "${commandOptions['port']}"');
-      this.printUsage();
-      exit(exit_codes.USAGE);
-    }
+      server.results.listen((result) {
+        if (result.isSuccess) {
+          log.message("${_green}GET$_none ${result.url.path} $_arrow "
+              "${result.id}");
+          return;
+        }
+
+        var msg = "${_red}GET$_none ${result.url.path} $_arrow";
+        var error = result.error.toString();
+        if (error.contains("\n")) {
+          log.message("$msg\n${prefixLines(error)}");
+        } else {
+          log.message("$msg $error");
+        }
+      }, onError: (error) {
+        if (!completer.isCompleted) completer.completeError(error);
+      });
+
+      log.message("Serving ${entrypoint.root.name} "
+          "on http://localhost:${server.port}");
+
+      return completer.future;
+    });
   }
 
   /// Installs dependencies is the lockfile is out of date with respect to the
@@ -91,185 +98,14 @@
     });
   }
 
-  void handleRequest(HttpRequest request) {
-    var id = getIdFromUri(request.uri);
-    if (id == null) {
-      notFound(request, "Path ${request.uri.path} is not valid.");
-      return;
+  /// Parses the `--port` command-line argument and exits if it isn't valid.
+  int parsePort() {
+    try {
+      return int.parse(commandOptions['port']);
+    } on FormatException catch(_) {
+      log.error('Could not parse port "${commandOptions['port']}"');
+      this.printUsage();
+      exit(exit_codes.USAGE);
     }
-
-    _barback.getAssetById(id).then((asset) {
-      return validateStream(asset.read()).then((stream) {
-        log.message(
-            "$_green${request.method}$_none ${request.uri} -> $asset");
-        // TODO(rnystrom): Set content-type based on asset type.
-        return request.response.addStream(stream).then((_) {
-          request.response.close();
-        });
-      }).catchError((error) {
-        log.error("$_red${request.method}$_none "
-            "${request.uri} -> $error");
-
-        // If we couldn't read the asset, handle the error gracefully.
-        if (error is FileException) {
-          // Assume this means the asset was a file-backed source asset
-          // and we couldn't read it, so treat it like a missing asset.
-          notFound(request, error);
-          return;
-        }
-
-        // Otherwise, it's some internal error.
-        request.response.statusCode = 500;
-        request.response.reasonPhrase = "Internal Error";
-        request.response.write(error);
-        request.response.close();
-      });
-    }).catchError((error) {
-      log.error("$_red${request.method}$_none ${request.uri} -> $error");
-      if (error is! AssetNotFoundException) {
-        _commandCompleter.completeError(error);
-        return;
-      }
-
-      notFound(request, error);
-    });
-  }
-
-  /// Responds to [request] with a 404 response and closes it.
-  void notFound(HttpRequest request, message) {
-    request.response.statusCode = 404;
-    request.response.reasonPhrase = "Not Found";
-    request.response.write(message);
-    request.response.close();
-  }
-
-  AssetId getIdFromUri(Uri uri) {
-    var parts = path.url.split(uri.path);
-
-    // Strip the leading "/" from the URL.
-    parts.removeAt(0);
-
-    var isSpecial = false;
-
-    // Checks to see if [uri]'s path contains a special directory [name] that
-    // identifies an asset within some package. If so, maps the package name
-    // and path following that to be within [dir] inside that package.
-    AssetId _trySpecialUrl(String name, String dir) {
-      // Find the package name and the relative path in the package.
-      var index = parts.indexOf(name);
-      if (index == -1) return null;
-
-      // If we got here, the path *did* contain the special directory, which
-      // means we should not interpret it as a regular path, even if it's
-      // missing the package name after it, which makes it invalid here.
-      isSpecial = true;
-      if (index + 1 >= parts.length) return null;
-
-      var package = parts[index + 1];
-      var assetPath = path.url.join(dir,
-          path.url.joinAll(parts.skip(index + 2)));
-      return new AssetId(package, assetPath);
-    }
-
-    // See if it's "packages" URL.
-    var id = _trySpecialUrl("packages", "lib");
-    if (id != null) return id;
-
-    // See if it's an "assets" URL.
-    id = _trySpecialUrl("assets", "asset");
-    if (id != null) return id;
-
-    // If we got here, we had a path like "/packages" which is a special
-    // directory, but not a valid path since it lacks a following package name.
-    if (isSpecial) return null;
-
-    // Otherwise, it's a path in current package's web directory.
-    return new AssetId(entrypoint.root.name,
-        path.url.join("web", path.url.joinAll(parts)));
-  }
-
-  /// Creates the [Barback] instance and listens to its outputs.
-  void initBarback() {
-    assert(_provider != null);
-
-    _barback = new Barback(_provider);
-
-    _barback.results.listen((result) {
-      if (result.succeeded) {
-        // TODO(rnystrom): Report using growl/inotify-send where available.
-        log.message("Build completed ${_green}successfully$_none");
-      } else {
-        log.message("Build completed with "
-            "${_red}${result.errors.length}$_none errors.");
-      }
-    });
-
-    _barback.errors.listen((error) {
-      log.error("${_red}Build error:\n$error$_none");
-    });
-  }
-
-  /// Adds all of the source assets in the provided packages to barback and
-  /// then watches the public directories for changes.
-  void watchSources() {
-    assert(_provider != null);
-    assert(_barback != null);
-
-    for (var package in _provider.packages) {
-      // Add the initial sources.
-      _barback.updateSources(listAssets(package));
-
-      // Watch the visible package directories for changes.
-      var packageDir = _provider.getPackageDir(package);
-
-      for (var name in getPublicDirectories(package)) {
-        var subdirectory = path.join(packageDir, name);
-        var watcher = new DirectoryWatcher(subdirectory);
-        watcher.events.listen((event) {
-          var id = new AssetId(package,
-              path.relative(event.path, from: packageDir));
-          if (event.type == ChangeType.REMOVE) {
-            _barback.removeSources([id]);
-          } else {
-            _barback.updateSources([id]);
-          }
-        });
-      }
-    }
-  }
-
-  /// Lists all of the visible files in [package].
-  ///
-  /// This is the recursive contents of the "asset" and "lib" directories (if
-  /// present). If [package] is the entrypoint package, it also includes the
-  /// contents of "web".
-  List<AssetId> listAssets(String package) {
-    var files = <AssetId>[];
-
-    for (var dirPath in getPublicDirectories(package)) {
-      var packageDir = _provider.getPackageDir(package);
-      var dir = path.join(packageDir, dirPath);
-      if (!dirExists(dir)) continue;
-      for (var entry in listDir(dir, recursive: true)) {
-        // Ignore "packages" symlinks if there.
-        if (path.split(entry).contains("packages")) continue;
-
-        // Skip directories.
-        if (!fileExists(entry)) continue;
-
-        var id = new AssetId(package, path.relative(entry, from: packageDir));
-        files.add(id);
-      }
-    }
-
-    return files;
-  }
-
-  /// Gets the names of the top-level directories in [package] whose contents
-  /// should be provided as source assets.
-  Iterable<String> getPublicDirectories(String package) {
-    var directories = ["asset", "lib"];
-    if (package == entrypoint.root.name) directories.add("web");
-    return directories;
   }
 }
diff --git a/sdk/lib/_internal/pub/lib/src/dart.dart b/sdk/lib/_internal/pub/lib/src/dart.dart
index d1e3b03..b7765b8 100644
--- a/sdk/lib/_internal/pub/lib/src/dart.dart
+++ b/sdk/lib/_internal/pub/lib/src/dart.dart
@@ -6,9 +6,11 @@
 library pub.dart;
 
 import 'dart:async';
+import 'dart:isolate';
 
 import 'package:analyzer_experimental/analyzer.dart';
 import 'package:path/path.dart' as path;
+import 'package:stack_trace/stack_trace.dart';
 import '../../../compiler/compiler.dart' as compiler;
 import '../../../compiler/implementation/source_file_provider.dart'
     show FormattingDiagnosticHandler, SourceFileProvider;
@@ -63,3 +65,84 @@
         node.functionExpression.parameters.parameters.isEmpty;
   });
 }
+
+/// Runs [code] in an isolate.
+///
+/// [code] should be the contents of a Dart entrypoint. It may contain imports;
+/// they will be resolved in the same context as the host isolate.
+///
+/// Returns a Future that will resolve to a [SendPort] that will communicate to
+/// the spawned isolate once it's spawned. If the isolate fails to spawn, the
+/// Future will complete with an error.
+Future<SendPort> runInIsolate(String code) {
+  return withTempDir((dir) {
+    var dartPath = path.join(dir, 'runInIsolate.dart');
+    writeTextFile(dartPath, code, dontLogContents: true);
+    var bufferPort = spawnFunction(_isolateBuffer);
+    return bufferPort.call(path.toUri(dartPath).toString()).then((response) {
+      if (response.first == 'error') {
+        return new Future.error(
+            new CrossIsolateException.deserialize(response.last));
+      }
+
+      return response.last;
+    });
+  });
+}
+
+// TODO(nweiz): remove this when issue 12617 is fixed.
+/// A function used as a buffer between the host isolate and [spawnUri].
+///
+/// [spawnUri] synchronously loads the file and its imports, which can deadlock
+/// the host isolate if there's an HTTP import pointing at a server in the host.
+/// Adding an additional isolate in the middle works around this.
+void _isolateBuffer() {
+  port.receive((uri, replyTo) {
+    try {
+      replyTo.send(['success', spawnUri(uri)]);
+    } catch (e, stack) {
+      replyTo.send(['error', CrossIsolateException.serialize(e, stack)]);
+    }
+  });
+}
+
+/// An exception that was originally raised in another isolate.
+///
+/// Exception objects can't cross isolate boundaries in general, so this class
+/// wraps as much information as can be consistently serialized.
+class CrossIsolateException implements Exception {
+  /// The name of the type of exception thrown.
+  ///
+  /// This is the return value of [error.runtimeType.toString()]. Keep in mind
+  /// that objects in different libraries may have the same type name.
+  final String type;
+
+  /// The exception's message, or its [toString] if it didn't expose a `message`
+  /// property.
+  final String message;
+
+  /// The exception's stack trace, or `null` if no stack trace was available.
+  final Trace stackTrace;
+
+  /// Loads a [CrossIsolateException] from a serialized representation.
+  ///
+  /// [error] should be the result of [CrossIsolateException.serialize].
+  CrossIsolateException.deserialize(Object error)
+      : type = error['type'],
+        message = error['message'],
+        stackTrace = error['stack'] == null ? null :
+            new Trace.parse(error['stack']);
+
+  /// Serializes [error] to an object that can safely be passed across isolate
+  /// boundaries.
+  static Object serialize(error, [StackTrace stack]) {
+    if (stack == null) stack = getAttachedStackTrace(error);
+    return {
+      'type': error.runtimeType.toString(),
+      'message': getErrorMessage(error),
+      'stack': stack == null ? null : stack.toString()
+    };
+  }
+
+  String toString() => "$message\n$stackTrace";
+}
diff --git a/sdk/lib/_internal/pub/lib/src/entrypoint.dart b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
index aec7cf9..317b1cb 100644
--- a/sdk/lib/_internal/pub/lib/src/entrypoint.dart
+++ b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
@@ -13,6 +13,7 @@
 import 'lock_file.dart';
 import 'log.dart' as log;
 import 'package.dart';
+import 'package_graph.dart';
 import 'system_cache.dart';
 import 'utils.dart';
 import 'solver/version_solver.dart';
@@ -186,6 +187,23 @@
     return true;
   }
 
+  /// Loads the package graph for the application and all of its transitive
+  /// dependencies.
+  Future<PackageGraph> loadPackageGraph() {
+    return Future.wait(loadLockFile().packages.values.map((id) {
+      var source = cache.sources[id.source];
+      return source.getDirectory(id)
+          .then((dir) => new Package.load(id.name, dir, cache.sources));
+    })).then((packages) {
+      var packageMap = <String, Package>{};
+      for (var package in packages) {
+        packageMap[package.name] = package;
+      }
+      packageMap[root.name] = root;
+      return new PackageGraph(this, packageMap);
+    });
+  }
+
   /// Saves a list of concrete package versions to the `pubspec.lock` file.
   void _saveLockFile(List<PackageId> packageIds) {
     var lockFile = new LockFile.empty();
diff --git a/sdk/lib/_internal/pub/lib/src/package_graph.dart b/sdk/lib/_internal/pub/lib/src/package_graph.dart
new file mode 100644
index 0000000..687b720
--- /dev/null
+++ b/sdk/lib/_internal/pub/lib/src/package_graph.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2013, 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 pub.package_graph;
+
+import 'entrypoint.dart';
+import 'package.dart';
+
+/// A holistic view of the entire transitive dependency graph for an entrypoint.
+///
+/// A package graph can be loaded using [Entrypoint.loadPackageGraph].
+class PackageGraph {
+  /// The entrypoint.
+  final Entrypoint entrypoint;
+
+  /// All transitive dependencies of the entrypoint (including itself).
+  final Map<String, Package> packages;
+
+  PackageGraph(this.entrypoint, this.packages);
+}
diff --git a/sdk/lib/_internal/pub/lib/src/pub_package_provider.dart b/sdk/lib/_internal/pub/lib/src/pub_package_provider.dart
deleted file mode 100644
index 0e2c51b..0000000
--- a/sdk/lib/_internal/pub/lib/src/pub_package_provider.dart
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2013, 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 pub.pub_package_provider;
-
-import 'dart:async';
-
-import 'package:barback/barback.dart';
-import 'package:path/path.dart' as path;
-
-import 'entrypoint.dart';
-
-/// An implementation of barback's [PackageProvider] interface so that barback
-/// can assets within pub packages.
-class PubPackageProvider implements PackageProvider {
-  /// Maps the names of all of the packages in [_entrypoint]'s transitive
-  /// dependency graph to the local path of the directory for that package.
-  final Map<String, String> _packageDirs;
-
-  /// Creates a new provider for [entrypoint].
-  static Future<PubPackageProvider> create(Entrypoint entrypoint) {
-    var packageDirs = <String, String>{};
-
-    packageDirs[entrypoint.root.name] = entrypoint.root.dir;
-
-    // Cache package directories up front so we can have synchronous access
-    // to them.
-    var futures = [];
-    entrypoint.loadLockFile().packages.forEach((name, package) {
-      var source = entrypoint.cache.sources[package.source];
-      futures.add(source.getDirectory(package).then((packageDir) {
-        packageDirs[name] = packageDir;
-      }));
-    });
-
-    return Future.wait(futures).then((_) {
-      return new PubPackageProvider._(packageDirs);
-    });
-  }
-
-  PubPackageProvider._(this._packageDirs);
-
-  Iterable<String> get packages => _packageDirs.keys;
-
-  /// Gets the root directory of [package].
-  String getPackageDir(String package) => _packageDirs[package];
-
-  Future<Asset> getAsset(AssetId id) {
-    var file = path.join(_packageDirs[id.package], id.path);
-    return new Future.value(new Asset.fromPath(id, file));
-  }
-}
diff --git a/sdk/lib/_internal/pub/lib/src/pubspec.dart b/sdk/lib/_internal/pub/lib/src/pubspec.dart
index 56b012b..ba0df4d 100644
--- a/sdk/lib/_internal/pub/lib/src/pubspec.dart
+++ b/sdk/lib/_internal/pub/lib/src/pubspec.dart
@@ -4,6 +4,7 @@
 
 library pub.pubspec;
 
+import 'package:barback/barback.dart';
 import 'package:yaml/yaml.dart';
 import 'package:path/path.dart' as path;
 
@@ -28,6 +29,10 @@
   /// The packages this package depends on when it is the root package.
   final List<PackageDep> devDependencies;
 
+  /// The ids of the libraries containing the transformers to use for this
+  /// package.
+  final List<Set<AssetId>> transformers;
+
   /// The environment-related metadata.
   final PubspecEnvironment environment;
 
@@ -59,7 +64,7 @@
   }
 
   Pubspec(this.name, this.version, this.dependencies, this.devDependencies,
-          this.environment, [Map<String, Object> fields])
+          this.environment, this.transformers, [Map<String, Object> fields])
     : this.fields = fields == null ? {} : fields;
 
   Pubspec.empty()
@@ -68,6 +73,7 @@
       dependencies = <PackageDep>[],
       devDependencies = <PackageDep>[],
       environment = new PubspecEnvironment(),
+      transformers = <Set<AssetId>>[],
       fields = {};
 
   /// Whether or not the pubspec has no contents.
@@ -173,6 +179,42 @@
         '"dev_dependencies".');
   }
 
+  var transformers = map['transformers'];
+  if (transformers != null) {
+    if (transformers is! List) {
+      throw new FormatException('"transformers" field must be a list, but was '
+          '"$transformers".');
+    }
+
+    transformers = transformers.map((phase) {
+      if (phase is! List) phase = [phase];
+      return phase.map((transformer) {
+        if (transformer is! String) {
+          throw new FormatException(
+              'Transformer "$transformer" must be a string.');
+        }
+
+        // Convert the concise asset name in the pubspec (of the form "package"
+        // or "package/library") to an AssetId that points to an actual dart
+        // file ("package/lib/package.dart" or "package/lib/library.dart",
+        // respectively).
+        var parts = split1(transformer, "/");
+        if (parts.length == 1) parts.add(parts.single);
+        var id = new AssetId(parts.first, 'lib/' + parts.last + '.dart');
+
+        if (id.package != name &&
+            !dependencies.any((ref) => ref.name == id.package)) {
+          throw new FormatException('Could not find package for transformer '
+              '"$transformer".');
+        }
+
+        return id;
+      }).toSet();
+    }).toList();
+  } else {
+    transformers = [];
+  }
+
   var environmentYaml = map['environment'];
   var sdkConstraint = VersionConstraint.any;
   if (environmentYaml != null) {
@@ -232,7 +274,7 @@
   }
 
   return new Pubspec(name, version, dependencies, devDependencies,
-      environment, map);
+      environment, transformers, map);
 }
 
 /// Parses [yaml] to a [Version] or throws a [FormatException] with the result
diff --git a/sdk/lib/_internal/pub/lib/src/utils.dart b/sdk/lib/_internal/pub/lib/src/utils.dart
index ed2e5e3..44f530a 100644
--- a/sdk/lib/_internal/pub/lib/src/utils.dart
+++ b/sdk/lib/_internal/pub/lib/src/utils.dart
@@ -10,9 +10,12 @@
 import "dart:convert";
 import 'dart:mirrors';
 
+import "package:analyzer_experimental/analyzer.dart";
 import "package:crypto/crypto.dart";
 import 'package:path/path.dart' as path;
 
+import 'dart.dart';
+
 /// A pair of values.
 class Pair<E, F> {
   E first;
@@ -71,14 +74,6 @@
   Future<List> get future => _completer.future;
 }
 
-/// Returns [posix] on POSIX machines and [windows] on Windows.
-///
-/// If [windows] is omitted, returns `""` on Windows.
-String getPlatformString(String posix, [String windows]) {
-  if (windows == null) windows = "";
-  return Platform.operatingSystem == "windows" ? windows : posix;
-}
-
 /// Like [new Future], but avoids around issue 11911 by using [new Future.value]
 /// under the covers.
 Future newFuture(callback()) => new Future.value().then((_) => callback());
@@ -377,6 +372,10 @@
   }).join("&");
 }
 
+/// Returns the union of all elements in each set in [sets].
+Set unionAll(Iterable<Set> sets) =>
+  sets.fold(new Set(), (union, set) => union.union(set));
+
 // TODO(nweiz): remove this when issue 9068 has been fixed.
 /// Whether [uri1] and [uri2] are equal. This consider HTTP URIs to default to
 /// port 80, and HTTPs URIs to default to port 443.
@@ -433,6 +432,20 @@
   return color;
 }
 
+/// Prepends each line in [text] with [prefix]. If [firstPrefix] is passed, the
+/// first line is prefixed with that instead.
+String prefixLines(String text, {String prefix: '| ', String firstPrefix}) {
+  var lines = text.split('\n');
+  if (firstPrefix == null) {
+    return lines.map((line) => '$prefix$line').join('\n');
+  }
+
+  var firstLine = "$firstPrefix${lines.first}";
+  lines = lines.skip(1).map((line) => '$prefix$line').toList();
+  lines.insert(0, firstLine);
+  return lines.join('\n');
+}
+
 /// Whether pub is running as a subprocess in an integration test.
 bool get runningAsTest =>
   Platform.environment.containsKey('_PUB_TESTING');
@@ -524,6 +537,23 @@
   return buffer.toString();
 }
 
+// Get a string description of an exception.
+//
+// Most exception types have a "message" property. We prefer this since
+// it skips the "Exception:", "HttpException:", etc. prefix that calling
+// toString() adds. But, alas, "message" isn't actually defined in the
+// base Exception type so there's no easy way to know if it's available
+// short of a giant pile of type tests for each known exception type.
+//
+// So just try it. If it throws, default to toString().
+String getErrorMessage(error) {
+  try {
+    return error.message;
+  } on NoSuchMethodError catch (_) {
+    return error.toString();
+  }
+}
+
 /// An exception class for exceptions that are intended to be seen by the user.
 /// These exceptions won't have any debugging information printed when they're
 /// thrown.
@@ -540,11 +570,34 @@
   throw new ApplicationException(message);
 }
 
+/// All the names of user-facing exceptions.
+final _userFacingExceptions = new Set<String>.from([
+  'ApplicationException',
+  // Errors coming from the Dart analyzer are probably caused by syntax errors
+  // in user code, so they're user-facing.
+  'AnalyzerError', 'AnalyzerErrorGroup',
+  // An error spawning an isolate probably indicates a transformer with an
+  // invalid import.
+  'IsolateSpawnException',
+  // TODO(nweiz): clean up the dart:io errors when issue 9955 is fixed.
+  'DirectoryException', 'FileException', 'HttpException', 'HttpException',
+  'LinkException', 'OSError', 'ProcessException', 'SocketException',
+  'WebSocketException'
+]);
+
 /// Returns whether [error] is a user-facing error object. This includes both
 /// [ApplicationException] and any dart:io errors.
 bool isUserFacingException(error) {
+  if (error is CrossIsolateException) {
+    return _userFacingExceptions.contains(error.type);
+  }
+
+  // TODO(nweiz): unify this list with _userFacingExceptions when issue 5897 is
+  // fixed.
   return error is ApplicationException ||
-    // TODO(nweiz): clean up this branch when issue 9955 is fixed.
+    error is AnalyzerError ||
+    error is AnalyzerErrorGroup ||
+    error is IsolateSpawnException ||
     error is DirectoryException ||
     error is FileException ||
     error is HttpException ||
diff --git a/sdk/lib/_internal/pub/pub.status b/sdk/lib/_internal/pub/pub.status
index 1e72e02..9dd5a3c 100644
--- a/sdk/lib/_internal/pub/pub.status
+++ b/sdk/lib/_internal/pub/pub.status
@@ -5,24 +5,26 @@
 test/serve/missing_file_test: Pass, Fail # Issue 12570
 test/oauth2/with_an_expired_credentials_refreshes_and_saves_test: Pass, Fail # Issue 12581
 
+[ $runtime == vm && $system == windows ]
+test/serve/watch_removed_file_test: Pass, Fail # Issue 13026
+
 # Issue 12837 is a networking issue on the pub-mac buildbot.
 [ $runtime == vm && $system == macos ]
 test/hosted/remove_removed_dependency_test: Pass, Fail # Issue 12837
 test/hosted/remove_removed_transitive_dependency_test: Pass, Fail # Issue 12837
+test/hosted/version_negotiation_test: Pass, Fail # Issue 12837
 test/install/hosted/cached_pubspec_test: Pass, Fail # Issue 12837
 test/install/hosted/do_not_update_on_removed_constraints_test: Pass, Fail # Issue 12837
 test/install/hosted/install_test: Pass, Fail # Issue 12837
 test/install/hosted/install_transitive_test: Pass, Fail # Issue 12837
-test/install/hosted/version_negotiation_test: Pass, Fail # Issue 12837
 test/install/hosted/repair_cache_test: Pass, Fail # Issue 12837
-test/serve/serve_from_dependency_asset_test: Pass, Fail # Issue 12837
 test/install/hosted/stay_locked_if_new_is_satisfied_test: Pass, Fail # Issue 12837
+test/install/hosted/stay_locked_test: Pass, Fail # Issue 12837
 test/install/hosted/unlock_if_incompatible_test: Pass, Fail # Issue 12837
 test/install/hosted/unlock_if_new_is_unsatisfied_test: Pass, Fail # Issue 12837
-test/install/hosted/stay_locked_test: Pass, Fail # Issue 12837
-
-[ $runtime == vm && $system == windows ]
-test/update/git/update_locked_test: Pass, Fail # Issue 12983
+test/install/hosted/version_negotiation_test: Pass, Fail # Issue 12837
+test/serve/installs_first_if_path_dependency_changed_test: Pass, Fail # Issue 12837
+test/serve/serve_from_dependency_asset_test: Pass, Fail # Issue 12837
 
 # Pub only runs on the VM, so just rule out all compilers.
 [ $compiler == dart2js || $compiler == dart2dart ]
diff --git a/sdk/lib/_internal/pub/test/serve/does_not_run_a_transform_on_an_input_in_another_package_test.dart b/sdk/lib/_internal/pub/test/serve/does_not_run_a_transform_on_an_input_in_another_package_test.dart
new file mode 100644
index 0000000..3a39dd3
--- /dev/null
+++ b/sdk/lib/_internal/pub/test/serve/does_not_run_a_transform_on_an_input_in_another_package_test.dart
@@ -0,0 +1,43 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.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 pub_tests;
+
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+import 'utils.dart';
+
+main() {
+  initConfig();
+  integration("does not run a transform on an input in another package", () {
+    d.dir("foo", [
+      d.pubspec({
+        "name": "foo",
+        "version": "0.0.1",
+        "transformers": ["foo/transformer"]
+      }),
+      d.dir("lib", [
+        d.file("transformer.dart", REWRITE_TRANSFORMER)
+      ]),
+      d.dir("asset", [
+        d.file("foo.txt", "foo")
+      ])
+    ]).create();
+
+    d.dir(appPath, [
+      d.appPubspec({"foo": {"path": "../foo"}}),
+      d.dir("asset", [
+        d.file("bar.txt", "bar")
+      ])
+    ]).create();
+
+    createLockFile('myapp', {
+      'foo': '../foo'
+    }, pkg: ['barback']);
+
+    startPubServe();
+    requestShould404("assets/myapp/bar.out");
+    endPubServe();
+  });
+}
diff --git a/sdk/lib/_internal/pub/test/serve/fails_to_load_a_file_that_defines_no_transforms_test.dart b/sdk/lib/_internal/pub/test/serve/fails_to_load_a_file_that_defines_no_transforms_test.dart
new file mode 100644
index 0000000..3803c91
--- /dev/null
+++ b/sdk/lib/_internal/pub/test/serve/fails_to_load_a_file_that_defines_no_transforms_test.dart
@@ -0,0 +1,36 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.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 pub_tests;
+
+import 'package:scheduled_test/scheduled_test.dart';
+
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+
+main() {
+  initConfig();
+
+  integration("fails to load a file that defines no transforms", () {
+    d.dir(appPath, [
+      d.pubspec({
+        "name": "myapp",
+        "transformers": ["myapp/transformer"]
+      }),
+      d.dir("lib", [
+        d.file("transformer.dart", "library does_nothing;")
+      ])
+    ]).create();
+
+    createLockFile('myapp', {}, pkg: ['barback']);
+
+    var pub = startPub(args: ['serve', '--port=0']);
+    expect(pub.nextErrLine(), completion(startsWith('No transformers were '
+       'defined in ')));
+    expect(pub.nextErrLine(), completion(startsWith('required by myapp.')));
+    pub.shouldExit(1);
+    expect(pub.remainingStderr(),
+        completion(isNot(contains('This is an unexpected error'))));
+  });
+}
diff --git a/sdk/lib/_internal/pub/test/serve/fails_to_load_a_non_existent_transform_test.dart b/sdk/lib/_internal/pub/test/serve/fails_to_load_a_non_existent_transform_test.dart
new file mode 100644
index 0000000..31e56aa
--- /dev/null
+++ b/sdk/lib/_internal/pub/test/serve/fails_to_load_a_non_existent_transform_test.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.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 pub_tests;
+
+import 'package:scheduled_test/scheduled_test.dart';
+
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+
+main() {
+  initConfig();
+  integration("fails to load a non-existent transform", () {
+    d.dir(appPath, [
+      d.pubspec({
+        "name": "myapp",
+        "transformers": ["myapp/transform"]
+      })
+    ]).create();
+
+    var pub = startPub(args: ['serve', '--port=0']);
+    expect(pub.nextErrLine(), completion(equals(
+        'Transformer library "package:myapp/transform.dart" not found.')));
+    pub.shouldExit(1);
+  });
+}
diff --git a/sdk/lib/_internal/pub/test/serve/fails_to_load_a_transform_from_a_non_dependency_test.dart b/sdk/lib/_internal/pub/test/serve/fails_to_load_a_transform_from_a_non_dependency_test.dart
new file mode 100644
index 0000000..57c3349
--- /dev/null
+++ b/sdk/lib/_internal/pub/test/serve/fails_to_load_a_transform_from_a_non_dependency_test.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.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 pub_tests;
+
+import 'package:scheduled_test/scheduled_test.dart';
+
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+
+main() {
+  initConfig();
+  integration("fails to load a transform from a non-dependency", () {
+    d.dir(appPath, [
+      d.pubspec({
+        "name": "myapp",
+        "transformers": ["foo"]
+      })
+    ]).create();
+
+    var pub = startPub(args: ['serve', '--port=0']);
+    // Ignore the line containing the path to the pubspec.
+    expect(pub.nextErrLine(), completes);
+    expect(pub.nextErrLine(),
+        completion(equals('Could not find package for transformer "foo".')));
+    pub.shouldExit(1);
+  });
+}
diff --git a/sdk/lib/_internal/pub/test/serve/fails_to_load_a_transform_with_a_syntax_error_test.dart b/sdk/lib/_internal/pub/test/serve/fails_to_load_a_transform_with_a_syntax_error_test.dart
new file mode 100644
index 0000000..38f96c1
--- /dev/null
+++ b/sdk/lib/_internal/pub/test/serve/fails_to_load_a_transform_with_a_syntax_error_test.dart
@@ -0,0 +1,36 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.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 pub_tests;
+
+import 'package:scheduled_test/scheduled_test.dart';
+
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+
+main() {
+  initConfig();
+
+  // A syntax error will cause the analyzer to fail to parse the transformer
+  // when attempting to rewrite its imports.
+  integration("fails to load a transform with a syntax error", () {
+    d.dir(appPath, [
+      d.pubspec({
+        "name": "myapp",
+        "transformers": ["myapp/src/transformer"]
+      }),
+      d.dir("lib", [d.dir("src", [
+        d.file("transformer.dart", "syntax error")
+      ])])
+    ]).create();
+
+    createLockFile('myapp', {}, pkg: ['barback']);
+
+    var pub = startPub(args: ['serve', '--port=0']);
+    expect(pub.nextErrLine(), completion(startsWith('Error on line')));
+    pub.shouldExit(1);
+    expect(pub.remainingStderr(),
+        completion(isNot(contains('This is an unexpected error'))));
+  });
+}
diff --git a/sdk/lib/_internal/pub/test/serve/fails_to_load_a_transform_with_an_import_error_test.dart b/sdk/lib/_internal/pub/test/serve/fails_to_load_a_transform_with_an_import_error_test.dart
new file mode 100644
index 0000000..f663af0
--- /dev/null
+++ b/sdk/lib/_internal/pub/test/serve/fails_to_load_a_transform_with_an_import_error_test.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.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 pub_tests;
+
+import 'package:scheduled_test/scheduled_test.dart';
+
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+
+main() {
+  initConfig();
+
+  // An import error will cause the isolate API to fail synchronously while
+  // loading the transformer.
+  integration("fails to load a transform with an import error", () {
+    d.dir(appPath, [
+      d.pubspec({
+        "name": "myapp",
+        "transformers": ["myapp/src/transformer"]
+      }),
+      d.dir("lib", [d.dir("src", [
+        d.file("transformer.dart", "import 'does/not/exist.dart';")
+      ])])
+    ]).create();
+
+    createLockFile('myapp', {}, pkg: ['barback']);
+
+    var pub = startPub(args: ['serve', '--port=0']);
+    expect(pub.nextErrLine(), completion(matches(new RegExp(
+        r"Error: line 1 pos 1: library handler failed$"))));
+    pub.shouldExit(1);
+  });
+}
diff --git a/sdk/lib/_internal/pub/test/serve/invalid_method_test.dart b/sdk/lib/_internal/pub/test/serve/invalid_method_test.dart
new file mode 100644
index 0000000..a543ccc
--- /dev/null
+++ b/sdk/lib/_internal/pub/test/serve/invalid_method_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.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 pub_tests;
+
+import 'package:path/path.dart' as path;
+import 'package:scheduled_test/scheduled_test.dart';
+
+import '../../lib/src/io.dart';
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+import 'utils.dart';
+
+main() {
+  initConfig();
+  integration("responds with a 405 for an invalid method", () {
+    d.dir(appPath, [
+      d.appPubspec(),
+      d.dir("web", [
+        d.file("index.html", "<body>"),
+      ])
+    ]).create();
+
+    startPubServe();
+
+    postShould405("index.html");
+    endPubServe();
+  });
+}
diff --git a/sdk/lib/_internal/pub/test/serve/prints_a_transform_error_in_apply_test.dart b/sdk/lib/_internal/pub/test/serve/prints_a_transform_error_in_apply_test.dart
new file mode 100644
index 0000000..e0b361d
--- /dev/null
+++ b/sdk/lib/_internal/pub/test/serve/prints_a_transform_error_in_apply_test.dart
@@ -0,0 +1,52 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.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 pub_tests;
+
+import 'package:scheduled_test/scheduled_test.dart';
+
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+import 'utils.dart';
+
+final transformer = """
+import 'dart:async';
+
+import 'package:barback/barback.dart';
+
+class RewriteTransformer extends Transformer {
+  RewriteTransformer();
+
+  String get allowedExtensions => '.txt';
+
+  Future apply(Transform transform) => throw new Exception('oh no!');
+}
+""";
+
+main() {
+  initConfig();
+  integration("prints a transform error in apply", () {
+    d.dir(appPath, [
+      d.pubspec({
+        "name": "myapp",
+        "transformers": ["myapp/src/transformer"]
+      }),
+      d.dir("lib", [d.dir("src", [
+        d.file("transformer.dart", transformer)
+      ])]),
+      d.dir("web", [
+        d.file("foo.txt", "foo")
+      ])
+    ]).create();
+
+    createLockFile('myapp', {}, pkg: ['barback']);
+
+    var server = startPubServe();
+    expect(server.nextErrLine(),
+        completion(equals('Build error:')));
+    expect(server.nextErrLine(), completion(equals('Transform Rewrite on '
+        'myapp|web/foo.txt threw error: oh no!')));
+    endPubServe();
+  });
+}
diff --git a/sdk/lib/_internal/pub/test/serve/prints_a_transform_interface_error_test.dart b/sdk/lib/_internal/pub/test/serve/prints_a_transform_interface_error_test.dart
new file mode 100644
index 0000000..63aa5c1
--- /dev/null
+++ b/sdk/lib/_internal/pub/test/serve/prints_a_transform_interface_error_test.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.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 pub_tests;
+
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+import 'utils.dart';
+
+import 'package:scheduled_test/scheduled_test.dart';
+
+final transformer = """
+import 'dart:async';
+
+import 'package:barback/barback.dart';
+
+class RewriteTransformer extends Transformer {
+  RewriteTransformer();
+
+  String get allowedExtensions => '.txt';
+}
+""";
+
+main() {
+  initConfig();
+  integration("prints a transform interface error", () {
+    d.dir(appPath, [
+      d.pubspec({
+        "name": "myapp",
+        "transformers": ["myapp/src/transformer"]
+      }),
+      d.dir("lib", [d.dir("src", [
+        d.file("transformer.dart", transformer)
+      ])]),
+      d.dir("web", [
+        d.file("foo.txt", "foo")
+      ])
+    ]).create();
+
+    createLockFile('myapp', {}, pkg: ['barback']);
+
+    var server = startPubServe();
+    expect(server.nextErrLine(), completion(equals('Build error:')));
+    expect(server.nextErrLine(), completion(equals("Transform Rewrite on "
+        "myapp|web/foo.txt threw error: Class 'RewriteTransformer' has no "
+        "instance method 'apply'.")));
+    endPubServe();
+  });
+}
diff --git a/sdk/lib/_internal/pub/test/serve/runs_a_local_transform_on_the_application_package_test.dart b/sdk/lib/_internal/pub/test/serve/runs_a_local_transform_on_the_application_package_test.dart
new file mode 100644
index 0000000..0ae9397
--- /dev/null
+++ b/sdk/lib/_internal/pub/test/serve/runs_a_local_transform_on_the_application_package_test.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.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 pub_tests;
+
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+import 'utils.dart';
+
+main() {
+  initConfig();
+  integration("runs a local transform on the application package", () {
+    d.dir(appPath, [
+      d.pubspec({
+        "name": "myapp",
+        "transformers": ["myapp/src/transformer"]
+      }),
+      d.dir("lib", [d.dir("src", [
+        d.file("transformer.dart", REWRITE_TRANSFORMER)
+      ])]),
+      d.dir("web", [
+        d.file("foo.txt", "foo")
+      ])
+    ]).create();
+
+    createLockFile('myapp', {}, pkg: ['barback']);
+
+    startPubServe();
+    requestShouldSucceed("foo.out", "foo.out");
+    endPubServe();
+  });
+}
diff --git a/sdk/lib/_internal/pub/test/serve/runs_a_third_party_transform_on_the_application_package_test.dart b/sdk/lib/_internal/pub/test/serve/runs_a_third_party_transform_on_the_application_package_test.dart
new file mode 100644
index 0000000..8185e56
--- /dev/null
+++ b/sdk/lib/_internal/pub/test/serve/runs_a_third_party_transform_on_the_application_package_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.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 pub_tests;
+
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+import 'utils.dart';
+
+main() {
+  initConfig();
+  integration("runs a third-party transform on the application package", () {
+    d.dir("foo", [
+      d.libPubspec("foo", '1.0.0'),
+      d.dir("lib", [
+        d.file("foo.dart", REWRITE_TRANSFORMER)
+      ])
+    ]).create();
+
+    d.dir(appPath, [
+      d.pubspec({
+        "name": "myapp",
+        "dependencies": {"foo": {"path": "../foo"}},
+        "transformers": ["foo"]
+      }),
+      d.dir("web", [
+        d.file("foo.txt", "foo")
+      ])
+    ]).create();
+
+    createLockFile('myapp', {
+      'foo': '../foo'
+    }, pkg: ['barback']);
+
+    startPubServe();
+    requestShouldSucceed("foo.out", "foo.out");
+    endPubServe();
+  });
+}
diff --git a/sdk/lib/_internal/pub/test/serve/runs_a_transform_on_a_dependency_test.dart b/sdk/lib/_internal/pub/test/serve/runs_a_transform_on_a_dependency_test.dart
new file mode 100644
index 0000000..90f2990
--- /dev/null
+++ b/sdk/lib/_internal/pub/test/serve/runs_a_transform_on_a_dependency_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS d.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 pub_tests;
+
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+import 'utils.dart';
+
+main() {
+  initConfig();
+  integration("runs a local transform on a dependency", () {
+    d.dir("foo", [
+      d.pubspec({
+        "name": "foo",
+        "version": "0.0.1",
+        "transformers": ["foo/transformer"]
+      }),
+      d.dir("lib", [
+        d.file("transformer.dart", REWRITE_TRANSFORMER)
+      ]),
+      d.dir("asset", [
+        d.file("foo.txt", "foo")
+      ])
+    ]).create();
+
+    d.dir(appPath, [
+      d.appPubspec({"foo": {"path": "../foo"}}),
+    ]).create();
+
+    createLockFile('myapp', {
+      'foo': '../foo'
+    }, pkg: ['barback']);
+
+    startPubServe();
+    requestShouldSucceed("assets/foo/foo.out", "foo.out");
+    endPubServe();
+  });
+}
diff --git a/sdk/lib/_internal/pub/test/serve/utils.dart b/sdk/lib/_internal/pub/test/serve/utils.dart
index 128917a..5046638 100644
--- a/sdk/lib/_internal/pub/test/serve/utils.dart
+++ b/sdk/lib/_internal/pub/test/serve/utils.dart
@@ -18,10 +18,33 @@
 /// The ephemeral port assigned to the running server.
 int _port;
 
+/// The code for a transformer that renames ".txt" files to ".out" and adds a
+/// ".out" suffix.
+const REWRITE_TRANSFORMER = """
+import 'dart:async';
+
+import 'package:barback/barback.dart';
+
+class RewriteTransformer extends Transformer {
+  RewriteTransformer();
+
+  String get allowedExtensions => '.txt';
+
+  Future apply(Transform transform) {
+    return transform.primaryInput.readAsString().then((contents) {
+      var id = transform.primaryInput.id.changeExtension(".out");
+      transform.addOutput(new Asset.fromString(id, "\$contents.out"));
+    });
+  }
+}
+""";
+
 /// Schedules starting the "pub serve" process.
 ///
 /// If [shouldInstallFirst] is `true`, validates that pub install is run first.
-void startPubServe({bool shouldInstallFirst: false}) {
+///
+/// Returns the `pub serve` process.
+ScheduledProcess startPubServe({bool shouldInstallFirst: false}) {
   // Use port 0 to get an ephemeral port.
   _pubServer = startPub(args: ["serve", "--port=0"]);
 
@@ -35,6 +58,7 @@
   }
 
   expect(_pubServer.nextLine().then(_parsePort), completes);
+  return _pubServer;
 }
 
 /// Parses the port number from the "Serving blah on localhost:1234" line
@@ -69,6 +93,16 @@
   }, "request $urlPath");
 }
 
+/// Schedules an HTTP POST to the running pub server with [urlPath] and verifies
+/// that it responds with a 405.
+void postShould405(String urlPath) {
+  schedule(() {
+    return http.post("http://localhost:$_port/$urlPath").then((response) {
+      expect(response.statusCode, equals(405));
+    });
+  }, "request $urlPath");
+}
+
 /// Reads lines from pub serve's stdout until it prints the build success
 /// message.
 ///
diff --git a/sdk/lib/_internal/pub/test/test_pub.dart b/sdk/lib/_internal/pub/test/test_pub.dart
index 7b63184..64c1682 100644
--- a/sdk/lib/_internal/pub/test/test_pub.dart
+++ b/sdk/lib/_internal/pub/test/test_pub.dart
@@ -19,6 +19,7 @@
 import 'package:scheduled_test/scheduled_server.dart';
 import 'package:scheduled_test/scheduled_test.dart';
 import 'package:unittest/compact_vm_config.dart';
+import 'package:yaml/yaml.dart';
 
 import '../lib/src/entrypoint.dart';
 // TODO(rnystrom): Using "gitlib" as the prefix here is ugly, but "git" collides
@@ -27,11 +28,14 @@
 import '../lib/src/git.dart' as gitlib;
 import '../lib/src/http.dart';
 import '../lib/src/io.dart';
+import '../lib/src/lock_file.dart';
 import '../lib/src/log.dart' as log;
+import '../lib/src/package.dart';
 import '../lib/src/safe_http_server.dart';
 import '../lib/src/system_cache.dart';
 import '../lib/src/utils.dart';
 import '../lib/src/validator.dart';
+import '../lib/src/version.dart';
 import 'descriptor.dart' as d;
 
 /// This should be called at the top of a test file to set up an appropriate
@@ -39,6 +43,7 @@
 initConfig() {
   useCompactVMConfiguration();
   filterStacks = true;
+  unittestConfiguration.timeout = null;
 }
 
 /// Returns whether we're running on a Dart build bot.
@@ -600,6 +605,44 @@
   }, 'ensuring that Git is installed');
 }
 
+/// Create a lock file for [package] without running `pub install`.
+///
+/// This creates a lock file with only path dependencies. [dependencies] is a
+/// map of dependency names to paths. [pkg] is a list of packages in the Dart
+/// repo's "pkg" directory; each package listed here and all its dependencies
+/// will be linked to the version in the Dart repo.
+void createLockFile(String package, Map<String, String> dependencies,
+    {Iterable<String> pkg}) {
+  if (pkg != null) {
+    var pkgDir = path.absolute(path.join(
+        path.dirname(Platform.executable),
+        '..', '..', '..', '..', 'pkg'));
+
+    _addPackage(String package) {
+      if (dependencies.containsKey(package)) return;
+      var packagePath = path.join(pkgDir, package);
+      dependencies[package] = packagePath;
+      var pubspec = loadYaml(
+          readTextFile(path.join(packagePath, 'pubspec.yaml')));
+      var packageDeps = pubspec['dependencies'];
+      if (packageDeps == null) return;
+      packageDeps.keys.forEach(_addPackage);
+    }
+
+    pkg.forEach(_addPackage);
+  }
+
+  var lockFile = new LockFile.empty();
+  dependencies.forEach((name, dependencyPath) {
+    var id = new PackageId(name, 'path', new Version(0, 0, 0), {
+      'path': dependencyPath,
+      'relative': path.isRelative(dependencyPath)
+    });
+    lockFile.packages[name] = id;
+  });
+  d.file(path.join(package, 'pubspec.lock'), lockFile.serialize()).create();
+}
+
 /// Use [client] as the mock HTTP client for this test.
 ///
 /// Note that this will only affect HTTP requests made via http.dart in the
diff --git a/sdk/lib/_internal/pub/test/update/git/do_not_update_if_unneeded_test.dart b/sdk/lib/_internal/pub/test/update/git/do_not_update_if_unneeded_test.dart
index 54c1a71..82361ce 100644
--- a/sdk/lib/_internal/pub/test/update/git/do_not_update_if_unneeded_test.dart
+++ b/sdk/lib/_internal/pub/test/update/git/do_not_update_if_unneeded_test.dart
@@ -6,11 +6,9 @@
 
 import '../../descriptor.dart' as d;
 import '../../test_pub.dart';
-import 'package:unittest/unittest.dart' as unittest;
 
 main() {
   initConfig();
-  unittest.unittestConfiguration.timeout = const Duration(seconds: 60);
   integration("doesn't update one locked Git package's dependencies if it's "
       "not necessary", () {
     ensureGit();
diff --git a/sdk/lib/_internal/pub/test/update/git/update_one_locked_test.dart b/sdk/lib/_internal/pub/test/update/git/update_one_locked_test.dart
index 5b5c837..42b9239 100644
--- a/sdk/lib/_internal/pub/test/update/git/update_one_locked_test.dart
+++ b/sdk/lib/_internal/pub/test/update/git/update_one_locked_test.dart
@@ -6,11 +6,9 @@
 
 import '../../descriptor.dart' as d;
 import '../../test_pub.dart';
-import 'package:unittest/unittest.dart' as unittest;
 
 main() {
   initConfig();
-  unittest.unittestConfiguration.timeout = const Duration(seconds: 60);
   integration("updates one locked Git package but no others", () {
     ensureGit();
 
diff --git a/sdk/lib/_internal/pub/test/version_solver_test.dart b/sdk/lib/_internal/pub/test/version_solver_test.dart
index d2b42b6..bbe86ac 100644
--- a/sdk/lib/_internal/pub/test/version_solver_test.dart
+++ b/sdk/lib/_internal/pub/test/version_solver_test.dart
@@ -1172,7 +1172,7 @@
   var name = description.replaceFirst(new RegExp(r"-[^-]+$"), "");
   var pubspec = new Pubspec(
       name, new Version.parse(version), dependencies, devDependencies,
-      new PubspecEnvironment(sdkConstraint));
+      new PubspecEnvironment(sdkConstraint), []);
   return new Package.inMemory(pubspec);
 }
 
diff --git a/sdk/lib/async/broadcast_stream_controller.dart b/sdk/lib/async/broadcast_stream_controller.dart
index fcfc43b..fb72872 100644
--- a/sdk/lib/async/broadcast_stream_controller.dart
+++ b/sdk/lib/async/broadcast_stream_controller.dart
@@ -446,7 +446,7 @@
   Future close() {
     if (!isClosed && _isFiring) {
       _addPendingEvent(const _DelayedDone());
-      _state |= _STATE_CLOSED;
+      _state |= _BroadcastStreamController._STATE_CLOSED;
       return super.done;
     }
     Future result = super.close();
diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart
index 4a3f064..4c846c6 100644
--- a/sdk/lib/async/future_impl.dart
+++ b/sdk/lib/async/future_impl.dart
@@ -4,9 +4,6 @@
 
 part of dart.async;
 
-deprecatedFutureValue(_FutureImpl future) =>
-  future._isComplete ? future._resultOrListeners : null;
-
 abstract class _Completer<T> implements Completer<T> {
   final Future<T> future;
   bool _isComplete = false;
@@ -181,12 +178,6 @@
   static const int _VALUE = 8;
   /// The future has been completed with an error result.
   static const int _ERROR = 12;
-  /// Extra bit set when the future has been completed with an error result.
-  /// but no listener has been scheduled to receive the error.
-  /// If the bit is still set when a [runAsync] call triggers, the error will
-  /// be reported to the top-level handler.
-  /// Assigning a listener before that time will clear the bit.
-  static const int _UNHANDLED_ERROR = 16;
 
   /** Whether the future is complete, and as what. */
   int _state = _INCOMPLETE;
@@ -199,11 +190,6 @@
   bool get _mayComplete => _state == _INCOMPLETE;
   bool get _hasValue => _state == _VALUE;
   bool get _hasError => _state >= _ERROR;
-  bool get _hasUnhandledError => _state >= _UNHANDLED_ERROR;
-
-  void _clearUnhandledError() {
-    _state &= ~_UNHANDLED_ERROR;
-  }
 
   /**
    * Either the result, a list of listeners or another future.
@@ -238,7 +224,7 @@
       // Force stack trace onto error, even if it had already one.
       _attachStackTrace(error, stackTrace);
     }
-    _setError(error);
+    _asyncSetError(error);
   }
 
   factory _FutureImpl.wait(Iterable<Future> futures) {
@@ -332,7 +318,9 @@
     _resultOrListeners = error;
 
     if (!hasListeners) {
-      _scheduleUnhandledError();
+      // TODO(floitsch): Hook this into unhandled error handling.
+      var error = _resultOrListeners;
+      _zone.handleUncaughtError(error);
       return;
     }
     while (listeners != null) {
@@ -355,22 +343,6 @@
     runAsync(() { _setErrorUnchecked(error); });
   }
 
-  void _scheduleUnhandledError() {
-    assert(_state == _ERROR);
-    _state = _ERROR | _UNHANDLED_ERROR;
-    // Wait for the rest of the current event's duration to see
-    // if a subscriber is added to handle the error.
-    runAsync(() {
-      if (_hasUnhandledError) {
-        // No error handler has been added since the error was set.
-        _clearUnhandledError();
-        // TODO(floitsch): Hook this into unhandled error handling.
-        var error = _resultOrListeners;
-        _zone.handleUncaughtError(error);
-      }
-    });
-  }
-
   void _addListener(_FutureListener listener) {
     assert(listener._nextListener == null);
     if (!listener._inSameErrorZone(_zone)) {
@@ -383,7 +355,6 @@
       return;
     }
     if (_isComplete) {
-      _clearUnhandledError();
       // Handle late listeners asynchronously.
       runAsync(() {
         if (_hasValue) {
@@ -431,7 +402,6 @@
       future._setValue(_resultOrListeners);
     } else {
       assert(_hasError);
-      _clearUnhandledError();
       future._setError(_resultOrListeners);
     }
   }
diff --git a/sdk/lib/async/zone.dart b/sdk/lib/async/zone.dart
index 078b2d9..9be85d1 100644
--- a/sdk/lib/async/zone.dart
+++ b/sdk/lib/async/zone.dart
@@ -139,9 +139,8 @@
   /// The parent zone. [null] if `this` is the default zone.
   final _Zone _parentZone;
 
-  /// The children of this zone. A child's [_parentZone] is `this`.
-  // TODO(floitsch): this should be a double-linked list.
-  final List<_Zone> _children = <_Zone>[];
+  /// The number of children of this zone. A child's [_parentZone] is `this`.
+  int _childCount = 0;
 
   /// The number of outstanding (asynchronous) callbacks. As long as the
   /// number is greater than 0 it means that the zone is not done yet.
@@ -196,7 +195,7 @@
    * outstanding-callback count, or when a child has been removed.
    */
   void _checkIfDone() {
-    if (!_isExecutingCallback && _openCallbacks == 0 && _children.isEmpty) {
+    if (!_isExecutingCallback && _openCallbacks == 0 && _childCount == 0) {
       _dispose();
     }
   }
@@ -288,30 +287,13 @@
   }
 
   void _addChild(_Zone child) {
-    // TODO(floitsch): the zone should just increment a counter, but not keep
-    // a reference to the child.
-    _children.add(child);
+    _childCount++;
   }
 
   void _removeChild(_Zone child) {
-    assert(!_children.isEmpty);
-    // Children are usually added and removed fifo or filo.
-    if (identical(_children.last, child)) {
-      _children.length--;
-      _checkIfDone();
-      return;
-    }
-    for (int i = 0; i < _children.length; i++) {
-      if (identical(_children[i], child)) {
-        _children[i] = _children[_children.length - 1];
-        _children.length--;
-        // No need to check for done, as otherwise _children.last above would
-        // have triggered.
-        assert(!_children.isEmpty);
-        return;
-      }
-    }
-    throw new ArgumentError(child);
+    assert(_childCount != 0);
+    _childCount--;
+    _checkIfDone();
   }
 }
 
diff --git a/sdk/lib/collection/hash_map.dart b/sdk/lib/collection/hash_map.dart
index a0624e0..3aadab2 100644
--- a/sdk/lib/collection/hash_map.dart
+++ b/sdk/lib/collection/hash_map.dart
@@ -4,6 +4,16 @@
 
 part of dart.collection;
 
+/** Default function for equality comparison in customized HashMaps */
+bool _defaultEquals(a, b) => a == b;
+/** Default function for hash-code computation in customized HashMaps */
+int _defaultHashCode(a) => a.hashCode;
+
+/** Type of custom equality function */
+typedef bool _Equality<K>(K a, K b);
+/** Type of custom hash code function. */
+typedef int _Hasher<K>(K object);
+
 /**
  * A hash-table based implementation of [Map].
  *
@@ -15,8 +25,32 @@
  *
  * The map allows `null` as a key.
  */
-class HashMap<K, V> implements Map<K, V> {
-  external HashMap();
+abstract class HashMap<K, V> implements Map<K, V> {
+  /**
+   * Creates a hash-table based [Map].
+   *
+   * The created map is not ordered in any way. When iterating the keys or
+   * values, the iteration order is unspecified except that it will stay the
+   * same as long as the map isn't changed.
+   *
+   * If [equals] is provided, it is used to compare the keys in the table with
+   * new keys. If [equals] is omitted, the key's own [Object.operator==] is used
+   * instead.
+   *
+   * Similar, if [hashCode] is provided, it is used to produce a hash value
+   * for keys in order to place them in the hash table. If it is omitted, the
+   * key's own [Object.hashCode] is used.
+   *
+   * The used `equals` and `hashCode` method should always be consistent,
+   * so that if `equals(a, b)` then `hashCode(a) == hashCode(b)`. The hash
+   * of an object, or what it compares equal to, should not change while the
+   * object is in the table. If it does change, the result is unpredictable.
+   *
+   * It is generally the case that if you supply one of [equals] and [hashCode],
+   * you also want to supply the other. The only common exception is to pass
+   * [identical] as the equality and use the default hash code.
+   */
+  external factory HashMap({bool equals(K key1, K key2), int hashCode(K key)});
 
   /**
    * Creates a [HashMap] that contains all key value pairs of [other].
@@ -61,28 +95,4 @@
     Maps._fillMapWithIterables(map, keys, values);
     return map;
   }
-
-  external int get length;
-  external bool get isEmpty;
-  external bool get isNotEmpty;
-
-  external Iterable<K> get keys;
-  external Iterable<V> get values;
-
-  external bool containsKey(Object key);
-  external bool containsValue(Object value);
-
-  external void addAll(Map<K, V> other);
-
-  external V operator [](Object key);
-  external void operator []=(K key, V value);
-
-  external V putIfAbsent(K key, V ifAbsent());
-
-  external V remove(Object key);
-  external void clear();
-
-  external void forEach(void action(K key, V value));
-
-  String toString() => Maps.mapToString(this);
 }
diff --git a/sdk/lib/convert/convert.dart b/sdk/lib/convert/convert.dart
index 5cca4d4..e76133b 100644
--- a/sdk/lib/convert/convert.dart
+++ b/sdk/lib/convert/convert.dart
@@ -17,6 +17,7 @@
 part 'codec.dart';
 part 'converter.dart';
 part 'encoding.dart';
+part 'html_escape.dart';
 part 'json.dart';
 part 'latin1.dart';
 part 'line_splitter.dart';
diff --git a/sdk/lib/convert/convert_sources.gypi b/sdk/lib/convert/convert_sources.gypi
index 35a825f..6c5267f 100644
--- a/sdk/lib/convert/convert_sources.gypi
+++ b/sdk/lib/convert/convert_sources.gypi
@@ -13,6 +13,7 @@
     'codec.dart',
     'converter.dart',
     'encoding.dart',
+    'html_escape.dart',
     'json.dart',
     'latin1.dart',
     'line_splitter.dart',
diff --git a/sdk/lib/convert/html_escape.dart b/sdk/lib/convert/html_escape.dart
new file mode 100644
index 0000000..dd9f3e7
--- /dev/null
+++ b/sdk/lib/convert/html_escape.dart
@@ -0,0 +1,100 @@
+// Copyright (c) 2013, 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.
+
+part of dart.convert;
+
+// TODO(floitsch) - Document - Issue 13097
+const HTML_ESCAPE = const HtmlEscape();
+
+class HtmlEscapeMode {
+  final String _name;
+  final bool escapeLtGt;
+  final bool escapeQuot;
+  final bool escapeApos;
+
+  // TODO(floitsch) - Document - Issue 13097
+  static const HtmlEscapeMode UNKNOWN =
+    const HtmlEscapeMode._('unknown', true, true, true);
+
+  // TODO(floitsch) - Document - Issue 13097
+  static const HtmlEscapeMode ATTRIBUTE =
+    const HtmlEscapeMode._('attribute', false, true, false);
+
+  // TODO(floitsch) - Document - Issue 13097
+  static const HtmlEscapeMode ELEMENT =
+    const HtmlEscapeMode._('element', true, false, false);
+
+  // TODO(floitsch) - Document - Issue 13097
+  const HtmlEscapeMode._(this._name, this.escapeLtGt, this.escapeQuot,
+    this.escapeApos);
+
+  String toString() => _name;
+}
+
+  // TODO(floitsch) - Document - Issue 13097
+class HtmlEscape extends Converter<String, String> {
+
+  // TODO(floitsch) - Document - Issue 13097
+  final HtmlEscapeMode mode;
+
+  // TODO(floitsch) - Document - Issue 13097
+  const HtmlEscape([this.mode = HtmlEscapeMode.UNKNOWN]);
+
+  String convert(String text) {
+    var val = _convert(text, 0, text.length);
+    return val == null ? text : val;
+  }
+
+  String _convert(String text, int start, int end) {
+    StringBuffer result = null;
+    for (int i = start; i < end; i++) {
+      var ch = text[i];
+      String replace = null;
+      switch (ch) {
+        case '&': replace = '&amp;'; break;
+        case '\u00A0'/*NO-BREAK SPACE*/: replace = '&nbsp;'; break;
+        case '"': if (mode.escapeQuot) replace = '&quot;'; break;
+        case "'": if (mode.escapeApos) replace = '&apos;'; break;
+        case '<': if (mode.escapeLtGt) replace = '&lt;'; break;
+        case '>': if (mode.escapeLtGt) replace = '&gt;'; break;
+      }
+      if (replace != null) {
+        if (result == null) result = new StringBuffer(text.substring(start, i));
+        result.write(replace);
+      } else if (result != null) {
+        result.write(ch);
+      }
+    }
+
+    return result != null ? result.toString() : null;
+  }
+
+  StringConversionSink startChunkedConversion(
+    ChunkedConversionSink<String> sink) {
+
+    if (sink is! StringConversionSink) {
+      sink = new StringConversionSink.from(sink);
+    }
+    return new _HtmlEscapeSink(this, sink);
+  }
+}
+
+class _HtmlEscapeSink extends StringConversionSinkBase {
+  final HtmlEscape _escape;
+  final StringConversionSink _sink;
+
+  _HtmlEscapeSink(this._escape, this._sink);
+
+  void addSlice(String chunk, int start, int end, bool isLast) {
+    var val = _escape._convert(chunk, start, end);
+    if(val == null) {
+      _sink.addSlice(chunk, start, end, isLast);
+    } else {
+      _sink.add(val);
+      if (isLast) _sink.close();
+    }
+  }
+
+  void close() => _sink.close();
+}
diff --git a/sdk/lib/convert/line_splitter.dart b/sdk/lib/convert/line_splitter.dart
index 2676c59..3b3e109 100644
--- a/sdk/lib/convert/line_splitter.dart
+++ b/sdk/lib/convert/line_splitter.dart
@@ -8,6 +8,9 @@
  * This class splits [String] values into individual lines.
  */
 class LineSplitter extends Converter<String, List<String>> {
+
+  const LineSplitter();
+
   List<String> convert(String data) {
     var lines = new List<String>();
 
diff --git a/sdk/lib/core/map.dart b/sdk/lib/core/map.dart
index e673446..fd3fd01 100644
--- a/sdk/lib/core/map.dart
+++ b/sdk/lib/core/map.dart
@@ -8,8 +8,7 @@
  * An unordered collection of key-value pairs,
  * from which you retrieve a value by using its associated key.
  *
- * Each key must be unique.
- * Null values are supported, but null keys are not.
+ * Each key can occur at most once in a map.
  */
 abstract class Map<K, V> {
   /**
diff --git a/sdk/lib/core/string.dart b/sdk/lib/core/string.dart
index b2ca3f2..2e0259e 100644
--- a/sdk/lib/core/string.dart
+++ b/sdk/lib/core/string.dart
@@ -219,18 +219,37 @@
   String replaceFirst(Pattern from, String to);
 
   /**
-   * Returns a new string where all occurences of [from] in this string
-   * are replaced with [replace].
+   * Replaces all substrings matching [from] with [replace].
+   *
+   * Returns a new string where the non-overlapping substrings that match
+   * [from] (the ones iterated by `from.allMatches(thisString)`) are replaced
+   * by the literal string [replace].
+   *
+   * Notice that the [replace] string is not interpreted. If the replacement
+   * depends on the match (for example on a [RegExp]'s capture groups), use
+   * the [replaceAllMapped] method instead.
    */
-  String replaceAll(Pattern from, var replace);
+  String replaceAll(Pattern from, String replace);
 
   /**
-   * Returns a new string where all occurences of [from] in this string
-   * are replaced with a [String] depending on [replace].
+   * Replace all substrings matching [from] by a string computed from the match.
    *
+   * Returns a new string where the non-overlapping substrings that match
+   * [from] (the ones iterated by `from.allMatches(thisString)`) are replaced
+   * by the result of calling [replace] on the corresponding [Match] object.
    *
-   * The [replace] function is called with the [Match] generated
-   * by the pattern, and its result is used as replacement.
+   * This can be used to replace matches with new content that depends on the
+   * match, unlike [replaceAll] where the replacement string is always the same.
+   *
+   * Example (simplified pig latin):
+   *     pigLatin(String words) => words.replaceAllMapped(
+   *         new RegExp(r"\b(\w*?)([aeiou]\w*)", caseSensitive: false),
+   *         (Match m) => "${m[2]}${m[1]}${m[1].isEmpty ? 'way' : 'ay'}");
+   *
+   * This would convert each word of a text to "pig-latin", so for example
+   *   `pigLatin("I have a secret now!")`
+   * returns
+   *   `"Iway avehay away ecretsay ownay!"`
    */
   String replaceAllMapped(Pattern from, String replace(Match match));
 
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index b5106a9..61dfe4c 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -1866,6 +1866,10 @@
   void assertCondition(bool condition, Object arg) => _isConsoleDefined ?
       JS('void', 'console.assertCondition(#, #)', condition, arg) : null;
 
+  @DomName('Console.clear')
+  void clear(Object arg) => _isConsoleDefined ?
+      JS('void', 'console.clear(#)', arg) : null;
+
   @DomName('Console.count')
   void count(Object arg) => _isConsoleDefined ?
       JS('void', 'console.count(#)', arg) : null;
@@ -1918,6 +1922,10 @@
   void profileEnd(String title) => _isConsoleDefined ?
       JS('void', 'console.profileEnd(#)', title) : null;
 
+  @DomName('Console.table')
+  void table(Object arg) => _isConsoleDefined ?
+      JS('void', 'console.table(#)', arg) : null;
+
   @DomName('Console.time')
   void time(String title) => _isConsoleDefined ?
       JS('void', 'console.time(#)', title) : null;
@@ -1950,111 +1958,6 @@
 @DomName('ConsoleBase')
 @Experimental() // untriaged
 class ConsoleBase extends Interceptor native "ConsoleBase" {
-
-  @DomName('ConsoleBase.assertCondition')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void assertCondition(bool condition, Object arg) native;
-
-  @DomName('ConsoleBase.clear')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void clear(Object arg) native;
-
-  @DomName('ConsoleBase.count')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void count(Object arg) native;
-
-  @DomName('ConsoleBase.debug')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void debug(Object arg) native;
-
-  @DomName('ConsoleBase.dir')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void dir(Object arg) native;
-
-  @DomName('ConsoleBase.dirxml')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void dirxml(Object arg) native;
-
-  @DomName('ConsoleBase.error')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void error(Object arg) native;
-
-  @DomName('ConsoleBase.group')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void group(Object arg) native;
-
-  @DomName('ConsoleBase.groupCollapsed')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void groupCollapsed(Object arg) native;
-
-  @DomName('ConsoleBase.groupEnd')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void groupEnd() native;
-
-  @DomName('ConsoleBase.info')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void info(Object arg) native;
-
-  @DomName('ConsoleBase.log')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void log(Object arg) native;
-
-  @DomName('ConsoleBase.markTimeline')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void markTimeline(Object arg) native;
-
-  @DomName('ConsoleBase.profile')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void profile(String title) native;
-
-  @DomName('ConsoleBase.profileEnd')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void profileEnd(String title) native;
-
-  @DomName('ConsoleBase.table')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void table(Object arg) native;
-
-  @DomName('ConsoleBase.time')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void time(String title) native;
-
-  @DomName('ConsoleBase.timeEnd')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void timeEnd(String title) native;
-
-  @DomName('ConsoleBase.timeStamp')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void timeStamp(Object arg) native;
-
-  @DomName('ConsoleBase.trace')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void trace(Object arg) native;
-
-  @DomName('ConsoleBase.warn')
-  @DocsEditable()
-  @Experimental() // untriaged
-  void warn(Object arg) native;
 }
 // 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
@@ -2147,7 +2050,7 @@
   @DomName('Crypto.subtle')
   @DocsEditable()
   @Experimental() // untriaged
-  final SubtleCrypto subtle;
+  final _SubtleCrypto subtle;
 
   @DomName('Crypto.getRandomValues')
   @DocsEditable()
@@ -2408,7 +2311,7 @@
 @DocsEditable()
 @DomName('CSSKeyframeRule')
 @Experimental() // untriaged
-class CssKeyframeRule extends CssRule native "CSSKeyframeRule" {
+class CssKeyframeRule extends CssRule native "CSSKeyframeRule,MozCSSKeyframeRule,WebKitCSSKeyframeRule" {
   // To suppress missing implicit constructor warnings.
   factory CssKeyframeRule._() { throw new UnsupportedError("Not supported"); }
 
@@ -2430,7 +2333,7 @@
 @DocsEditable()
 @DomName('CSSKeyframesRule')
 @Experimental() // untriaged
-class CssKeyframesRule extends CssRule native "CSSKeyframesRule" {
+class CssKeyframesRule extends CssRule native "CSSKeyframesRule,MozCSSKeyframesRule,WebKitCSSKeyframesRule" {
   // To suppress missing implicit constructor warnings.
   factory CssKeyframesRule._() { throw new UnsupportedError("Not supported"); }
 
@@ -2461,10 +2364,11 @@
   @Experimental() // untriaged
   CssKeyframeRule findRule(String key) native;
 
+  @JSName('insertRule')
   @DomName('CSSKeyframesRule.insertRule')
   @DocsEditable()
   @Experimental() // untriaged
-  void insertRule(String rule) native;
+  void appendRule(String rule) native;
 }
 // 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
@@ -6385,6 +6289,8 @@
   // To suppress missing implicit constructor warnings.
   factory CustomEvent._() { throw new UnsupportedError("Not supported"); }
 
+  @DomName('CustomEvent.detail')
+  @DocsEditable()
   dynamic get detail => convertNativeToDart_SerializedScriptValue(this._get_detail);
   @JSName('detail')
   @DomName('CustomEvent.detail')
@@ -7107,6 +7013,9 @@
   @Experimental() // untriaged
   final ScriptElement currentScript;
 
+  @DomName('Document.window')
+  @DocsEditable()
+  @Experimental() // untriaged
   WindowBase get window => _convertNativeToDart_Window(this._get_window);
   @JSName('defaultView')
   @DomName('Document.window')
@@ -9484,6 +9393,12 @@
       this, this, this);
   }
 
+  @DomName('Element.shadowRoot')
+  @SupportedBrowser(SupportedBrowser.CHROME, '25')
+  @Experimental()
+  ShadowRoot get shadowRoot =>
+      JS('ShadowRoot', '#.shadowRoot || #.webkitShadowRoot', this, this);
+
 
   /**
    * Gets the template this node refers to.
@@ -10222,12 +10137,6 @@
   @DocsEditable()
   final int scrollWidth;
 
-  @DomName('Element.shadowRoot')
-  @DocsEditable()
-  // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-shadow-aware-create-shadow-root
-  @Experimental()
-  final ShadowRoot shadowRoot;
-
   @DomName('Element.style')
   @DocsEditable()
   final CssStyleDeclaration style;
@@ -10253,15 +10162,15 @@
   @DocsEditable()
   void focus() native;
 
-  @JSName('getAttribute')
   @DomName('Element.getAttribute')
   @DocsEditable()
-  String _getAttribute(String name) native;
+  @deprecated
+  String getAttribute(String name) native;
 
-  @JSName('getAttributeNS')
   @DomName('Element.getAttributeNS')
   @DocsEditable()
-  String _getAttributeNS(String namespaceURI, String localName) native;
+  @deprecated
+  String getAttributeNS(String namespaceURI, String localName) native;
 
   @DomName('Element.getBoundingClientRect')
   @DocsEditable()
@@ -10362,15 +10271,15 @@
   @Experimental() // non-standard
   void _scrollIntoViewIfNeeded([bool centerIfNeeded]) native;
 
-  @JSName('setAttribute')
   @DomName('Element.setAttribute')
   @DocsEditable()
-  void _setAttribute(String name, String value) native;
+  @deprecated
+  void setAttribute(String name, String value) native;
 
-  @JSName('setAttributeNS')
   @DomName('Element.setAttributeNS')
   @DocsEditable()
-  void _setAttributeNS(String namespaceURI, String qualifiedName, String value) native;
+  @deprecated
+  void setAttributeNS(String namespaceURI, String qualifiedName, String value) native;
 
   @JSName('webkitGetRegionFlowRanges')
   @DomName('Element.webkitGetRegionFlowRanges')
@@ -11110,6 +11019,8 @@
   @Experimental() // nonstandard
   final DataTransfer clipboardData;
 
+  @DomName('Event.currentTarget')
+  @DocsEditable()
   EventTarget get currentTarget => _convertNativeToDart_EventTarget(this._get_currentTarget);
   @JSName('currentTarget')
   @DomName('Event.currentTarget')
@@ -11134,6 +11045,8 @@
   @Creates('NodeList')
   final List<Node> path;
 
+  @DomName('Event.target')
+  @DocsEditable()
   EventTarget get target => _convertNativeToDart_EventTarget(this._get_target);
   @JSName('target')
   @DomName('Event.target')
@@ -11402,6 +11315,8 @@
   // To suppress missing implicit constructor warnings.
   factory File._() { throw new UnsupportedError("Not supported"); }
 
+  @DomName('File.lastModifiedDate')
+  @DocsEditable()
   DateTime get lastModifiedDate => convertNativeToDart_DateTime(this._get_lastModifiedDate);
   @JSName('lastModifiedDate')
   @DomName('File.lastModifiedDate')
@@ -11894,6 +11809,8 @@
   // To suppress missing implicit constructor warnings.
   factory FocusEvent._() { throw new UnsupportedError("Not supported"); }
 
+  @DomName('FocusEvent.relatedTarget')
+  @DocsEditable()
   EventTarget get relatedTarget => _convertNativeToDart_EventTarget(this._get_relatedTarget);
   @JSName('relatedTarget')
   @DomName('FocusEvent.relatedTarget')
@@ -12415,6 +12332,8 @@
   @DocsEditable()
   final int length;
 
+  @DomName('History.state')
+  @DocsEditable()
   dynamic get state => convertNativeToDart_SerializedScriptValue(this._get_state);
   @JSName('state')
   @DomName('History.state')
@@ -12802,11 +12721,14 @@
   Element get pointerLockElement =>
       _webkitPointerLockElement;
 
-  @DomName('Document.webkitVisibilityState')
+  @DomName('Document.visibilityState')
   @SupportedBrowser(SupportedBrowser.CHROME)
-  @SupportedBrowser(SupportedBrowser.SAFARI)
+  @SupportedBrowser(SupportedBrowser.FIREFOX)
+  @SupportedBrowser(SupportedBrowser.IE, '10')
   @Experimental()
-  String get visibilityState => _webkitVisibilityState;
+  String get visibilityState => JS('String',
+    '(#.visibilityState || #.mozVisibilityState || #.msVisibilityState ||'
+      '#.webkitVisibilityState)', this, this, this, this);
 
   @Experimental
   void register(String tag, Type customElementClass) {
@@ -12816,6 +12738,36 @@
   @Creates('Null')  // Set from Dart code; does not instantiate a native type.
   // Note: used to polyfill <template>
   Document _templateContentsOwner;
+
+  @DomName('Document.visibilityChange')
+  @SupportedBrowser(SupportedBrowser.CHROME)
+  @SupportedBrowser(SupportedBrowser.FIREFOX)
+  @SupportedBrowser(SupportedBrowser.IE, '10')
+  @Experimental()
+  static const EventStreamProvider<Event> visibilityChangeEvent =
+      const _CustomEventStreamProvider<Event>(
+        _determineVisibilityChangeEventType);
+
+  static String _determineVisibilityChangeEventType(EventTarget e) {
+    if (JS('bool', '(typeof #.hidden !== "undefined")', e)) {
+      // Opera 12.10 and Firefox 18 and later support
+      return 'visibilitychange';
+    } else if (JS('bool', '(typeof #.mozHidden !== "undefined")', e)) {
+      return 'mozvisibilitychange';
+    } else if (JS('bool', '(typeof #.msHidden !== "undefined")', e)) {
+      return 'msvisibilitychange';
+    } else if (JS('bool', '(typeof #.webkitHidden !== "undefined")', e)) {
+      return 'webkitvisibilitychange';
+    }
+    return 'visibilitychange';
+  }
+
+  @SupportedBrowser(SupportedBrowser.CHROME)
+  @SupportedBrowser(SupportedBrowser.FIREFOX)
+  @SupportedBrowser(SupportedBrowser.IE, '10')
+  @Experimental()
+  Stream<Event> get onVisibilityChange =>
+      visibilityChangeEvent.forTarget(this);
 }
 // 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
@@ -13208,8 +13160,23 @@
   @SupportedBrowser(SupportedBrowser.FIREFOX)
   @SupportedBrowser(SupportedBrowser.IE, '10')
   @SupportedBrowser(SupportedBrowser.SAFARI)
+  dynamic get response => _convertNativeToDart_XHR_Response(this._get_response);
+  @JSName('response')
+  /**
+   * The data received as a reponse from the request.
+   *
+   * The data could be in the
+   * form of a [String], [ByteBuffer], [Document], [Blob], or json (also a
+   * [String]). `null` indicates request failure.
+   */
+  @DomName('XMLHttpRequest.response')
+  @DocsEditable()
+  @SupportedBrowser(SupportedBrowser.CHROME)
+  @SupportedBrowser(SupportedBrowser.FIREFOX)
+  @SupportedBrowser(SupportedBrowser.IE, '10')
+  @SupportedBrowser(SupportedBrowser.SAFARI)
   @Creates('ByteBuffer|Blob|Document|=Object|JSExtendableArray|String|num')
-  final Object response;
+  final dynamic _get_response;
 
   /**
    * The response in string form or `null on failure.
@@ -13428,6 +13395,8 @@
   @DocsEditable()
   factory IFrameElement() => document.$dom_createElement("iframe");
 
+  @DomName('HTMLIFrameElement.contentWindow')
+  @DocsEditable()
   WindowBase get contentWindow => _convertNativeToDart_Window(this._get_contentWindow);
   @JSName('contentWindow')
   @DomName('HTMLIFrameElement.contentWindow')
@@ -13815,6 +13784,8 @@
   @DocsEditable()
   String value;
 
+  @DomName('HTMLInputElement.valueAsDate')
+  @DocsEditable()
   DateTime get valueAsDate => convertNativeToDart_DateTime(this._get_valueAsDate);
   @JSName('valueAsDate')
   @DomName('HTMLInputElement.valueAsDate')
@@ -16207,6 +16178,8 @@
   // To suppress missing implicit constructor warnings.
   factory MessageEvent._() { throw new UnsupportedError("Not supported"); }
 
+  @DomName('MessageEvent.data')
+  @DocsEditable()
   dynamic get data => convertNativeToDart_SerializedScriptValue(this._get_data);
   @JSName('data')
   @DomName('MessageEvent.data')
@@ -16230,10 +16203,14 @@
   @Creates('JSExtendableArray')
   final List<MessagePort> ports;
 
+  @DomName('MessageEvent.source')
+  @DocsEditable()
   EventTarget get source => _convertNativeToDart_EventTarget(this._get_source);
   @JSName('source')
   @DomName('MessageEvent.source')
   @DocsEditable()
+  @Creates('Null')
+  @Returns('EventTarget|=Object')
   final dynamic _get_source;
 
   @JSName('initMessageEvent')
@@ -16329,6 +16306,8 @@
 @Experimental()
 class Metadata extends Interceptor native "Metadata" {
 
+  @DomName('Metadata.modificationTime')
+  @DocsEditable()
   DateTime get modificationTime => convertNativeToDart_DateTime(this._get_modificationTime);
   @JSName('modificationTime')
   @DomName('Metadata.modificationTime')
@@ -16750,6 +16729,8 @@
   @DocsEditable()
   final bool metaKey;
 
+  @DomName('MouseEvent.relatedTarget')
+  @DocsEditable()
   EventTarget get relatedTarget => _convertNativeToDart_EventTarget(this._get_relatedTarget);
   @JSName('relatedTarget')
   @DomName('MouseEvent.relatedTarget')
@@ -17579,7 +17560,7 @@
     _this._replaceChild(value, this[index]);
   }
 
-  Iterator<Node> get iterator => _this._childNodes.iterator;
+  Iterator<Node> get iterator => _this.childNodes.iterator;
 
   // From List<Node>:
 
@@ -17601,15 +17582,15 @@
   // -- end List<Node> mixins.
 
   // TODO(jacobr): benchmark whether this is more efficient or whether caching
-  // a local copy of _childNodes is more efficient.
-  int get length => _this._childNodes.length;
+  // a local copy of childNodes is more efficient.
+  int get length => _this.childNodes.length;
 
   void set length(int value) {
     throw new UnsupportedError(
         "Cannot set length on immutable List.");
   }
 
-  Node operator[](int index) => _this._childNodes[index];
+  Node operator[](int index) => _this.childNodes[index];
 }
 
 /** Information about the instantiated template. */
@@ -17803,12 +17784,12 @@
   @DocsEditable()
   static const int TEXT_NODE = 3;
 
-  @JSName('childNodes')
   @DomName('Node.childNodes')
   @DocsEditable()
+  @deprecated
   @Returns('NodeList')
   @Creates('NodeList')
-  final List<Node> _childNodes;
+  final List<Node> childNodes;
 
   @DomName('Node.firstChild')
   @DocsEditable()
@@ -18749,6 +18730,14 @@
   // To suppress missing implicit constructor warnings.
   factory Performance._() { throw new UnsupportedError("Not supported"); }
 
+  @DomName('Performance.webkitresourcetimingbufferfullEvent')
+  @DocsEditable()
+  @SupportedBrowser(SupportedBrowser.CHROME)
+  @SupportedBrowser(SupportedBrowser.SAFARI)
+  @Experimental()
+  // http://www.w3c-test.org/webperf/specs/ResourceTiming/#performanceresourcetiming-methods
+  static const EventStreamProvider<Event> resourceTimingBufferFullEvent = const EventStreamProvider<Event>('webkitresourcetimingbufferfull');
+
   /// Checks if this type is supported on the current platform.
   static bool get supported => JS('bool', '!!(window.performance)');
 
@@ -18828,6 +18817,12 @@
   @Experimental()
   // http://www.w3c-test.org/webperf/specs/ResourceTiming/#performanceresourcetiming-methods
   void setResourceTimingBufferSize(int maxSize) native;
+
+  @DomName('Performance.onwebkitresourcetimingbufferfull')
+  @DocsEditable()
+  // http://www.w3c-test.org/webperf/specs/ResourceTiming/#performanceresourcetiming-methods
+  @Experimental()
+  Stream<Event> get onResourceTimingBufferFull => resourceTimingBufferFullEvent.forTarget(this);
 }
 // 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
@@ -19201,6 +19196,8 @@
   // To suppress missing implicit constructor warnings.
   factory PopStateEvent._() { throw new UnsupportedError("Not supported"); }
 
+  @DomName('PopStateEvent.state')
+  @DocsEditable()
   dynamic get state => convertNativeToDart_SerializedScriptValue(this._get_state);
   @JSName('state')
   @DomName('PopStateEvent.state')
@@ -20353,6 +20350,8 @@
   @DocsEditable()
   final RtcStatsReport remote;
 
+  @DomName('RTCStatsReport.timestamp')
+  @DocsEditable()
   DateTime get timestamp => convertNativeToDart_DateTime(this._get_timestamp);
   @JSName('timestamp')
   @DomName('RTCStatsReport.timestamp')
@@ -20986,10 +20985,20 @@
   // To suppress missing implicit constructor warnings.
   factory SharedWorkerGlobalScope._() { throw new UnsupportedError("Not supported"); }
 
+  @DomName('SharedWorkerGlobalScope.connectEvent')
+  @DocsEditable()
+  @Experimental() // untriaged
+  static const EventStreamProvider<Event> connectEvent = const EventStreamProvider<Event>('connect');
+
   @DomName('SharedWorkerGlobalScope.name')
   @DocsEditable()
   @Experimental() // untriaged
   final String name;
+
+  @DomName('SharedWorkerGlobalScope.onconnect')
+  @DocsEditable()
+  @Experimental() // untriaged
+  Stream<Event> get onConnect => connectEvent.forTarget(this);
 }
 // 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
@@ -22165,107 +22174,6 @@
 
 
 @DocsEditable()
-@DomName('SubtleCrypto')
-@Experimental() // untriaged
-class SubtleCrypto extends Interceptor native "SubtleCrypto" {
-
-  @DomName('SubtleCrypto.decrypt')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object decrypt(Map algorithm, CryptoKey key, TypedData data) {
-    var algorithm_1 = convertDartToNative_Dictionary(algorithm);
-    return _decrypt_1(algorithm_1, key, data);
-  }
-  @JSName('decrypt')
-  @DomName('SubtleCrypto.decrypt')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object _decrypt_1(algorithm, CryptoKey key, TypedData data) native;
-
-  @DomName('SubtleCrypto.digest')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object digest(Map algorithm, TypedData data) {
-    var algorithm_1 = convertDartToNative_Dictionary(algorithm);
-    return _digest_1(algorithm_1, data);
-  }
-  @JSName('digest')
-  @DomName('SubtleCrypto.digest')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object _digest_1(algorithm, TypedData data) native;
-
-  @DomName('SubtleCrypto.encrypt')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object encrypt(Map algorithm, CryptoKey key, TypedData data) {
-    var algorithm_1 = convertDartToNative_Dictionary(algorithm);
-    return _encrypt_1(algorithm_1, key, data);
-  }
-  @JSName('encrypt')
-  @DomName('SubtleCrypto.encrypt')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object _encrypt_1(algorithm, CryptoKey key, TypedData data) native;
-
-  @DomName('SubtleCrypto.generateKey')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object generateKey(Map algorithm, bool extractable, List<String> keyUsages) {
-    var algorithm_1 = convertDartToNative_Dictionary(algorithm);
-    return _generateKey_1(algorithm_1, extractable, keyUsages);
-  }
-  @JSName('generateKey')
-  @DomName('SubtleCrypto.generateKey')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object _generateKey_1(algorithm, extractable, List<String> keyUsages) native;
-
-  @DomName('SubtleCrypto.importKey')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object importKey(String format, TypedData keyData, Map algorithm, bool extractable, List<String> keyUsages) {
-    var algorithm_1 = convertDartToNative_Dictionary(algorithm);
-    return _importKey_1(format, keyData, algorithm_1, extractable, keyUsages);
-  }
-  @JSName('importKey')
-  @DomName('SubtleCrypto.importKey')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object _importKey_1(format, TypedData keyData, algorithm, extractable, List<String> keyUsages) native;
-
-  @DomName('SubtleCrypto.sign')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object sign(Map algorithm, CryptoKey key, TypedData data) {
-    var algorithm_1 = convertDartToNative_Dictionary(algorithm);
-    return _sign_1(algorithm_1, key, data);
-  }
-  @JSName('sign')
-  @DomName('SubtleCrypto.sign')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object _sign_1(algorithm, CryptoKey key, TypedData data) native;
-
-  @DomName('SubtleCrypto.verify')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object verify(Map algorithm, CryptoKey key, TypedData signature, TypedData data) {
-    var algorithm_1 = convertDartToNative_Dictionary(algorithm);
-    return _verify_1(algorithm_1, key, signature, data);
-  }
-  @JSName('verify')
-  @DomName('SubtleCrypto.verify')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object _verify_1(algorithm, CryptoKey key, TypedData signature, TypedData data) native;
-}
-// 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.
-
-
-@DocsEditable()
 @DomName('HTMLTableCaptionElement')
 class TableCaptionElement extends HtmlElement native "HTMLTableCaptionElement" {
   // To suppress missing implicit constructor warnings.
@@ -23489,6 +23397,8 @@
   @DocsEditable()
   final int _screenY;
 
+  @DomName('Touch.target')
+  @DocsEditable()
   EventTarget get target => _convertNativeToDart_EventTarget(this._get_target);
   @JSName('target')
   @DomName('Touch.target')
@@ -23931,6 +23841,8 @@
   @Experimental() // nonstandard
   final int _pageY;
 
+  @DomName('UIEvent.view')
+  @DocsEditable()
   WindowBase get view => _convertNativeToDart_Window(this._get_view);
   @JSName('view')
   @DomName('UIEvent.view')
@@ -25096,6 +25008,8 @@
   @Experimental() // non-standard
   final bool offscreenBuffering;
 
+  @DomName('Window.opener')
+  @DocsEditable()
   WindowBase get opener => _convertNativeToDart_Window(this._get_opener);
   @JSName('opener')
   @DomName('Window.opener')
@@ -25120,6 +25034,8 @@
   @DocsEditable()
   final int pageYOffset;
 
+  @DomName('Window.parent')
+  @DocsEditable()
   WindowBase get parent => _convertNativeToDart_Window(this._get_parent);
   @JSName('parent')
   @DomName('Window.parent')
@@ -25165,6 +25081,8 @@
   @DocsEditable()
   final BarProp scrollbars;
 
+  @DomName('Window.self')
+  @DocsEditable()
   WindowBase get self => _convertNativeToDart_Window(this._get_self);
   @JSName('self')
   @DomName('Window.self')
@@ -25201,6 +25119,8 @@
   @DocsEditable()
   final BarProp toolbar;
 
+  @DomName('Window.top')
+  @DocsEditable()
   WindowBase get top => _convertNativeToDart_Window(this._get_top);
   @JSName('top')
   @DomName('Window.top')
@@ -25229,6 +25149,8 @@
   @deprecated // deprecated
   final StorageInfo storageInfo;
 
+  @DomName('Window.window')
+  @DocsEditable()
   WindowBase get window => _convertNativeToDart_Window(this._get_window);
   @JSName('window')
   @DomName('Window.window')
@@ -26301,6 +26223,11 @@
   @Experimental() // untriaged
   static const EventStreamProvider<ProgressEvent> progressEvent = const EventStreamProvider<ProgressEvent>('progress');
 
+  @DomName('XMLHttpRequestEventTarget.timeoutEvent')
+  @DocsEditable()
+  @Experimental() // untriaged
+  static const EventStreamProvider<ProgressEvent> timeoutEvent = const EventStreamProvider<ProgressEvent>('timeout');
+
   @DomName('XMLHttpRequestEventTarget.onabort')
   @DocsEditable()
   @Experimental() // untriaged
@@ -26318,6 +26245,10 @@
 
   @DomName('XMLHttpRequestEventTarget.onloadend')
   @DocsEditable()
+  @SupportedBrowser(SupportedBrowser.CHROME)
+  @SupportedBrowser(SupportedBrowser.FIREFOX)
+  @SupportedBrowser(SupportedBrowser.IE, '10')
+  @SupportedBrowser(SupportedBrowser.SAFARI)
   @Experimental() // untriaged
   Stream<ProgressEvent> get onLoadEnd => loadEndEvent.forTarget(this);
 
@@ -26328,8 +26259,17 @@
 
   @DomName('XMLHttpRequestEventTarget.onprogress')
   @DocsEditable()
+  @SupportedBrowser(SupportedBrowser.CHROME)
+  @SupportedBrowser(SupportedBrowser.FIREFOX)
+  @SupportedBrowser(SupportedBrowser.IE, '10')
+  @SupportedBrowser(SupportedBrowser.SAFARI)
   @Experimental() // untriaged
   Stream<ProgressEvent> get onProgress => progressEvent.forTarget(this);
+
+  @DomName('XMLHttpRequestEventTarget.ontimeout')
+  @DocsEditable()
+  @Experimental() // untriaged
+  Stream<ProgressEvent> get onTimeout => timeoutEvent.forTarget(this);
 }
 // 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
@@ -27463,6 +27403,16 @@
 
 
 @DocsEditable()
+@DomName('SubtleCrypto')
+@Experimental() // untriaged
+abstract class _SubtleCrypto extends Interceptor native "SubtleCrypto" {
+}
+// 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.
+
+
+@DocsEditable()
 @DomName('WebKitMediaSource')
 @Experimental() // untriaged
 abstract class _WebKitMediaSource extends EventTarget native "WebKitMediaSource" {
@@ -27623,15 +27573,15 @@
   }
 
   String operator [](String key) {
-    return _element._getAttribute(key);
+    return _element.getAttribute(key);
   }
 
   void operator []=(String key, String value) {
-    _element._setAttribute(key, value);
+    _element.setAttribute(key, value);
   }
 
   String remove(String key) {
-    String value = _element._getAttribute(key);
+    String value = _element.getAttribute(key);
     _element._removeAttribute(key);
     return value;
   }
@@ -27660,11 +27610,11 @@
   }
 
   String operator [](String key) {
-    return _element._getAttributeNS(_namespace, key);
+    return _element.getAttributeNS(_namespace, key);
   }
 
   void operator []=(String key, String value) {
-    _element._setAttributeNS(_namespace, key, value);
+    _element.setAttributeNS(_namespace, key, value);
   }
 
   String remove(String key) {
@@ -31982,6 +31932,13 @@
     return e;
   }
 }
+
+_convertNativeToDart_XHR_Response(o) {
+  if (o is Document) {
+    return o;
+  }
+  return convertNativeToDart_SerializedScriptValue(o);
+}
 // Copyright (c) 2013, 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.
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index bc54884..222c855 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -2456,7 +2456,7 @@
   @DomName('Crypto.subtle')
   @DocsEditable()
   @Experimental() // untriaged
-  SubtleCrypto get subtle native "Crypto_subtle_Getter";
+  _SubtleCrypto get subtle native "Crypto_subtle_Getter";
 
   @DomName('Crypto.getRandomValues')
   @DocsEditable()
@@ -2813,7 +2813,7 @@
   @DomName('CSSKeyframesRule.insertRule')
   @DocsEditable()
   @Experimental() // untriaged
-  void insertRule(String rule) native "CSSKeyframesRule_insertRule_Callback";
+  void appendRule(String rule) native "CSSKeyframesRule_insertRule_Callback";
 
 }
 // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
@@ -10589,11 +10589,13 @@
 
   @DomName('Element.getAttribute')
   @DocsEditable()
-  String _getAttribute(String name) native "Element_getAttribute_Callback";
+  @deprecated
+  String getAttribute(String name) native "Element_getAttribute_Callback";
 
   @DomName('Element.getAttributeNS')
   @DocsEditable()
-  String _getAttributeNS(String namespaceURI, String localName) native "Element_getAttributeNS_Callback";
+  @deprecated
+  String getAttributeNS(String namespaceURI, String localName) native "Element_getAttributeNS_Callback";
 
   @DomName('Element.getBoundingClientRect')
   @DocsEditable()
@@ -10693,11 +10695,13 @@
 
   @DomName('Element.setAttribute')
   @DocsEditable()
-  void _setAttribute(String name, String value) native "Element_setAttribute_Callback";
+  @deprecated
+  void setAttribute(String name, String value) native "Element_setAttribute_Callback";
 
   @DomName('Element.setAttributeNS')
   @DocsEditable()
-  void _setAttributeNS(String namespaceURI, String qualifiedName, String value) native "Element_setAttributeNS_Callback";
+  @deprecated
+  void setAttributeNS(String namespaceURI, String qualifiedName, String value) native "Element_setAttributeNS_Callback";
 
   @DomName('Element.webkitGetRegionFlowRanges')
   @DocsEditable()
@@ -13264,9 +13268,10 @@
   Element get pointerLockElement =>
       _webkitPointerLockElement;
 
-  @DomName('Document.webkitVisibilityState')
+  @DomName('Document.visibilityState')
   @SupportedBrowser(SupportedBrowser.CHROME)
-  @SupportedBrowser(SupportedBrowser.SAFARI)
+  @SupportedBrowser(SupportedBrowser.FIREFOX)
+  @SupportedBrowser(SupportedBrowser.IE, '10')
   @Experimental()
   String get visibilityState => _webkitVisibilityState;
 
@@ -13277,6 +13282,26 @@
 
   // Note: used to polyfill <template>
   Document _templateContentsOwner;
+
+  @DomName('Document.visibilityChange')
+  @SupportedBrowser(SupportedBrowser.CHROME)
+  @SupportedBrowser(SupportedBrowser.FIREFOX)
+  @SupportedBrowser(SupportedBrowser.IE, '10')
+  @Experimental()
+  static const EventStreamProvider<Event> visibilityChangeEvent =
+      const _CustomEventStreamProvider<Event>(
+        _determineVisibilityChangeEventType);
+
+  static String _determineVisibilityChangeEventType(EventTarget e) {
+    return 'webkitvisibilitychange';
+  }
+
+  @SupportedBrowser(SupportedBrowser.CHROME)
+  @SupportedBrowser(SupportedBrowser.FIREFOX)
+  @SupportedBrowser(SupportedBrowser.IE, '10')
+  @Experimental()
+  Stream<Event> get onVisibilityChange =>
+      visibilityChangeEvent.forTarget(this);
 }
 // 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
@@ -18876,7 +18901,7 @@
     _this._replaceChild(value, this[index]);
   }
 
-  Iterator<Node> get iterator => _this._childNodes.iterator;
+  Iterator<Node> get iterator => _this.childNodes.iterator;
 
   // From List<Node>:
 
@@ -18898,15 +18923,15 @@
   // -- end List<Node> mixins.
 
   // TODO(jacobr): benchmark whether this is more efficient or whether caching
-  // a local copy of _childNodes is more efficient.
-  int get length => _this._childNodes.length;
+  // a local copy of childNodes is more efficient.
+  int get length => _this.childNodes.length;
 
   void set length(int value) {
     throw new UnsupportedError(
         "Cannot set length on immutable List.");
   }
 
-  Node operator[](int index) => _this._childNodes[index];
+  Node operator[](int index) => _this.childNodes[index];
 }
 
 /** Information about the instantiated template. */
@@ -19102,7 +19127,8 @@
 
   @DomName('Node.childNodes')
   @DocsEditable()
-  List<Node> get _childNodes native "Node_childNodes_Getter";
+  @deprecated
+  List<Node> get childNodes native "Node_childNodes_Getter";
 
   @DomName('Node.firstChild')
   @DocsEditable()
@@ -20204,6 +20230,14 @@
   // To suppress missing implicit constructor warnings.
   factory Performance._() { throw new UnsupportedError("Not supported"); }
 
+  @DomName('Performance.webkitresourcetimingbufferfullEvent')
+  @DocsEditable()
+  @SupportedBrowser(SupportedBrowser.CHROME)
+  @SupportedBrowser(SupportedBrowser.SAFARI)
+  @Experimental()
+  // http://www.w3c-test.org/webperf/specs/ResourceTiming/#performanceresourcetiming-methods
+  static const EventStreamProvider<Event> resourceTimingBufferFullEvent = const EventStreamProvider<Event>('webkitresourcetimingbufferfull');
+
   /// Checks if this type is supported on the current platform.
   static bool get supported => true;
 
@@ -20297,6 +20331,12 @@
   @Experimental() // untriaged
   void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "Performance_removeEventListener_Callback";
 
+  @DomName('Performance.onwebkitresourcetimingbufferfull')
+  @DocsEditable()
+  // http://www.w3c-test.org/webperf/specs/ResourceTiming/#performanceresourcetiming-methods
+  @Experimental()
+  Stream<Event> get onResourceTimingBufferFull => resourceTimingBufferFullEvent.forTarget(this);
+
 }
 // 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
@@ -22611,11 +22651,21 @@
   // To suppress missing implicit constructor warnings.
   factory SharedWorkerGlobalScope._() { throw new UnsupportedError("Not supported"); }
 
+  @DomName('SharedWorkerGlobalScope.connectEvent')
+  @DocsEditable()
+  @Experimental() // untriaged
+  static const EventStreamProvider<Event> connectEvent = const EventStreamProvider<Event>('connect');
+
   @DomName('SharedWorkerGlobalScope.name')
   @DocsEditable()
   @Experimental() // untriaged
   String get name native "SharedWorkerGlobalScope_name_Getter";
 
+  @DomName('SharedWorkerGlobalScope.onconnect')
+  @DocsEditable()
+  @Experimental() // untriaged
+  Stream<Event> get onConnect => connectEvent.forTarget(this);
+
 }
 // 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
@@ -24051,54 +24101,6 @@
 
 
 @DocsEditable()
-@DomName('SubtleCrypto')
-@Experimental() // untriaged
-class SubtleCrypto extends NativeFieldWrapperClass1 {
-
-  @DomName('SubtleCrypto.decrypt')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object decrypt(Map algorithm, CryptoKey key, TypedData data) native "SubtleCrypto_decrypt_Callback";
-
-  @DomName('SubtleCrypto.digest')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object digest(Map algorithm, TypedData data) native "SubtleCrypto_digest_Callback";
-
-  @DomName('SubtleCrypto.encrypt')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object encrypt(Map algorithm, CryptoKey key, TypedData data) native "SubtleCrypto_encrypt_Callback";
-
-  @DomName('SubtleCrypto.generateKey')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object generateKey(Map algorithm, bool extractable, List<String> keyUsages) native "SubtleCrypto_generateKey_Callback";
-
-  @DomName('SubtleCrypto.importKey')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object importKey(String format, TypedData keyData, Map algorithm, bool extractable, List<String> keyUsages) native "SubtleCrypto_importKey_Callback";
-
-  @DomName('SubtleCrypto.sign')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object sign(Map algorithm, CryptoKey key, TypedData data) native "SubtleCrypto_sign_Callback";
-
-  @DomName('SubtleCrypto.verify')
-  @DocsEditable()
-  @Experimental() // untriaged
-  Object verify(Map algorithm, CryptoKey key, TypedData signature, TypedData data) native "SubtleCrypto_verify_Callback";
-
-}
-// 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.
-
-// WARNING: Do not edit - generated code.
-
-
-@DocsEditable()
 @DomName('HTMLTableCaptionElement')
 class TableCaptionElement extends HtmlElement {
   // To suppress missing implicit constructor warnings.
@@ -28169,6 +28171,11 @@
   @Experimental() // untriaged
   static const EventStreamProvider<ProgressEvent> progressEvent = const EventStreamProvider<ProgressEvent>('progress');
 
+  @DomName('XMLHttpRequestEventTarget.timeoutEvent')
+  @DocsEditable()
+  @Experimental() // untriaged
+  static const EventStreamProvider<ProgressEvent> timeoutEvent = const EventStreamProvider<ProgressEvent>('timeout');
+
   @DomName('XMLHttpRequestEventTarget.addEventListener')
   @DocsEditable()
   @Experimental() // untriaged
@@ -28201,6 +28208,10 @@
 
   @DomName('XMLHttpRequestEventTarget.onloadend')
   @DocsEditable()
+  @SupportedBrowser(SupportedBrowser.CHROME)
+  @SupportedBrowser(SupportedBrowser.FIREFOX)
+  @SupportedBrowser(SupportedBrowser.IE, '10')
+  @SupportedBrowser(SupportedBrowser.SAFARI)
   @Experimental() // untriaged
   Stream<ProgressEvent> get onLoadEnd => loadEndEvent.forTarget(this);
 
@@ -28211,9 +28222,18 @@
 
   @DomName('XMLHttpRequestEventTarget.onprogress')
   @DocsEditable()
+  @SupportedBrowser(SupportedBrowser.CHROME)
+  @SupportedBrowser(SupportedBrowser.FIREFOX)
+  @SupportedBrowser(SupportedBrowser.IE, '10')
+  @SupportedBrowser(SupportedBrowser.SAFARI)
   @Experimental() // untriaged
   Stream<ProgressEvent> get onProgress => progressEvent.forTarget(this);
 
+  @DomName('XMLHttpRequestEventTarget.ontimeout')
+  @DocsEditable()
+  @Experimental() // untriaged
+  Stream<ProgressEvent> get onTimeout => timeoutEvent.forTarget(this);
+
 }
 // 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
@@ -29484,6 +29504,19 @@
 
 
 @DocsEditable()
+@DomName('SubtleCrypto')
+@Experimental() // untriaged
+abstract class _SubtleCrypto extends NativeFieldWrapperClass1 {
+
+}
+// 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.
+
+// WARNING: Do not edit - generated code.
+
+
+@DocsEditable()
 @DomName('WebKitMediaSource')
 @Experimental() // untriaged
 abstract class _WebKitMediaSource extends EventTarget {
@@ -29654,15 +29687,15 @@
   }
 
   String operator [](String key) {
-    return _element._getAttribute(key);
+    return _element.getAttribute(key);
   }
 
   void operator []=(String key, String value) {
-    _element._setAttribute(key, value);
+    _element.setAttribute(key, value);
   }
 
   String remove(String key) {
-    String value = _element._getAttribute(key);
+    String value = _element.getAttribute(key);
     _element._removeAttribute(key);
     return value;
   }
@@ -29691,11 +29724,11 @@
   }
 
   String operator [](String key) {
-    return _element._getAttributeNS(_namespace, key);
+    return _element.getAttributeNS(_namespace, key);
   }
 
   void operator []=(String key, String value) {
-    _element._setAttributeNS(_namespace, key, value);
+    _element.setAttributeNS(_namespace, key, value);
   }
 
   String remove(String key) {
diff --git a/sdk/lib/html/html_common/device.dart b/sdk/lib/html/html_common/device.dart
index d7fb730..25d7ff0 100644
--- a/sdk/lib/html/html_common/device.dart
+++ b/sdk/lib/html/html_common/device.dart
@@ -37,7 +37,7 @@
    */
   static bool get isIE {
     if (_isIE == null) {
-      _isIE = !isOpera && userAgent.contains("MSIE", 0);
+      _isIE = !isOpera && userAgent.contains("Trident/", 0);
     }
     return _isIE;
   }
diff --git a/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart b/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
index 3fbe9ff..b1eea89 100644
--- a/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
+++ b/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
@@ -1,3 +1,75 @@
+/**
+ * A client-side key-value store with support for indexes.
+ *
+ * Many browsers support IndexedDB&mdash;a web standard for
+ * an indexed database.
+ * By storing data on the client in an IndexedDB,
+ * a web app gets some advantages, such as faster performance and persistence.
+ * To find out which browsers support IndexedDB,
+ * refer to [Can I Use?](http://caniuse.com/#feat=indexeddb)
+ *
+ * In IndexedDB, each record is identified by a unique index or key,
+ * making data retrieval speedy.
+ * You can store structured data,
+ * such as images, arrays, and maps using IndexedDB.
+ * The standard does not specify size limits for individual data items
+ * or for the database itself, but browsers may impose storage limits.
+ *
+ * ## Using indexed_db
+ *
+ * The classes in this library provide an interface
+ * to the browser's IndexedDB, if it has one.
+ * To use this library in your code:
+ *
+ *     import 'dart:indexed_db';
+ *
+ * A web app can determine if the browser supports
+ * IndexedDB with [IdbFactory.supported]:
+ *
+ *     if (IdbFactory.supported)
+ *       // Use indexeddb.
+ *     else
+ *       // Find an alternative.
+ *
+ * Access to the browser's IndexedDB is provided by the app's top-level
+ * [Window] object, which your code can refer to with `window.indexedDB`.
+ * So, for example,
+ * here's how to use window.indexedDB to open a database:
+ *
+ *     Future open() {
+ *       return window.indexedDB.open('myIndexedDB',
+ *           version: 1,
+ *           onUpgradeNeeded: _initializeDatabase)
+ *         .then(_loadFromDB);
+ *     }
+ *     void _initializeDatabase(VersionChangeEvent e) {
+ *       ...
+ *     }
+ *     Future _loadFromDB(Database db) {
+ *       ...
+ *     }
+ *
+ *
+ * All data in an IndexedDB is stored within an [ObjectStore].
+ * To manipulate the database use [Transaction]s.
+ *
+ * ## Other resources
+ *
+ * Other options for client-side data storage include:
+ *
+ * * [Window.localStorage]&mdash;a
+ * basic mechanism that stores data as a [Map],
+ * and where both the keys and the values are strings.
+ *
+ * * [dart:web_sql]&mdash;a database that can be queried with SQL.
+ * 
+ * For a tutorial about using the indexed_db library with Dart,
+ * check out
+ * [Use IndexedDB](http://www.dartlang.org/docs/tutorials/indexeddb/).
+ *
+ * [IndexedDB reference](http://docs.webplatform.org/wiki/apis/indexeddb)
+ * provides wiki-style docs about indexedDB
+ */
 library dart.dom.indexed_db;
 
 import 'dart:async';
@@ -220,6 +292,8 @@
   // To suppress missing implicit constructor warnings.
   factory CursorWithValue._() { throw new UnsupportedError("Not supported"); }
 
+  @DomName('IDBCursorWithValue.value')
+  @DocsEditable()
   dynamic get value => _convertNativeToDart_IDBAny(this._get_value);
   @JSName('value')
   @DomName('IDBCursorWithValue.value')
@@ -578,7 +652,12 @@
     } else {
       key_OR_range = range;
     }
-    var request = _openCursor(key_OR_range, direction);
+    var request;
+    if (direction == null) {
+      request = _openCursor(key_OR_range);
+    } else {
+      request = _openCursor(key_OR_range, direction);
+    }
     return ObjectStore._cursorStreamFromResult(request, autoAdvance);
   }
 
@@ -600,7 +679,12 @@
     } else {
       key_OR_range = range;
     }
-    var request = _openKeyCursor(key_OR_range, direction);
+    var request;
+    if (direction == null) {
+      request = _openKeyCursor(key_OR_range);
+    } else {
+      request = _openKeyCursor(key_OR_range, direction);
+    }
     return ObjectStore._cursorStreamFromResult(request, autoAdvance);
   }
 
@@ -654,7 +738,7 @@
   @Returns('Request')
   @Creates('Request')
   @Creates('Cursor')
-  Request _openCursor(Object key, String direction) native;
+  Request _openCursor(Object key, [String direction]) native;
 
   @JSName('openKeyCursor')
   @DomName('IDBIndex.openKeyCursor')
@@ -662,7 +746,7 @@
   @Returns('Request')
   @Creates('Request')
   @Creates('Cursor')
-  Request _openKeyCursor(Object key, String direction) native;
+  Request _openKeyCursor(Object key, [String direction]) native;
 
 }
 // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
@@ -1111,6 +1195,8 @@
   @DocsEditable()
   final String readyState;
 
+  @DomName('IDBRequest.result')
+  @DocsEditable()
   dynamic get result => _convertNativeToDart_IDBAny(this._get_result);
   @JSName('result')
   @DomName('IDBRequest.result')
diff --git a/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart b/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
index c21a6a4..9071f38 100644
--- a/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
+++ b/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
@@ -441,7 +441,12 @@
     } else {
       key_OR_range = range;
     }
-    var request = _openCursor(key_OR_range, direction);
+    var request;
+    if (direction == null) {
+      request = _openCursor(key_OR_range);
+    } else {
+      request = _openCursor(key_OR_range, direction);
+    }
     return ObjectStore._cursorStreamFromResult(request, autoAdvance);
   }
 
@@ -463,7 +468,12 @@
     } else {
       key_OR_range = range;
     }
-    var request = _openKeyCursor(key_OR_range, direction);
+    var request;
+    if (direction == null) {
+      request = _openKeyCursor(key_OR_range);
+    } else {
+      request = _openKeyCursor(key_OR_range, direction);
+    }
     return ObjectStore._cursorStreamFromResult(request, autoAdvance);
   }
 
@@ -502,11 +512,11 @@
 
   @DomName('IDBIndex.openCursor')
   @DocsEditable()
-  Request _openCursor(Object key, String direction) native "IDBIndex_openCursor_Callback";
+  Request _openCursor(Object key, [String direction]) native "IDBIndex_openCursor_Callback";
 
   @DomName('IDBIndex.openKeyCursor')
   @DocsEditable()
-  Request _openKeyCursor(Object key, String direction) native "IDBIndex_openKeyCursor_Callback";
+  Request _openKeyCursor(Object key, [String direction]) native "IDBIndex_openKeyCursor_Callback";
 
 }
 // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
diff --git a/sdk/lib/io/directory.dart b/sdk/lib/io/directory.dart
index 57b6568..a7fe520 100644
--- a/sdk/lib/io/directory.dart
+++ b/sdk/lib/io/directory.dart
@@ -89,43 +89,6 @@
   Directory createTempSync();
 
   /**
-   * Deletes this directory.
-   *
-   * If [recursive] is false, the directory must be empty.  Only directories
-   * and links to directories will be deleted.
-   *
-   * If [recursive] is true, this directory and all sub-directories
-   * and files in the directories are deleted. Links are not followed
-   * when deleting recursively. Only the link is deleted, not its target.
-   *
-   * If [recursive] is true, the target is deleted even if it is a file, or
-   * a link to a file, not only if it is a directory.  This behavior allows
-   * [delete] to be used to unconditionally delete any file system object.
-   *
-   * Returns a [:Future<Directory>:] that completes with this
-   * directory when the deletion is done. If the directory cannot be
-   * deleted, the future completes with an exception.
-   */
-  Future<Directory> delete({recursive: false});
-
-  /**
-   * Synchronously deletes this directory.
-   *
-   * If [recursive] is false, the directory must be empty.
-   *
-   * If [recursive] is true, this directory and all sub-directories
-   * and files in the directories are deleted. Links are not followed
-   * when deleting recursively. Only the link is deleted, not its target.
-   *
-   * If [recursive] is true, the target is deleted even if it is a file, or
-   * a link to a file, not only if it is a directory.  This behavior allows
-   * [delete] to be used to unconditionally delete any file system object.
-   *
-   * Throws an exception if the directory cannot be deleted.
-   */
-  void deleteSync({recursive: false});
-
-  /**
    * Renames this directory. Returns a [:Future<Directory>:] that completes
    * with a [Directory] instance for the renamed directory.
    *
diff --git a/sdk/lib/io/directory_impl.dart b/sdk/lib/io/directory_impl.dart
index 39d36cf..f54a641 100644
--- a/sdk/lib/io/directory_impl.dart
+++ b/sdk/lib/io/directory_impl.dart
@@ -4,7 +4,7 @@
 
 part of dart.io;
 
-class _Directory implements Directory {
+class _Directory extends FileSystemEntity implements Directory {
   static const CREATE_REQUEST = 0;
   static const DELETE_REQUEST = 1;
   static const EXISTS_REQUEST = 2;
@@ -29,7 +29,7 @@
   external static _createTemp(String template);
   external static int _exists(String path);
   external static _create(String path);
-  external static _delete(String path, bool recursive);
+  external static _deleteNative(String path, bool recursive);
   external static _rename(String path, String newPath);
   external static List _list(String path, bool recursive, bool followLinks);
   external static SendPort _newServicePort();
@@ -183,7 +183,7 @@
     return new Directory(result);
   }
 
-  Future<Directory> delete({recursive: false}) {
+  Future<Directory> _delete({recursive: false}) {
     _ensureDirectoryService();
     List request = new List(3);
     request[0] = DELETE_REQUEST;
@@ -197,8 +197,8 @@
     });
   }
 
-  void deleteSync({recursive: false}) {
-    var result = _delete(path, recursive);
+  void _deleteSync({recursive: false}) {
+    var result = _deleteNative(path, recursive);
     if (result is OSError) {
       throw new DirectoryException("Deletion failed", path, result);
     }
@@ -229,35 +229,22 @@
     return new Directory(newPath);
   }
 
-  static String _trimTrailingPathSeparators(String path) {
-    // Don't handle argument errors here.
-    if (path is! String) return path;
-    if (Platform.operatingSystem == 'windows') {
-      while (path.length > 1 &&
-             (path.endsWith(Platform.pathSeparator) ||
-              path.endsWith('/'))) {
-        path = path.substring(0, path.length - 1);
-      }
-    } else {
-      while (path.length > 1 && path.endsWith(Platform.pathSeparator)) {
-        path = path.substring(0, path.length - 1);
-      }
-    }
-    return path;
-  }
-
   Stream<FileSystemEntity> list({bool recursive: false,
                                  bool followLinks: true}) {
-    return new _AsyncDirectoryLister(_trimTrailingPathSeparators(path),
-                                     recursive,
-                                     followLinks).stream;
+    return new _AsyncDirectoryLister(
+        FileSystemEntity._trimTrailingPathSeparators(path),
+        recursive,
+        followLinks).stream;
   }
 
   List listSync({bool recursive: false, bool followLinks: true}) {
     if (recursive is! bool || followLinks is! bool) {
       throw new ArgumentError();
     }
-    return _list(_trimTrailingPathSeparators(path), recursive, followLinks);
+    return _list(
+        FileSystemEntity._trimTrailingPathSeparators(path),
+        recursive,
+        followLinks);
   }
 
   String toString() => "Directory: '$path'";
diff --git a/sdk/lib/io/file.dart b/sdk/lib/io/file.dart
index ffcadc7..d5579ca 100644
--- a/sdk/lib/io/file.dart
+++ b/sdk/lib/io/file.dart
@@ -60,21 +60,6 @@
   void createSync();
 
   /**
-   * Delete the file. Returns a [:Future<File>:] that completes with
-   * the file when it has been deleted. Only a file or a link to a file
-   * can be deleted with this method, not a directory or a broken link.
-   */
-  Future<File> delete();
-
-  /**
-   * Synchronously delete the file. Only a file or a link to a file
-   * can be deleted with this method, not a directory or a broken link.
-   *
-   * Throws a [FileException] if the operation fails.
-   */
-  void deleteSync();
-
-  /**
    * Renames this file. Returns a `Future<File>` that completes
    * with a [File] instance for the renamed file.
    *
diff --git a/sdk/lib/io/file_impl.dart b/sdk/lib/io/file_impl.dart
index 3ce6ee1..ba6b642 100644
--- a/sdk/lib/io/file_impl.dart
+++ b/sdk/lib/io/file_impl.dart
@@ -234,7 +234,7 @@
 }
 
 // Class for encapsulating the native implementation of files.
-class _File implements File {
+class _File extends FileSystemEntity implements File {
   final String path;
   SendPort _fileService;
 
@@ -295,7 +295,10 @@
     throwIfError(result, "Cannot create file", path);
   }
 
-  Future<File> delete() {
+  Future<File> _delete({bool recursive: false}) {
+    if (recursive) {
+      return new Directory(path).delete(recursive: true).then((_) => this);
+    }
     _ensureFileService();
     List request = new List(2);
     request[0] = _DELETE_REQUEST;
@@ -308,12 +311,15 @@
     });
   }
 
-  external static _delete(String path);
+  external static _deleteNative(String path);
 
-  external static _deleteLink(String path);
+  external static _deleteLinkNative(String path);
 
-  void deleteSync() {
-    var result = _delete(path);
+  void _deleteSync({bool recursive: false}) {
+    if (recursive) {
+      return new Directory(path).deleteSync(recursive: true);
+    }
+    var result = _deleteNative(path);
     throwIfError(result, "Cannot delete file", path);
   }
 
diff --git a/sdk/lib/io/file_system_entity.dart b/sdk/lib/io/file_system_entity.dart
index b764f04..0887175 100644
--- a/sdk/lib/io/file_system_entity.dart
+++ b/sdk/lib/io/file_system_entity.dart
@@ -168,77 +168,6 @@
 abstract class FileSystemEntity {
   String get path;
 
-  external static _getType(String path, bool followLinks);
-  external static _identical(String path1, String path2);
-
-  static int _getTypeSync(String path, bool followLinks) {
-    var result = _getType(path, followLinks);
-    _throwIfError(result, 'Error getting type of FileSystemEntity');
-    return result;
-  }
-
-  static Future<int> _getTypeAsync(String path, bool followLinks) {
-    // Get a new file service port for each request.  We could also cache one.
-    var service = _FileUtils._newServicePort();
-    List request = new List(3);
-    request[0] = _TYPE_REQUEST;
-    request[1] = path;
-    request[2] = followLinks;
-    return service.call(request).then((response) {
-      if (_isErrorResponse(response)) {
-        throw _exceptionFromResponse(response, "Error getting type", path);
-      }
-      return response;
-    });
-  }
-
-  /**
-   * Synchronously checks whether two paths refer to the same object in the
-   * file system. Returns a [:Future<bool>:] that completes with the result.
-   *
-   * Comparing a link to its target returns false, as does comparing two links
-   * that point to the same target.  To check the target of a link, use
-   * Link.target explicitly to fetch it.  Directory links appearing
-   * inside a path are followed, though, to find the file system object.
-   *
-   * Completes the returned Future with an error if one of the paths points
-   * to an object that does not exist.
-   */
-  static Future<bool> identical(String path1, String path2) {
-    // Get a new file service port for each request.  We could also cache one.
-    var service = _FileUtils._newServicePort();
-    List request = new List(3);
-    request[0] = _IDENTICAL_REQUEST;
-    request[1] = path1;
-    request[2] = path2;
-    return service.call(request).then((response) {
-      if (_isErrorResponse(response)) {
-        throw _exceptionFromResponse(response,
-            "Error in FileSystemEntity.identical($path1, $path2)", "");
-      }
-      return response;
-    });
-  }
-
-
-  /**
-   * Synchronously checks whether two paths refer to the same object in the
-   * file system.
-   *
-   * Comparing a link to its target returns false, as does comparing two links
-   * that point to the same target.  To check the target of a link, use
-   * Link.target explicitly to fetch it.  Directory links appearing
-   * inside a path are followed, though, to find the file system object.
-   *
-   * Throws an error if one of the paths points to an object that does not
-   * exist.
-   */
-  static bool identicalSync(String path1, String path2) {
-    var result = _identical(path1, path2);
-    _throwIfError(result, 'Error in FileSystemEntity.identicalSync');
-    return result;
-  }
-
   /**
    * Checks whether the file system entity with this path exists. Returns
    * a [:Future<bool>:] that completes with the result.
@@ -316,6 +245,129 @@
    */
   FileStat statSync();
 
+  /**
+   * Deletes this [FileSystemEntity].
+   *
+   * If the [FileSystemEntity] is a directory, and if [recursive] is false,
+   * the directory must be empty. Otherwise, if [recursive] is true, the
+   * directory and all sub-directories and files in the directories are
+   * deleted. Links are not followed when deleting recursively. Only the link
+   * is deleted, not its target.
+   *
+   * If [recursive] is true, the [FileSystemEntity] is deleted even if the type
+   * of the [FileSystemEntity] doesn't match the content of the file system.
+   * This behavior allows [delete] to be used to unconditionally delete any file
+   * system object.
+   *
+   * Returns a [:Future<FileSystemEntity>:] that completes with this
+   * [FileSystemEntity] when the deletion is done. If the [FileSystemEntity]
+   * cannot be deleted, the future completes with an exception.
+   */
+  Future<FileSystemEntity> delete({recursive: false})
+      => _delete(recursive: recursive);
+
+  /**
+   * Synchronously deletes this [FileSystemEntity].
+   *
+   * If the [FileSystemEntity] is a directory, and if [recursive] is false,
+   * the directory must be empty. Otherwise, if [recursive] is true, the
+   * directory and all sub-directories and files in the directories are
+   * deleted. Links are not followed when deleting recursively. Only the link
+   * is deleted, not its target.
+   *
+   * If [recursive] is true, the [FileSystemEntity] is deleted even if the type
+   * of the [FileSystemEntity] doesn't match the content of the file system.
+   * This behavior allows [deleteSync] to be used to unconditionally delete any
+   * file system object.
+   *
+   * Throws an exception if the [FileSystemEntity] cannot be deleted.
+   */
+  void deleteSync({recursive: false})
+      => _deleteSync(recursive: recursive);
+
+
+  /**
+   * Start watch the [FileSystemEntity] for changes.
+   *
+   * The implementation uses platform-depending event-based APIs for receiving
+   * file-system notifixations, thus behvaiour depends on the platform.
+   *
+   *   * `Windows`: Uses `ReadDirectoryChangesW`. The implementation supports
+   *     only watching dirctories but supports recursive watching.
+   *   * `Linux`: Uses `inotify`. The implementation supports watching both
+   *     files and dirctories, but doesn't support recursive watching.
+   *   * `Mac OS`: Uses `FSEvents`. The implementation supports watching both
+   *     files and dirctories, and also recursive watching. Note that FSEvents
+   *     always use recursion internally, so when disabled, some events are
+   *     ignored.
+   *
+   * The system will start listen for events once the returned [Stream] is
+   * being listened to, not when the call to [watch] is issued. Note that the
+   * returned [Stream] is endless. To stop the [Stream], simply cancel the
+   * subscription.
+   */
+  Stream<FileSystemEvent> watch({int events: FileSystemEvent.ALL,
+                                 bool recursive: false})
+     => new _FileSystemWatcher(_trimTrailingPathSeparators(path),
+                               events,
+                               recursive).stream;
+
+  Future<FileSystemEntity> _delete({recursive: false});
+  void _deleteSync({recursive: false});
+
+  /**
+   * Synchronously checks whether two paths refer to the same object in the
+   * file system. Returns a [:Future<bool>:] that completes with the result.
+   *
+   * Comparing a link to its target returns false, as does comparing two links
+   * that point to the same target.  To check the target of a link, use
+   * Link.target explicitly to fetch it.  Directory links appearing
+   * inside a path are followed, though, to find the file system object.
+   *
+   * Completes the returned Future with an error if one of the paths points
+   * to an object that does not exist.
+   */
+  static Future<bool> identical(String path1, String path2) {
+    // Get a new file service port for each request.  We could also cache one.
+    var service = _FileUtils._newServicePort();
+    List request = new List(3);
+    request[0] = _IDENTICAL_REQUEST;
+    request[1] = path1;
+    request[2] = path2;
+    return service.call(request).then((response) {
+      if (_isErrorResponse(response)) {
+        throw _exceptionFromResponse(response,
+            "Error in FileSystemEntity.identical($path1, $path2)", "");
+      }
+      return response;
+    });
+  }
+
+
+  /**
+   * Synchronously checks whether two paths refer to the same object in the
+   * file system.
+   *
+   * Comparing a link to its target returns false, as does comparing two links
+   * that point to the same target.  To check the target of a link, use
+   * Link.target explicitly to fetch it.  Directory links appearing
+   * inside a path are followed, though, to find the file system object.
+   *
+   * Throws an error if one of the paths points to an object that does not
+   * exist.
+   */
+  static bool identicalSync(String path1, String path2) {
+    var result = _identical(path1, path2);
+    _throwIfError(result, 'Error in FileSystemEntity.identicalSync');
+    return result;
+  }
+
+  /**
+   * Test if [watch] is supported on the current system.
+   *
+   * Mac OS 10.6 and below is not supported.
+   */
+  static bool get isWatchSupported => _FileSystemWatcher.isSupported;
 
   /**
    * Finds the type of file system object that a path points to. Returns
@@ -348,7 +400,6 @@
   static FileSystemEntityType typeSync(String path, {bool followLinks: true})
       => FileSystemEntityType._lookup(_getTypeSync(path, followLinks));
 
-
   /**
    * Checks if type(path, followLinks: false) returns
    * FileSystemEntityType.LINK.
@@ -389,12 +440,150 @@
   static bool isDirectorySync(String path) =>
       (_getTypeSync(path, true) == FileSystemEntityType.DIRECTORY._type);
 
+  external static _getType(String path, bool followLinks);
+  external static _identical(String path1, String path2);
 
-  static _throwIfError(Object result, String msg) {
+  static int _getTypeSync(String path, bool followLinks) {
+    var result = _getType(path, followLinks);
+    _throwIfError(result, 'Error getting type of FileSystemEntity');
+    return result;
+  }
+
+  static Future<int> _getTypeAsync(String path, bool followLinks) {
+    // Get a new file service port for each request.  We could also cache one.
+    var service = _FileUtils._newServicePort();
+    List request = new List(3);
+    request[0] = _TYPE_REQUEST;
+    request[1] = path;
+    request[2] = followLinks;
+    return service.call(request).then((response) {
+      if (_isErrorResponse(response)) {
+        throw _exceptionFromResponse(response, "Error getting type", path);
+      }
+      return response;
+    });
+  }
+
+  static _throwIfError(Object result, String msg, [String path]) {
     if (result is OSError) {
-      throw new FileException(msg, result);
+      throw new FileException(msg, path, result);
     } else if (result is ArgumentError) {
       throw result;
     }
   }
+
+  static String _trimTrailingPathSeparators(String path) {
+    // Don't handle argument errors here.
+    if (path is! String) return path;
+    if (Platform.operatingSystem == 'windows') {
+      while (path.length > 1 &&
+             (path.endsWith(Platform.pathSeparator) ||
+              path.endsWith('/'))) {
+        path = path.substring(0, path.length - 1);
+      }
+    } else {
+      while (path.length > 1 && path.endsWith(Platform.pathSeparator)) {
+        path = path.substring(0, path.length - 1);
+      }
+    }
+    return path;
+  }
+}
+
+
+/**
+ * Base event class emitted by FileSystemWatcher.
+ */
+class FileSystemEvent {
+  static const int CREATE = 1 << 0;
+  static const int MODIFY = 1 << 1;
+  static const int DELETE = 1 << 2;
+  static const int MOVE = 1 << 3;
+  static const int ALL = CREATE | MODIFY | DELETE | MOVE;
+
+  static const int _MODIFY_ATTRIBUTES = 1 << 4;
+
+  /**
+   * The type of event. See [FileSystemEvent] for a list of events.
+   */
+  final int type;
+
+  /**
+   * The path that triggered the event. Depending on the platform and the
+   * FileSystemEntity, the path may be relative.
+   */
+  final String path;
+
+  FileSystemEvent._(this.type, this.path);
+}
+
+
+/**
+ * File system event for newly created file system objects.
+ */
+class FileSystemCreateEvent extends FileSystemEvent {
+  FileSystemCreateEvent._(path)
+      : super._(FileSystemEvent.CREATE, path);
+
+  String toString() => "FileSystemCreateEvent('$path')";
+}
+
+
+/**
+ * File system event for modifications of file system objects.
+ */
+class FileSystemModifyEvent extends FileSystemEvent {
+  /**
+   * If the content was changed and not only the attributes, [contentChanged]
+   * is `true`.
+   */
+  final bool contentChanged;
+
+  FileSystemModifyEvent._(path, this.contentChanged)
+      : super._(FileSystemEvent.MODIFY, path);
+
+  String toString() =>
+      "FileSystemModifyEvent('$path', contentChanged=$contentChanged)";
+}
+
+
+/**
+ * File system event for deletion of file system objects.
+ */
+class FileSystemDeleteEvent extends FileSystemEvent {
+  FileSystemDeleteEvent._(path)
+      : super._(FileSystemEvent.DELETE, path);
+
+  String toString() => "FileSystemDeleteEvent('$path')";
+}
+
+
+/**
+ * File system event for moving of file system objects.
+ */
+class FileSystemMoveEvent extends FileSystemEvent {
+  /**
+   * If the underlaying implementation is able to identify the destination of
+   * the moved file, [destination] will be set. Otherwise, it will be `null`.
+   */
+  final String destination;
+
+  FileSystemMoveEvent._(path, this.destination)
+      : super._(FileSystemEvent.MOVE, path);
+
+  String toString() {
+    var buffer = new StringBuffer();
+    buffer.write("FileSystemMoveEvent('$path'");
+    if (destination != null) buffer.write(", '$destination'");
+    buffer.write(')');
+    return buffer.toString();
+  }
+}
+
+
+abstract class _FileSystemWatcher {
+  external factory _FileSystemWatcher(String path, int events, bool recursive);
+  external static bool get isSupported;
+
+  Stream<FileSystemEvent> get stream;
 }
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index a7cac9f..c5897ef 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -570,6 +570,9 @@
     }
   }
 
+  bool _ignoreError(error)
+    => error is SocketException && _outbound is HttpResponse;
+
   _ensureController() {
     if (_controller != null) return;
     _controller = new StreamController(sync: true,
@@ -585,8 +588,7 @@
               },
               onError: (error) {
                 _socketError = true;
-                if (error is SocketException &&
-                    _outbound is HttpResponse) {
+                if (_ignoreError(error)) {
                   _cancel();
                   _done();
                   _closeCompleter.complete(_outbound);
@@ -637,7 +639,9 @@
   Future close() {
     Future closeOutbound() {
       if (_socketError) return new Future.value(_outbound);
-      return _outbound._close().then((_) => _outbound);
+      return _outbound._close()
+          .catchError((_) {}, test: _ignoreError)
+          .then((_) => _outbound);
     }
     if (_controller == null) return closeOutbound();
     _controller.close();
diff --git a/sdk/lib/io/link.dart b/sdk/lib/io/link.dart
index d774fa2..3df3fc9 100644
--- a/sdk/lib/io/link.dart
+++ b/sdk/lib/io/link.dart
@@ -65,23 +65,6 @@
   Future<Link> update(String target);
 
   /**
-   * Deletes the link. Returns a [:Future<Link>:] that completes with
-   * the link when it has been deleted. This does not delete, or otherwise
-   * affect, the target of the link. It also works on broken links, but if
-   * the link does not exist or is not actually a link, it completes the
-   * future with a LinkException.
-   */
-  Future<Link> delete();
-
-  /**
-   * Synchronously deletes the link. This does not delete, or otherwise
-   * affect, the target of the link.  It also works on broken links, but if
-   * the link does not exist or is not actually a link, it throws a
-   * LinkException.
-   */
-  void deleteSync();
-
-  /**
    * Renames this link. Returns a `Future<Link>` that completes
    * with a [Link] instance for the renamed link.
    *
@@ -213,7 +196,10 @@
     return delete().then((_) => create(target));
   }
 
-  Future<Link> delete() {
+  Future<Link> _delete({bool recursive: false}) {
+    if (recursive) {
+      return new Directory(path).delete(recursive: true).then((_) => this);
+    }
     _ensureFileService();
     List request = new List(2);
     request[0] = _DELETE_LINK_REQUEST;
@@ -226,8 +212,11 @@
     });
   }
 
-  void deleteSync() {
-    var result = _File._deleteLink(path);
+  void _deleteSync({bool recursive: false}) {
+    if (recursive) {
+      return new Directory(path).deleteSync(recursive: true);
+    }
+    var result = _File._deleteLinkNative(path);
     throwIfError(result, "Cannot delete link", path);
   }
 
diff --git a/sdk/lib/svg/dart2js/svg_dart2js.dart b/sdk/lib/svg/dart2js/svg_dart2js.dart
index 2222b2e..75f2c18 100644
--- a/sdk/lib/svg/dart2js/svg_dart2js.dart
+++ b/sdk/lib/svg/dart2js/svg_dart2js.dart
@@ -1,3 +1,11 @@
+/**
+ * Scalable Vector Graphics:
+ * Two-dimensional vector graphics with support for events and animation.
+ *
+ * For details about the features and syntax of SVG, a W3C standard,
+ * refer to the
+ * [Scalable Vector Graphics Specification](http://www.w3.org/TR/SVG/).
+ */
 library dart.dom.svg;
 
 import 'dart:async';
diff --git a/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart b/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart
index 1b1d0db..3a42513 100644
--- a/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart
+++ b/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart
@@ -1074,16 +1074,27 @@
 @Experimental() // untriaged
 class PeriodicWave extends Interceptor native "PeriodicWave" {
 }
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
+// 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.
 
 
+@DocsEditable()
 @DomName('ScriptProcessorNode')
 // https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#ScriptProcessorNode
 @Experimental()
 class ScriptProcessorNode extends AudioNode native "ScriptProcessorNode,JavaScriptAudioNode" {
-  Stream<AudioProcessingEvent> _eventStream;
+  // To suppress missing implicit constructor warnings.
+  factory ScriptProcessorNode._() { throw new UnsupportedError("Not supported"); }
+
+  @DomName('ScriptProcessorNode.audioprocessEvent')
+  @DocsEditable()
+  @Experimental() // untriaged
+  static const EventStreamProvider<AudioProcessingEvent> audioProcessEvent = const EventStreamProvider<AudioProcessingEvent>('audioprocess');
+
+  @DomName('ScriptProcessorNode.bufferSize')
+  @DocsEditable()
+  final int bufferSize;
 
   /**
    * Get a Stream that fires events when AudioProcessingEvents occur.
@@ -1092,36 +1103,10 @@
    * the soft-real-time properties which which these events are fired and can
    * be processed.
    */
-  Stream<AudioProcessingEvent> get onAudioProcess {
-    if (_eventStream == null) {
-      var controller = new StreamController(sync: true);
-      var callback = (audioData) {
-          if (controller.hasListener) {
-            // This stream is a strange combination of broadcast and single
-            // subscriber streams. We only allow one listener, but if there is
-            // no listener, we don't queue up events, we just drop them on the
-            // floor.
-            controller.add(audioData);
-          }
-        };
-      _setEventListener(callback);
-      _eventStream = controller.stream;
-    }
-    return _eventStream;
-  }
-
-    _setEventListener(callback) {
-      JS('void', '#.onaudioprocess = #', this,
-          convertDartClosureToJS(callback, 1));
-    }
-
-  // To suppress missing implicit constructor warnings.
-  factory ScriptProcessorNode._() { throw new UnsupportedError("Not supported"); }
-
-  @DomName('ScriptProcessorNode.bufferSize')
+  @DomName('ScriptProcessorNode.onaudioprocess')
   @DocsEditable()
-  final int bufferSize;
-
+  @Experimental() // untriaged
+  Stream<AudioProcessingEvent> get onAudioProcess => audioProcessEvent.forTarget(this);
 }
 // 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/sdk/lib/web_audio/dartium/web_audio_dartium.dart b/sdk/lib/web_audio/dartium/web_audio_dartium.dart
index f925e65..b6c1003 100644
--- a/sdk/lib/web_audio/dartium/web_audio_dartium.dart
+++ b/sdk/lib/web_audio/dartium/web_audio_dartium.dart
@@ -1317,46 +1317,26 @@
 class PeriodicWave extends NativeFieldWrapperClass1 {
 
 }
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
+// 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.
 
+// WARNING: Do not edit - generated code.
 
+
+@DocsEditable()
 @DomName('ScriptProcessorNode')
 // https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#ScriptProcessorNode
 @Experimental()
 class ScriptProcessorNode extends AudioNode {
-  Stream<AudioProcessingEvent> _eventStream;
-
-  /**
-   * Get a Stream that fires events when AudioProcessingEvents occur.
-   * This particular stream is special in that it only allows one listener to a
-   * given stream. Converting the returned Stream [asBroadcast] will likely ruin
-   * the soft-real-time properties which which these events are fired and can
-   * be processed.
-   */
-  Stream<AudioProcessingEvent> get onAudioProcess {
-    if (_eventStream == null) {
-      var controller = new StreamController(sync: true);
-      var callback = (audioData) {
-          if (controller.hasListener) {
-            // This stream is a strange combination of broadcast and single
-            // subscriber streams. We only allow one listener, but if there is
-            // no listener, we don't queue up events, we just drop them on the
-            // floor.
-            controller.add(audioData);
-          }
-        };
-      _setEventListener(callback);
-      _eventStream = controller.stream;
-    }
-    return _eventStream;
-  }
-
-
   // To suppress missing implicit constructor warnings.
   factory ScriptProcessorNode._() { throw new UnsupportedError("Not supported"); }
 
+  @DomName('ScriptProcessorNode.audioprocessEvent')
+  @DocsEditable()
+  @Experimental() // untriaged
+  static const EventStreamProvider<AudioProcessingEvent> audioProcessEvent = const EventStreamProvider<AudioProcessingEvent>('audioprocess');
+
   @DomName('ScriptProcessorNode.bufferSize')
   @DocsEditable()
   int get bufferSize native "ScriptProcessorNode_bufferSize_Getter";
@@ -1366,6 +1346,18 @@
   @Experimental() // non-standard
   void _setEventListener(EventListener eventListener) native "ScriptProcessorNode__setEventListener_Callback";
 
+  /**
+   * Get a Stream that fires events when AudioProcessingEvents occur.
+   * This particular stream is special in that it only allows one listener to a
+   * given stream. Converting the returned Stream [asBroadcast] will likely ruin
+   * the soft-real-time properties which which these events are fired and can
+   * be processed.
+   */
+  @DomName('ScriptProcessorNode.onaudioprocess')
+  @DocsEditable()
+  @Experimental() // untriaged
+  Stream<AudioProcessingEvent> get onAudioProcess => audioProcessEvent.forTarget(this);
+
 }
 // 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/tests/co19/co19-analyzer.status b/tests/co19/co19-analyzer.status
index 6984c32..bb87b73 100644
--- a/tests/co19/co19-analyzer.status
+++ b/tests/co19/co19-analyzer.status
@@ -57,29 +57,6 @@
 Language/05_Variables/05_Variables_A13_t01: fail, OK
 Language/07_Classes/07_Classes_A02_t11: fail, OK
 
-# co19 issue #429, It is a compile-time error if a formal parameter is declared as a constant variable
-Language/07_Classes/6_Constructors/1_Generative_Constructors_A15_t07: fail, OK
-
-# co19 issue #430, return not subtype from factory
-Language/07_Classes/6_Constructors/2_Factories_A06_t01: fail, OK
-Language/07_Classes/6_Constructors/2_Factories_A06_t02: fail, OK
-Language/07_Classes/6_Constructors/2_Factories_A06_t04: fail, OK
-
-# co19 issue #431, it is OK to use 'double' argument for const constructor
-Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t01: fail, OK
-
-# co19 issue #428, number literals with a + prefix
-LibTest/core/double/ceil_A01_t05: fail, OK
-LibTest/core/double/floor_A01_t05: fail, OK
-
-# co19 issue 459, FallThroughError is no longer const
-LibTest/core/FallThroughError/FallThroughError_A01_t01: Fail, OK
-
-# co19 issue #437, annotation should be constant _variable_ or constant constructor invocation
-Language/07_Classes/07_Classes_A01_t20: fail, OK
-Language/07_Classes/07_Classes_A02_t34: fail, OK
-Language/07_Classes/07_Classes_A03_t10: fail, OK
-
 # co19 issue #464, not initialized final instance variable is warning, not error
 Language/07_Classes/6_Constructors/1_Generative_Constructors_A09_t01: fail
 
@@ -112,31 +89,10 @@
 Language/07_Classes/3_Setters_A08_t03: fail, OK
 Language/07_Classes/3_Setters_A08_t04: fail, OK
 
-# co19 issue #516, it is a compile-time error if a class has both a getter and a method with the same name.
-Language/07_Classes/3_Setters_A08_t05: fail, OK
-
 # co19 issue #438, Static variables are initialized lazily, need not be constants
 Language/12_Expressions/01_Constants_A16_t01: fail, OK
 Language/12_Expressions/01_Constants_A16_t02: fail, OK
 
-# co19 issue #517, +5 is not a valid expression
-Language/12_Expressions/01_Constants_A01_t01: fail, OK
-Language/12_Expressions/03_Numbers_A01_t01: fail, OK
-Language/12_Expressions/03_Numbers_A01_t02: fail, OK
-Language/12_Expressions/03_Numbers_A01_t03: fail, OK
-Language/12_Expressions/03_Numbers_A01_t04: fail, OK
-Language/12_Expressions/03_Numbers_A01_t08: fail, OK
-Language/12_Expressions/03_Numbers_A01_t10: fail, OK
-Language/13_Statements/02_Expression_Statements_A01_t06: fail, OK
-
-# co19 issue #518, It is a compile-time error if evaluation of a compile-time constant would raise an exception
-Language/12_Expressions/01_Constants_A11_t01: fail, OK
-Language/12_Expressions/01_Constants_A12_t01: fail, OK
-Language/12_Expressions/01_Constants_A13_t06: fail, OK
-
-# co19 issue #519, ++5 is not assignable
-Language/12_Expressions/07_Maps_A01_t01: fail, OK
-
 # co19 issue #420, "throw" requires expression, "rethrow" should be used instead
 Language/12_Expressions/08_Throw_A05_t01: fail, OK
 Language/12_Expressions/08_Throw_A05_t02: fail, OK
@@ -145,53 +101,18 @@
 # co19 issue #454 (wrongly closed)
 Language/12_Expressions/12_Instance_Creation/1_New_A01_t04: fail, OK
 
-# co19 issue #521, attempt to create instance of not a class
-Language/12_Expressions/12_Instance_Creation/1_New_A02_t01: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A02_t02: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A02_t03: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A02_t05: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A02_t07: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t03: fail, OK
-
-# co19 issue #523, new malbound type
-Language/12_Expressions/12_Instance_Creation/1_New_A05_t01: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A05_t02: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A05_t03: fail, OK
-
-# co19 issue #524, new abstract class
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t01: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t02: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t12: fail, OK
-
-# co19 issue #526, use undefined constructor
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t04: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t05: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t06: fail, OK
-
-# co19 issue #527, not enough or extra positional parameters; no such named paramater
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t07: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t08: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t09: fail, OK
-
 # co19 issue #528, Const: wrong number of type arguments
 Language/12_Expressions/12_Instance_Creation_A01_t02: fail, OK
 Language/12_Expressions/12_Instance_Creation_A01_t05: fail, OK
 Language/12_Expressions/12_Instance_Creation_A01_t06: fail, OK
 
-# co19 issue #529, const instance creation with invalid type arguments
-Language/12_Expressions/12_Instance_Creation_A01_t08: fail, OK
-
 # co19 issue #388 (wrongly closed), StringBuffer methods changed
-Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t05: fail, OK
 Language/12_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: fail, OK
 
 # co19 issue #433 (wrongly closed), missing @static-warning annotation
 Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t01: fail, OK
 Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t07: fail, OK
 
-# co19 issue #530, garbage
-Language/12_Expressions/32_Type_Test_A04_t02: fail, OK
-
 # co19 issue #541: tests contain unqualified reference to static members defined in superclass
 Language/12_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t07: fail, OK
 Language/12_Expressions/30_Identifier_Reference_A14_t03: fail, OK
@@ -201,6 +122,9 @@
 
 LibTest/core/NoSuchMethodError/NoSuchMethodError_A01_t01: Fail, OK # co19 issue 556
 
+LibTest/async/Stream/listen_A04_t01: Fail, OK # co19 issue 557
+LibTest/typed_data/ByteData/buffer_A01_t02: Fail, OK # co19 issue 557
+
 Language/13_Statements/11_Return_A07_t01: fail # co19-roll r546: Please triage this failure
 Language/13_Statements/11_Try_A02_t03: fail # co19-roll r546: Please triage this failure
 Language/13_Statements/11_Try_A03_t03: fail # co19-roll r546: Please triage this failure
@@ -208,14 +132,12 @@
 Language/14_Libraries_and_Scripts/1_Imports_A03_t27: fail # co19-roll r546: Please triage this failure
 Language/14_Libraries_and_Scripts/1_Imports_A03_t47: fail # co19-roll r546: Please triage this failure
 Language/14_Libraries_and_Scripts/1_Imports_A03_t67: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/2_Exports_A01_t17: fail # co19-roll r546: Please triage this failure
 Language/14_Libraries_and_Scripts/2_Exports_A05_t01: fail # co19-roll r546: Please triage this failure
 Language/14_Libraries_and_Scripts/5_URIs_A01_t24: fail # co19-roll r546: Please triage this failure
 Language/14_Libraries_and_Scripts/5_URIs_A01_t25: fail # co19-roll r546: Please triage this failure
 Language/15_Types/6_Type_dynamic_A03_t01: fail # co19-roll r546: Please triage this failure
 Language/15_Types/6_Type_dynamic_A04_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/EventTransformStream/asBroadcastStream_A01_t02: fail # co19-roll r546: Please triage this failure
-LibTest/async/EventTransformStream/distinct_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/EventTransformStream/distinct_A01_t02: fail # co19-roll r546: Please triage this failure
 LibTest/async/EventTransformStream/drain_A02_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/EventTransformStream/drain_A02_t02: fail # co19-roll r546: Please triage this failure
@@ -224,9 +146,6 @@
 LibTest/async/EventTransformStream/first_A02_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/EventTransformStream/handleError_A03_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/EventTransformStream/listen_A03_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/EventTransformStream/listen_A04_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/EventTransformStream/transform_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/EventTransformStream/where_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/Future/asStream_A01_t02: pass # co19-roll r546: Please triage this failure
 LibTest/async/Future/asStream_A02_t01: pass # co19-roll r546: Please triage this failure
 LibTest/async/Future/whenComplete_A03_t01: pass # co19-roll r546: Please triage this failure
@@ -254,39 +173,24 @@
 LibTest/async/Stream/isBroadcast_A01_t02: fail # co19-roll r546: Please triage this failure
 LibTest/async/StreamIterator/cancel_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/Stream/listen_A03_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/Stream/listen_A04_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/Stream/Stream_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/Stream/Stream.fromFuture_A02_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/Stream/Stream.fromFuture_A02_t02: fail # co19-roll r546: Please triage this failure
 LibTest/async/Stream/Stream.fromIterable_A01_t02: fail # co19-roll r546: Please triage this failure
-LibTest/async/Stream/Stream.periodic_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/Stream/transform_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/Stream/where_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/Timer/cancel_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/Timer/Timer.periodic_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/Timer/Timer.periodic_A02_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/DateTime/compareTo_A02_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/DateTime/subtract_A02_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/double/truncate_A01_t01: fail # co19-roll r559: Please triage this failure
-LibTest/core/double/truncate_A01_t05: fail # co19-roll r559: Please triage this failure
 LibTest/core/Duration/operator_div_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/Duration/operator_eq_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/Duration/operator_gt_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/Duration/operator_gte_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/Duration/operator_lt_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/Duration/operator_lte_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/Duration/operator_minus_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/Duration/operator_mult_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/Duration/operator_plus_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/FallThroughError/toString_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/int/ceilToDouble_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/int/floorToDouble_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/int/roundToDouble_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/int/truncateToDouble_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/asMap_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/every_A03_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/forEach_A01_t02: fail # co19-roll r546: Please triage this failure
-LibTest/core/List/join_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/lastWhere_A03_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/List_A01_t03: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/List.filled_A01_t01: fail # co19-roll r546: Please triage this failure
@@ -295,7 +199,6 @@
 LibTest/core/List/List.generate_A01_t02: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/List.generate_A01_t03: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/map_A02_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/List/removeAt_A02_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/replaceRange_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/replaceRange_A01_t02: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/skipWhile_A02_t01: fail # co19-roll r546: Please triage this failure
@@ -312,4 +215,3 @@
 LibTest/isolate/IsolateStream/contains_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/isolate/IsolateStream/contains_A02_t01: fail # co19-roll r546: Please triage this failure
 LibTest/isolate/IsolateStream/isBroadcast_A01_t02: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/SendPort/send_A02_t02: fail # co19-roll r546: Please triage this failure
diff --git a/tests/co19/co19-analyzer2.status b/tests/co19/co19-analyzer2.status
index f80c456..7b4a78b 100644
--- a/tests/co19/co19-analyzer2.status
+++ b/tests/co19/co19-analyzer2.status
@@ -41,8 +41,6 @@
 LibTest/core/String/concat_A01_t01: fail, OK
 LibTest/core/String/concat_A02_t01: fail, OK
 LibTest/core/String/hashCode_A01_t01: fail, OK
-LibTest/core/Set/isSubsetOf_A01_t01: fail, OK
-LibTest/core/Set/isSubsetOf_A01_t02: fail, OK
 
 # co19 issue #424, Uninitialized finals are warnings not errors
 Language/05_Variables/05_Variables_A07_t05: fail, OK
@@ -57,29 +55,6 @@
 Language/05_Variables/05_Variables_A13_t01: fail, OK
 Language/07_Classes/07_Classes_A02_t11: fail, OK
 
-# co19 issue #429, It is a compile-time error if a formal parameter is declared as a constant variable
-Language/07_Classes/6_Constructors/1_Generative_Constructors_A15_t07: fail, OK
-
-# co19 issue #430, return not subtype from factory
-Language/07_Classes/6_Constructors/2_Factories_A06_t01: fail, OK
-Language/07_Classes/6_Constructors/2_Factories_A06_t02: fail, OK
-Language/07_Classes/6_Constructors/2_Factories_A06_t04: fail, OK
-
-# co19 issue #431, it is OK to use 'double' argument for const constructor
-Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t01: fail, OK
-
-# co19 issue #428, number literals with a + prefix
-LibTest/core/double/ceil_A01_t05: fail, OK
-LibTest/core/double/floor_A01_t05: fail, OK
-
-# co19 issue 459, FallThroughError is no longer const
-LibTest/core/FallThroughError/FallThroughError_A01_t01: Fail, OK
-
-# co19 issue #437, annotation should be constant _variable_ or constant constructor invocation
-Language/07_Classes/07_Classes_A01_t20: fail, OK
-Language/07_Classes/07_Classes_A02_t34: fail, OK
-Language/07_Classes/07_Classes_A03_t10: fail, OK
-
 # co19 issue #464, not initialized final instance variable is warning, not error
 Language/07_Classes/6_Constructors/1_Generative_Constructors_A09_t01: fail
 
@@ -89,7 +64,6 @@
 # co19 issue #448, Collection was removed
 LibTest/collection/Queue/Queue.from_A01_t01: fail, OK
 LibTest/collection/Queue/Queue.from_A01_t02: fail, OK
-LibTest/core/Set/intersection_A01_t02: fail, OK
 
 # co19 issue 452, more method in Iterable
 LibTest/core/Set/Set.from_A01_t02: fail, OK
@@ -109,89 +83,27 @@
 # co19 issue #515, it is a compile-time error if there is more than one entity with the same name declared in the same scope
 Language/07_Classes/3_Setters_A08_t01: fail, OK
 Language/07_Classes/3_Setters_A08_t02: fail, OK
-Language/07_Classes/3_Setters_A08_t03: fail, OK
 Language/07_Classes/3_Setters_A08_t04: fail, OK
 
-# co19 issue #516, it is a compile-time error if a class has both a getter and a method with the same name.
-Language/07_Classes/3_Setters_A08_t05: fail, OK
-
 # co19 issue #438, Static variables are initialized lazily, need not be constants
 Language/12_Expressions/01_Constants_A16_t01: fail, OK
 Language/12_Expressions/01_Constants_A16_t02: fail, OK
 
-# co19 issue #517, +5 is not a valid expression
-Language/12_Expressions/01_Constants_A01_t01: fail, OK
-Language/12_Expressions/03_Numbers_A01_t01: fail, OK
-Language/12_Expressions/03_Numbers_A01_t02: fail, OK
-Language/12_Expressions/03_Numbers_A01_t03: fail, OK
-Language/12_Expressions/03_Numbers_A01_t04: fail, OK
-Language/12_Expressions/03_Numbers_A01_t08: fail, OK
-Language/12_Expressions/03_Numbers_A01_t10: fail, OK
-Language/13_Statements/02_Expression_Statements_A01_t06: fail, OK
-
-# co19 issue #518, It is a compile-time error if evaluation of a compile-time constant would raise an exception
-Language/12_Expressions/01_Constants_A11_t01: fail, OK
-Language/12_Expressions/01_Constants_A12_t01: fail, OK
-Language/12_Expressions/01_Constants_A13_t06: fail, OK
-
-# co19 issue #519, ++5 is not assignable
-Language/12_Expressions/07_Maps_A01_t01: fail, OK
-
-# co19 issue #420, "throw" requires expression, "rethrow" should be used instead
-Language/12_Expressions/08_Throw_A05_t01: fail, OK
-Language/12_Expressions/08_Throw_A05_t02: fail, OK
-Language/12_Expressions/08_Throw_A05_t03: fail, OK
-
 # co19 issue #454 (wrongly closed)
 Language/12_Expressions/12_Instance_Creation/1_New_A01_t04: fail, OK
 
-# co19 issue #521, attempt to create instance of not a class
-Language/12_Expressions/12_Instance_Creation/1_New_A02_t01: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A02_t02: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A02_t03: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A02_t05: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A02_t07: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t03: fail, OK
-
-# co19 issue #523, new malbound type
-Language/12_Expressions/12_Instance_Creation/1_New_A05_t01: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A05_t02: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A05_t03: fail, OK
-
-# co19 issue #524, new abstract class
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t01: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t02: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t12: fail, OK
-
-# co19 issue #526, use undefined constructor
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t04: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t05: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t06: fail, OK
-
-# co19 issue #527, not enough or extra positional parameters; no such named paramater
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t07: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t08: fail, OK
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t09: fail, OK
-
 # co19 issue #528, Const: wrong number of type arguments
 Language/12_Expressions/12_Instance_Creation_A01_t02: fail, OK
 Language/12_Expressions/12_Instance_Creation_A01_t05: fail, OK
 Language/12_Expressions/12_Instance_Creation_A01_t06: fail, OK
 
-# co19 issue #529, const instance creation with invalid type arguments
-Language/12_Expressions/12_Instance_Creation_A01_t08: fail, OK
-
 # co19 issue #388 (wrongly closed), StringBuffer methods changed
-Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t05: fail, OK
 Language/12_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: fail, OK
 
 # co19 issue #433 (wrongly closed), missing @static-warning annotation
 Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t01: fail, OK
 Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t07: fail, OK
 
-# co19 issue #530, garbage
-Language/12_Expressions/32_Type_Test_A04_t02: fail, OK
-
 # co19 issue #541: tests contain unqualified reference to static members defined in superclass
 Language/12_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t07: fail, OK
 Language/12_Expressions/30_Identifier_Reference_A14_t03: fail, OK
@@ -201,6 +113,9 @@
 
 LibTest/core/NoSuchMethodError/NoSuchMethodError_A01_t01: Fail, OK # co19 issue 556
 
+LibTest/async/Stream/listen_A04_t01: Fail, OK # co19 issue 557
+LibTest/typed_data/ByteData/buffer_A01_t02: Fail, OK # co19 issue 557
+
 Language/13_Statements/11_Return_A07_t01: fail # co19-roll r546: Please triage this failure
 Language/13_Statements/11_Try_A02_t03: fail # co19-roll r546: Please triage this failure
 Language/13_Statements/11_Try_A03_t03: fail # co19-roll r546: Please triage this failure
@@ -208,14 +123,12 @@
 Language/14_Libraries_and_Scripts/1_Imports_A03_t27: fail # co19-roll r546: Please triage this failure
 Language/14_Libraries_and_Scripts/1_Imports_A03_t47: fail # co19-roll r546: Please triage this failure
 Language/14_Libraries_and_Scripts/1_Imports_A03_t67: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/2_Exports_A01_t17: fail # co19-roll r546: Please triage this failure
 Language/14_Libraries_and_Scripts/2_Exports_A05_t01: fail # co19-roll r546: Please triage this failure
 Language/14_Libraries_and_Scripts/5_URIs_A01_t24: fail # co19-roll r546: Please triage this failure
 Language/14_Libraries_and_Scripts/5_URIs_A01_t25: fail # co19-roll r546: Please triage this failure
 Language/15_Types/6_Type_dynamic_A03_t01: fail # co19-roll r546: Please triage this failure
 Language/15_Types/6_Type_dynamic_A04_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/EventTransformStream/asBroadcastStream_A01_t02: fail # co19-roll r546: Please triage this failure
-LibTest/async/EventTransformStream/distinct_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/EventTransformStream/distinct_A01_t02: fail # co19-roll r546: Please triage this failure
 LibTest/async/EventTransformStream/drain_A02_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/EventTransformStream/drain_A02_t02: fail # co19-roll r546: Please triage this failure
@@ -224,9 +137,6 @@
 LibTest/async/EventTransformStream/first_A02_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/EventTransformStream/handleError_A03_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/EventTransformStream/listen_A03_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/EventTransformStream/listen_A04_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/EventTransformStream/transform_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/EventTransformStream/where_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/Future/asStream_A01_t02: pass # co19-roll r546: Please triage this failure
 LibTest/async/Future/asStream_A02_t01: pass # co19-roll r546: Please triage this failure
 LibTest/async/Future/whenComplete_A03_t01: pass # co19-roll r546: Please triage this failure
@@ -254,39 +164,23 @@
 LibTest/async/Stream/isBroadcast_A01_t02: fail # co19-roll r546: Please triage this failure
 LibTest/async/StreamIterator/cancel_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/Stream/listen_A03_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/Stream/listen_A04_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/Stream/Stream_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/Stream/Stream.fromFuture_A02_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/Stream/Stream.fromFuture_A02_t02: fail # co19-roll r546: Please triage this failure
 LibTest/async/Stream/Stream.fromIterable_A01_t02: fail # co19-roll r546: Please triage this failure
-LibTest/async/Stream/Stream.periodic_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/Stream/transform_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/Stream/where_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/async/Timer/cancel_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/Timer/Timer.periodic_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/Timer/Timer.periodic_A02_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/DateTime/compareTo_A02_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/DateTime/subtract_A02_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/double/truncate_A01_t01: fail # co19-roll r559: Please triage this failure
-LibTest/core/double/truncate_A01_t05: fail # co19-roll r559: Please triage this failure
 LibTest/core/Duration/operator_div_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/Duration/operator_eq_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/Duration/operator_gt_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/Duration/operator_gte_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/Duration/operator_lt_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/Duration/operator_lte_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/Duration/operator_minus_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/Duration/operator_mult_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/Duration/operator_plus_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/FallThroughError/toString_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/int/ceilToDouble_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/int/floorToDouble_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/int/roundToDouble_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/int/truncateToDouble_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/asMap_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/every_A03_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/forEach_A01_t02: fail # co19-roll r546: Please triage this failure
-LibTest/core/List/join_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/lastWhere_A03_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/List_A01_t03: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/List.filled_A01_t01: fail # co19-roll r546: Please triage this failure
@@ -295,7 +189,6 @@
 LibTest/core/List/List.generate_A01_t02: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/List.generate_A01_t03: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/map_A02_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/List/removeAt_A02_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/replaceRange_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/replaceRange_A01_t02: fail # co19-roll r546: Please triage this failure
 LibTest/core/List/skipWhile_A02_t01: fail # co19-roll r546: Please triage this failure
@@ -311,5 +204,4 @@
 LibTest/isolate/IsolateStream/asBroadcastStream_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/isolate/IsolateStream/contains_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/isolate/IsolateStream/contains_A02_t01: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/IsolateStream/isBroadcast_A01_t02: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/SendPort/send_A02_t02: fail # co19-roll r546: Please triage this failure
+LibTest/isolate/IsolateStream/isBroadcast_A01_t02: fail # co19-roll r546: Please triage this failure
\ No newline at end of file
diff --git a/tests/co19/co19-co19.status b/tests/co19/co19-co19.status
index 12b1782..e470bb0 100644
--- a/tests/co19/co19-co19.status
+++ b/tests/co19/co19-co19.status
@@ -8,14 +8,19 @@
 
 ### GENERAL FAILURES ###
 
+[ $runtime == vm || $compiler == dart2dart || $compiler == dart2js ]
+LibTest/typed_data/ByteData/elementSizeInBytes_A01_t01: fail # co19-roll r569: Please triage this failure
+
 [ $runtime == vm || $compiler == dart2js ]
-Language/13_Statements/11_Try_A02_t03: fail # co19 issue 552
-Language/13_Statements/11_Try_A03_t03: fail # co19 issue 552
-Language/13_Statements/11_Try_A04_t03: fail # co19 issue 552
-Language/13_Statements/11_Try_A07_t03: fail # co19 issue 553
+Language/12_Expressions/01_Constants_A16_t01: FAIL, OK # co19 issue 525
+Language/12_Expressions/01_Constants_A16_t02: FAIL, OK # co19 issue 525
+
+Language/13_Statements/11_Try_A02_t03: FAIL, OK # co19 issue 552
+Language/13_Statements/11_Try_A03_t03: FAIL, OK # co19 issue 552
+Language/13_Statements/11_Try_A04_t03: FAIL, OK # co19 issue 552
+Language/13_Statements/11_Try_A07_t03: FAIL, OK # co19 issue 553
 
 Language/07_Classes/6_Constructors_A02_t01: SKIP # co19 issue 415.
-Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t01: FAIL, OK # co19 issue 426
 Language/07_Classes/6_Constructors/1_Generative_Constructors_A04_t15: FAIL, OK # co19 issue 547
 
 LibTest/math/acos_A01_t01: PASS, FAIL, OK # co19 issue 44
@@ -26,8 +31,6 @@
 LibTest/math/max_A01_t03: FAIL, OK # co19 issue 467
 LibTest/math/min_A01_t03: FAIL, OK # co19 issue 467
 LibTest/math/pow_A01_t01: FAIL, OK # co19 issue 44
-LibTest/math/pow_A11_t01: FAIL, OK # co19 issue 512
-LibTest/math/pow_A13_t01: FAIL, OK # co19 issue 507
 LibTest/math/sin_A01_t01: PASS, FAIL, OK # co19 issue 44
 LibTest/math/tan_A01_t01: PASS, FAIL, OK  # co19 issue 44
 
@@ -65,262 +68,6 @@
 LibTest/async/EventTransformStream/elementAt_A03_t01: FAIL # co19 issue 545
 LibTest/async/Stream/elementAt_A03_t01: FAIL # co19 issue 545
 
-LibTest/typed_data/Float32x4/wwww_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wwwx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wwwy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wwwz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wwxw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wwxx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wwxy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wwxz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wwyw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wwyx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wwyy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wwyz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wwzw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wwzx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wwzy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wwzz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wxww_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wxwx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wxwy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wxwz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wxxw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wxxx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wxxy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wxxz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wxyw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wxyx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wxyy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wxyz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wxzw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wxzx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wxzy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wxzz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wyww_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wywx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wywy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wywz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wyxw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wyxx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wyxy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wyxz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wyyw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wyyx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wyyy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wyyz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wyzw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wyzx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wyzy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wyzz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wzww_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wzwx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wzwy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wzwz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wzxw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wzxx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wzxy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wzxz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wzyw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wzyx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wzyy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wzyz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wzzw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wzzx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wzzy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/wzzz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xwww_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xwwx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xwwy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xwwz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xwxw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xwxx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xwxy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xwxz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xwyw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xwyx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xwyy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xwyz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xwzw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xwzx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xwzy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xwzz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xxww_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xxwx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xxwy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xxwz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xxxw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xxxx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xxxy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xxxz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xxyw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xxyx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xxyy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xxyz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xxzw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xxzx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xxzy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xxzz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xyww_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xywx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xywy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xywz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xyxw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xyxx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xyxy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xyxz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xyyw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xyyx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xyyy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xyyz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xyzw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xyzx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xyzy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xyzz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xzww_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xzwx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xzwy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xzwz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xzxw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xzxx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xzxy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xzxz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xzyw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xzyx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xzyy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xzyz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xzzw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xzzx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xzzy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/xzzz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/ywww_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/ywwx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/ywwy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/ywwz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/ywxw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/ywxx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/ywxy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/ywxz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/ywyw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/ywyx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/ywyy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/ywyz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/ywzw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/ywzx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/ywzy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/ywzz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yxww_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yxwx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yxwy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yxwz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yxxw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yxxx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yxxy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yxxz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yxyw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yxyx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yxyy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yxyz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yxzw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yxzx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yxzy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yxzz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yyww_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yywx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yywy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yywz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yyxw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yyxx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yyxy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yyxz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yyyw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yyyx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yyyy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yyyz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yyzw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yyzx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yyzy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yyzz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yzww_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yzwx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yzwy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yzwz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yzxw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yzxx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yzxy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yzxz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yzyw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yzyx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yzyy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yzyz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yzzw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yzzx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yzzy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/yzzz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zwww_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zwwx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zwwy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zwwz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zwxw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zwxx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zwxy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zwxz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zwyw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zwyx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zwyy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zwyz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zwzw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zwzx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zwzy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zwzz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zxww_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zxwx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zxwy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zxwz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zxxw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zxxx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zxxy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zxxz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zxyw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zxyx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zxyy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zxyz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zxzw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zxzx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zxzy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zxzz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zyww_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zywx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zywy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zywz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zyxw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zyxx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zyxy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zyxz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zyyw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zyyx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zyyy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zyyz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zyzw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zyzx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zyzy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zyzz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zzww_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zzwx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zzwy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zzwz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zzxw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zzxx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zzxy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zzxz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zzyw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zzyx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zzyy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zzyz_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zzzw_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zzzx_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zzzy_A01_t01: FAIL, OK # co19 issue 546
-LibTest/typed_data/Float32x4/zzzz_A01_t01: FAIL, OK # co19 issue 546
 LibTest/typed_data/Int8List/Int8List.fromList_A01_t02: Fail # co19-roll r559: Please triage this failure
 
 LibTest/typed_data/Float32List/removeAll_A01_t01: Fail  # co19 issue 548
@@ -348,62 +95,14 @@
 LibTest/typed_data/Uint8List/removeAll_A01_t01: Fail  # co19 issue 548
 LibTest/typed_data/Uint8List/retainAll_A01_t01: Fail  # co19 issue 548
 
-
 ### CHECKED MODE FAILURES ###
 
 [ ($runtime == vm || $compiler == dart2js) && $checked]
 Language/13_Statements/09_Switch_A05_t01: FAIL, OK # co19 issue 498
 Language/14_Libraries_and_Scripts/1_Imports_A03_t26: FAIL, OK  # co19 issue 498
 Language/15_Types/1_Static_Types_A03_t01: Fail # co19-roll r559: Please triage this failure
-Language/15_Types/1_Static_Types_A03_t03: FAIL, OK  # co19 issue 498
-Language/15_Types/1_Static_Types_A03_t04: FAIL, OK  # co19 issue 498
 LibTest/async/EventTransformStream/contains_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/contains_A02_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/distinct_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/drain_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/first_A03_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/firstWhere_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/firstWhere_A02_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/fold_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/fold_A01_t02: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/forEach_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/forEach_A02_t02: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/handleError_A02_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/isBroadcast_A01_t02: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/lastWhere_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/lastWhere_A02_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/listen_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/listen_A02_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/listen_A03_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/map_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/reduce_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/reduce_A01_t02: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/singleWhere_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/skip_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/take_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/take_A01_t02: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/toList_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/toSet_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/transform_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/where_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/EventTransformStream/where_A01_t02: FAIL, OK  # co19 issue 498
-LibTest/async/Stream/drain_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/StreamEventTransformer/bind_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/Stream/firstWhere_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/Stream/firstWhere_A02_t01: FAIL, OK  # co19 issue 498
-LibTest/async/Stream/fold_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/Stream/fold_A01_t02: FAIL, OK  # co19 issue 498
-LibTest/async/Stream/lastWhere_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/Stream/lastWhere_A02_t01: FAIL, OK  # co19 issue 498
-LibTest/async/Stream/reduce_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/Stream/reduce_A01_t02: FAIL, OK  # co19 issue 498
-LibTest/async/Stream/singleWhere_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/Stream/take_A01_t02: FAIL, OK  # co19 issue 498
-LibTest/async/Stream/transform_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/Stream/where_A01_t01: FAIL, OK  # co19 issue 498
-LibTest/async/Stream/where_A01_t02: FAIL, OK  # co19 issue 498
 LibTest/core/DateTime/compareTo_A02_t01: FAIL, OK  # co19 issue 498
-LibTest/core/List/join_A01_t01: FAIL, OK  # co19 issue 498
 LibTest/core/List/removeAt_A02_t01: FAIL, OK  # co19 issue 498
 LibTest/core/TypeError/column_A01_t01: FAIL, OK # co19 issue 510
 LibTest/core/TypeError/dstName_A01_t01: FAIL, OK # co19 issue 510
diff --git a/tests/co19/co19-dart2dart.status b/tests/co19/co19-dart2dart.status
index 1688c19..a926046 100644
--- a/tests/co19/co19-dart2dart.status
+++ b/tests/co19/co19-dart2dart.status
@@ -5,15 +5,7 @@
 [ $compiler == dart2dart ]
 LibTest/async/Stream/Stream.periodic_A01_t01: Pass, Fail # Issue 12562.
 
-LibTest/math/max_A01_t03: Fail # co19 issue 467
-LibTest/math/min_A01_t03: Fail # co19 issue 467
-
-# The following tests fail because they contain number literals with a + prefix (co19 issue 428)
-LibTest/core/double/floor_A01_t05: Fail # issue 428
-LibTest/core/double/ceil_A01_t05: Fail # issue 428
-
 Language/07_Classes/9_Superclasses/1_Inheritance_and_Overriding_A01_t03: Fail # TODO(dart2dart-team): Please triage this failure.
-LibTest/collection/Queue/iterator_current_A01_t02: Fail # co19 issue 475
 LibTest/core/int/toStringAsExponential_A02_t01: Fail # co19 issue 477
 
 Language/03_Overview/1_Scoping_A01_t39: Fail # http://dartbug.com/7202
@@ -58,10 +50,7 @@
 Language/06_Functions/2_Formal_Parameters_A03_t05: Fail # http://dartbug.com/5519
 Language/06_Functions/2_Formal_Parameters_A03_t06: Fail # http://dartbug.com/5519
 Language/06_Functions/4_External_Functions_A01_t01: Fail # inherited from VM
-Language/07_Classes/07_Classes_A02_t02: Fail # http://dartbug.com/5519
-Language/07_Classes/07_Classes_A02_t04: Fail # http://dartbug.com/5519
 Language/07_Classes/07_Classes_A02_t11: Fail # http://dartbug.com/5519
-Language/07_Classes/07_Classes_A03_t10: Fail # http://dartbug.com/6687
 Language/07_Classes/3_Setters_A04_t01: Fail # inherited from VM
 Language/07_Classes/3_Setters_A04_t02: Fail # inherited from VM
 Language/07_Classes/3_Setters_A04_t03: Fail # inherited from VM
@@ -70,9 +59,7 @@
 Language/07_Classes/3_Setters_A04_t06: Fail # inherited from VM
 Language/07_Classes/3_Setters_A04_t07: Fail # inherited from VM
 Language/07_Classes/6_Constructors/1_Generative_Constructors_A09_t01: Fail # http://dartbug.com/5519
-Language/07_Classes/6_Constructors/1_Generative_Constructors_A15_t07: Fail # inherited from VM
 Language/07_Classes/6_Constructors/2_Factories_A07_t01: Fail # inherited from VM
-Language/07_Classes/6_Constructors/3_Constant_Constructors_A03_t01: Fail # http://dartbug.com/5519
 Language/07_Classes/6_Constructors/3_Constant_Constructors_A04_t01: Fail # inherited from VM
 Language/07_Classes/6_Constructors/3_Constant_Constructors_A04_t02: Fail # inherited from VM
 Language/07_Classes/6_Constructors/3_Constant_Constructors_A04_t03: Fail # inherited from VM
@@ -94,7 +81,6 @@
 LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A03_t01: Fail # inherited from VM
 LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A03_t01: Fail, OK # co19 issue 294
 LibTest/core/RegExp/firstMatch_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/double/toRadixString_A01_t01: Fail # inherited from VM
 LibTest/core/int/operator_left_shift_A01_t02: Fail, OK # co19 issue 129
 LibTest/core/int/toRadixString_A01_t01: Fail # inherited from VM
 LibTest/isolate/ReceivePort/receive_A01_t02: Fail, OK # co19 issue 276
@@ -106,18 +92,10 @@
 LibTest/isolate/isolate_api/spawnUri_A01_t05: Fail, OK # Problems with the test: encoded file name
 LibTest/math/exp_A01_t01: Fail # Issue co19 - 44
 LibTest/math/pow_A01_t01: Fail # Inherited from VM.
-LibTest/math/pow_A11_t01: Fail # Inherited from VM.
-LibTest/math/pow_A13_t01: Fail # Inherited from VM.
-LibTest/math/pow_A18_t01: Fail # Inherited from VM.
 LibTest/math/sin_A01_t01: Fail # Inherited from VM.
 LibTest/math/tan_A01_t01: Fail # Issue co19 - 44
 
 
-
-LibTest/core/String/indexOf_A01_t02: Fail # Issue 427
-LibTest/core/String/lastIndexOf_A01_t02: Fail # Issue 427
-
-
 [ $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
@@ -138,15 +116,6 @@
 LibTest/core/double/floor_A01_t04: Fail # truncate/ceil/floor/round returns ints, issue 389
 LibTest/core/double/round_A01_t02: Fail # truncate/ceil/floor/round returns ints, issue 389
 LibTest/core/double/round_A01_t04: Fail # truncate/ceil/floor/round returns ints, issue 389
-LibTest/core/double/truncate_A01_t03: Fail # truncate/ceil/floor/round returns ints, issue 389
-LibTest/core/double/truncate_A01_t04: Fail # truncate/ceil/floor/round returns ints, issue 389
-
-LibTest/core/Set/isSubsetOf_A01_t01: Fail # Issue 400
-LibTest/core/Set/isSubsetOf_A01_t02: Fail # Issue 400
-
-LibTest/core/FallThroughError/toString_A01_t01: Fail # FallThroughError is no longer const. Issue 459
-LibTest/core/FallThroughError/FallThroughError_A01_t01: Fail # FallThroughError is no longer const. Issue 459
-
 
 # co19-roll r546 (11.08.2013) caused these failures
 [ $compiler == dart2dart ]
@@ -170,7 +139,6 @@
 Language/07_Classes/1_Instance_Methods_A01_t06: Fail # co19-roll r559: Please triage this failure
 Language/07_Classes/3_Setters_A08_t01: fail # co19-roll r546: Please triage this failure
 Language/07_Classes/3_Setters_A08_t02: fail # co19-roll r546: Please triage this failure
-Language/07_Classes/3_Setters_A08_t03: fail # co19-roll r546: Please triage this failure
 Language/07_Classes/3_Setters_A08_t04: fail # co19-roll r546: Please triage this failure
 Language/07_Classes/4_Abstract_Instance_Members_A03_t01: Fail # co19-roll r559: Please triage this failure
 Language/07_Classes/4_Abstract_Instance_Members_A03_t02: Fail # co19-roll r559: Please triage this failure
@@ -178,7 +146,6 @@
 Language/07_Classes/4_Abstract_Instance_Members_A03_t04: Fail # co19-roll r559: Please triage this failure
 Language/07_Classes/4_Abstract_Instance_Members_A03_t05: Fail # co19-roll r559: Please triage this failure
 Language/12_Expressions/00_Object_Identity/1_Object_Identity_A04_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A01_t01: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/01_Constants_A03_t02: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/01_Constants_A03_t03: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/01_Constants_A03_t04: fail # co19-roll r546: Please triage this failure
@@ -216,8 +183,6 @@
 Language/12_Expressions/01_Constants_A15_t20: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/01_Constants_A15_t21: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/01_Constants_A15_t31: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A16_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A16_t02: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/01_Constants_A16_t03: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/01_Constants_A17_t01: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/01_Constants_A17_t02: fail # co19-roll r546: Please triage this failure
@@ -227,12 +192,6 @@
 Language/12_Expressions/01_Constants_A19_t04: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/01_Constants_A20_t02: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/01_Constants_A20_t03: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/03_Numbers_A01_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/03_Numbers_A01_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/03_Numbers_A01_t03: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/03_Numbers_A01_t04: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/03_Numbers_A01_t08: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/03_Numbers_A01_t10: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/05_Strings/1_String_Interpolation_A01_t09: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/05_Strings_A02_t46: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/05_Strings_A02_t48: fail # co19-roll r546: Please triage this failure
@@ -249,9 +208,6 @@
 Language/12_Expressions/07_Maps_A12_t05: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/07_Maps_A12_t06: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/07_Maps_A12_t07: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/08_Throw_A05_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/08_Throw_A05_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/08_Throw_A05_t03: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/12_Instance_Creation/1_New_A02_t03: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/12_Instance_Creation/1_New_A02_t05: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/12_Instance_Creation/1_New_A02_t06: fail # co19-roll r546: Please triage this failure
@@ -268,7 +224,6 @@
 Language/12_Expressions/12_Instance_Creation/2_Const_A06_t02: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/12_Instance_Creation/2_Const_A10_t01: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A05_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t05: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t09: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/22_Equality_A01_t01: fail # co19-roll r546: Please triage this failure
@@ -292,7 +247,6 @@
 Language/12_Expressions/32_Type_Test_A04_t04: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/33_Type_Cast_A03_t02: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/33_Type_Cast_A03_t03: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/02_Expression_Statements_A01_t06: fail # co19-roll r546: Please triage this failure
 Language/13_Statements/02_Expression_Statements_A01_t08: fail # co19-roll r546: Please triage this failure
 Language/13_Statements/03_Variable_Declaration_A04_t01: fail # co19-roll r546: Please triage this failure
 Language/13_Statements/03_Variable_Declaration_A04_t02: fail # co19-roll r546: Please triage this failure
@@ -305,9 +259,6 @@
 Language/13_Statements/06_For_A01_t11: fail # co19-roll r546: Please triage this failure
 Language/13_Statements/09_Switch_A01_t02: fail # co19-roll r546: Please triage this failure
 Language/13_Statements/09_Switch_A04_t01: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/11_Return_A05_t01: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/11_Return_A05_t02: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/11_Return_A05_t03: fail # co19-roll r546: Please triage this failure
 Language/13_Statements/11_Try_A02_t03: fail # co19-roll r546: Please triage this failure
 Language/13_Statements/11_Try_A03_t03: fail # co19-roll r546: Please triage this failure
 Language/13_Statements/11_Try_A04_t03: fail # co19-roll r546: Please triage this failure
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 8fe176e..0f0d2e3 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -18,7 +18,6 @@
 # Crashes first, please. Then untriaged bugs. There is a section below
 # for co19 bugs.
 [ $compiler == dart2js ]
-
 Language/03_Overview/1_Scoping_A02_t05: Fail # TODO(ahe): Please triage this failure.
 Language/03_Overview/1_Scoping_A02_t06: Fail # TODO(ahe): Please triage this failure.
 Language/07_Classes/6_Constructors/2_Factories_A07_t01: Fail # TODO(ahe): Please triage this failure.
@@ -26,7 +25,25 @@
 LibTest/core/double/INFINITY_A01_t04: Fail # TODO(ahe): Please triage this failure.
 LibTest/core/double/NEGATIVE_INFINITY_A01_t04: Fail # TODO(ahe): Please triage this failure.
 LibTest/core/List/sort_A01_t04: Pass, Slow # http://dartbug.com/11846
+LibTest/math/pow_A13_t01: FAIL, OK # co19 issue 507
+LibTest/math/pow_A18_t01: FAIL, OK # co19 issue 507
 
+LibTest/typed_data/ByteData/getFloat32_A02_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/getFloat64_A02_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/getInt16_A02_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/getInt32_A02_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/getInt64_A02_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/getUint16_A02_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/getUint32_A02_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/getUint64_A02_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/setFloat32_A02_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/setFloat64_A02_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/setInt16_A02_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/setInt32_A02_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/setInt64_A02_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/setUint16_A02_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/setUint32_A02_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/setUint64_A02_t02: fail # co19-roll r569: Please triage this failure
 
 [ $compiler == dart2js && $runtime == jsshell ]
 LibTest/isolate/SendPort/send_A02_t05: Fail, Pass # TODO(ahe): Please triage this failure.
@@ -43,6 +60,8 @@
 
 [ $compiler == dart2js ]
 
+LibTest/core/List/removeAt_A02_t01: Fail # Issue 1533
+
 LibTest/isolate/ReceivePort/receive_A01_t02: Fail # Issue 6750
 
 LibTest/typed_data/Float64List/Float64List.view_A01_t01: Fail, OK # Issue 12928
@@ -58,7 +77,6 @@
 LibTest/async/Stream/listen_A04_t01: Pass, Timeout # Issue: 8920
 LibTest/core/DateTime/timeZoneName_A01_t01: Fail # Issue: 8920
 LibTest/core/double/round_A01_t01: Fail # Issue: 8920
-LibTest/core/double/toRadixString_A01_t01: Fail # Issue: 8920
 LibTest/core/double/toStringAsExponential_A01_t04: Fail # Issue: 8920
 LibTest/core/double/toStringAsPrecision_A01_t04: Fail # Issue: 8920
 LibTest/core/int/compareTo_A01_t01: Fail # Issue: 8920
@@ -147,18 +165,68 @@
 Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t14: Fail, OK # co19 issue 210
 Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t15: Fail, OK # co19 issue 210
 Language/06_Functions/4_External_Functions_A01_t01: Fail, OK # http://dartbug.com/5021
-LibTest/core/FallThroughError/FallThroughError_A01_t01: Fail # FallThroughError is no longer const. Issue 459
-LibTest/core/FallThroughError/toString_A01_t01: Fail # FallThroughError is no longer const. Issue 459
 LibTest/core/int/hashCode_A01_t01: Fail, OK # co19 issue 308
-LibTest/core/Set/isSubsetOf_A01_t01: fail # Issue 400
-LibTest/core/Set/isSubsetOf_A01_t02: fail # Issue 400
-LibTest/core/String/indexOf_A01_t02: Fail # Issue 427
-LibTest/core/String/lastIndexOf_A01_t02: Fail # Issue 427
 LibTest/typed_data/Int64List/*: Fail # co19-roll r559: Please triage this failure
 LibTest/typed_data/Int64List/Int64List_A02_t01: pass # co19-roll r559: Please triage this failure
 LibTest/typed_data/Uint64List/*: Fail # co19-roll r559: Please triage this failure
 LibTest/typed_data/Uint64List/Uint64List_A02_t01: pass # co19-roll r559: Please triage this failure
+LibTest/typed_data/ByteData/*Uint64*: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/*Int64*: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/ByteData.view_A03_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/ByteData.view_A01_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/ByteData.view_A01_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/ByteData_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/ByteData.view_A04_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/ByteData.view_A04_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/ByteData_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/ByteData.view_A03_t01: fail # co19-roll r569: Please triage this failure
 
+LibTest/typed_data/ByteData/ByteData.view_A05_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/ByteData.view_A05_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/ByteData.view_A05_t02: fail # Issue 12989
+LibTest/typed_data/ByteData/ByteData.view_A05_t02: fail # Issue 12989
+LibTest/typed_data/ByteData/ByteData.view_A05_t03: fail # Issue 12989
+LibTest/typed_data/ByteData/ByteData.view_A05_t03: fail # Issue 12989
+LibTest/typed_data/ByteData/getFloat32_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/getFloat32_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/getFloat64_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/getFloat64_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/getInt16_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/getInt16_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/getInt32_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/getInt32_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/getInt8_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/getInt8_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/getInt8_A02_t02: fail # Issue 12989
+LibTest/typed_data/ByteData/getInt8_A02_t02: fail # Issue 12989
+LibTest/typed_data/ByteData/getUint16_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/getUint16_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/getUint32_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/getUint32_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/getUint8_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/getUint8_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/getUint8_A02_t02: fail # Issue 12989
+LibTest/typed_data/ByteData/getUint8_A02_t02: fail # Issue 12989
+LibTest/typed_data/ByteData/setFloat32_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/setFloat32_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/setFloat64_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/setFloat64_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/setInt16_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/setInt16_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/setInt32_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/setInt32_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/setInt8_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/setInt8_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/setInt8_A02_t02: fail # Issue 12989
+LibTest/typed_data/ByteData/setInt8_A02_t02: fail # Issue 12989
+LibTest/typed_data/ByteData/setUint16_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/setUint16_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/setUint32_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/setUint32_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/setUint8_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/setUint8_A02_t01: fail # Issue 12989
+LibTest/typed_data/ByteData/setUint8_A02_t02: fail # Issue 12989
+LibTest/typed_data/ByteData/setUint8_A02_t02: fail # Issue 12989
 
 [ $compiler == dart2js && $jscl ]
 LibTest/core/RegExp/Pattern_semantics/firstMatch_CharacterClassEscape_A04_t01: Fail, Pass # issue 3333
@@ -166,7 +234,6 @@
 LibTest/core/RegExp/Pattern_semantics/firstMatch_NonEmptyClassRanges_A01_t01: Fail, OK # This is not rejected by V8.
 LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A04_t01: Fail, OK # co19 issue 92.
 LibTest/core/RegExp/firstMatch_A01_t01: Fail, OK # Bad test, use Match.regexp, not Match.pattern.
-LibTest/core/double/toRadixString_A01_t01: Fail, OK # Unimplemented test stub.
 LibTest/core/int/compareTo_A01_t01: Fail, OK # Requires big int.
 LibTest/core/int/hashCode_A01_t01: Fail, OK # co19 testing missing assertion.
 LibTest/core/int/isEven_A01_t01: Fail, OK # Not in API.
@@ -231,14 +298,9 @@
 Language/06_Functions/2_Formal_Parameters_A03_t05: Fail # Checks that it is a compile-time error if an optional named parameter is declared as a constant typed variable.
 Language/06_Functions/2_Formal_Parameters_A03_t05: Fail # Checks that it is a compile-time error if an optional positional parameter is declared as a constant variable.
 Language/06_Functions/2_Formal_Parameters_A03_t06: Fail # TODO(ahe): Enforce optional parameter semantics.
-Language/07_Classes/07_Classes_A02_t02: Fail # Checks that it is a compile-time error if a constant constructor declaration includes a body.
-Language/07_Classes/07_Classes_A02_t04: Fail # Checks that it is a compile-time error if a constant constructor declaration with initializers includes a body.
 Language/07_Classes/07_Classes_A02_t11: Fail # Checks that it is a compile-time error if a static final variable declaration does not include explicit initializer.
 Language/07_Classes/07_Classes_A11_t01: Fail # Checks that a class name cannot be used as a name of a member variable.
 Language/07_Classes/07_Classes_A11_t03: Fail # Checks that a class name cannot be used as a name of a static variable.
-Language/07_Classes/6_Constructors/3_Constant_Constructors_A03_t01: Fail # Checks that a compile-time error is produced when a class with constant  constructor also declares a non-final instance variable.
-Language/12_Expressions/01_Constants_A16_t01: Fail # Checks that an IntegerDivisionByZeroException raised during evaluation  of a compile-time constant causes a compile-time error.
-Language/12_Expressions/01_Constants_A16_t02: Fail # Checks that an OutOfMemoryException raised during evaluation of a compile-time constant causes a compile-time error.
 Language/12_Expressions/01_Constants_A20_t03: Fail # Checks that an identifier expression that denotes a type parameter  can not be assigned to a constant variable.
 Language/12_Expressions/05_Strings/1_String_Interpolation_A01_t09: Fail # Checks that it is a compile-time error if a string interpolation construct does not start with IDENTIFIER_NO_DOLLAR or opening brace.
 Language/12_Expressions/05_Strings_A02_t46: Fail # Checks that multi-line strings that contain characters and sequences prohibited by this grammar, cause compile-time errors.
@@ -260,9 +322,6 @@
 Language/13_Statements/03_Variable_Declaration_A04_t06: Fail # Checks that a variable declaration statement final T e = e; causes a compile-time error.
 Language/13_Statements/03_Variable_Declaration_A04_t07: Fail # Checks that a variable declaration statement var e = e; causes a compile-time error. A top-level variable with the same name is declared.
 Language/13_Statements/03_Variable_Declaration_A04_t08: Fail # Checks that it is a compile-time error if the initializing expression of a local variable v refers to the name v= even when a top-level variable  with the same name is declared.
-Language/13_Statements/11_Return_A05_t01: Fail # Checks that a compile-time error occurs if a return statement  of the form return e; appears in a generative constructor.
-Language/13_Statements/11_Return_A05_t02: Fail # Checks that a compile-time error occurs if a return statement  of the form return e; appears in a named generative constructor.
-Language/13_Statements/11_Return_A05_t03: Fail # Checks that a compile-time error occurs if a return statement  of the form return e; appears in a generative constructor.
 Language/14_Libraries_and_Scripts/5_URIs_A01_t24: Fail # Checks that it is a compile-time error when the URI in a part directive consists of two adjacent string literals instead of one.
 Language/14_Libraries_and_Scripts/5_URIs_A01_t25: Fail # Checks that it is a compile-time error when the URI in a part directive consists of two adjacent multi-line string literals  instead of one.
 Language/15_Types/3_Type_Declarations/1_Typedef_A06_t01: Fail # Checks that a compile error is produced when a null default value is specified for a required argument in a function type alias.
@@ -290,8 +349,6 @@
 Language/07_Classes/3_Setters_A04_t06: Fail # http://dartbug.com/5023
 Language/07_Classes/3_Setters_A04_t07: Fail # http://dartbug.com/5023
 
-Language/07_Classes/07_Classes_A03_t10: Fail # http://dartbug.com/6687
-
 
 [ $compiler == dart2js && $runtime == ie9 ]
 # These are most likey due to the fact that IE9 doesn't support typed data
@@ -320,6 +377,48 @@
 LibTest/typed_data/Uint8ClampedList/Uint8ClampedList_A02_t01: pass # co19-roll r559: Please triage this failure
 LibTest/typed_data/Uint8List/Uint8List_A02_t01: pass # co19-roll r559: Please triage this failure
 
+LibTest/typed_data/ByteBuffer/hashCode_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteBuffer/hashCode_A01_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteBuffer/lengthInBytes_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteBuffer/lengthInBytes_A01_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteBuffer/operator_equality_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteBuffer/runtimeType_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteBuffer/runtimeType_A01_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteBuffer/toString_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/buffer_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/buffer_A01_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/ByteData_A01_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/ByteData.view_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/ByteData.view_A02_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/elementSizeInBytes_A01_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/getFloat32_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/getFloat64_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/getInt16_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/getInt32_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/getInt8_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/getUint16_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/getUint32_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/getUint8_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/hashCode_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/hashCode_A01_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/lengthInBytes_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/lengthInBytes_A01_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/offsetInBytes_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/offsetInBytes_A01_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/operator_equality_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/runtimeType_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/runtimeType_A01_t02: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/setFloat32_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/setFloat64_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/setInt16_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/setInt32_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/setInt8_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/setUint16_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/setUint32_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/setUint8_A01_t01: fail # co19-roll r569: Please triage this failure
+LibTest/typed_data/ByteData/toString_A01_t01: fail # co19-roll r569: Please triage this failure
+
+
 [ $compiler == dart2js ]
 Language/03_Overview/1_Scoping_A02_t28: fail # co19-roll r559: Please triage this failure
 Language/05_Variables/05_Variables_A05_t01: fail # co19-roll r546: Please triage this failure
@@ -333,7 +432,6 @@
 Language/07_Classes/1_Instance_Methods_A01_t06: fail # co19-roll r559: Please triage this failure
 Language/07_Classes/3_Setters_A08_t01: fail # co19-roll r546: Please triage this failure
 Language/07_Classes/3_Setters_A08_t02: fail # co19-roll r546: Please triage this failure
-Language/07_Classes/3_Setters_A08_t03: fail # co19-roll r546: Please triage this failure
 Language/07_Classes/3_Setters_A08_t04: fail # co19-roll r546: Please triage this failure
 Language/07_Classes/4_Abstract_Instance_Members_A03_t01: fail # co19-roll r559: Please triage this failure
 Language/07_Classes/4_Abstract_Instance_Members_A03_t02: fail # co19-roll r559: Please triage this failure
@@ -346,9 +444,6 @@
 Language/12_Expressions/00_Object_Identity/1_Object_Identity_A06_t01: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/00_Object_Identity/1_Object_Identity_A06_t02: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/01_Constants_A03_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A11_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A12_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A13_t06: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/03_Numbers_A01_t06: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/03_Numbers_A01_t09: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/05_Strings_A20_t01: fail # co19-roll r546: Please triage this failure
@@ -359,16 +454,12 @@
 Language/12_Expressions/07_Maps_A12_t05: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/07_Maps_A12_t06: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/07_Maps_A12_t07: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/08_Throw_A05_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/08_Throw_A05_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/08_Throw_A05_t03: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/12_Instance_Creation/1_New_A02_t03: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/12_Instance_Creation/1_New_A02_t05: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/12_Instance_Creation/1_New_A02_t06: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/12_Instance_Creation/1_New_A02_t07: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/12_Instance_Creation/2_Const_A11_t01: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/12_Instance_Creation/2_Const_A11_t03: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t05: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t09: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/22_Equality_A01_t01: fail # co19-roll r546: Please triage this failure
@@ -428,7 +519,6 @@
 LibTest/isolate/isolate_api/streamSpawnFunction_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/isolate/isolate_api/streamSpawnFunction_A02_t01: fail # co19-roll r546: Please triage this failure
 LibTest/isolate/isolate_api/streamSpawnFunction_A02_t02: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/isolate_api/streamSpawnFunction_A02_t03: fail # co19-roll r546: Please triage this failure
 LibTest/isolate/IsolateSink/add_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/isolate/IsolateSink/add_A01_t02: fail # co19-roll r546: Please triage this failure
 LibTest/isolate/IsolateSink/addError_A01_t01: fail # co19-roll r546: Please triage this failure
@@ -516,14 +606,11 @@
 Language/12_Expressions/20_Logical_Boolean_Expressions_A03_t01: fail # co19-roll r546: Please triage this failure
 Language/12_Expressions/27_Unary_Expressions_A02_t03: fail # co19-roll r546: Please triage this failure
 Language/13_Statements/06_For/1_For_Loop_A01_t08: fail # co19-roll r546: Please triage this failure
-LibTest/core/Set/intersection_A01_t02: fail # co19-roll r546: Please triage this failure
-LibTest/typed_data/Float32x4List/operator_subscripted_assignment_A02_t01: Fail # co19-roll r559: Please triage this failure
 LibTest/typed_data/Float32x4List/reduce_A01_t01: Fail # co19-roll r559: Please triage this failure
 
 [ $compiler == dart2js && $runtime == jsshell ]
 LibTest/typed_data/Float32List/hashCode_A01_t01: fail # co19-roll r559: Please triage this failure
-LibTest/typed_data/Float32List/toList_A01_t01: timeout # co19-roll r559: Please triage this failure
-LibTest/typed_data/Float32x4/toUint32x4_A01_t02: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32List/toList_A01_t01: fail, timeout # co19-roll r559: Please triage this failure
 LibTest/typed_data/Float64List/hashCode_A01_t01: fail # co19-roll r559: Please triage this failure
 LibTest/typed_data/Float64List/toList_A01_t01: fail, timeout # co19-roll r559: Please triage this failure
 LibTest/typed_data/Int16List/hashCode_A01_t01: fail # co19-roll r559: Please triage this failure
@@ -542,7 +629,7 @@
 LibTest/typed_data/Uint8ClampedList/hashCode_A01_t01: fail # co19-roll r559: Please triage this failure
 LibTest/typed_data/Uint8ClampedList/toList_A01_t01: fail, timeout # co19-roll r559: Please triage this failure
 LibTest/typed_data/Uint8List/hashCode_A01_t01: fail # co19-roll r559: Please triage this failure
-LibTest/typed_data/Uint8List/toList_A01_t01: timeout # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8List/toList_A01_t01: fail, timeout # co19-roll r559: Please triage this failure
 
 # Could this be dart issue 7728?
 [ $compiler == dart2js && ($runtime == d8 || $runtime == jsshell) ]
@@ -577,3 +664,7 @@
 LibTest/typed_data/Uint8ClampedList/runtimeType_A01_t01: fail # co19-roll r559: Please triage this failure
 LibTest/typed_data/Uint8List/runtimeType_A01_t01: fail # co19-roll r559: Please triage this failure
 
+[ $compiler == dart2js || $compiler == dart2dart ]
+Language/07_Classes/6_Constructors/1_Generative_Constructors_A15_t08: fail # co19-roll r569: Please triage this failure
+
+
diff --git a/tests/co19/co19-runtime.status b/tests/co19/co19-runtime.status
index dd687c2..950b3b7 100644
--- a/tests/co19/co19-runtime.status
+++ b/tests/co19/co19-runtime.status
@@ -2,17 +2,15 @@
 # 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.
 
+[ $runtime == vm ]
+Language/12_Expressions/01_Constants_A16_t04: fail # Issue 392
+Language/12_Expressions/01_Constants_A16_t05: fail # Issue 392
+
 [ $runtime == vm && $system == windows ]
 LibTest/core/Stopwatch/elapsed_A01_t01: Pass, Fail # Issue 11382.
 LibTest/core/Stopwatch/elapsed_A01_t03: Pass, Fail # Issue 12383.
 
 [ $compiler == none && $runtime == vm ]
-# The following tests fail because they contain number literals with a + prefix (co19 issue 428)
-LibTest/core/double/floor_A01_t05: Fail # co19 issue 428
-LibTest/core/double/ceil_A01_t05: Fail # co19 issue 428
-
-LibTest/math/pow_A18_t01: Fail # co19 issue 507
-
 Language/05_Variables/1_Evaluation_of_Implicit_Variable_Getters_A01_t02: Fail # Dart issue 5802
 Language/05_Variables/1_Evaluation_of_Implicit_Variable_Getters_A01_t05: Fail # Dart issue 5894
 
@@ -28,31 +26,12 @@
 
 LibTest/core/Match/operator_subscript_A01_t01: Fail # Issue 12508
 LibTest/core/RegExp/firstMatch_A01_t01: Fail # Issue 12508
-LibTest/core/double/toRadixString_A01_t01: Fail # co19 issue 491
 LibTest/core/int/toRadixString_A01_t01: Fail # co19 issue 492
 
-LibTest/isolate/ReceivePort/receive_A01_t02: Fail # VM triage, check spec.
-LibTest/isolate/isolate_api/spawnUri_A02_t02: Fail # VM triage, check spec.
-LibTest/isolate/isolate_api/spawnUri_A02_t03: Fail # VM triage, check spec.
-
-
-Language/07_Classes/6_Constructors/1_Generative_Constructors_A15_t07: Fail $ co19 issue 494
-
-LibTest/core/Set/isSubsetOf_A01_t01: fail # Issue 400
-LibTest/core/Set/isSubsetOf_A01_t02: fail # Issue 400
-
-LibTest/core/String/indexOf_A01_t02: Fail # Issue 427
-LibTest/core/String/lastIndexOf_A01_t02: Fail # Issue 427
-
-LibTest/core/FallThroughError/toString_A01_t01: Fail # FallThroughError is no longer const. Issue 459
-LibTest/core/FallThroughError/FallThroughError_A01_t01: Fail # FallThroughError is no longer const. Issue 459
-
 Language/03_Overview/2_Privacy_A01_t06: Fail # Issue 463
 
 LibTest/async/Timer/Timer.periodic_A02_t01: Pass, Fail # co19 issue 537
 
-# end [ $compiler == none && $runtime == vm ]
-
 
 [ $compiler == none && $runtime == vm && $checked ]
 LibTest/async/Future/catchError_A01_t01: Fail # Future constructors have changed # issue 408
@@ -79,7 +58,6 @@
 
 [ $compiler == none && $runtime == vm && $arch == arm ]
 LibTest/typed_data/Float32List/Float32List.view_A01_t02: Crash  # Issue 12868
-LibTest/typed_data/Float32x4/toUint32x4_A01_t02: Fail  # Issue 12868
 LibTest/typed_data/Float64List/Float64List.view_A01_t02: Crash  # Issue 12868
 
 [ $compiler == none && $runtime == vm ]
@@ -97,28 +75,15 @@
 Language/07_Classes/07_Classes_A11_t04: fail # Dart issue 12545
 Language/07_Classes/3_Setters_A08_t01: fail # co19 issue 520
 Language/07_Classes/3_Setters_A08_t02: fail # co19 issue 520
-Language/07_Classes/3_Setters_A08_t03: fail # co19 issue 520
 Language/07_Classes/3_Setters_A08_t04: fail # co19 issue 520
-Language/07_Classes/3_Setters_A08_t05: fail # co19 issue 520
 Language/07_Classes/6_Constructors/1_Generative_Constructors_A09_t01: fail # Dart issue 12543
-Language/12_Expressions/01_Constants_A01_t01: fail # co19 issue 522
-Language/12_Expressions/01_Constants_A16_t01: fail # co19 issue 525
-Language/12_Expressions/01_Constants_A16_t02: fail # co19 issue 525
-Language/12_Expressions/03_Numbers_A01_t01: fail # co19 issue 522
-Language/12_Expressions/03_Numbers_A01_t02: fail # co19 issue 522
-Language/12_Expressions/03_Numbers_A01_t03: fail # co19 issue 522
-Language/12_Expressions/03_Numbers_A01_t04: fail # co19 issue 522
-Language/12_Expressions/03_Numbers_A01_t08: fail # co19 issue 522
-Language/12_Expressions/03_Numbers_A01_t10: fail # co19 issue 522
 Language/12_Expressions/05_Strings_A02_t46: fail # Dart issue 12547
 Language/12_Expressions/05_Strings_A02_t48: fail # Dart issue 12547
 Language/12_Expressions/05_Strings_A20_t01: fail # Dart issue 12518
-Language/12_Expressions/07_Maps_A01_t01: fail # co19 issue 522
 Language/12_Expressions/12_Instance_Creation/1_New_A06_t12: fail # Dart issue 12549
 Language/12_Expressions/12_Instance_Creation/1_New_A09_t09: fail # Dart issue 1372
 Language/12_Expressions/12_Instance_Creation/2_Const_A10_t01: fail # co19 issue 525
 Language/12_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A05_t01: fail # Dart issue 12550
-Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t05: fail # co19 issue 533
 Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t09: fail # Dart issue 12549
 Language/12_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: fail # Dart issue 12549
 Language/12_Expressions/30_Identifier_Reference_A05_t02: fail # Dart issue 12551
@@ -128,7 +93,6 @@
 Language/12_Expressions/32_Type_Test_A04_t04: fail # co19 issue 534
 Language/12_Expressions/33_Type_Cast_A03_t02: fail # co19 issue 534
 Language/12_Expressions/33_Type_Cast_A03_t03: fail # co19 issue 534
-Language/13_Statements/02_Expression_Statements_A01_t06: fail # co19 issue 517
 Language/13_Statements/03_Variable_Declaration_A04_t07: fail # co19 issue 535
 Language/13_Statements/03_Variable_Declaration_A04_t08: fail # co19 issue 535
 Language/13_Statements/06_For_A01_t11: fail # Dart issue 5675
@@ -162,25 +126,21 @@
 Language/14_Libraries_and_Scripts/5_URIs_A01_t21: fail # Issue 12518
 
 LibTest/core/DateTime/parse_A03_t01: fail # Issue 12514
+
+# All isolate are being ignored at the moment as the library will go through some changes.
 LibTest/isolate/isolate_api/spawnFunction_A04_t01: fail # co19-roll r546: Please triage this failure
 LibTest/isolate/isolate_api/streamSpawnFunction_A02_t01: fail # co19-roll r546: Please triage this failure
 LibTest/isolate/IsolateSink/addError_A01_t01: fail # co19-roll r546: Please triage this failure
 LibTest/isolate/IsolateSink/addError_A01_t02: fail # co19-roll r546: Please triage this failure
 LibTest/isolate/IsolateStream/any_A02_t01: fail # co19-roll r546: Please triage this failure
 LibTest/isolate/IsolateStream/contains_A02_t01: fail, pass # co19-roll r546: Please triage this failure
-LibTest/isolate/isolate_api/streamSpawnFunction_A02_t03: fail, pass # co19-roll r546: Please triage this failure
 LibTest/isolate/SendPort/send_A01_t01: fail # co19-roll r546: Please triage this failure
+LibTest/isolate/ReceivePort/receive_A01_t02: Fail # VM triage, check spec.
+LibTest/isolate/isolate_api/spawnUri_A02_t02: Fail # VM triage, check spec.
+LibTest/isolate/isolate_api/spawnUri_A02_t03: Fail # VM triage, check spec.
+
 
 [ $compiler == none && $runtime == vm && $checked ]
-Language/12_Expressions/12_Instance_Creation_A01_t08: FAIL, OK  # co19 issue 498
-LibTest/core/double/truncate_A01_t01: Fail # co19 issue 554
-LibTest/core/double/truncate_A01_t05: Fail #  co19 issue 554
-LibTest/core/int/ceilToDouble_A01_t01: fail  # co19 issue 498
-LibTest/core/int/floorToDouble_A01_t01: fail  # co19 issue 498
-LibTest/core/int/roundToDouble_A01_t01: fail  # co19 issue 498
-LibTest/core/int/truncateToDouble_A01_t01: fail  # co19 issue 498
-LibTest/typed_data/Float32List/operator_subscripted_assignment_A02_t01: Fail # co19 issue 555
-LibTest/typed_data/Float64List/operator_subscripted_assignment_A02_t01: Fail # co19 issue 555
 LibTest/typed_data/Float32x4List/elementAt_A01_t01: Fail # Dart issue 12861
 LibTest/typed_data/Float32x4List/fillRange_A01_t01: Fail # Dart issue 12861
 LibTest/typed_data/Float32x4List/first_A01_t01: Fail # Dart issue 12861
@@ -196,7 +156,6 @@
 LibTest/typed_data/Float32x4List/map_A03_t01: Fail # Dart issue 12861
 LibTest/typed_data/Float32x4List/operator_subscript_A01_t01: Fail # Dart issue 12861
 LibTest/typed_data/Float32x4List/operator_subscripted_assignment_A01_t01: Fail # Dart issue 12861
-LibTest/typed_data/Float32x4List/operator_subscripted_assignment_A02_t01: Fail # Dart issue 12861
 LibTest/typed_data/Float32x4List/reduce_A01_t01: Fail # Dart issue 12861
 LibTest/typed_data/Float32x4List/reversed_A01_t01: Fail # Dart issue 12861
 LibTest/typed_data/Float32x4List/single_A01_t01: Fail # Dart issue 12861
diff --git a/tests/compiler/dart2js/analyze_all_test.dart b/tests/compiler/dart2js/analyze_all_test.dart
index 2a7fcc7..58a313c 100644
--- a/tests/compiler/dart2js/analyze_all_test.dart
+++ b/tests/compiler/dart2js/analyze_all_test.dart
@@ -3,7 +3,8 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
-import 'compiler_helper.dart';
+import "compiler_helper.dart";
+import "package:async_helper/async_helper.dart";
 
 const String SOURCE = """
 class Foo {
@@ -28,24 +29,29 @@
 
 main() {
   Uri uri = Uri.parse('test:code');
-  var compiler = compilerFor(SOURCE, uri, analyzeAll: false);
-  compiler.runCompiler(uri);
-  Expect.isFalse(compiler.compilationFailed);
-  print(compiler.warnings);
-  Expect.isTrue(compiler.warnings.isEmpty, 'unexpected warnings');
-  Expect.isTrue(compiler.errors.isEmpty, 'unexpected errors');
-  compiler = compilerFor(SOURCE, uri, analyzeAll: true);
-  compiler.runCompiler(uri);
-  Expect.isTrue(compiler.compilationFailed);
-  Expect.isTrue(compiler.warnings.isEmpty, 'unexpected warnings');
-  Expect.equals(2, compiler.errors.length,
-                'expected exactly two errors, but got ${compiler.errors}');
+  asyncStart();
+  var compiler1 = compilerFor(SOURCE, uri, analyzeAll: false);
+  compiler1.runCompiler(uri).then((_) {
+    Expect.isFalse(compiler1.compilationFailed);
+    print(compiler1.warnings);
+    Expect.isTrue(compiler1.warnings.isEmpty, 'unexpected warnings');
+    Expect.isTrue(compiler1.errors.isEmpty, 'unexpected errors');
+  }).whenComplete(() => asyncEnd());
 
-  Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST,
-                compiler.errors[0].message.kind);
-  Expect.equals("Foo", compiler.errors[0].node.toString());
+  asyncStart();
+  var compiler2 = compilerFor(SOURCE, uri, analyzeAll: true);
+  compiler2.runCompiler(uri).then((_) {
+    Expect.isTrue(compiler2.compilationFailed);
+    Expect.isTrue(compiler2.warnings.isEmpty, 'unexpected warnings');
+    Expect.equals(2, compiler2.errors.length,
+                  'expected exactly two errors, but got ${compiler2.errors}');
 
-  Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST,
-                compiler.errors[1].message.kind);
-  Expect.equals("Foo", compiler.errors[1].node.toString());
+    Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST,
+                  compiler2.errors[0].message.kind);
+    Expect.equals("Foo", compiler2.errors[0].node.toString());
+
+    Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST,
+                  compiler2.errors[1].message.kind);
+    Expect.equals("Foo", compiler2.errors[1].node.toString());
+  }).whenComplete(() => asyncEnd());
 }
diff --git a/tests/compiler/dart2js/analyze_api_test.dart b/tests/compiler/dart2js/analyze_api_test.dart
index ec291dd..de48a2e 100644
--- a/tests/compiler/dart2js/analyze_api_test.dart
+++ b/tests/compiler/dart2js/analyze_api_test.dart
@@ -6,6 +6,7 @@
 
 import '../../../sdk/lib/_internal/libraries.dart';
 import 'analyze_helper.dart';
+import "package:async_helper/async_helper.dart";
 
 /**
  * Map of white-listed warnings and errors.
@@ -28,5 +29,5 @@
       uriList.add(new Uri(scheme: 'dart', path: name));
     }
   });
-  analyze(uriList, WHITE_LIST);
+  asyncTest(() => analyze(uriList, WHITE_LIST));
 }
diff --git a/tests/compiler/dart2js/analyze_dart2js_test.dart b/tests/compiler/dart2js/analyze_dart2js_test.dart
index 8f2a641..9508083 100644
--- a/tests/compiler/dart2js/analyze_dart2js_test.dart
+++ b/tests/compiler/dart2js/analyze_dart2js_test.dart
@@ -7,6 +7,7 @@
 import "package:expect/expect.dart";
 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart';
 import 'analyze_helper.dart';
+import "package:async_helper/async_helper.dart";
 
 /**
  * Map of whitelisted warnings and errors.
@@ -25,5 +26,5 @@
 void main() {
   var uri = currentDirectory.resolve(
       'sdk/lib/_internal/compiler/implementation/dart2js.dart');
-  analyze([uri], WHITE_LIST);
+  asyncTest(() => analyze([uri], WHITE_LIST));
 }
diff --git a/tests/compiler/dart2js/analyze_helper.dart b/tests/compiler/dart2js/analyze_helper.dart
index a9c081d..3eee5f8 100644
--- a/tests/compiler/dart2js/analyze_helper.dart
+++ b/tests/compiler/dart2js/analyze_helper.dart
@@ -5,6 +5,7 @@
 library analyze_helper;
 
 import "package:expect/expect.dart";
+import 'dart:async';
 import 'dart:io';
 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api;
 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart';
@@ -122,7 +123,7 @@
   }
 }
 
-void analyze(List<Uri> uriList, Map<String, List<String>> whiteList) {
+Future analyze(List<Uri> uriList, Map<String, List<String>> whiteList) {
   var libraryRoot = currentDirectory.resolve('sdk/');
   var provider = new SourceFileProvider();
   var handler = new CollectingDiagnosticHandler(whiteList, provider);
@@ -134,6 +135,7 @@
       <String>['--analyze-only', '--analyze-all',
                '--categories=Client,Server']);
   compiler.librariesToAnalyzeWhenRun = uriList;
-  compiler.run(null);
-  handler.checkResults();
+  return compiler.run(null).then((_) {
+    handler.checkResults();
+  });
 }
diff --git a/tests/compiler/dart2js/analyze_only_test.dart b/tests/compiler/dart2js/analyze_only_test.dart
index 6ab9867..67bbeb8 100644
--- a/tests/compiler/dart2js/analyze_only_test.dart
+++ b/tests/compiler/dart2js/analyze_only_test.dart
@@ -7,6 +7,7 @@
 
 import "package:expect/expect.dart";
 import 'dart:async';
+import "package:async_helper/async_helper.dart";
 
 import '../../utils/dummy_compiler_test.dart' as dummy;
 import '../../../sdk/lib/_internal/compiler/compiler.dart';
@@ -34,6 +35,7 @@
   print('-----------------------------------------------');
   print('main source:\n$main');
   print('options: $options\n');
+  asyncStart();
   Future<String> result =
       compile(new Uri(scheme: 'main'),
               new Uri(scheme: 'lib', path: '/'),
@@ -43,7 +45,7 @@
     onValue(code, errors, warnings);
   }, onError: (e) {
       throw 'Compilation failed';
-  });
+  }).whenComplete(() => asyncEnd());
 }
 
 main() {
diff --git a/tests/compiler/dart2js/async_compiler_input_provider_test.dart b/tests/compiler/dart2js/async_compiler_input_provider_test.dart
new file mode 100644
index 0000000..9b8a826
--- /dev/null
+++ b/tests/compiler/dart2js/async_compiler_input_provider_test.dart
@@ -0,0 +1,62 @@
+// 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.
+
+import "dart:async";
+import "dart:io";
+
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+import '../../../sdk/lib/_internal/compiler/compiler.dart' as compiler;
+import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart';
+
+const SOURCES = const {
+  "/main.dart": """
+    import "foo.dart";
+    main() => foo();
+    """,
+  "/foo.dart": """
+    library foo;
+    import "bar.dart";
+    foo() => bar();
+    """,
+  "/bar.dart": """
+    library bar;
+    bar() => print("bar");
+    """
+};
+
+Future<String> provideInput(Uri uri) {
+  var source = SOURCES[uri.path];
+  if (source == null) {
+    // Not one of our source files, so assume it's a built-in.
+    source = new File(uriPathToNative(uri.path)).readAsStringSync();
+  }
+
+  // Deliver the input asynchronously.
+  return new Future(() => source);
+}
+
+main() {
+  var entrypoint = Uri.parse("file:///main.dart");
+
+  // Find the path to sdk/ in the repo relative to this script.
+  Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
+  Uri libraryRoot = script.resolve('../../../sdk/');
+  Uri packageRoot = script.resolve('./packages/');
+
+  asyncStart();
+  compiler.compile(entrypoint, libraryRoot, packageRoot,
+      provideInput, handleDiagnostic, []).then((code) {
+    Expect.isNotNull(code);
+  }).whenComplete(() => asyncEnd());
+}
+
+void handleDiagnostic(Uri uri, int begin, int end, String message,
+                      compiler.Diagnostic kind) {
+  print(message);
+  if (kind != compiler.Diagnostic.VERBOSE_INFO) {
+    throw 'Unexpected diagnostic kind $kind';
+  }
+}
diff --git a/tests/compiler/dart2js/bad_loop_test.dart b/tests/compiler/dart2js/bad_loop_test.dart
index 5cecb22..65629a4 100644
--- a/tests/compiler/dart2js/bad_loop_test.dart
+++ b/tests/compiler/dart2js/bad_loop_test.dart
@@ -4,6 +4,7 @@
 
 import 'package:expect/expect.dart';
 import 'memory_source_file_helper.dart';
+import "package:async_helper/async_helper.dart";
 
 import '../../../sdk/lib/_internal/compiler/compiler.dart'
        show Diagnostic;
@@ -13,8 +14,7 @@
   Uri libraryRoot = script.resolve('../../../sdk/');
   Uri packageRoot = script.resolve('./packages/');
 
-  MemorySourceFileProvider.MEMORY_SOURCE_FILES = MEMORY_SOURCE_FILES;
-  var provider = new MemorySourceFileProvider();
+  var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);
   int warningCount = 0;
   int errorCount = 0;
   void diagnosticHandler(Uri uri, int begin, int end,
@@ -37,10 +37,12 @@
                                    libraryRoot,
                                    packageRoot,
                                    ['--analyze-only']);
-  compiler.run(Uri.parse('memory:main.dart'));
-  Expect.isTrue(compiler.compilationFailed);
-  Expect.equals(5, errorCount);
-  Expect.equals(1, warningCount);
+  asyncStart();
+  compiler.run(Uri.parse('memory:main.dart')).then((_) {
+    Expect.isTrue(compiler.compilationFailed);
+    Expect.equals(5, errorCount);
+    Expect.equals(1, warningCount);
+  }).whenComplete(() => asyncEnd());
 }
 
 const Map MEMORY_SOURCE_FILES = const {
diff --git a/tests/compiler/dart2js/bailout_indexable_test.dart b/tests/compiler/dart2js/bailout_indexable_test.dart
new file mode 100644
index 0000000..8a44ac8
--- /dev/null
+++ b/tests/compiler/dart2js/bailout_indexable_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2013, 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.
+
+import "package:expect/expect.dart";
+import 'compiler_helper.dart';
+
+const String TEST = '''
+foo(a) {
+  foo([]);
+  print(a[0]);
+}
+''';
+
+main() {
+  String generated = compile(
+      TEST,
+      entry: 'foo',
+      interceptorsSource: DEFAULT_INTERCEPTORSLIB
+      // ADD a bogus indexable class that does not have [].
+          + 'class BogusIndexable implements JSIndexable {}');
+
+  // Ensure that we still generate an optimized version, even if there
+  // is an indexable class that does not implement [].
+  Expect.isTrue(!generated.contains('index'));
+}
diff --git a/tests/compiler/dart2js/call_site_simple_type_inferer_test.dart b/tests/compiler/dart2js/call_site_simple_type_inferer_test.dart
index 9c7e0cd..b568b19 100644
--- a/tests/compiler/dart2js/call_site_simple_type_inferer_test.dart
+++ b/tests/compiler/dart2js/call_site_simple_type_inferer_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'
     show TypeMask;
 
@@ -15,12 +16,14 @@
                     bool disableInlining,
                     check(compiler, element)) {
   Uri uri = new Uri(scheme: 'source');
+  asyncStart();
   var compiler = compilerFor(code, uri);
   compiler.disableInlining = disableInlining;
-  compiler.runCompiler(uri);
-  var cls = findElement(compiler, className);
-  var member = cls.lookupLocalMember(buildSourceString(memberName));
-  return check(compiler, member);
+  compiler.runCompiler(uri).then((_) {
+    var cls = findElement(compiler, className);
+    var member = cls.lookupLocalMember(buildSourceString(memberName));
+    return check(compiler, member);
+  }).whenComplete(() => asyncEnd());
 }
 
 const String TEST_1 = r"""
diff --git a/tests/compiler/dart2js/class_codegen2_test.dart b/tests/compiler/dart2js/class_codegen2_test.dart
index 99e329d..458e1d3 100644
--- a/tests/compiler/dart2js/class_codegen2_test.dart
+++ b/tests/compiler/dart2js/class_codegen2_test.dart
@@ -3,7 +3,9 @@
 // BSD-style license that can be found in the LICENSE file.
 // Test that parameters keep their names in the output.
 
+import 'dart:async';
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 import 'parser_helper.dart';
 
@@ -87,15 +89,11 @@
   // At some point Dart2js generated bad object literals with dangling commas:
   // { a: true, }. Make sure this doesn't happen again.
   RegExp danglingComma = new RegExp(r',[ \n]*}');
-  String generated = compileAll(TEST_ONE);
-  Expect.isFalse(danglingComma.hasMatch(generated));
 
-  generated = compileAll(TEST_TWO);
-  Expect.isFalse(danglingComma.hasMatch(generated));
-
-  generated = compileAll(TEST_THREE);
-  Expect.isFalse(danglingComma.hasMatch(generated));
-
-  generated = compileAll(TEST_FOUR);
-  Expect.isFalse(danglingComma.hasMatch(generated));
+  asyncStart();
+  Future.forEach([TEST_ONE, TEST_TWO, TEST_THREE, TEST_FOUR], (test) {
+    return compileAll(test).then((generated) {
+      Expect.isFalse(danglingComma.hasMatch(generated));
+    });
+  }).whenComplete(() => asyncEnd());
 }
diff --git a/tests/compiler/dart2js/class_codegen_test.dart b/tests/compiler/dart2js/class_codegen_test.dart
index b4e72c1..ed7c90c 100644
--- a/tests/compiler/dart2js/class_codegen_test.dart
+++ b/tests/compiler/dart2js/class_codegen_test.dart
@@ -3,7 +3,9 @@
 // BSD-style license that can be found in the LICENSE file.
 // Test that parameters keep their names in the output.
 
+import 'dart:async';
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 import 'parser_helper.dart';
 
@@ -64,9 +66,10 @@
 """;
 
 twoClasses() {
-  String generated = compileAll(TEST_ONE);
-  Expect.isTrue(generated.contains('A: {"": "Object;"'));
-  Expect.isTrue(generated.contains('B: {"": "Object;"'));
+  asyncTest(() => compileAll(TEST_ONE).then((generated) {
+    Expect.isTrue(generated.contains('A: {"": "Object;"'));
+    Expect.isTrue(generated.contains('B: {"": "Object;"'));
+  }));
 }
 
 subClass() {
@@ -75,18 +78,20 @@
     Expect.isTrue(generated.contains('B: {"": "A;"'));
   }
 
-  checkOutput(compileAll(TEST_TWO));
-  checkOutput(compileAll(TEST_THREE));
+  asyncTest(() => compileAll(TEST_TWO).then(checkOutput));
+  asyncTest(() => compileAll(TEST_THREE).then(checkOutput));
 }
 
 fieldTest() {
-  String generated = compileAll(TEST_FOUR);
-  Expect.isTrue(generated.contains(r"""B: {"": "A;y,z,x", static:"""));
+  asyncTest(() => compileAll(TEST_FOUR).then((generated) {
+    Expect.isTrue(generated.contains(r"""B: {"": "A;y,z,x", static:"""));
+  }));
 }
 
 constructor1() {
-  String generated = compileAll(TEST_FIVE);
-  Expect.isTrue(generated.contains(new RegExp(r"new [$a-z]+\.A\(a\);")));
+  asyncTest(() => compileAll(TEST_FIVE).then((generated) {
+    Expect.isTrue(generated.contains(new RegExp(r"new [$a-z]+\.A\(a\);")));
+  }));
 }
 
 main() {
diff --git a/tests/compiler/dart2js/class_order_test.dart b/tests/compiler/dart2js/class_order_test.dart
index a4cc29e..26850f0 100644
--- a/tests/compiler/dart2js/class_order_test.dart
+++ b/tests/compiler/dart2js/class_order_test.dart
@@ -4,6 +4,7 @@
 // Test that parameters keep their names in the output.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 const String TEST_ONE = r"""
@@ -35,9 +36,11 @@
   // we just verify that their members are in the correct order.
   RegExp regexp = new RegExp(r"foo\$0?:(.|\n)*bar\$0:(.|\n)*gee\$0:");
 
-  String generated = compileAll(TEST_ONE);
-  Expect.isTrue(regexp.hasMatch(generated));
+  asyncTest(() => compileAll(TEST_ONE).then((generated) {
+    Expect.isTrue(regexp.hasMatch(generated));
+  }));
 
-  generated = compileAll(TEST_TWO);
-  Expect.isTrue(regexp.hasMatch(generated));
+  asyncTest(() => compileAll(TEST_TWO).then((generated) {
+    Expect.isTrue(regexp.hasMatch(generated));
+  }));
 }
diff --git a/tests/compiler/dart2js/closure_codegen_test.dart b/tests/compiler/dart2js/closure_codegen_test.dart
index b4399a8..0474b02 100644
--- a/tests/compiler/dart2js/closure_codegen_test.dart
+++ b/tests/compiler/dart2js/closure_codegen_test.dart
@@ -4,6 +4,7 @@
 // Test that parameters keep their names in the output.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 import 'parser_helper.dart';
 
@@ -52,10 +53,11 @@
 // Make sure that the bailout version does not introduce a second version of
 // the closure.
 closureBailout() {
-  String generated = compileAll(TEST_BAILOUT);
-  RegExp regexp = new RegExp(r'call\$0: function');
-  Iterator<Match> matches = regexp.allMatches(generated).iterator;
-  checkNumberOfMatches(matches, 1);
+  asyncTest(() => compileAll(TEST_BAILOUT).then((generated) {
+    RegExp regexp = new RegExp(r'call\$0: function');
+    Iterator<Match> matches = regexp.allMatches(generated).iterator;
+    checkNumberOfMatches(matches, 1);
+  }));
 }
 
 main() {
diff --git a/tests/compiler/dart2js/codegen_helper.dart b/tests/compiler/dart2js/codegen_helper.dart
index 4e8d498..1993ec5 100644
--- a/tests/compiler/dart2js/codegen_helper.dart
+++ b/tests/compiler/dart2js/codegen_helper.dart
@@ -2,19 +2,20 @@
 // 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 'dart:async';
 import 'package:expect/expect.dart';
 
 import 'memory_source_file_helper.dart';
 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart"
     show SourceString;
 
-Map<String, String> generate(String code, [List<String> options = const []]) {
+Future<Map<String, String>> generate(String code,
+    [List<String> options = const []]) {
   Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
   Uri libraryRoot = script.resolve('../../../sdk/');
   Uri packageRoot = script.resolve('./packages/');
 
-  MemorySourceFileProvider.MEMORY_SOURCE_FILES = { 'main.dart': code };
-  var provider = new MemorySourceFileProvider();
+  var provider = new MemorySourceFileProvider({ 'main.dart': code });
   var handler = new FormattingDiagnosticHandler(provider);
 
   Compiler compiler = new Compiler(provider.readStringFromUri,
@@ -24,13 +25,15 @@
                                    packageRoot,
                                    options);
   Uri uri = Uri.parse('memory:main.dart');
-  Expect.isTrue(compiler.run(uri));
-  Map<String, String> result = new Map<String, String>();
-  for (var element in compiler.backend.generatedCode.keys) {
-    if (element.getCompilationUnit().script.uri != uri) continue;
-    var name = element.name.slowToString();
-    var code = compiler.backend.assembleCode(element);
-    result[name] = code;
-  }
-  return result;
+  return compiler.run(uri).then((success) {
+    Expect.isTrue(success);
+    Map<String, String> result = new Map<String, String>();
+    for (var element in compiler.backend.generatedCode.keys) {
+      if (element.getCompilationUnit().script.uri != uri) continue;
+      var name = element.name.slowToString();
+      var code = compiler.backend.assembleCode(element);
+      result[name] = code;
+    }
+    return result;
+  });
 }
diff --git a/tests/compiler/dart2js/compiler_helper.dart b/tests/compiler/dart2js/compiler_helper.dart
index d891603..98aeb8a 100644
--- a/tests/compiler/dart2js/compiler_helper.dart
+++ b/tests/compiler/dart2js/compiler_helper.dart
@@ -5,6 +5,7 @@
 
 library compiler_helper;
 
+import 'dart:async';
 import "package:expect/expect.dart";
 
 import '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart'
@@ -90,40 +91,42 @@
   return compiler;
 }
 
-String compileAll(String code, {String coreSource: DEFAULT_CORELIB}) {
+Future<String> compileAll(String code, {String coreSource: DEFAULT_CORELIB}) {
   Uri uri = new Uri(scheme: 'source');
   MockCompiler compiler = compilerFor(code, uri, coreSource: coreSource);
-  compiler.runCompiler(uri);
-  Expect.isFalse(compiler.compilationFailed,
-                 'Unexpected compilation error');
-  return compiler.assembledCode;
+  return compiler.runCompiler(uri).then((_) {
+    Expect.isFalse(compiler.compilationFailed,
+                   'Unexpected compilation error');
+    return compiler.assembledCode;
+  });
 }
 
-dynamic compileAndCheck(String code,
-                        String name,
-                        check(MockCompiler compiler, lego.Element element)) {
+Future compileAndCheck(String code,
+                       String name,
+                       check(MockCompiler compiler, lego.Element element)) {
   Uri uri = new Uri(scheme: 'source');
   MockCompiler compiler = compilerFor(code, uri);
-  compiler.runCompiler(uri);
-  lego.Element element = findElement(compiler, name);
-  return check(compiler, element);
+  return compiler.runCompiler(uri).then((_) {
+    lego.Element element = findElement(compiler, name);
+    return check(compiler, element);
+  });
 }
 
-compileSources(Map<String, String> sources,
+Future compileSources(Map<String, String> sources,
                check(MockCompiler compiler)) {
   Uri base = new Uri(scheme: 'source');
   Uri mainUri = base.resolve('main.dart');
   String mainCode = sources['main.dart'];
   Expect.isNotNull(mainCode, 'No source code found for "main.dart"');
   MockCompiler compiler = compilerFor(mainCode, mainUri);
-
   sources.forEach((String path, String code) {
     if (path == 'main.dart') return;
     compiler.registerSource(base.resolve(path), code);
   });
 
-  compiler.runCompiler(mainUri);
-  return check(compiler);
+  return compiler.runCompiler(mainUri).then((_) {
+    return check(compiler);
+  });
 }
 
 lego.Element findElement(compiler, String name) {
diff --git a/tests/compiler/dart2js/concrete_type_inference_test.dart b/tests/compiler/dart2js/concrete_type_inference_test.dart
index fe95c49..b01868b 100644
--- a/tests/compiler/dart2js/concrete_type_inference_test.dart
+++ b/tests/compiler/dart2js/concrete_type_inference_test.dart
@@ -2,21 +2,24 @@
 // 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 'dart:async';
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 import 'parser_helper.dart';
 
-void compileAndFind(String code, String name,
+Future compileAndFind(String code, String name,
                     check(compiler, element)) {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(code, uri);
-  compiler.runCompiler(uri);
-  var element = findElement(compiler, name);
-  return check(compiler, element);
+  return compiler.runCompiler(uri).then((_) {
+    var element = findElement(compiler, name);
+    check(compiler, element);
+  });
 }
 
 void checkPrintType(String expression, checkType(compiler, type)) {
-  compileAndFind(
+  asyncTest(() => compileAndFind(
       'main() { print($expression); }',
       'print',
       (compiler, printElement) {
@@ -24,9 +27,9 @@
           printElement.computeSignature(compiler).requiredParameters.head;
         var type = compiler.typesTask.getGuaranteedTypeOfElement(parameter);
         checkType(compiler, type);
-      });
+      }));
 
-  compileAndFind(
+  asyncTest(() => compileAndFind(
       'main() { var x = print; print($expression); }',
       'print',
       (compiler, printElement) {
@@ -36,9 +39,9 @@
         var inferrer = compiler.typesTask.typesInferrer;
         Expect.identical(compiler.typesTask.dynamicType,
                          type.simplify(compiler));
-      });
+      }));
 
-  compileAndFind(
+  asyncTest(() => compileAndFind(
       'main() { print($expression); print($expression); }',
       'print',
       (compiler, printElement) {
@@ -46,7 +49,7 @@
           printElement.computeSignature(compiler).requiredParameters.head;
         var type = compiler.typesTask.getGuaranteedTypeOfElement(parameter);
         checkType(compiler, type);
-      });
+      }));
 }
 
 void testBasicTypes() {
@@ -54,7 +57,7 @@
     var inferrer = compiler.typesTask.typesInferrer;
     Expect.identical(compiler.typesTask.boolType, type);
   });
-  checkPrintType('1.0', (compiler, type) {
+  checkPrintType('1.5', (compiler, type) {
     var inferrer = compiler.typesTask.typesInferrer;
     Expect.identical(compiler.typesTask.doubleType, type);
   });
diff --git a/tests/compiler/dart2js/cpa_inference_test.dart b/tests/compiler/dart2js/cpa_inference_test.dart
index bbe7d38..ab3b4be 100644
--- a/tests/compiler/dart2js/cpa_inference_test.dart
+++ b/tests/compiler/dart2js/cpa_inference_test.dart
@@ -2,7 +2,9 @@
 // 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 'dart:async';
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart';
 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart';
 import '../../../sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart';
@@ -145,7 +147,7 @@
 
 const String CORELIB = r'''
   print(var obj) {}
-  abstract class num { 
+  abstract class num {
     num operator +(num x);
     num operator *(num x);
     num operator -(num x);
@@ -174,7 +176,7 @@
   class Dynamic_ {}
   bool identical(Object a, Object b) {}''';
 
-AnalysisResult analyze(String code, {int maxConcreteTypeSize: 1000}) {
+Future<AnalysisResult> analyze(String code, {int maxConcreteTypeSize: 1000}) {
   Uri uri = new Uri(scheme: 'source');
   MockCompiler compiler = new MockCompiler(
       coreSource: CORELIB,
@@ -182,8 +184,9 @@
       maxConcreteTypeSize: maxConcreteTypeSize);
   compiler.sourceFiles[uri.toString()] = new SourceFile(uri.toString(), code);
   compiler.typesTask.concreteTypesInferrer.testMode = true;
-  compiler.runCompiler(uri);
-  return new AnalysisResult(compiler);
+  return compiler.runCompiler(uri).then((_) {
+    return new AnalysisResult(compiler);
+  });
 }
 
 testDynamicBackDoor() {
@@ -193,8 +196,9 @@
       x;
     }
     """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasUnknownType('x');
+  return analyze(source).then((result) {
+    result.checkNodeHasUnknownType('x');
+  });
 }
 
 testVariableDeclaration() {
@@ -206,9 +210,10 @@
         v1; v2;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('v1', [result.nullType]);
-  result.checkNodeHasType('v2', [result.int]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('v1', [result.nullType]);
+    result.checkNodeHasType('v2', [result.int]);
+  });
 }
 
 testLiterals() {
@@ -222,12 +227,13 @@
         v1; v2; v3; v4; v5;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('v1', [result.int]);
-  result.checkNodeHasType('v2', [result.double]);
-  result.checkNodeHasType('v3', [result.string]);
-  result.checkNodeHasType('v4', [result.bool]);
-  result.checkNodeHasType('v5', [result.nullType]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('v1', [result.int]);
+    result.checkNodeHasType('v2', [result.double]);
+    result.checkNodeHasType('v3', [result.string]);
+    result.checkNodeHasType('v4', [result.bool]);
+    result.checkNodeHasType('v5', [result.nullType]);
+  });
 }
 
 testRedefinition() {
@@ -238,8 +244,9 @@
         foo;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('foo', [result.string]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('foo', [result.string]);
+  });
 }
 
 testIfThenElse() {
@@ -254,8 +261,9 @@
         foo;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('foo', [result.string, result.bool]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('foo', [result.string, result.bool]);
+  });
 }
 
 testTernaryIf() {
@@ -266,8 +274,9 @@
         foo;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('foo', [result.string, result.bool]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('foo', [result.string, result.bool]);
+  });
 }
 
 testWhile() {
@@ -284,12 +293,13 @@
         foo; bar;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType(
-      'foo',
-      [result.base('A'), result.base('B'), result.base('C')]);
-  // Check that the condition is evaluated.
-  result.checkNodeHasType('bar', [result.int]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType(
+        'foo',
+        [result.base('A'), result.base('B'), result.base('C')]);
+    // Check that the condition is evaluated.
+    result.checkNodeHasType('bar', [result.int]);
+  });
 }
 
 testDoWhile() {
@@ -306,12 +316,13 @@
         foo; bar;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType(
-      'foo',
-      [result.base('A'), result.base('B'), result.base('C')]);
-  // Check that the condition is evaluated.
-  result.checkNodeHasType('bar', [result.int]);
+  return analyze(source).then((AnalysisResult result) {
+    result.checkNodeHasType(
+        'foo',
+        [result.base('A'), result.base('B'), result.base('C')]);
+    // Check that the condition is evaluated.
+    result.checkNodeHasType('bar', [result.int]);
+  });
 }
 
 testFor1() {
@@ -327,10 +338,11 @@
         foo;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType(
-      'foo',
-      [result.base('A'), result.base('B'), result.base('C')]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType(
+        'foo',
+        [result.base('A'), result.base('B'), result.base('C')]);
+  });
 }
 
 testFor2() {
@@ -346,10 +358,11 @@
         foo; bar;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('foo', [result.base('A'), result.base('B')]);
-  // Check that the condition is evaluated.
-  result.checkNodeHasType('bar', [result.int]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('foo', [result.base('A'), result.base('B')]);
+    // Check that the condition is evaluated.
+    result.checkNodeHasType('bar', [result.int]);
+  });
 }
 
 testFor3() {
@@ -363,8 +376,9 @@
         i;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('i', [result.int]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('i', [result.int]);
+  });
 }
 
 testForIn() {
@@ -399,8 +413,10 @@
         res;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('res', [result.int, result.string, result.nullType]);
+  return analyze(source).then((AnalysisResult result) {
+    result.checkNodeHasType('res',
+        [result.int, result.string, result.nullType]);
+  });
 }
 
 testToplevelVariable() {
@@ -409,15 +425,16 @@
       class A {
          f() => top;
       }
-      main() { 
+      main() {
         var foo = top;
         var bar = new A().f();
         foo; bar;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('foo', [result.string]);
-  result.checkNodeHasType('bar', [result.string]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('foo', [result.string]);
+    result.checkNodeHasType('bar', [result.string]);
+  });
 }
 
 testNonRecusiveFunction() {
@@ -425,8 +442,9 @@
       f(x, y) => true ? x : y;
       main() { var foo = f(42, "abc"); foo; }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('foo', [result.int, result.string]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('foo', [result.int, result.string]);
+  });
 }
 
 testRecusiveFunction() {
@@ -437,18 +455,20 @@
       }
       main() { var foo = f(42); foo; }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('foo', [result.int, result.string]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('foo', [result.int, result.string]);
+  });
 }
 
 testMutuallyRecusiveFunction() {
   final String source = r"""
       f() => true ? 42 : g();
-      g() => true ? "abc" : f(); 
+      g() => true ? "abc" : f();
       main() { var foo = f(); foo; }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('foo', [result.int, result.string]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('foo', [result.int, result.string]);
+  });
 }
 
 testSimpleSend() {
@@ -463,7 +483,7 @@
         f(x) => 3.14;
       }
       class D {
-        var f;  // we check that this field is ignored in calls to dynamic.f() 
+        var f;  // we check that this field is ignored in calls to dynamic.f()
         D(this.f);
       }
       main() {
@@ -473,9 +493,10 @@
         foo; bar;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('foo', [result.int]);
-  result.checkNodeHasType('bar', [result.int, result.string]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('foo', [result.int]);
+    result.checkNodeHasType('bar', [result.int, result.string]);
+  });
 }
 
 testSendToClosureField() {
@@ -490,8 +511,9 @@
         foo;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('foo', [result.int]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('foo', [result.int]);
+  });
 }
 
 testSendToThis1() {
@@ -506,8 +528,9 @@
         foo;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('foo', [result.int]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('foo', [result.int]);
+  });
 }
 
 testSendToThis2() {
@@ -523,8 +546,9 @@
         x;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('x', [result.base('B')]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('x', [result.base('B')]);
+  });
 }
 
 testSendToThis3() {
@@ -541,8 +565,9 @@
         x;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('x', [result.string]);
+  return analyze(source).then((AnalysisResult result) {
+    result.checkNodeHasType('x', [result.string]);
+  });
 }
 
 testConstructor() {
@@ -556,11 +581,12 @@
         new A(true, null);
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkFieldHasType('A', 'x', [result.int, result.bool]);
-  result.checkFieldHasType('A', 'y', [result.string, result.nullType]);
-  // TODO(polux): we can be smarter and infer {string} for z
-  result.checkFieldHasType('A', 'z', [result.string, result.nullType]);
+  return analyze(source).then((result) {
+    result.checkFieldHasType('A', 'x', [result.int, result.bool]);
+    result.checkFieldHasType('A', 'y', [result.string, result.nullType]);
+    // TODO(polux): we can be smarter and infer {string} for z
+    result.checkFieldHasType('A', 'z', [result.string, result.nullType]);
+  });
 }
 
 testGetters() {
@@ -586,12 +612,13 @@
         foo; bar; baz; qux; quux;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('foo', [result.int]);
-  result.checkNodeHasType('bar', [result.int]);
-  result.checkNodeHasType('baz', [result.int]);
-  result.checkNodeHasType('qux', []);
-  result.checkNodeHasType('quux', [result.int, result.string]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('foo', [result.int]);
+    result.checkNodeHasType('bar', [result.int]);
+    result.checkNodeHasType('baz', [result.int]);
+    result.checkNodeHasType('qux', []);
+    result.checkNodeHasType('quux', [result.int, result.string]);
+  });
 }
 
 testSetters() {
@@ -617,20 +644,21 @@
         "__dynamic_for_test".y = 3.14;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkFieldHasType('B', 'x',
-                           [result.int,         // new B(42)
-                            result.nullType]);  // dynamic.x = null
-  result.checkFieldHasType('A', 'x',
-                           [result.int,       // new A(42, ...)
-                            result.string,    // a.x = 'abc'
-                            result.bool,      // a.y = true
-                            result.nullType,  // dynamic.x = null
-                            result.double]);  // dynamic.y = 3.14
-  result.checkFieldHasType('A', 'w',
-                           [result.int,       // new A(..., 42)
-                            result.bool,      // a.y = true
-                            result.double]);  // dynamic.y = double
+  return analyze(source).then((result) {
+    result.checkFieldHasType('B', 'x',
+                             [result.int,         // new B(42)
+                              result.nullType]);  // dynamic.x = null
+    result.checkFieldHasType('A', 'x',
+                             [result.int,       // new A(42, ...)
+                              result.string,    // a.x = 'abc'
+                              result.bool,      // a.y = true
+                              result.nullType,  // dynamic.x = null
+                              result.double]);  // dynamic.y = 3.14
+    result.checkFieldHasType('A', 'w',
+                             [result.int,       // new A(..., 42)
+                              result.bool,      // a.y = true
+                              result.double]);  // dynamic.y = double
+  });
 }
 
 testOptionalNamedParameters() {
@@ -695,29 +723,30 @@
         test.f3(1, z: 2);  // non-existing named parameter
       }
       """;
-  AnalysisResult result = analyze(source);
+  return analyze(source).then((result) {
 
-  final foo = result.base('Foo');
-  final nil = result.nullType;
+    final foo = result.base('Foo');
+    final nil = result.nullType;
 
-  result.checkFieldHasType('A', 'x', [result.int, result.string]);
-  result.checkFieldHasType('A', 'y', [nil]);
-  result.checkFieldHasType('A', 'z', [nil, result.double]);
-  result.checkFieldHasType('A', 'w', [nil, result.bool]);
-  result.checkFieldHasType('Test', 'a', [foo, result.int, result.string]);
-  result.checkFieldHasType('Test', 'b', [foo, nil]);
-  result.checkFieldHasType('Test', 'c', [foo, nil, result.double]);
-  result.checkFieldHasType('Test', 'd', [foo, nil, result.bool]);
+    result.checkFieldHasType('A', 'x', [result.int, result.string]);
+    result.checkFieldHasType('A', 'y', [nil]);
+    result.checkFieldHasType('A', 'z', [nil, result.double]);
+    result.checkFieldHasType('A', 'w', [nil, result.bool]);
+    result.checkFieldHasType('Test', 'a', [foo, result.int, result.string]);
+    result.checkFieldHasType('Test', 'b', [foo, nil]);
+    result.checkFieldHasType('Test', 'c', [foo, nil, result.double]);
+    result.checkFieldHasType('Test', 'd', [foo, nil, result.bool]);
 
-  result.checkFieldHasType('B', 'x', [result.string]);
-  result.checkFieldHasType('B', 'y', [result.bool]);
-  result.checkFieldHasType('Test', 'e', [foo, result.string]);
-  result.checkFieldHasType('Test', 'f', [foo, result.bool]);
+    result.checkFieldHasType('B', 'x', [result.string]);
+    result.checkFieldHasType('B', 'y', [result.bool]);
+    result.checkFieldHasType('Test', 'e', [foo, result.string]);
+    result.checkFieldHasType('Test', 'f', [foo, result.bool]);
 
-  result.checkFieldHasType('C', 'x', [result.string]);
-  result.checkFieldHasType('C', 'y', [result.bool]);
-  result.checkFieldHasType('Test', 'g', [foo, result.string]);
-  result.checkFieldHasType('Test', 'h', [foo, result.bool]);
+    result.checkFieldHasType('C', 'x', [result.string]);
+    result.checkFieldHasType('C', 'y', [result.bool]);
+    result.checkFieldHasType('Test', 'g', [foo, result.string]);
+    result.checkFieldHasType('Test', 'h', [foo, result.bool]);
+  });
 }
 
 testOptionalPositionalParameters() {
@@ -767,24 +796,25 @@
       test.f2(1, 2, 3);  // too many arguments
     }
   """;
-  AnalysisResult result = analyze(source);
+  return analyze(source).then((result) {
 
-  final foo = result.base('Foo');
-  final nil = result.nullType;
+    final foo = result.base('Foo');
+    final nil = result.nullType;
 
-  result.checkFieldHasType('A', 'x', [result.int, result.string]);
-  result.checkFieldHasType('A', 'y', [nil, result.bool]);
-  result.checkFieldHasType('A', 'z', [nil, result.double]);
-  result.checkFieldHasType('A', 'w', [nil]);
-  result.checkFieldHasType('Test', 'a', [foo, result.int, result.string]);
-  result.checkFieldHasType('Test', 'b', [foo, nil, result.bool]);
-  result.checkFieldHasType('Test', 'c', [foo, nil, result.double]);
-  result.checkFieldHasType('Test', 'd', [foo, nil]);
+    result.checkFieldHasType('A', 'x', [result.int, result.string]);
+    result.checkFieldHasType('A', 'y', [nil, result.bool]);
+    result.checkFieldHasType('A', 'z', [nil, result.double]);
+    result.checkFieldHasType('A', 'w', [nil]);
+    result.checkFieldHasType('Test', 'a', [foo, result.int, result.string]);
+    result.checkFieldHasType('Test', 'b', [foo, nil, result.bool]);
+    result.checkFieldHasType('Test', 'c', [foo, nil, result.double]);
+    result.checkFieldHasType('Test', 'd', [foo, nil]);
 
-  result.checkFieldHasType('B', 'x', [result.string]);
-  result.checkFieldHasType('B', 'y', [result.bool]);
-  result.checkFieldHasType('Test', 'e', [foo, result.string]);
-  result.checkFieldHasType('Test', 'f', [foo, result.bool]);
+    result.checkFieldHasType('B', 'x', [result.string]);
+    result.checkFieldHasType('B', 'y', [result.bool]);
+    result.checkFieldHasType('Test', 'e', [foo, result.string]);
+    result.checkFieldHasType('Test', 'f', [foo, result.bool]);
+  });
 }
 
 testListLiterals() {
@@ -799,10 +829,11 @@
         x; y;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('x', [result.growableList]);
-  result.checkNodeHasType('y', [result.growableList]);
-  result.checkFieldHasType('A', 'x', [result.int]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('x', [result.growableList]);
+    result.checkNodeHasType('y', [result.growableList]);
+    result.checkFieldHasType('A', 'x', [result.int]);
+  });
 }
 
 testMapLiterals() {
@@ -817,10 +848,11 @@
         x; y;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('x', [result.map]);
-  result.checkNodeHasType('y', [result.map]);
-  result.checkFieldHasType('A', 'x', [result.int]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('x', [result.map]);
+    result.checkNodeHasType('y', [result.map]);
+    result.checkFieldHasType('A', 'x', [result.int]);
+  });
 }
 
 testReturn() {
@@ -833,9 +865,10 @@
         x; y;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('x', [result.int, result.string]);
-  result.checkNodeHasType('y', [result.nullType]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('x', [result.int, result.string]);
+    result.checkNodeHasType('y', [result.nullType]);
+  });
 }
 
 testNoReturn() {
@@ -848,9 +881,10 @@
         x; y;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('x', [result.int, result.nullType]);
-  result.checkNodeHasType('y', [result.nullType]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('x', [result.int, result.nullType]);
+    result.checkNodeHasType('y', [result.nullType]);
+  });
 }
 
 testArithmeticOperators() {
@@ -872,21 +906,22 @@
           a; b; c; d; e; f; g; h; i; j; k; l;
         }""";
   }
-  for (String op in ['+', '*', '-']) {
-    AnalysisResult result = analyze(source(op));
-    result.checkNodeHasType('a', [result.int]);
-    result.checkNodeHasType('b', [result.num]);
-    result.checkNodeHasType('c', [result.num]);
-    result.checkNodeHasType('d', [result.double]);
-    result.checkNodeHasType('e', [result.num]);
-    result.checkNodeHasType('f', [result.num]);
-    result.checkNodeHasType('g', [result.num]);
-    result.checkNodeHasType('h', [result.num]);
-    result.checkNodeHasType('i', [result.int]);
-    result.checkNodeHasType('j', [result.int]);
-    result.checkNodeHasType('k', [result.double]);
-    result.checkNodeHasType('l', [result.double]);
-  }
+  return Future.forEach(['+', '*', '-'], (String op) {
+    return analyze(source(op)).then((result) {
+      result.checkNodeHasType('a', [result.int]);
+      result.checkNodeHasType('b', [result.num]);
+      result.checkNodeHasType('c', [result.num]);
+      result.checkNodeHasType('d', [result.double]);
+      result.checkNodeHasType('e', [result.num]);
+      result.checkNodeHasType('f', [result.num]);
+      result.checkNodeHasType('g', [result.num]);
+      result.checkNodeHasType('h', [result.num]);
+      result.checkNodeHasType('i', [result.int]);
+      result.checkNodeHasType('j', [result.int]);
+      result.checkNodeHasType('k', [result.double]);
+      result.checkNodeHasType('l', [result.double]);
+    });
+  });
 }
 
 testBooleanOperators() {
@@ -900,13 +935,14 @@
           a; b; c; d;
         }""";
   }
-  for (String op in ['&&', '||']) {
-    AnalysisResult result = analyze(source(op));
-    result.checkNodeHasType('a', [result.bool]);
-    result.checkNodeHasType('b', [result.bool]);
-    result.checkNodeHasType('c', [result.bool]);
-    result.checkNodeHasType('d', [result.bool]);
-  }
+  return Future.forEach(['&&', '||'], (String op) {
+    return analyze(source(op)).then((result) {
+      result.checkNodeHasType('a', [result.bool]);
+      result.checkNodeHasType('b', [result.bool]);
+      result.checkNodeHasType('c', [result.bool]);
+      result.checkNodeHasType('d', [result.bool]);
+    });
+  });
 }
 
 testBooleanOperatorsShortCirtcuit() {
@@ -918,10 +954,11 @@
           x;
         }""";
   }
-  for (String op in ['&&', '||']) {
-    AnalysisResult result = analyze(source(op));
-    result.checkNodeHasType('x', [result.nullType, result.int]);
-  }
+  return Future.forEach(['&&', '||'], (String op) {
+    return analyze(source(op)).then((AnalysisResult result) {
+      result.checkNodeHasType('x', [result.nullType, result.int]);
+    });
+  });
 }
 
 testOperators() {
@@ -936,9 +973,10 @@
         x; y;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('x', [result.int]);
-  result.checkNodeHasType('y', [result.string]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('x', [result.int]);
+    result.checkNodeHasType('y', [result.string]);
+  });
 }
 
 testSetIndexOperator() {
@@ -953,10 +991,11 @@
         x;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('x', [result.string]);
-  result.checkFieldHasType('A', 'witness1', [result.int, result.nullType]);
-  result.checkFieldHasType('A', 'witness2', [result.string, result.nullType]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('x', [result.string]);
+    result.checkFieldHasType('A', 'witness1', [result.int, result.nullType]);
+    result.checkFieldHasType('A', 'witness2', [result.string, result.nullType]);
+  });
 }
 
 testCompoundOperators1() {
@@ -981,13 +1020,14 @@
         x1; x2; x3; x4; x5; x6;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('x1', [result.int]);
-  result.checkNodeHasType('x2', [result.int]);
-  result.checkNodeHasType('x3', [result.int]);
-  result.checkNodeHasType('x4', [result.string]);
-  result.checkNodeHasType('x5', [result.string]);
-  result.checkNodeHasType('x6', [result.string]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('x1', [result.int]);
+    result.checkNodeHasType('x2', [result.int]);
+    result.checkNodeHasType('x3', [result.int]);
+    result.checkNodeHasType('x4', [result.string]);
+    result.checkNodeHasType('x5', [result.string]);
+    result.checkNodeHasType('x6', [result.string]);
+  });
 }
 
 
@@ -1010,16 +1050,17 @@
     main () {
       var a = new A(1, 1);
       a.x++;
-      a.y++; 
+      a.y++;
     }
     """;
-  AnalysisResult result = analyze(source);
-  result.checkFieldHasType('A', 'xx', [result.int]);
-  result.checkFieldHasType('A', 'yy', [result.int]);
-  result.checkFieldHasType('A', 'witness1', [result.string, result.nullType]);
-  result.checkFieldHasType('A', 'witness2', [result.string, result.nullType]);
-  result.checkFieldHasType('A', 'witness3', [result.string, result.nullType]);
-  result.checkFieldHasType('A', 'witness4', [result.string, result.nullType]);
+  return analyze(source).then((result) {
+    result.checkFieldHasType('A', 'xx', [result.int]);
+    result.checkFieldHasType('A', 'yy', [result.int]);
+    result.checkFieldHasType('A', 'witness1', [result.string, result.nullType]);
+    result.checkFieldHasType('A', 'witness2', [result.string, result.nullType]);
+    result.checkFieldHasType('A', 'witness3', [result.string, result.nullType]);
+    result.checkFieldHasType('A', 'witness4', [result.string, result.nullType]);
+  });
 }
 
 testInequality() {
@@ -1038,11 +1079,12 @@
         foo; bar; baz;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('foo', [result.bool]);
-  result.checkNodeHasType('bar', [result.bool]);
-  result.checkNodeHasType('baz', []);
-  result.checkFieldHasType('A', 'witness', [result.string, result.nullType]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('foo', [result.bool]);
+    result.checkNodeHasType('bar', [result.bool]);
+    result.checkNodeHasType('baz', []);
+    result.checkFieldHasType('A', 'witness', [result.string, result.nullType]);
+  });
 }
 
 testFieldInitialization1() {
@@ -1058,10 +1100,11 @@
       new B();
     }
     """;
-  AnalysisResult result = analyze(source);
-  result.checkFieldHasType('A', 'x', [result.nullType]);
-  result.checkFieldHasType('A', 'y', [result.int]);
-  result.checkFieldHasType('B', 'z', [result.string]);
+  return analyze(source).then((result) {
+    result.checkFieldHasType('A', 'x', [result.nullType]);
+    result.checkFieldHasType('A', 'y', [result.int]);
+    result.checkFieldHasType('B', 'z', [result.string]);
+  });
 }
 
 testFieldInitialization2() {
@@ -1074,8 +1117,9 @@
       new A();
     }
     """;
-  AnalysisResult result = analyze(source);
-  result.checkFieldHasType('A', 'x', [result.int]);
+  return analyze(source).then((result) {
+    result.checkFieldHasType('A', 'x', [result.int]);
+  });
 }
 
 testFieldInitialization3() {
@@ -1095,15 +1139,16 @@
       foo; bar;
     }
     """;
-  AnalysisResult result = analyze(source);
-  // checks that B.B is set as a reader of A.x
-  result.checkFieldHasType('B', 'x', [result.nullType, result.string]);
-  // checks that B.B is set as a caller of f
-  result.checkFieldHasType('B', 'y', [result.nullType, result.string]);
-  // checks that readers of x are notified by changes in x's type
-  result.checkNodeHasType('foo', [result.nullType, result.string]);
-  // checks that readers of y are notified by changes in y's type
-  result.checkNodeHasType('bar', [result.nullType, result.string]);
+  return analyze(source).then((result) {
+    // checks that B.B is set as a reader of A.x
+    result.checkFieldHasType('B', 'x', [result.nullType, result.string]);
+    // checks that B.B is set as a caller of f
+    result.checkFieldHasType('B', 'y', [result.nullType, result.string]);
+    // checks that readers of x are notified by changes in x's type
+    result.checkNodeHasType('foo', [result.nullType, result.string]);
+    // checks that readers of y are notified by changes in y's type
+    result.checkNodeHasType('bar', [result.nullType, result.string]);
+  });
 }
 
 testLists() {
@@ -1135,16 +1180,17 @@
       var x8 = l2.removeLast();
       x1; x2; x3; x4; x5; x6; x7; x8;
     }""";
-  AnalysisResult result = analyze(source);
-  final expectedTypes = ['A', 'C', 'D', 'F', 'G'].map(result.base).toList();
-  result.checkNodeHasType('x1', expectedTypes);
-  result.checkNodeHasType('x2', expectedTypes);
-  result.checkNodeHasType('x3', []);
-  result.checkNodeHasType('x4', expectedTypes);
-  result.checkNodeHasType('x5', expectedTypes);
-  result.checkNodeHasType('x6', []);
-  result.checkNodeHasType('x7', expectedTypes);
-  result.checkNodeHasType('x8', expectedTypes);
+  return analyze(source).then((result) {
+    final expectedTypes = ['A', 'C', 'D', 'F', 'G'].map(result.base).toList();
+    result.checkNodeHasType('x1', expectedTypes);
+    result.checkNodeHasType('x2', expectedTypes);
+    result.checkNodeHasType('x3', []);
+    result.checkNodeHasType('x4', expectedTypes);
+    result.checkNodeHasType('x5', expectedTypes);
+    result.checkNodeHasType('x6', []);
+    result.checkNodeHasType('x7', expectedTypes);
+    result.checkNodeHasType('x8', expectedTypes);
+  });
 }
 
 testListWithCapacity() {
@@ -1154,8 +1200,9 @@
       var x = [][0];
       x;
     }""";
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('x', [result.nullType]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('x', [result.nullType]);
+  });
 }
 
 testEmptyList() {
@@ -1165,8 +1212,9 @@
       var x = l[0];
       x;
     }""";
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('x', []);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('x', []);
+  });
 }
 
 testSendWithWrongArity() {
@@ -1181,11 +1229,12 @@
       x; y; z; w;
     }
     """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('x', []);
-  result.checkNodeHasType('y', []);
-  result.checkNodeHasType('z', []);
-  result.checkNodeHasType('w', []);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('x', []);
+    result.checkNodeHasType('y', []);
+    result.checkNodeHasType('z', []);
+    result.checkNodeHasType('w', []);
+  });
 }
 
 testBigTypesWidening1() {
@@ -1198,9 +1247,10 @@
       x; y;
     }
     """;
-  AnalysisResult result = analyze(source, maxConcreteTypeSize: 2);
-  result.checkNodeHasType('x', [result.int, result.string]);
-  result.checkNodeHasUnknownType('y');
+  return analyze(source, maxConcreteTypeSize: 2).then((result) {
+    result.checkNodeHasType('x', [result.int, result.string]);
+    result.checkNodeHasUnknownType('y');
+  });
 }
 
 testBigTypesWidening2() {
@@ -1216,9 +1266,10 @@
       a.y = true;
     }
     """;
-  AnalysisResult result = analyze(source, maxConcreteTypeSize: 2);
-  result.checkFieldHasType('A', 'x', [result.int, result.string]);
-  result.checkFieldHasUknownType('A', 'y');
+  return analyze(source, maxConcreteTypeSize: 2).then((result) {
+    result.checkFieldHasType('A', 'x', [result.int, result.string]);
+    result.checkFieldHasUknownType('A', 'y');
+  });
 }
 
 testDynamicIsAbsorbing() {
@@ -1233,8 +1284,9 @@
       x;
     }
     """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasUnknownType('x');
+  return analyze(source).then((result) {
+    result.checkNodeHasUnknownType('x');
+  });
 }
 
 testJsCall() {
@@ -1279,34 +1331,35 @@
       iNull; j;
     }
     """;
-  AnalysisResult result = analyze(source);
-  List maybe(List types) => new List.from(types)..add(result.nullType);
-  result.checkNodeHasUnknownType('a');
-  result.checkNodeHasUnknownType('b');
-  final expectedCType = [result.growableList];
-  result.checkNodeHasType('c', expectedCType);
-  result.checkNodeHasType('cNull', maybe(expectedCType));
-  final expectedDType = [result.string];
-  result.checkNodeHasType('d', expectedDType);
-  result.checkNodeHasType('dNull', maybe(expectedDType));
-  final expectedEType = [result.int];
-  result.checkNodeHasType('e', expectedEType);
-  result.checkNodeHasType('eNull', maybe(expectedEType));
-  final expectedFType = [result.double];
-  result.checkNodeHasType('f', expectedFType);
-  result.checkNodeHasType('fNull', maybe(expectedFType));
-  final expectedGType = [result.num];
-  result.checkNodeHasType('g', expectedGType);
-  result.checkNodeHasType('gNull', maybe(expectedGType));
-  final expectedHType = [result.bool];
-  result.checkNodeHasType('h', expectedHType);
-  result.checkNodeHasType('hNull', maybe(expectedHType));
-  final expectedIType = [result.base('A'), result.base('B'),
-                         result.base('BB'), result.base('C'),
-                         result.base('D')];
-  result.checkNodeHasType('i', expectedIType);
-  result.checkNodeHasType('iNull', maybe(expectedIType));
-  result.checkNodeHasType('j', []);
+  return analyze(source).then((result) {
+    List maybe(List types) => new List.from(types)..add(result.nullType);
+    result.checkNodeHasUnknownType('a');
+    result.checkNodeHasUnknownType('b');
+    final expectedCType = [result.growableList];
+    result.checkNodeHasType('c', expectedCType);
+    result.checkNodeHasType('cNull', maybe(expectedCType));
+    final expectedDType = [result.string];
+    result.checkNodeHasType('d', expectedDType);
+    result.checkNodeHasType('dNull', maybe(expectedDType));
+    final expectedEType = [result.int];
+    result.checkNodeHasType('e', expectedEType);
+    result.checkNodeHasType('eNull', maybe(expectedEType));
+    final expectedFType = [result.double];
+    result.checkNodeHasType('f', expectedFType);
+    result.checkNodeHasType('fNull', maybe(expectedFType));
+    final expectedGType = [result.num];
+    result.checkNodeHasType('g', expectedGType);
+    result.checkNodeHasType('gNull', maybe(expectedGType));
+    final expectedHType = [result.bool];
+    result.checkNodeHasType('h', expectedHType);
+    result.checkNodeHasType('hNull', maybe(expectedHType));
+    final expectedIType = [result.base('A'), result.base('B'),
+                           result.base('BB'), result.base('C'),
+                           result.base('D')];
+    result.checkNodeHasType('i', expectedIType);
+    result.checkNodeHasType('iNull', maybe(expectedIType));
+    result.checkNodeHasType('j', []);
+  });
 }
 
 testJsCallAugmentsSeenClasses() {
@@ -1316,20 +1369,23 @@
       x;
     }
     """;
-  AnalysisResult result1 = analyze(source1);
-  result1.checkNodeHasType('x', []);
+  return analyze(source1).then((AnalysisResult result) {
+    result.checkNodeHasType('x', []);
+  }).whenComplete(() {
 
-  final String source2 = r"""
-    import 'dart:foreign';
-
-    main () {
-      var x = "__dynamic_for_test".truncate();
-      JS('double', 'foo');
-      x;
-    }
-    """;
-  AnalysisResult result2 = analyze(source2);
-  result2.checkNodeHasType('x', [result2.int]);
+    final String source2 = r"""
+      import 'dart:foreign';
+  
+      main () {
+        var x = "__dynamic_for_test".truncate();
+        JS('double', 'foo');
+        x;
+      }
+      """;
+    return analyze(source2).then((AnalysisResult result) {
+      result.checkNodeHasType('x', [result.int]);
+    });
+  });
 }
 
 testIsCheck() {
@@ -1339,8 +1395,9 @@
       x;
     }
     """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('x', [result.bool]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('x', [result.bool]);
+  });
 }
 
 testSeenClasses() {
@@ -1366,8 +1423,9 @@
         foo;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('foo', [result.int]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('foo', [result.int]);
+  });
 }
 
 testIntDoubleNum() {
@@ -1379,10 +1437,11 @@
         a; b; c;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('a', [result.int]);
-  result.checkNodeHasType('b', [result.double]);
-  result.checkNodeHasType('c', [result.num]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('a', [result.int]);
+    result.checkNodeHasType('b', [result.double]);
+    result.checkNodeHasType('c', [result.num]);
+  });
 }
 
 testConcreteTypeToTypeMask() {
@@ -1398,46 +1457,48 @@
         new D();
       }
       """;
-  AnalysisResult result = analyze(source);
+  return analyze(source).then((result) {
 
-  convert(ConcreteType type) {
-    return result.compiler.typesTask.concreteTypesInferrer
-        .concreteTypeToTypeMask(type);
-  }
+    convert(ConcreteType type) {
+      return result.compiler.typesTask.concreteTypesInferrer
+          .concreteTypeToTypeMask(type);
+    }
 
-  final nullSingleton =
-      result.compiler.typesTask.concreteTypesInferrer.singletonConcreteType(
-          new NullBaseType());
+    final nullSingleton =
+        result.compiler.typesTask.concreteTypesInferrer.singletonConcreteType(
+            new NullBaseType());
 
-  singleton(ClassElement element) {
-    return result.compiler.typesTask.concreteTypesInferrer
-        .singletonConcreteType(new ClassBaseType(element));
-  }
+    singleton(ClassElement element) {
+      return result.compiler.typesTask.concreteTypesInferrer
+          .singletonConcreteType(new ClassBaseType(element));
+    }
 
-  ClassElement a = findElement(result.compiler, 'A');
-  ClassElement b = findElement(result.compiler, 'B');
-  ClassElement c = findElement(result.compiler, 'C');
-  ClassElement d = findElement(result.compiler, 'D');
+    ClassElement a = findElement(result.compiler, 'A');
+    ClassElement b = findElement(result.compiler, 'B');
+    ClassElement c = findElement(result.compiler, 'C');
+    ClassElement d = findElement(result.compiler, 'D');
 
-  for (ClassElement cls in [a, b, c, d]) {
-    Expect.equals(convert(singleton(cls)),
-                  new TypeMask.nonNullExact(cls.rawType));
-  }
+    for (ClassElement cls in [a, b, c, d]) {
+      Expect.equals(convert(singleton(cls)),
+                    new TypeMask.nonNullExact(cls.rawType));
+    }
 
-  for (ClassElement cls in [a, b, c, d]) {
-    Expect.equals(convert(singleton(cls).union(nullSingleton)),
-                  new TypeMask.exact(cls.rawType));
-  }
+    for (ClassElement cls in [a, b, c, d]) {
+      Expect.equals(convert(singleton(cls).union(nullSingleton)),
+                    new TypeMask.exact(cls.rawType));
+    }
 
-  Expect.equals(convert(singleton(a).union(singleton(b))),
-                new TypeMask.nonNullSubclass(a.rawType));
+    Expect.equals(convert(singleton(a).union(singleton(b))),
+                  new TypeMask.nonNullSubclass(a.rawType));
 
-  Expect.equals(convert(singleton(a).union(singleton(b)).union(nullSingleton)),
-                new TypeMask.subclass(a.rawType));
+    Expect.equals(
+        convert(singleton(a).union(singleton(b)).union(nullSingleton)),
+                  new TypeMask.subclass(a.rawType));
 
-  Expect.equals(
-      convert(singleton(b).union(singleton(d))).simplify(result.compiler),
-      new TypeMask.nonNullSubtype(a.rawType));
+    Expect.equals(
+        convert(singleton(b).union(singleton(d))).simplify(result.compiler),
+        new TypeMask.nonNullSubtype(a.rawType));
+  });
 }
 
 testSelectors() {
@@ -1463,45 +1524,46 @@
         new Z().foo();
       }
       """;
-  AnalysisResult result = analyze(source);
+  return analyze(source).then((result) {
 
-  inferredType(Selector selector) {
-    return result.compiler.typesTask.concreteTypesInferrer
-        .getTypeOfSelector(selector);
-  }
+    inferredType(Selector selector) {
+      return result.compiler.typesTask.concreteTypesInferrer
+          .getTypeOfSelector(selector);
+    }
 
-  ClassElement abc = findElement(result.compiler, 'ABC');
-  ClassElement bc = findElement(result.compiler, 'BC');
-  ClassElement a = findElement(result.compiler, 'A');
-  ClassElement b = findElement(result.compiler, 'B');
-  ClassElement c = findElement(result.compiler, 'C');
-  ClassElement xy = findElement(result.compiler, 'XY');
-  ClassElement x = findElement(result.compiler, 'X');
-  ClassElement y = findElement(result.compiler, 'Y');
-  ClassElement z = findElement(result.compiler, 'Z');
+    ClassElement abc = findElement(result.compiler, 'ABC');
+    ClassElement bc = findElement(result.compiler, 'BC');
+    ClassElement a = findElement(result.compiler, 'A');
+    ClassElement b = findElement(result.compiler, 'B');
+    ClassElement c = findElement(result.compiler, 'C');
+    ClassElement xy = findElement(result.compiler, 'XY');
+    ClassElement x = findElement(result.compiler, 'X');
+    ClassElement y = findElement(result.compiler, 'Y');
+    ClassElement z = findElement(result.compiler, 'Z');
 
-  Selector foo = new Selector.call(buildSourceString("foo"), null, 0);
+    Selector foo = new Selector.call(buildSourceString("foo"), null, 0);
 
-  Expect.equals(
-      inferredType(foo).simplify(result.compiler),
-      new TypeMask.nonNullSubclass(abc.rawType));
-  Expect.equals(
-      inferredType(new TypedSelector.subclass(x.rawType, foo)),
-      new TypeMask.nonNullExact(b.rawType));
-  Expect.equals(
-      inferredType(new TypedSelector.subclass(y.rawType, foo)),
-      new TypeMask.nonNullExact(c.rawType));
-  Expect.equals(
-      inferredType(new TypedSelector.subclass(z.rawType, foo)),
-      new TypeMask.nonNullExact(a.rawType));
-  Expect.equals(
-      inferredType(new TypedSelector.subclass(
-          xy.rawType, foo)).simplify(result.compiler),
-      new TypeMask.nonNullSubclass(bc.rawType));
+    Expect.equals(
+        inferredType(foo).simplify(result.compiler),
+        new TypeMask.nonNullSubclass(abc.rawType));
+    Expect.equals(
+        inferredType(new TypedSelector.subclass(x.rawType, foo)),
+        new TypeMask.nonNullExact(b.rawType));
+    Expect.equals(
+        inferredType(new TypedSelector.subclass(y.rawType, foo)),
+        new TypeMask.nonNullExact(c.rawType));
+    Expect.equals(
+        inferredType(new TypedSelector.subclass(z.rawType, foo)),
+        new TypeMask.nonNullExact(a.rawType));
+    Expect.equals(
+        inferredType(new TypedSelector.subclass(
+            xy.rawType, foo)).simplify(result.compiler),
+        new TypeMask.nonNullSubclass(bc.rawType));
 
-  Selector bar = new Selector.call(buildSourceString("bar"), null, 0);
+    Selector bar = new Selector.call(buildSourceString("bar"), null, 0);
 
-  Expect.isNull(inferredType(bar));
+    Expect.isNull(inferredType(bar));
+  });
 }
 
 testMixins() {
@@ -1523,11 +1585,12 @@
         x; y; z; w;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('x', [result.string]);
-  result.checkNodeHasType('y', [result.string]);
-  result.checkNodeHasType('z', [result.int]);
-  result.checkNodeHasType('w', [result.int]);
+  return analyze(source).then((result) {
+    result.checkNodeHasType('x', [result.string]);
+    result.checkNodeHasType('y', [result.string]);
+    result.checkNodeHasType('z', [result.int]);
+    result.checkNodeHasType('w', [result.int]);
+  });
 }
 
 testClosures() {
@@ -1549,10 +1612,11 @@
         a; b; f;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('a', [result.int, result.string]);
-  result.checkNodeHasType('f', [result.functionType]);
-  result.checkNodeHasUnknownType('b');
+  return analyze(source).then((AnalysisResult result) {
+    result.checkNodeHasType('a', [result.int, result.string]);
+    result.checkNodeHasType('f', [result.functionType]);
+    result.checkNodeHasUnknownType('b');
+  });
 }
 
 testNestedFunctions() {
@@ -1574,69 +1638,72 @@
         a; b; f;
       }
       """;
-  AnalysisResult result = analyze(source);
-  result.checkNodeHasType('a', [result.int, result.string]);
-  result.checkNodeHasType('f', [result.functionType]);
-  result.checkNodeHasUnknownType('b');
+  return analyze(source).then((AnalysisResult result) {
+    result.checkNodeHasType('a', [result.int, result.string]);
+    result.checkNodeHasType('f', [result.functionType]);
+    result.checkNodeHasUnknownType('b');
+  });
 }
 
 void main() {
-  testDynamicBackDoor();
-  testVariableDeclaration();
-  testLiterals();
-  testRedefinition();
-  testIfThenElse();
-  testTernaryIf();
-  testWhile();
-  testDoWhile();
-  testFor1();
-  testFor2();
-  testFor3();
-  testForIn();
-  testToplevelVariable();
-  testNonRecusiveFunction();
-  testRecusiveFunction();
-  testMutuallyRecusiveFunction();
-  testSimpleSend();
-  // testSendToClosureField();  // closures are not yet supported
-  testSendToThis1();
-  testSendToThis2();
-  testSendToThis3();
-  testConstructor();
-  testGetters();
-  testSetters();
-  testOptionalNamedParameters();
-  testOptionalPositionalParameters();
-  testListLiterals();
-  testMapLiterals();
-  testReturn();
-  // testNoReturn(); // right now we infer the empty type instead of null
-  testArithmeticOperators();
-  testBooleanOperators();
-  testBooleanOperatorsShortCirtcuit();
-  testOperators();
-  testCompoundOperators1();
-  testCompoundOperators2();
-  testSetIndexOperator();
-  testInequality();
-  testFieldInitialization1();
-  testFieldInitialization2();
-  testFieldInitialization3();
-  testSendWithWrongArity();
-  testBigTypesWidening1();
-  testBigTypesWidening2();
-  testDynamicIsAbsorbing();
-  testLists();
-  testListWithCapacity();
-  testEmptyList();
-  testJsCall();
-  testJsCallAugmentsSeenClasses();
-  testIsCheck();
-  testSeenClasses();
-  testIntDoubleNum();
-  testConcreteTypeToTypeMask();
-  testSelectors();
-  testMixins();
-  testClosures();
-  testNestedFunctions();
+  asyncTest(() => Future.forEach([
+    testDynamicBackDoor,
+    testVariableDeclaration,
+    testLiterals,
+    testRedefinition,
+    testIfThenElse,
+    testTernaryIf,
+    testWhile,
+    testDoWhile,
+    testFor1,
+    testFor2,
+    testFor3,
+    testForIn,
+    testToplevelVariable,
+    testNonRecusiveFunction,
+    testRecusiveFunction,
+    testMutuallyRecusiveFunction,
+    testSimpleSend,
+    // testSendToClosureField,  // closures are not yet supported
+    testSendToThis1,
+    testSendToThis2,
+    testSendToThis3,
+    testConstructor,
+    testGetters,
+    testSetters,
+    testOptionalNamedParameters,
+    testOptionalPositionalParameters,
+    testListLiterals,
+    testMapLiterals,
+    testReturn,
+    // testNoReturn, // right now we infer the empty type instead of null
+    testArithmeticOperators,
+    testBooleanOperators,
+    testBooleanOperatorsShortCirtcuit,
+    testOperators,
+    testCompoundOperators1,
+    testCompoundOperators2,
+    testSetIndexOperator,
+    testInequality,
+    testFieldInitialization1,
+    testFieldInitialization2,
+    testFieldInitialization3,
+    testSendWithWrongArity,
+    testBigTypesWidening1,
+    testBigTypesWidening2,
+    testDynamicIsAbsorbing,
+    testLists,
+    testListWithCapacity,
+    testEmptyList,
+    testJsCall,
+    testJsCallAugmentsSeenClasses,
+    testIsCheck,
+    testSeenClasses,
+    testIntDoubleNum,
+    testConcreteTypeToTypeMask,
+    testSelectors,
+    testMixins,
+    testClosures,
+    testNestedFunctions,
+  ], (f) => f()));
 }
diff --git a/tests/compiler/dart2js/dart2js.status b/tests/compiler/dart2js/dart2js.status
index f2965d5..1b73d2e 100644
--- a/tests/compiler/dart2js/dart2js.status
+++ b/tests/compiler/dart2js/dart2js.status
@@ -5,10 +5,9 @@
 identity_test: Fail # Issue 6638
 constant_folding_string_test: Fail
 boolified_operator_test: Fail # Issue 8001
-analyze_api_test: Pass, Slow
 
-[ $checked ]
-field_type_inferer_test: Slow, Pass # Issue 6658.
+analyze_api_test: Pass, Slow
+analyze_dart2js_test: Pass, Slow
 
 [ $jscl || $runtime == drt || $runtime == dartium || $runtime == ff || $runtime == firefox || $runtime == chrome || $runtime == safari || $runtime == ie9 || $runtime == opera ]
 *: Skip # dart2js uses #import('dart:io'); and it is not self-hosted (yet).
diff --git a/tests/compiler/dart2js/dart_backend_test.dart b/tests/compiler/dart2js/dart_backend_test.dart
index 2afbe17..608ec55 100644
--- a/tests/compiler/dart2js/dart_backend_test.dart
+++ b/tests/compiler/dart2js/dart_backend_test.dart
@@ -4,6 +4,7 @@
 
 import "package:expect/expect.dart";
 import 'dart:async';
+import "package:async_helper/async_helper.dart";
 import 'parser_helper.dart';
 import 'mock_compiler.dart';
 import '../../../sdk/lib/_internal/compiler/compiler.dart';
@@ -129,13 +130,13 @@
   if (minify) options.add('--minify');
   if (stripTypes) options.add('--force-strip=types');
 
-  compile(
+  asyncTest(() => compile(
       scriptUri,
       fileUri('libraryRoot/'),
       fileUri('packageRoot/'),
       provider,
       handler,
-      options).then(continuation);
+      options).then(continuation));
 }
 
 testSimpleFileUnparse() {
diff --git a/tests/compiler/dart2js/dead_bailout_target_test.dart b/tests/compiler/dart2js/dead_bailout_target_test.dart
index 5e7cb91..5c369b2 100644
--- a/tests/compiler/dart2js/dead_bailout_target_test.dart
+++ b/tests/compiler/dart2js/dead_bailout_target_test.dart
@@ -6,6 +6,7 @@
 // instruction gets removed from the graph when it's not used.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 String TEST = r'''
@@ -32,7 +33,6 @@
 
 main() {
   String generated = compile(TEST, entry: 'foo');
-
   // Check that we only have one bailout call. The second bailout call
   // is dead code because we know [:a.length:] is an int.
   checkNumberOfMatches(new RegExp('bailout').allMatches(generated).iterator, 1);
@@ -49,20 +49,20 @@
     Expect.isTrue(!generated.contains('getInterceptor'));
   }
 
-  generated = compileAll(TEST);
-  
-  // Check that the foo bailout method is generated.
-  checkNumberOfMatches(
-      new RegExp('foo\\\$bailout').allMatches(generated).iterator, 2);
+  asyncTest(() => compileAll(TEST).then((generated) {
+    // Check that the foo bailout method is generated.
+    checkNumberOfMatches(
+        new RegExp('foo\\\$bailout').allMatches(generated).iterator, 2);
 
-  // Check that it's the only bailout method.
-  checkNumberOfMatches(new RegExp('bailout').allMatches(generated).iterator, 2);
+    // Check that it's the only bailout method.
+    checkNumberOfMatches(new RegExp('bailout').allMatches(generated).iterator, 2);
 
-  // Check that the bailout method has a case 2 for the state, which
-  // is the second bailout in foo.
-  Expect.isTrue(generated.contains('case 2:'));
+    // Check that the bailout method has a case 2 for the state, which
+    // is the second bailout in foo.
+    Expect.isTrue(generated.contains('case 2:'));
 
-  // Finally, make sure that the reason foo does not contain
-  // 'getInterceptor' is not because the compiler renamed it.
-  Expect.isTrue(generated.contains('getInterceptor'));
+    // Finally, make sure that the reason foo does not contain
+    // 'getInterceptor' is not because the compiler renamed it.
+    Expect.isTrue(generated.contains('getInterceptor'));
+  }));
 }
diff --git a/tests/compiler/dart2js/dead_code_test.dart b/tests/compiler/dart2js/dead_code_test.dart
index 993d7e950..e4096c0 100644
--- a/tests/compiler/dart2js/dead_code_test.dart
+++ b/tests/compiler/dart2js/dead_code_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 String TEST = r'''
@@ -16,6 +17,7 @@
 ''';
 
 main() {
-  String generated = compileAll(TEST);
-  Expect.isFalse(generated.contains('return 42'), 'dead code not eliminated');
+  asyncTest(() => compileAll(TEST).then((generated) {
+    Expect.isFalse(generated.contains('return 42'), 'dead code not eliminated');
+  }));
 }
diff --git a/tests/compiler/dart2js/deferred_load_graph_segmentation_test.dart b/tests/compiler/dart2js/deferred_load_graph_segmentation_test.dart
index b6b1065..31ff16d 100644
--- a/tests/compiler/dart2js/deferred_load_graph_segmentation_test.dart
+++ b/tests/compiler/dart2js/deferred_load_graph_segmentation_test.dart
@@ -7,6 +7,7 @@
 // much be included in the initial download (loaded eagerly).
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'memory_source_file_helper.dart';
 
 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
@@ -17,8 +18,7 @@
   Uri libraryRoot = script.resolve('../../../sdk/');
   Uri packageRoot = script.resolve('./packages/');
 
-  MemorySourceFileProvider.MEMORY_SOURCE_FILES = MEMORY_SOURCE_FILES;
-  var provider = new MemorySourceFileProvider();
+  var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);
   var handler = new FormattingDiagnosticHandler(provider);
 
   Compiler compiler = new Compiler(provider.readStringFromUri,
@@ -27,26 +27,27 @@
                                    libraryRoot,
                                    packageRoot,
                                    ['--analyze-only']);
-  compiler.run(Uri.parse('memory:main.dart'));
-  var main = compiler.mainApp.find(dart2js.Compiler.MAIN);
-  Expect.isNotNull(main, 'Could not find "main"');
-  compiler.deferredLoadTask.onResolutionComplete(main);
+  asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
+    var main = compiler.mainApp.find(dart2js.Compiler.MAIN);
+    Expect.isNotNull(main, 'Could not find "main"');
+    compiler.deferredLoadTask.onResolutionComplete(main);
 
-  var deferredClasses =
-      compiler.deferredLoadTask.allDeferredElements.where((e) => e.isClass())
-      .toSet();
+    var deferredClasses =
+        compiler.deferredLoadTask.allDeferredElements.where((e) => e.isClass())
+        .toSet();
 
-  var dateTime =
-      deferredClasses
-          .where((e) => e.name.slowToString() == 'DateTime').single;
+    var dateTime =
+        deferredClasses
+            .where((e) => e.name.slowToString() == 'DateTime').single;
 
-  var myClass =
-      deferredClasses.where((e) => e.name.slowToString() == 'MyClass').single;
+    var myClass =
+        deferredClasses.where((e) => e.name.slowToString() == 'MyClass').single;
 
-  var deferredLibrary = compiler.libraries['memory:deferred.dart'];
+    var deferredLibrary = compiler.libraries['memory:deferred.dart'];
 
-  Expect.equals(deferredLibrary, myClass.getLibrary());
-  Expect.equals(compiler.coreLibrary, dateTime.declaration.getLibrary());
+    Expect.equals(deferredLibrary, myClass.getLibrary());
+    Expect.equals(compiler.coreLibrary, dateTime.declaration.getLibrary());
+  }));
 }
 
 const Map MEMORY_SOURCE_FILES = const {
diff --git a/tests/compiler/dart2js/diagnose_ambiguous_test.dart b/tests/compiler/dart2js/diagnose_ambiguous_test.dart
index 70d2fb4..e026f90 100644
--- a/tests/compiler/dart2js/diagnose_ambiguous_test.dart
+++ b/tests/compiler/dart2js/diagnose_ambiguous_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'memory_source_file_helper.dart';
 
 import '../../../sdk/lib/_internal/compiler/compiler.dart'
@@ -15,8 +16,7 @@
   Uri libraryRoot = script.resolve('../../../sdk/');
   Uri packageRoot = script.resolve('./packages/');
 
-  MemorySourceFileProvider.MEMORY_SOURCE_FILES = MEMORY_SOURCE_FILES;
-  var provider = new MemorySourceFileProvider();
+  var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);
   var diagnostics = [];
   void diagnosticHandler(Uri uri, int begin, int end,
                          String message, Diagnostic kind) {
@@ -32,28 +32,30 @@
                                    libraryRoot,
                                    packageRoot,
                                    ['--analyze-only']);
-  compiler.run(Uri.parse('memory:main.dart'));
-  diagnostics.sort();
-  var expected = [
-      'memory:exporter.dart:43:47:Info: "function(hest)" is defined here.:info',
-      'memory:library.dart:14:19:Info: "class(Fisk)" is (re)exported by '
-      'multiple libraries.:info',
-      'memory:library.dart:30:34:Info: "function(fisk)" is (re)exported by '
-      'multiple libraries.:info',
-      'memory:library.dart:41:45:Info: "function(hest)" is defined here.'
-      ':info',
-      'memory:main.dart:0:22:Info: "class(Fisk)" is imported here.:info',
-      'memory:main.dart:0:22:Info: "function(fisk)" is imported here.:info',
-      'memory:main.dart:0:22:Info: "function(hest)" is imported here.:info',
-      'memory:main.dart:23:46:Info: "class(Fisk)" is imported here.:info',
-      'memory:main.dart:23:46:Info: "function(fisk)" is imported here.:info',
-      'memory:main.dart:23:46:Info: "function(hest)" is imported here.:info',
-      'memory:main.dart:59:63:Warning: Duplicate import of "Fisk".:warning',
-      'memory:main.dart:76:80:Error: Duplicate import of "fisk".:error',
-      'memory:main.dart:86:90:Error: Duplicate import of "hest".:error'
-  ];
-  Expect.listEquals(expected, diagnostics);
-  Expect.isTrue(compiler.compilationFailed);
+  asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
+    diagnostics.sort();
+    var expected = [
+        'memory:exporter.dart:43:47:Info: "function(hest)" is defined here.'
+        ':info',
+        'memory:library.dart:14:19:Info: "class(Fisk)" is (re)exported by '
+        'multiple libraries.:info',
+        'memory:library.dart:30:34:Info: "function(fisk)" is (re)exported by '
+        'multiple libraries.:info',
+        'memory:library.dart:41:45:Info: "function(hest)" is defined here.'
+        ':info',
+        'memory:main.dart:0:22:Info: "class(Fisk)" is imported here.:info',
+        'memory:main.dart:0:22:Info: "function(fisk)" is imported here.:info',
+        'memory:main.dart:0:22:Info: "function(hest)" is imported here.:info',
+        'memory:main.dart:23:46:Info: "class(Fisk)" is imported here.:info',
+        'memory:main.dart:23:46:Info: "function(fisk)" is imported here.:info',
+        'memory:main.dart:23:46:Info: "function(hest)" is imported here.:info',
+        'memory:main.dart:59:63:Warning: Duplicate import of "Fisk".:warning',
+        'memory:main.dart:76:80:Error: Duplicate import of "fisk".:error',
+        'memory:main.dart:86:90:Error: Duplicate import of "hest".:error'
+    ];
+    Expect.listEquals(expected, diagnostics);
+    Expect.isTrue(compiler.compilationFailed);
+  }));
 }
 
 const Map MEMORY_SOURCE_FILES = const {
diff --git a/tests/compiler/dart2js/emit_const_fields_test.dart b/tests/compiler/dart2js/emit_const_fields_test.dart
index d539d89..14385d7 100644
--- a/tests/compiler/dart2js/emit_const_fields_test.dart
+++ b/tests/compiler/dart2js/emit_const_fields_test.dart
@@ -4,6 +4,7 @@
 // Test that unused static consts are not emitted.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 const String TEST_GUIDE = r"""
@@ -18,8 +19,9 @@
 """;
 
 main() {
-  String generated = compileAll(TEST_GUIDE);
-  Expect.isTrue(generated.contains("42"));
-  Expect.isFalse(generated.contains("TITLE"));
+  asyncTest(() => compileAll(TEST_GUIDE).then((generated) {
+    Expect.isTrue(generated.contains("42"));
+    Expect.isFalse(generated.contains("TITLE"));
+  }));
 }
 
diff --git a/tests/compiler/dart2js/field_codegen_test.dart b/tests/compiler/dart2js/field_codegen_test.dart
index d9a8aec..eb1a6c4 100644
--- a/tests/compiler/dart2js/field_codegen_test.dart
+++ b/tests/compiler/dart2js/field_codegen_test.dart
@@ -4,6 +4,7 @@
 // Test that parameters keep their names in the output.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 import 'parser_helper.dart';
 
@@ -20,8 +21,11 @@
 """;
 
 main() {
-  String generated = compileAll(TEST_NULL0);
-  Expect.isTrue(generated.contains("null"));
-  generated = compileAll(TEST_NULL1);
-  Expect.isTrue(generated.contains("null"));
+  asyncTest(() => compileAll(TEST_NULL0).then((generated) {
+    Expect.isTrue(generated.contains("null"));
+  }));
+
+  asyncTest(() => compileAll(TEST_NULL1).then((generated) {
+    Expect.isTrue(generated.contains("null"));
+  }));
 }
diff --git a/tests/compiler/dart2js/field_type_simple_inferer_test.dart b/tests/compiler/dart2js/field_type_simple_inferer_test.dart
index 9f43fd5..6fc97af 100644
--- a/tests/compiler/dart2js/field_type_simple_inferer_test.dart
+++ b/tests/compiler/dart2js/field_type_simple_inferer_test.dart
@@ -2,7 +2,9 @@
 // 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 'dart:async';
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'
     show TypeMask;
 
@@ -16,11 +18,12 @@
                     check(compiler, element)) {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(code, uri);
-  compiler.runCompiler(uri);
-  compiler.disableInlining = disableInlining;
-  var cls = findElement(compiler, className);
-  var member = cls.lookupMember(buildSourceString(memberName));
-  return check(compiler, member);
+  asyncTest(() => compiler.runCompiler(uri).then((_) {
+    compiler.disableInlining = disableInlining;
+    var cls = findElement(compiler, className);
+    var member = cls.lookupMember(buildSourceString(memberName));
+    check(compiler, member);
+  }));
 }
 
 const String TEST_1 = r"""
diff --git a/tests/compiler/dart2js/gvn_dynamic_field_get_test.dart b/tests/compiler/dart2js/gvn_dynamic_field_get_test.dart
index c1a784a..2c27c74 100644
--- a/tests/compiler/dart2js/gvn_dynamic_field_get_test.dart
+++ b/tests/compiler/dart2js/gvn_dynamic_field_get_test.dart
@@ -5,6 +5,7 @@
 // effects.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 import 'parser_helper.dart';
 
@@ -24,16 +25,17 @@
 main() {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri);
-  compiler.runCompiler(uri);
-  String generated = compiler.assembledCode;
-  RegExp regexp = new RegExp(r"get\$foo");
-  Iterator matches = regexp.allMatches(generated).iterator;
-  checkNumberOfMatches(matches, 1);
-  var cls = findElement(compiler, 'A');
-  Expect.isNotNull(cls);
-  SourceString name = buildSourceString('foo');
-  var element = cls.lookupLocalMember(name);
-  Expect.isNotNull(element);
-  Selector selector = new Selector.getter(name, null);
-  Expect.isFalse(compiler.world.hasAnyUserDefinedGetter(selector));
+  asyncTest(() => compiler.runCompiler(uri).then((_) {
+    String generated = compiler.assembledCode;
+    RegExp regexp = new RegExp(r"get\$foo");
+    Iterator matches = regexp.allMatches(generated).iterator;
+    checkNumberOfMatches(matches, 1);
+    var cls = findElement(compiler, 'A');
+    Expect.isNotNull(cls);
+    SourceString name = buildSourceString('foo');
+    var element = cls.lookupLocalMember(name);
+    Expect.isNotNull(element);
+    Selector selector = new Selector.getter(name, null);
+    Expect.isFalse(compiler.world.hasAnyUserDefinedGetter(selector));
+  }));
 }
diff --git a/tests/compiler/dart2js/gvn_test.dart b/tests/compiler/dart2js/gvn_test.dart
index 85bfad9..150237d 100644
--- a/tests/compiler/dart2js/gvn_test.dart
+++ b/tests/compiler/dart2js/gvn_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 const String TEST_ONE = r"""
@@ -118,16 +119,20 @@
   generated = compile(TEST_FOUR, entry: 'foo');
   checkNumberOfMatches(new RegExp("shr").allMatches(generated).iterator, 1);
 
-  generated = compileAll(TEST_FIVE);
-  checkNumberOfMatches(
-      new RegExp("get\\\$foo").allMatches(generated).iterator, 1);
+  asyncTest(() => compileAll(TEST_FIVE).then((generated) {
+    checkNumberOfMatches(
+        new RegExp("get\\\$foo").allMatches(generated).iterator, 1);
+  }));
 
-  generated = compileAll(TEST_SIX);
-  Expect.isTrue(generated.contains('for (t1 = a.field === 54; t1;)'));
+  asyncTest(() => compileAll(TEST_SIX).then((generated) {
+    Expect.isTrue(generated.contains('for (t1 = a.field === 54; t1;)'));
+  }));
 
-  generated = compileAll(TEST_SEVEN);
-  Expect.isTrue(generated.contains('for (t1 = a.field === 54; t1;)'));
+  asyncTest(() => compileAll(TEST_SEVEN).then((generated) {
+    Expect.isTrue(generated.contains('for (t1 = a.field === 54; t1;)'));
+  }));
 
-  generated = compileAll(TEST_EIGHT);
-  Expect.isTrue(generated.contains('for (; i < t1; ++i)'));
+  asyncTest(() => compileAll(TEST_EIGHT).then((generated) {
+    Expect.isTrue(generated.contains('for (; i < t1; ++i)'));
+  }));
 }
diff --git a/tests/compiler/dart2js/import_test.dart b/tests/compiler/dart2js/import_test.dart
index 54748c4..aeaa469 100644
--- a/tests/compiler/dart2js/import_test.dart
+++ b/tests/compiler/dart2js/import_test.dart
@@ -8,6 +8,7 @@
 library dart2js.test.import;
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'memory_compiler.dart';
 
 const MEMORY_SOURCE_FILES = const {
@@ -30,17 +31,19 @@
 testMissingImports() {
   var collector = new DiagnosticCollector();
   var compiler = compilerFor(MEMORY_SOURCE_FILES, diagnosticHandler: collector);
-  compiler.run(Uri.parse('memory:main.dart'));
-  Expect.equals(4, collector.errors.length);
-  Expect.equals(1, collector.warnings.length);
+  asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
+    Expect.equals(4, collector.errors.length);
+    Expect.equals(1, collector.warnings.length);
+  }));
 }
 
 testMissingMain() {
   var collector = new DiagnosticCollector();
   var compiler = compilerFor({}, diagnosticHandler: collector);
-  compiler.run(Uri.parse('memory:missing.dart'));
-  Expect.equals(1, collector.errors.length);
-  Expect.equals(0, collector.warnings.length);
+  asyncTest(() => compiler.run(Uri.parse('memory:missing.dart')).then((_) {
+    Expect.equals(1, collector.errors.length);
+    Expect.equals(0, collector.warnings.length);
+  }));
 }
 
 void main() {
diff --git a/tests/compiler/dart2js/inferrer_factory_test.dart b/tests/compiler/dart2js/inferrer_factory_test.dart
index 7e2c9ec..a8b225c 100644
--- a/tests/compiler/dart2js/inferrer_factory_test.dart
+++ b/tests/compiler/dart2js/inferrer_factory_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 const String TEST1 = r"""
@@ -22,9 +23,10 @@
 """;
 
 main() {
-  String generated = compileAll(TEST1);
-  // Check that we're using the index operator on the object returned
-  // by the A factory.
-  Expect.isTrue(generated.contains('[0] = 42'));
+  asyncTest(() => compileAll(TEST1).then((generated) {
+    // Check that we're using the index operator on the object returned
+    // by the A factory.
+    Expect.isTrue(generated.contains('[0] = 42'));
+  }));
 }
 
diff --git a/tests/compiler/dart2js/library_load_test.dart b/tests/compiler/dart2js/library_load_test.dart
deleted file mode 100644
index 36c9adf..0000000
--- a/tests/compiler/dart2js/library_load_test.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2013, 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.
-
-import "package:expect/expect.dart";
-import 'mock_compiler.dart';
-
-class ScanMockCompiler extends MockCompiler {
-  ScanMockCompiler() {
-    isolateHelperLibrary = null;
-    foreignLibrary = null;
-  }
-
-  LibraryElement scanBuiltinLibrary(String filename) {
-    return createLibrary(filename, "main(){}");
-  }
-}
-
-void main() {
-  Compiler compiler = new ScanMockCompiler();
-  Expect.equals(null, compiler.isolateHelperLibrary);
-  Expect.equals(null, compiler.foreignLibrary);
-  compiler.onLibraryLoaded(mockLibrary(compiler, "mock"),
-			    new Uri(scheme: 'dart', path: '_isolate_helper'));
-  Expect.isTrue(compiler.isolateHelperLibrary != null);
-  compiler.onLibraryLoaded(mockLibrary(compiler, "mock"),
-			    new Uri(scheme: 'dart', path: '_foreign_helper'));
-  Expect.isTrue(compiler.isolateHelperLibrary != null);
-  Expect.equals(new Uri(scheme: 'dart', path: '_isolate_helper'),
-		 compiler.isolateHelperLibrary.canonicalUri);
-  Expect.isTrue(compiler.foreignLibrary != null);
-  Expect.equals(new Uri(scheme: 'dart', path: '_foreign_helper'),
-		 compiler.foreignLibrary.canonicalUri);
-}
diff --git a/tests/compiler/dart2js/list_tracer2_test.dart b/tests/compiler/dart2js/list_tracer2_test.dart
index 0bc6126..cb7734d 100644
--- a/tests/compiler/dart2js/list_tracer2_test.dart
+++ b/tests/compiler/dart2js/list_tracer2_test.dart
@@ -6,6 +6,7 @@
 // the presence of a fixed length list constructor call.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import
     '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'
     show ContainerTypeMask, TypeMask;
@@ -25,14 +26,15 @@
 void main() {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri);
-  compiler.runCompiler(uri);
-  var typesInferrer = compiler.typesTask.typesInferrer;
+  asyncTest(() => compiler.runCompiler(uri).then((_) {
+    var typesInferrer = compiler.typesTask.typesInferrer;
 
-  checkType(String name, type) {
-    var element = findElement(compiler, name);
-    ContainerTypeMask mask = typesInferrer.getTypeOfElement(element);
-    Expect.equals(type, mask.elementType.simplify(compiler), name);
-  }
+    checkType(String name, type) {
+      var element = findElement(compiler, name);
+      ContainerTypeMask mask = typesInferrer.getTypeOfElement(element);
+      Expect.equals(type, mask.elementType.simplify(compiler), name);
+    }
 
-  checkType('myList', compiler.typesTask.intType);
+    checkType('myList', compiler.typesTask.intType);
+  }));
 }
diff --git a/tests/compiler/dart2js/list_tracer_length_test.dart b/tests/compiler/dart2js/list_tracer_length_test.dart
index 2a48ef5..6b039d8 100644
--- a/tests/compiler/dart2js/list_tracer_length_test.dart
+++ b/tests/compiler/dart2js/list_tracer_length_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 const String TEST1 = r"""
@@ -63,8 +64,9 @@
 """;
 
 void checkRangeError(String test, {bool hasRangeError}) {
-  String generated = compileAll(test);
-  Expect.equals(hasRangeError, generated.contains('ioore'));
+  asyncTest(() => compileAll(test).then((generated) {
+    Expect.equals(hasRangeError, generated.contains('ioore'));
+  }));
 }
 
 main() {
diff --git a/tests/compiler/dart2js/list_tracer_node_type_test.dart b/tests/compiler/dart2js/list_tracer_node_type_test.dart
index 93e636e..aa3e859 100644
--- a/tests/compiler/dart2js/list_tracer_node_type_test.dart
+++ b/tests/compiler/dart2js/list_tracer_node_type_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 const String TEST1 = r"""
@@ -57,28 +58,34 @@
 
 
 main() {
-  String generated = compileAll(TEST1);
-  // Check that we only do a null check on the receiver for
-  // [: a[0] + 42 :]. We can do a null check because we inferred that
-  // the list is of type int or null.
-  Expect.isFalse(generated.contains('if (typeof t1'));
-  Expect.isTrue(generated.contains('if (t1 == null)'));
+  asyncTest(() => compileAll(TEST1).then((generated) {
+    // Check that we only do a null check on the receiver for
+    // [: a[0] + 42 :]. We can do a null check because we inferred that
+    // the list is of type int or null.
+    Expect.isFalse(generated.contains('if (typeof t1'));
+    Expect.isTrue(generated.contains('if (t1 == null)'));
+  }));
 
-  generated = compileAll(TEST2);
-  Expect.isFalse(generated.contains('if (typeof t1'));
-  Expect.isTrue(generated.contains('if (t1 == null)'));
+  asyncTest(() => compileAll(TEST2).then((generated) {
+    Expect.isFalse(generated.contains('if (typeof t1'));
+    Expect.isTrue(generated.contains('if (t1 == null)'));
+  }));
 
-  generated = compileAll(TEST3);
-  Expect.isFalse(generated.contains('if (typeof t1'));
-  Expect.isTrue(generated.contains('if (t1 == null)'));
+  asyncTest(() => compileAll(TEST3).then((generated) {
+    Expect.isFalse(generated.contains('if (typeof t1'));
+    Expect.isTrue(generated.contains('if (t1 == null)'));
+  }));
 
-  generated = compileAll(TEST4);
-  Expect.isFalse(generated.contains('if (typeof t1'));
-  Expect.isTrue(generated.contains('if (t1 == null)'));
+  asyncTest(() => compileAll(TEST4).then((generated) {
+    Expect.isFalse(generated.contains('if (typeof t1'));
+    Expect.isTrue(generated.contains('if (t1 == null)'));
+  }));
 
-  generated = compileAll(TEST5);
-  Expect.isFalse(generated.contains('iae'));
+  asyncTest(() => compileAll(TEST5).then((generated) {
+    Expect.isFalse(generated.contains('iae'));
+  }));
 
-  generated = compileAll(TEST6);
-  Expect.isFalse(generated.contains('iae'));
+  asyncTest(() => compileAll(TEST6).then((generated) {
+    Expect.isFalse(generated.contains('iae'));
+  }));
 }
diff --git a/tests/compiler/dart2js/list_tracer_test.dart b/tests/compiler/dart2js/list_tracer_test.dart
index c9b9791..936dd17 100644
--- a/tests/compiler/dart2js/list_tracer_test.dart
+++ b/tests/compiler/dart2js/list_tracer_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import
     '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'
     show ContainerTypeMask, TypeMask;
@@ -189,43 +190,44 @@
 void doTest(String allocation, {bool nullify}) {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(generateTest(allocation), uri);
-  compiler.runCompiler(uri);
-  var typesTask = compiler.typesTask;
-  var typesInferrer = typesTask.typesInferrer;
+  asyncTest(() => compiler.runCompiler(uri).then((_) {
+    var typesTask = compiler.typesTask;
+    var typesInferrer = typesTask.typesInferrer;
 
-  checkType(String name, type) {
-    var element = findElement(compiler, name);
-    ContainerTypeMask mask = typesInferrer.getTypeOfElement(element);
-    if (nullify) type = type.nullable();
-    Expect.equals(type, mask.elementType.simplify(compiler), name);
-  }
+    checkType(String name, type) {
+      var element = findElement(compiler, name);
+      ContainerTypeMask mask = typesInferrer.getTypeOfElement(element);
+      if (nullify) type = type.nullable();
+      Expect.equals(type, mask.elementType.simplify(compiler), name);
+    }
 
-  checkType('listInField', typesTask.numType);
-  checkType('listPassedToMethod', typesTask.numType);
-  checkType('listReturnedFromMethod', typesTask.numType);
-  checkType('listUsedWithCascade', typesTask.numType);
-  checkType('listUsedInClosure', typesTask.numType);
-  checkType('listPassedToSelector', typesTask.numType);
-  checkType('listReturnedFromSelector', typesTask.numType);
-  checkType('listUsedWithAddAndInsert', typesTask.numType);
-  checkType('listUsedWithConstraint', typesTask.numType);
-  checkType('listEscapingFromSetter', typesTask.numType);
-  checkType('listUsedInLocal', typesTask.numType);
-  checkType('listEscapingInSetterValue', typesTask.numType);
-  checkType('listEscapingInIndex', typesTask.numType);
-  checkType('listEscapingInIndexSet', typesTask.intType);
-  checkType('listEscapingTwiceInIndexSet', typesTask.numType);
-  checkType('listSetInNonFinalField', typesTask.numType);
-  checkType('listWithChangedLength', typesTask.intType.nullable());
+    checkType('listInField', typesTask.numType);
+    checkType('listPassedToMethod', typesTask.numType);
+    checkType('listReturnedFromMethod', typesTask.numType);
+    checkType('listUsedWithCascade', typesTask.numType);
+    checkType('listUsedInClosure', typesTask.numType);
+    checkType('listPassedToSelector', typesTask.numType);
+    checkType('listReturnedFromSelector', typesTask.numType);
+    checkType('listUsedWithAddAndInsert', typesTask.numType);
+    checkType('listUsedWithConstraint', typesTask.numType);
+    checkType('listEscapingFromSetter', typesTask.numType);
+    checkType('listUsedInLocal', typesTask.numType);
+    checkType('listEscapingInSetterValue', typesTask.numType);
+    checkType('listEscapingInIndex', typesTask.numType);
+    checkType('listEscapingInIndexSet', typesTask.intType);
+    checkType('listEscapingTwiceInIndexSet', typesTask.numType);
+    checkType('listSetInNonFinalField', typesTask.numType);
+    checkType('listWithChangedLength', typesTask.intType.nullable());
 
-  checkType('listPassedToClosure', typesTask.dynamicType);
-  checkType('listReturnedFromClosure', typesTask.dynamicType);
-  checkType('listUsedWithNonOkSelector', typesTask.dynamicType);
-  checkType('listPassedAsOptionalParameter', typesTask.dynamicType);
-  checkType('listPassedAsNamedParameter', typesTask.dynamicType);
+    checkType('listPassedToClosure', typesTask.dynamicType);
+    checkType('listReturnedFromClosure', typesTask.dynamicType);
+    checkType('listUsedWithNonOkSelector', typesTask.dynamicType);
+    checkType('listPassedAsOptionalParameter', typesTask.dynamicType);
+    checkType('listPassedAsNamedParameter', typesTask.dynamicType);
 
-  if (!allocation.contains('filled')) {
-    checkType('listUnset', new TypeMask.nonNullEmpty());
-    checkType('listOnlySetWithConstraint', new TypeMask.nonNullEmpty());
-  }
+    if (!allocation.contains('filled')) {
+      checkType('listUnset', new TypeMask.nonNullEmpty());
+      checkType('listOnlySetWithConstraint', new TypeMask.nonNullEmpty());
+    }
+  }));
 }
diff --git a/tests/compiler/dart2js/lookup_member_test.dart b/tests/compiler/dart2js/lookup_member_test.dart
index ea1d687..261e53c 100644
--- a/tests/compiler/dart2js/lookup_member_test.dart
+++ b/tests/compiler/dart2js/lookup_member_test.dart
@@ -1,76 +1,78 @@
-// Copyright (c) 2013, 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 subtype_test;

-

-import 'package:expect/expect.dart';

-import 'type_test_helper.dart';

-import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart';

-import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart"

-       show Element, ClassElement;

-

-void main() {

-  test();

-}

-

-void test() {

-  var env = new TypeEnvironment(r"""

-      class A<T> {

-        T foo;

-      }

-      class B<S> extends A<A<S>> {

-        S bar;

-      }

-      class C<U> extends B<String> with D<B<U>> {

-        U baz;

-      }

-      class D<V> {

-        V boz;

-      }

-      """);

-

-  void expect(DartType receiverType, String memberName, DartType expectedType) {

-    Member member = receiverType.lookupMember(env.sourceString(memberName));

-    Expect.isNotNull(member);

-    DartType memberType = member.computeType(env.compiler);

-    Expect.equals(expectedType, memberType,

-        'Wrong member type for $receiverType.$memberName.');

-  }

-

-  DartType int_ = env['int'];

-  DartType String_ = env['String'];

-

-  ClassElement A = env.getElement('A');

-  DartType T = A.typeVariables.head;

-  DartType A_T = A.thisType;

-  expect(A_T, 'foo', T);

-

-  DartType A_int = instantiate(A, [int_]);

-  expect(A_int, 'foo', int_);

-

-  ClassElement B = env.getElement('B');

-  DartType S = B.typeVariables.head;

-  DartType B_S = B.thisType;

-  expect(B_S, 'foo', instantiate(A, [S]));

-  expect(B_S, 'bar', S);

-

-  DartType B_int = instantiate(B, [int_]);

-  expect(B_int, 'foo', A_int);

-  expect(B_int, 'bar', int_);

-

-  ClassElement C = env.getElement('C');

-  DartType U = C.typeVariables.head;

-  DartType C_U = C.thisType;

-  expect(C_U, 'foo', instantiate(A, [String_]));

-  expect(C_U, 'bar', String_);

-  expect(C_U, 'baz', U);

-  expect(C_U, 'boz', instantiate(B, [U]));

-

-  DartType C_int = instantiate(C, [int_]);

-  expect(C_int, 'foo', instantiate(A, [String_]));

-  expect(C_int, 'bar', String_);

-  expect(C_int, 'baz', int_);

-  expect(C_int, 'boz', instantiate(B, [int_]));

-}

-

+// Copyright (c) 2013, 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 subtype_test;
+
+import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
+import 'type_test_helper.dart';
+import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart';
+import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart"
+       show Element, ClassElement;
+
+void main() {
+  test();
+}
+
+void test() {
+  asyncTest(() => TypeEnvironment.create(r"""
+      class A<T> {
+        T foo;
+      }
+      class B<S> extends A<A<S>> {
+        S bar;
+      }
+      class C<U> extends B<String> with D<B<U>> {
+        U baz;
+      }
+      class D<V> {
+        V boz;
+      }
+      """).then((env) {
+    void expect(DartType receiverType, String memberName,
+                DartType expectedType) {
+      Member member = receiverType.lookupMember(env.sourceString(memberName));
+      Expect.isNotNull(member);
+      DartType memberType = member.computeType(env.compiler);
+      Expect.equals(expectedType, memberType,
+          'Wrong member type for $receiverType.$memberName.');
+    }
+
+    DartType int_ = env['int'];
+    DartType String_ = env['String'];
+
+    ClassElement A = env.getElement('A');
+    DartType T = A.typeVariables.head;
+    DartType A_T = A.thisType;
+    expect(A_T, 'foo', T);
+
+    DartType A_int = instantiate(A, [int_]);
+    expect(A_int, 'foo', int_);
+
+    ClassElement B = env.getElement('B');
+    DartType S = B.typeVariables.head;
+    DartType B_S = B.thisType;
+    expect(B_S, 'foo', instantiate(A, [S]));
+    expect(B_S, 'bar', S);
+
+    DartType B_int = instantiate(B, [int_]);
+    expect(B_int, 'foo', A_int);
+    expect(B_int, 'bar', int_);
+
+    ClassElement C = env.getElement('C');
+    DartType U = C.typeVariables.head;
+    DartType C_U = C.thisType;
+    expect(C_U, 'foo', instantiate(A, [String_]));
+    expect(C_U, 'bar', String_);
+    expect(C_U, 'baz', U);
+    expect(C_U, 'boz', instantiate(B, [U]));
+
+    DartType C_int = instantiate(C, [int_]);
+    expect(C_int, 'foo', instantiate(A, [String_]));
+    expect(C_int, 'bar', String_);
+    expect(C_int, 'baz', int_);
+    expect(C_int, 'boz', instantiate(B, [int_]));
+  }));
+}
+
diff --git a/tests/compiler/dart2js/memory_compiler.dart b/tests/compiler/dart2js/memory_compiler.dart
index 04a95df..eb5f588 100644
--- a/tests/compiler/dart2js/memory_compiler.dart
+++ b/tests/compiler/dart2js/memory_compiler.dart
@@ -83,8 +83,7 @@
   Uri libraryRoot = script.resolve('../../../sdk/');
   Uri packageRoot = script.resolve('./packages/');
 
-  MemorySourceFileProvider.MEMORY_SOURCE_FILES = memorySourceFiles;
-  var provider = new MemorySourceFileProvider();
+  var provider = new MemorySourceFileProvider(memorySourceFiles);
   var handler =
       createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics);
 
@@ -93,7 +92,7 @@
     return new NullSink('$name.$extension');
   }
 
-  Compiler compiler = new Compiler(provider,
+  Compiler compiler = new Compiler(provider.readStringFromUri,
                                    outputProvider,
                                    handler,
                                    libraryRoot,
@@ -141,8 +140,7 @@
   Uri libraryRoot = script.resolve('../../../sdk/');
   Uri packageRoot = script.resolve('./packages/');
 
-  MemorySourceFileProvider.MEMORY_SOURCE_FILES = memorySourceFiles;
-  var provider = new MemorySourceFileProvider();
+  var provider = new MemorySourceFileProvider(memorySourceFiles);
   var handler =
       createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics);
 
diff --git a/tests/compiler/dart2js/memory_source_file_helper.dart b/tests/compiler/dart2js/memory_source_file_helper.dart
index f8ecb27..8ebdf7d 100644
--- a/tests/compiler/dart2js/memory_source_file_helper.dart
+++ b/tests/compiler/dart2js/memory_source_file_helper.dart
@@ -24,14 +24,17 @@
        show SourceFileProvider, FormattingDiagnosticHandler;
 
 class MemorySourceFileProvider extends SourceFileProvider {
-  static Map MEMORY_SOURCE_FILES;
+  final Map<String, String> memorySourceFiles;
+
+  MemorySourceFileProvider(Map<String, String> this.memorySourceFiles);
+
   Future<String> readStringFromUri(Uri resourceUri) {
     if (resourceUri.scheme != 'memory') {
       return super.readStringFromUri(resourceUri);
     }
-    String source = MEMORY_SOURCE_FILES[resourceUri.path];
+    String source = memorySourceFiles[resourceUri.path];
     // TODO(ahe): Return new Future.error(...) ?
-    if (source == null) throw 'No such file $resourceUri';
+    if (source == null) return new Future.error('No such file $resourceUri');
     String resourceName = '$resourceUri';
     this.sourceFiles[resourceName] = new SourceFile(resourceName, source);
     return new Future.value(source);
diff --git a/tests/compiler/dart2js/message_kind_helper.dart b/tests/compiler/dart2js/message_kind_helper.dart
index b7163fe..b702d02 100644
--- a/tests/compiler/dart2js/message_kind_helper.dart
+++ b/tests/compiler/dart2js/message_kind_helper.dart
@@ -5,6 +5,7 @@
 library dart2js.test.message_kind_helper;
 
 import 'package:expect/expect.dart';
+import 'dart:async';
 
 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' show
     Compiler,
@@ -14,7 +15,7 @@
 
 const String ESCAPE_REGEXP = r'[[\]{}()*+?.\\^$|]';
 
-Compiler check(MessageKind kind, Compiler cachedCompiler) {
+Future<Compiler> check(MessageKind kind, Compiler cachedCompiler) {
   Expect.isNotNull(kind.howToFix);
   Expect.isFalse(kind.examples.isEmpty);
 
@@ -33,22 +34,28 @@
         options: ['--analyze-only'],
         cachedCompiler: cachedCompiler);
 
-    compiler.run(Uri.parse('memory:main.dart'));
+    return compiler.run(Uri.parse('memory:main.dart')).then((_) {
 
-    Expect.isFalse(messages.isEmpty, 'No messages in """$example"""');
+      Expect.isFalse(messages.isEmpty, 'No messages in """$example"""');
 
-    String expectedText = !kind.hasHowToFix
-        ? kind.template : '${kind.template}\n${kind.howToFix}';
-    String pattern = expectedText.replaceAllMapped(
-        new RegExp(ESCAPE_REGEXP), (m) => '\\${m[0]}');
-    pattern = pattern.replaceAll(new RegExp(r'#\\\{[^}]*\\\}'), '.*');
+      String expectedText = !kind.hasHowToFix
+          ? kind.template : '${kind.template}\n${kind.howToFix}';
+      String pattern = expectedText.replaceAllMapped(
+          new RegExp(ESCAPE_REGEXP), (m) => '\\${m[0]}');
+      pattern = pattern.replaceAll(new RegExp(r'#\\\{[^}]*\\\}'), '.*');
 
-    for (String message in messages) {
-      Expect.isTrue(new RegExp('^$pattern\$').hasMatch(message),
-                    '"$pattern" does not match "$message"');
-    }
-    cachedCompiler = compiler;
+      // TODO(johnniwinther): Extend MessageKind to contain information on
+      // where info messages are expected.
+      bool messageFound = false;
+      for (String message in messages) {
+        if (new RegExp('^$pattern\$').hasMatch(message)) {
+          messageFound = true;
+        }
+      }
+      Expect.isTrue(messageFound, '"$pattern" does not match any in $messages');
+      return compiler;
+    });
   }
 
-  return cachedCompiler;
+  return new Future<Compiler>.sync(cachedCompiler);
 }
diff --git a/tests/compiler/dart2js/message_kind_test.dart b/tests/compiler/dart2js/message_kind_test.dart
index 55f9bed..6610e12 100644
--- a/tests/compiler/dart2js/message_kind_test.dart
+++ b/tests/compiler/dart2js/message_kind_test.dart
@@ -2,6 +2,9 @@
 // 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 'package:expect/expect.dart';
+import 'dart:async';
+import "package:async_helper/async_helper.dart";
 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' show
     DualKind,
     MessageKind;
@@ -43,10 +46,14 @@
     }
   };
   var cachedCompiler;
-  for (String name in examples) {
+  asyncTest(() => Future.forEach(examples, (String name) {
     Stopwatch sw = new Stopwatch()..start();
-    cachedCompiler = check(kinds[name], cachedCompiler);
-    sw.stop();
-    print("Checked '$name' in ${sw.elapsedMilliseconds}ms.");
-  }
+    return check(kinds[name], cachedCompiler).
+        then((var compiler) {
+          cachedCompiler = compiler;
+          sw.stop();
+          print("Checked '$name' in ${sw.elapsedMilliseconds}ms.");
+        });
+    }
+  ));
 }
diff --git a/tests/compiler/dart2js/metadata_test.dart b/tests/compiler/dart2js/metadata_test.dart
index 0e3b20b..3f84263 100644
--- a/tests/compiler/dart2js/metadata_test.dart
+++ b/tests/compiler/dart2js/metadata_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 import 'parser_helper.dart';
 
@@ -20,16 +21,14 @@
 
 void checkAnnotation(String name, String declaration,
                      {bool isTopLevelOnly: false}) {
-  var source;
-
   // Ensure that a compile-time constant can be resolved from an
   // annotation.
-  source = """const native = 'xyz';
-              @native
-              $declaration
-              main() {}""";
+  var source1 = """const native = 'xyz';
+                   @native
+                   $declaration
+                   main() {}""";
 
-  compileAndCheck(source, name, (compiler, element) {
+  compileAndCheck(source1, name, (compiler, element) {
     compiler.enqueuer.resolution.queueIsClosed = false;
     Expect.equals(1, length(element.metadata));
     PartialMetadataAnnotation annotation = element.metadata.head;
@@ -37,17 +36,17 @@
     Constant value = annotation.value;
     Expect.stringEquals('xyz', value.value.slowToString());
 
-    checkPosition(annotation, annotation.cachedNode, source, compiler);
+    checkPosition(annotation, annotation.cachedNode, source1, compiler);
   });
 
   // Ensure that each repeated annotation has a unique instance of
   // [MetadataAnnotation].
-  source = """const native = 'xyz';
-              @native @native
-              $declaration
-              main() {}""";
+  var source2 = """const native = 'xyz';
+                   @native @native
+                   $declaration
+                   main() {}""";
 
-  compileAndCheck(source, name, (compiler, element) {
+  compileAndCheck(source2, name, (compiler, element) {
     compiler.enqueuer.resolution.queueIsClosed = false;
     Expect.equals(2, length(element.metadata));
     PartialMetadataAnnotation annotation1 = element.metadata.head;
@@ -63,22 +62,22 @@
     Expect.stringEquals('xyz', value1.value.slowToString());
     Expect.stringEquals('xyz', value2.value.slowToString());
 
-    checkPosition(annotation1, annotation1.cachedNode, source, compiler);
-    checkPosition(annotation2, annotation2.cachedNode, source, compiler);
+    checkPosition(annotation1, annotation1.cachedNode, source2, compiler);
+    checkPosition(annotation2, annotation2.cachedNode, source2, compiler);
   });
 
   if (isTopLevelOnly) return;
 
   // Ensure that a compile-time constant can be resolved from an
   // annotation.
-  source = """const native = 'xyz';
-              class Foo {
-                @native
-                $declaration
-              }
-              main() {}""";
+  var source3 = """const native = 'xyz';
+                   class Foo {
+                     @native
+                     $declaration
+                   }
+                   main() {}""";
 
-  compileAndCheck(source, 'Foo', (compiler, element) {
+  compileAndCheck(source3, 'Foo', (compiler, element) {
     compiler.enqueuer.resolution.queueIsClosed = false;
     Expect.equals(0, length(element.metadata));
     element.ensureResolved(compiler);
@@ -90,19 +89,19 @@
     Constant value = annotation.value;
     Expect.stringEquals('xyz', value.value.slowToString());
 
-    checkPosition(annotation, annotation.cachedNode, source, compiler);
+    checkPosition(annotation, annotation.cachedNode, source3, compiler);
   });
 
   // Ensure that each repeated annotation has a unique instance of
   // [MetadataAnnotation].
-  source = """const native = 'xyz';
-              class Foo {
-                @native @native
-                $declaration
-              }
-              main() {}""";
+  var source4 = """const native = 'xyz';
+                   class Foo {
+                     @native @native
+                     $declaration
+                   }
+                   main() {}""";
 
-  compileAndCheck(source, 'Foo', (compiler, element) {
+  compileAndCheck(source4, 'Foo', (compiler, element) {
     compiler.enqueuer.resolution.queueIsClosed = false;
     Expect.equals(0, length(element.metadata));
     element.ensureResolved(compiler);
@@ -122,8 +121,8 @@
     Expect.stringEquals('xyz', value1.value.slowToString());
     Expect.stringEquals('xyz', value2.value.slowToString());
 
-    checkPosition(annotation1, annotation1.cachedNode, source, compiler);
-    checkPosition(annotation1, annotation2.cachedNode, source, compiler);
+    checkPosition(annotation1, annotation1.cachedNode, source4, compiler);
+    checkPosition(annotation1, annotation2.cachedNode, source4, compiler);
   });
 }
 
@@ -156,21 +155,23 @@
     var compiler = compilerFor(source, uri)
         ..registerSource(partUri, partSource)
         ..registerSource(libUri, libSource)
-        ..registerSource(async, 'class DeferredLibrary {}')
-        ..runCompiler(uri);
-    compiler.enqueuer.resolution.queueIsClosed = false;
-    LibraryElement element = compiler.libraries['$uri'];
-    Expect.isNotNull(element, 'Cannot find $uri');
+        ..registerSource(async, 'class DeferredLibrary {}');
 
-    Link<MetadataAnnotation> metadata = extractMetadata(element);
-    Expect.equals(1, length(metadata));
+    asyncTest(() => compiler.runCompiler(uri).then((_) {
+      compiler.enqueuer.resolution.queueIsClosed = false;
+      LibraryElement element = compiler.libraries['$uri'];
+      Expect.isNotNull(element, 'Cannot find $uri');
 
-    PartialMetadataAnnotation annotation = metadata.head;
-    annotation.ensureResolved(compiler);
-    Constant value = annotation.value;
-    Expect.stringEquals('xyz', value.value.slowToString());
+      Link<MetadataAnnotation> metadata = extractMetadata(element);
+      Expect.equals(1, length(metadata));
 
-    checkPosition(annotation, annotation.cachedNode, source, compiler);
+      PartialMetadataAnnotation annotation = metadata.head;
+      annotation.ensureResolved(compiler);
+      Constant value = annotation.value;
+      Expect.stringEquals('xyz', value.value.slowToString());
+
+      checkPosition(annotation, annotation.cachedNode, source, compiler);
+    }));
   }
 
   var source;
diff --git a/tests/compiler/dart2js/mirror_helper_rename_test.dart b/tests/compiler/dart2js/mirror_helper_rename_test.dart
index 67f1a95..9b82355 100644
--- a/tests/compiler/dart2js/mirror_helper_rename_test.dart
+++ b/tests/compiler/dart2js/mirror_helper_rename_test.dart
@@ -3,6 +3,8 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import 'dart:async';
+import "package:async_helper/async_helper.dart";
 import 'memory_compiler.dart' show compilerFor;
 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart' show
     Compiler;
@@ -26,7 +28,7 @@
   testWithoutMirrorHelperLibrary(minify: false);
 }
 
-Compiler runCompiler({useMirrorHelperLibrary: false, minify: false}) {
+Future<Compiler> runCompiler({useMirrorHelperLibrary: false, minify: false}) {
   List<String> options = ['--output-type=dart'];
   if (minify) {
     options.add('--minify');
@@ -34,58 +36,59 @@
   Compiler compiler = compilerFor(MEMORY_SOURCE_FILES, options: options);
   DartBackend backend = compiler.backend;
   backend.useMirrorHelperLibrary = useMirrorHelperLibrary;
-  compiler.runCompiler(Uri.parse('memory:main.dart'));
-  return compiler;
+  return
+      compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) => compiler);
 }
 
 void testWithMirrorHelperLibrary({bool minify}) {
-  Compiler compiler = runCompiler(useMirrorHelperLibrary: true, minify: minify);
+  asyncTest(() => runCompiler(useMirrorHelperLibrary: true, minify: minify).
+      then((Compiler compiler) {
+    DartBackend backend = compiler.backend;
+    MirrorRenamer mirrorRenamer = backend.mirrorRenamer;
+    Map<Node, String> renames = backend.renames;
+    Map<String, SourceString> symbols = mirrorRenamer.symbols;
 
-  DartBackend backend = compiler.backend;
-  MirrorRenamer mirrorRenamer = backend.mirrorRenamer;
-  Map<Node, String> renames = backend.renames;
-  Map<String, SourceString> symbols = mirrorRenamer.symbols;
+    Expect.isFalse(null == backend.mirrorHelperLibrary);
+    Expect.isFalse(null == backend.mirrorHelperGetNameFunction);
 
-  Expect.isFalse(null == backend.mirrorHelperLibrary);
-  Expect.isFalse(null == backend.mirrorHelperGetNameFunction);
-
-  for (Node n in renames.keys) {
-    if (symbols.containsKey(renames[n])) {
-      if(n.toString() == 'getName') {
-        Expect.equals(
-            const SourceString(MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION),
-            symbols[renames[n]]);
-      } else {
-        Expect.equals(n.toString(), symbols[renames[n]].stringValue);
+    for (Node n in renames.keys) {
+      if (symbols.containsKey(renames[n])) {
+        if(n.toString() == 'getName') {
+          Expect.equals(
+              const SourceString(MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION),
+              symbols[renames[n]]);
+        } else {
+          Expect.equals(n.toString(), symbols[renames[n]].stringValue);
+        }
       }
     }
-  }
 
-  String output = compiler.assembledCode;
-  String getNameMatch = MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION;
-  Iterable i = getNameMatch.allMatches(output);
+    String output = compiler.assembledCode;
+    String getNameMatch = MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION;
+    Iterable i = getNameMatch.allMatches(output);
 
+    if (minify) {
+      Expect.equals(0, i.length);
+    } else {
+      // Appears twice in code (defined & called).
+      Expect.equals(2, i.length);
+    }
 
-  if (minify) {
-    Expect.equals(0, i.length);
-  } else {
-    // Appears twice in code (defined & called).
-    Expect.equals(2, i.length);
-  }
-
-  String mapMatch = 'const<String,SourceString>';
-  i = mapMatch.allMatches(output);
-  Expect.equals(1, i.length);
+    String mapMatch = 'const<String,SourceString>';
+    i = mapMatch.allMatches(output);
+    Expect.equals(1, i.length);
+  }));
 }
 
 void testWithoutMirrorHelperLibrary({bool minify}) {
-  Compiler compiler =
-      runCompiler(useMirrorHelperLibrary: false, minify: minify);
-  DartBackend backend = compiler.backend;
+  asyncTest(() => runCompiler(useMirrorHelperLibrary: false, minify: minify).
+      then((Compiler compiler) {
+    DartBackend backend = compiler.backend;
 
-  Expect.equals(null, backend.mirrorHelperLibrary);
-  Expect.equals(null, backend.mirrorHelperGetNameFunction);
-  Expect.equals(null, backend.mirrorRenamer);
+    Expect.equals(null, backend.mirrorHelperLibrary);
+    Expect.equals(null, backend.mirrorHelperGetNameFunction);
+    Expect.equals(null, backend.mirrorRenamer);
+  }));
 }
 
 const MEMORY_SOURCE_FILES = const <String, String> {
diff --git a/tests/compiler/dart2js/mirror_helper_test.dart b/tests/compiler/dart2js/mirror_helper_test.dart
index ba3b9af..b2f2b29 100644
--- a/tests/compiler/dart2js/mirror_helper_test.dart
+++ b/tests/compiler/dart2js/mirror_helper_test.dart
@@ -3,6 +3,8 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import 'dart:async';
+import "package:async_helper/async_helper.dart";
 import 'memory_compiler.dart' show compilerFor;
 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart' show
     Compiler;
@@ -35,7 +37,7 @@
   testWithoutMirrorRenaming(minify: false);
 }
 
-Compiler runCompiler({useMirrorHelperLibrary: false, minify: false}) {
+Future<Compiler> runCompiler({useMirrorHelperLibrary: false, minify: false}) {
   List<String> options = ['--output-type=dart'];
   if (minify) {
     options.add('--minify');
@@ -43,42 +45,45 @@
   Compiler compiler = compilerFor(MEMORY_SOURCE_FILES, options: options);
   DartBackend backend = compiler.backend;
   backend.useMirrorHelperLibrary = useMirrorHelperLibrary;
-  compiler.runCompiler(Uri.parse('memory:main.dart'));
-  return compiler;
+  return
+      compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) => compiler);
 }
 
 void testWithMirrorRenaming({bool minify}) {
-  Compiler compiler = runCompiler(useMirrorHelperLibrary: true, minify: minify);
+  asyncTest(() => runCompiler(useMirrorHelperLibrary: true, minify: minify).
+      then((Compiler compiler) {
 
-  DartBackend backend = compiler.backend;
-  MirrorRenamer mirrorRenamer = backend.mirrorRenamer;
-  Map<Node, String> renames = backend.renames;
-  Map<LibraryElement, String> imports = backend.imports;
+    DartBackend backend = compiler.backend;
+    MirrorRenamer mirrorRenamer = backend.mirrorRenamer;
+    Map<Node, String> renames = backend.renames;
+    Map<LibraryElement, String> imports = backend.imports;
 
-  Node getNameFunctionNode =
-      backend.memberNodes.values.first.first.body.statements.nodes.head;
+    Node getNameFunctionNode =
+        backend.memberNodes.values.first.first.body.statements.nodes.head;
 
-  Expect.equals(renames[mirrorRenamer.mirrorHelperGetNameFunctionNode.name],
-                renames[getNameFunctionNode.expression.selector]);
-  Expect.equals("",
-                renames[getNameFunctionNode.expression.receiver]);
-  Expect.equals(1, imports.keys.length);
+    Expect.equals(renames[mirrorRenamer.mirrorHelperGetNameFunctionNode.name],
+                  renames[getNameFunctionNode.expression.selector]);
+    Expect.equals("",
+                  renames[getNameFunctionNode.expression.receiver]);
+    Expect.equals(1, imports.keys.length);
+  }));
 }
 
 void testWithoutMirrorRenaming({bool minify}) {
-  Compiler compiler =
-      runCompiler(useMirrorHelperLibrary: false, minify: minify);
+  asyncTest(() => runCompiler(useMirrorHelperLibrary: false, minify: minify).
+      then((Compiler compiler) {
 
-  DartBackend backend = compiler.backend;
-  Map<Node, String> renames = backend.renames;
-  Map<LibraryElement, String> imports = backend.imports;
+    DartBackend backend = compiler.backend;
+    Map<Node, String> renames = backend.renames;
+    Map<LibraryElement, String> imports = backend.imports;
 
-  Node getNameFunctionNode =
-      backend.memberNodes.values.first.first.body.statements.nodes.head;
+    Node getNameFunctionNode =
+        backend.memberNodes.values.first.first.body.statements.nodes.head;
 
-  Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.selector));
-  Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.receiver));
-  Expect.equals(1, imports.keys.length);
+    Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.selector));
+    Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.receiver));
+    Expect.equals(1, imports.keys.length);
+  }));
 }
 
 const MEMORY_SOURCE_FILES = const <String, String> {
diff --git a/tests/compiler/dart2js/mirror_helper_unique_minification_test.dart b/tests/compiler/dart2js/mirror_helper_unique_minification_test.dart
index c1206fc..490aad3 100644
--- a/tests/compiler/dart2js/mirror_helper_unique_minification_test.dart
+++ b/tests/compiler/dart2js/mirror_helper_unique_minification_test.dart
@@ -3,6 +3,8 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import 'dart:async';
+import "package:async_helper/async_helper.dart";
 import 'memory_compiler.dart' show compilerFor;
 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart' show
     Compiler;
@@ -20,7 +22,7 @@
   testNoUniqueMinification();
 }
 
-Compiler runCompiler({useMirrorHelperLibrary: false, minify: false}) {
+Future<Compiler> runCompiler({useMirrorHelperLibrary: false, minify: false}) {
   List<String> options = ['--output-type=dart'];
   if (minify) {
     options.add('--minify');
@@ -28,41 +30,46 @@
   Compiler compiler = compilerFor(MEMORY_SOURCE_FILES, options: options);
   DartBackend backend = compiler.backend;
   backend.useMirrorHelperLibrary = useMirrorHelperLibrary;
-  compiler.runCompiler(Uri.parse('memory:main.dart'));
-  return compiler;
+  return
+      compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) => compiler);
 }
 
 void testUniqueMinification() {
-  Compiler compiler = runCompiler(useMirrorHelperLibrary: true, minify: true);
-  DartBackend backend = compiler.backend;
-  MirrorRenamer mirrorRenamer = backend.mirrorRenamer;
-  Map<Node, String> renames = backend.renames;
-  Map<String, SourceString> symbols = mirrorRenamer.symbols;
+  asyncTest(() => runCompiler(useMirrorHelperLibrary: true, minify: true).
+      then((Compiler compiler) {
+    DartBackend backend = compiler.backend;
+    MirrorRenamer mirrorRenamer = backend.mirrorRenamer;
+    Map<Node, String> renames = backend.renames;
+    Map<String, SourceString> symbols = mirrorRenamer.symbols;
 
-  // Check that no two different source code names get the same mangled name,
-  // with the exception of MirrorSystem.getName that gets renamed to the same
-  // mangled name as the getNameHelper from _mirror_helper.dart.
-  for (Node node in renames.keys) {
-    Identifier identifier = node.asIdentifier();
-    if (identifier != null) {
-      SourceString source = identifier.source;
-      if (mirrorRenamer.mirrorSystemGetNameNodes.first.selector == node)
-        continue;
-      if (symbols.containsKey(renames[node])) {
-        print(node);
-        Expect.equals(source, symbols[renames[node]]);
+    // Check that no two different source code names get the same mangled name,
+    // with the exception of MirrorSystem.getName that gets renamed to the same
+    // mangled name as the getNameHelper from _mirror_helper.dart.
+    for (Node node in renames.keys) {
+      Identifier identifier = node.asIdentifier();
+      if (identifier != null) {
+        SourceString source = identifier.source;
+        if (mirrorRenamer.mirrorSystemGetNameNodes.first.selector == node)
+          continue;
+        if (symbols.containsKey(renames[node])) {
+          print(node);
+          Expect.equals(source, symbols[renames[node]]);
+        }
       }
     }
-  }
+  }));
 }
 
 void testNoUniqueMinification() {
-  Compiler compiler = runCompiler(useMirrorHelperLibrary: false, minify: true);
-  DartBackend backend = compiler.backend;
-  Map<Node, String> renames = backend.renames;
+  asyncTest(() => runCompiler(useMirrorHelperLibrary: false, minify: true).
+      then((Compiler compiler) {
+    DartBackend backend = compiler.backend;
+    Map<Node, String> renames = backend.renames;
 
-  // 'Foo' appears twice and 'invocation' and 'hest' get the same mangled name.
-  Expect.equals(renames.values.toSet().length, renames.values.length - 2);
+    // 'Foo' appears twice and 'invocation' and 'hest' get the same mangled
+    // name.
+    Expect.equals(renames.values.toSet().length, renames.values.length - 2);
+  }));
 }
 
 const MEMORY_SOURCE_FILES = const <String, String> {
diff --git a/tests/compiler/dart2js/mirror_tree_shaking_test.dart b/tests/compiler/dart2js/mirror_tree_shaking_test.dart
index c3c6393..67717f6 100644
--- a/tests/compiler/dart2js/mirror_tree_shaking_test.dart
+++ b/tests/compiler/dart2js/mirror_tree_shaking_test.dart
@@ -5,6 +5,7 @@
 // Test that tree-shaking hasn't been turned off.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'memory_source_file_helper.dart';
 
 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
@@ -20,8 +21,7 @@
   Uri libraryRoot = script.resolve('../../../sdk/');
   Uri packageRoot = script.resolve('./packages/');
 
-  MemorySourceFileProvider.MEMORY_SOURCE_FILES = MEMORY_SOURCE_FILES;
-  var provider = new MemorySourceFileProvider();
+  var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);
   void diagnosticHandler(Uri uri, int begin, int end,
                          String message, Diagnostic kind) {
     if (kind == Diagnostic.VERBOSE_INFO
@@ -42,12 +42,13 @@
                                    libraryRoot,
                                    packageRoot,
                                    []);
-  compiler.run(Uri.parse('memory:main.dart'));
-  Expect.isFalse(compiler.compilationFailed);
-  Expect.isFalse(compiler.enqueuer.resolution.hasEnqueuedEverything);
-  Expect.isFalse(compiler.enqueuer.codegen.hasEnqueuedEverything);
-  Expect.isFalse(compiler.disableTypeInference);
-  Expect.isFalse(compiler.backend.hasRetainedMetadata);
+  asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
+    Expect.isFalse(compiler.compilationFailed);
+    Expect.isFalse(compiler.enqueuer.resolution.hasEnqueuedEverything);
+    Expect.isFalse(compiler.enqueuer.codegen.hasEnqueuedEverything);
+    Expect.isFalse(compiler.disableTypeInference);
+    Expect.isFalse(compiler.backend.hasRetainedMetadata);
+  }));
 }
 
 const Map MEMORY_SOURCE_FILES = const {
diff --git a/tests/compiler/dart2js/mirrors_lookup_test.dart b/tests/compiler/dart2js/mirrors_lookup_test.dart
index 8cda12e..d5ebab5 100644
--- a/tests/compiler/dart2js/mirrors_lookup_test.dart
+++ b/tests/compiler/dart2js/mirrors_lookup_test.dart
@@ -5,6 +5,7 @@
 library dart2js.test.memory_source_file_helper;
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'memory_compiler.dart';
 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart';
 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart';
@@ -33,9 +34,9 @@
 };
 
 void main() {
-  mirrorSystemFor(MEMORY_SOURCE_FILES).then(
+  asyncTest(() => mirrorSystemFor(MEMORY_SOURCE_FILES).then(
       (MirrorSystem mirrors) => test(mirrors),
-      onError: (e) => Expect.fail('$e'));
+      onError: (e) => Expect.fail('$e')));
 }
 
 void test(MirrorSystem mirrors) {
diff --git a/tests/compiler/dart2js/mirrors_metadata_test.dart b/tests/compiler/dart2js/mirrors_metadata_test.dart
index 22b0c81..1e3307c 100644
--- a/tests/compiler/dart2js/mirrors_metadata_test.dart
+++ b/tests/compiler/dart2js/mirrors_metadata_test.dart
@@ -4,6 +4,7 @@
 
 import 'package:expect/expect.dart';
 import 'dart:async';
+import "package:async_helper/async_helper.dart";
 import 'dart:io';
 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart';
 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart';
@@ -14,15 +15,16 @@
 const String SOURCE = 'source';
 Uri SOURCE_URI = new Uri(scheme: SOURCE, path: SOURCE);
 
-MirrorSystem createMirrorSystem(String source) {
+Future<MirrorSystem> createMirrorSystem(String source) {
   MockCompiler compiler = new MockCompiler(
       analyzeOnly: true,
       analyzeAll: true,
       preserveComments: true);
-  compiler.registerSource(SOURCE_URI, source);
-  compiler.librariesToAnalyzeWhenRun = <Uri>[SOURCE_URI];
-  compiler.runCompiler(null);
-  return new Dart2JsMirrorSystem(compiler);
+    compiler.registerSource(SOURCE_URI, source);
+    compiler.librariesToAnalyzeWhenRun = <Uri>[SOURCE_URI];
+  return compiler.runCompiler(null).then((_) {
+    return new Dart2JsMirrorSystem(compiler);
+  });
 }
 
 void validateDeclarationComment(String code,
@@ -30,21 +32,22 @@
                                 String trimmedText,
                                 bool isDocComment,
                                 List<String> declarationNames) {
-  MirrorSystem mirrors = createMirrorSystem(code);
-  LibraryMirror library = mirrors.libraries[SOURCE_URI];
-  Expect.isNotNull(library);
-  for (String declarationName in declarationNames) {
-    DeclarationMirror declaration = library.members[declarationName];
-    Expect.isNotNull(declaration);
-    List<InstanceMirror> metadata = declaration.metadata;
-    Expect.isNotNull(metadata);
-    Expect.equals(1, metadata.length);
-    Expect.isTrue(metadata[0] is CommentInstanceMirror);
-    CommentInstanceMirror commentMetadata = metadata[0];
-    Expect.equals(text, commentMetadata.text);
-    Expect.equals(trimmedText, commentMetadata.trimmedText);
-    Expect.equals(isDocComment, commentMetadata.isDocComment);
-  }
+  asyncTest(() => createMirrorSystem(code).then((mirrors) {
+    LibraryMirror library = mirrors.libraries[SOURCE_URI];
+    Expect.isNotNull(library);
+    for (String declarationName in declarationNames) {
+      DeclarationMirror declaration = library.members[declarationName];
+      Expect.isNotNull(declaration);
+      List<InstanceMirror> metadata = declaration.metadata;
+      Expect.isNotNull(metadata);
+      Expect.equals(1, metadata.length);
+      Expect.isTrue(metadata[0] is CommentInstanceMirror);
+      CommentInstanceMirror commentMetadata = metadata[0];
+      Expect.equals(text, commentMetadata.text);
+      Expect.equals(trimmedText, commentMetadata.trimmedText);
+      Expect.equals(isDocComment, commentMetadata.isDocComment);
+    }
+  }));
 }
 
 void testDeclarationComment(String declaration, List<String> declarationNames) {
diff --git a/tests/compiler/dart2js/mirrors_test.dart b/tests/compiler/dart2js/mirrors_test.dart
index 75aadeb..7051a3b 100644
--- a/tests/compiler/dart2js/mirrors_test.dart
+++ b/tests/compiler/dart2js/mirrors_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart';
 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart';
 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart';
@@ -48,12 +49,13 @@
   var provider = new SourceFileProvider();
   var diagnosticHandler =
         new FormattingDiagnosticHandler(provider).diagnosticHandler;
+  asyncStart();
   var result = analyze([inputUri], libUri, null,
                        provider.readStringFromUri, diagnosticHandler,
                        <String>['--preserve-comments']);
   result.then((MirrorSystem mirrors) {
     test(mirrors);
-  });
+  }).whenComplete(() => asyncEnd());
 }
 
 void test(MirrorSystem mirrors) {
diff --git a/tests/compiler/dart2js/mirrors_used_test.dart b/tests/compiler/dart2js/mirrors_used_test.dart
index 2608a31..4c0a807 100644
--- a/tests/compiler/dart2js/mirrors_used_test.dart
+++ b/tests/compiler/dart2js/mirrors_used_test.dart
@@ -7,6 +7,7 @@
 library dart2js.test.mirrors_used_test;
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 
 import 'memory_compiler.dart' show
     compilerFor;
@@ -35,87 +36,88 @@
 void main() {
   Compiler compiler = compilerFor(
       MEMORY_SOURCE_FILES, diagnosticHandler: expectOnlyVerboseInfo);
-  compiler.runCompiler(Uri.parse('memory:main.dart'));
+  asyncTest(() => compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) {
+    print('');
+    List generatedCode =
+        Elements.sortedByPosition(compiler.enqueuer.codegen.generatedCode.keys);
+    for (var element in generatedCode) {
+      print(element);
+    }
+    print('');
 
-  print('');
-  List generatedCode =
-      Elements.sortedByPosition(compiler.enqueuer.codegen.generatedCode.keys);
-  for (var element in generatedCode) {
-    print(element);
-  }
-  print('');
+    // This assertion can fail for two reasons:
+    // 1. Too many elements retained for reflection.
+    // 2. Some code was refactored, and there are more methods.
+    // Either situation could be problematic, but in situation 2, it is often
+    // acceptable to increase [expectedMethodCount] a little.
+    int expectedMethodCount = 322;
+    Expect.isTrue(
+        generatedCode.length <= expectedMethodCount,
+        'Too many compiled methods: '
+        '${generatedCode.length} > $expectedMethodCount');
 
-  // This assertion can fail for two reasons:
-  // 1. Too many elements retained for reflection.
-  // 2. Some code was refactored, and there are more methods.
-  // Either situation could be problematic, but in situation 2, it is often
-  // acceptable to increase [expectedMethodCount] a little.
-  int expectedMethodCount = 322;
-  Expect.isTrue(
-      generatedCode.length <= expectedMethodCount,
-      'Too many compiled methods: '
-      '${generatedCode.length} > $expectedMethodCount');
+    // The following names should be retained:
+    List expectedNames = [
+        'Foo', // The name of class Foo.
+        r'Foo$', // The name of class Foo's constructor.
+        'Foo_staticMethod', // The name of Foo.staticMethod.
+        r'get$field', // The (getter) name of Foo.field.
+        r'instanceMethod$0']; // The name of Foo.instanceMethod.
+    Set recordedNames = new Set()
+        ..addAll(compiler.backend.emitter.recordedMangledNames)
+        ..addAll(compiler.backend.emitter.mangledFieldNames.keys)
+        ..addAll(compiler.backend.emitter.mangledGlobalFieldNames.keys);
+    Expect.setEquals(new Set.from(expectedNames), recordedNames);
 
-  // The following names should be retained:
-  List expectedNames = [
-      'Foo', // The name of class Foo.
-      r'Foo$', // The name of class Foo's constructor.
-      'Foo_staticMethod', // The name of Foo.staticMethod.
-      r'get$field', // The (getter) name of Foo.field.
-      r'instanceMethod$0']; // The name of Foo.instanceMethod.
-  Set recordedNames = new Set()
-      ..addAll(compiler.backend.emitter.recordedMangledNames)
-      ..addAll(compiler.backend.emitter.mangledFieldNames.keys)
-      ..addAll(compiler.backend.emitter.mangledGlobalFieldNames.keys);
-  Expect.setEquals(new Set.from(expectedNames), recordedNames);
-
-  for (var library in compiler.libraries.values) {
-    library.forEachLocalMember((member) {
-      if (library == compiler.mainApp
-          && member.name == const SourceString('Foo')) {
-        Expect.isTrue(
-            compiler.backend.isNeededForReflection(member), '$member');
-        member.forEachLocalMember((classMember) {
+    for (var library in compiler.libraries.values) {
+      library.forEachLocalMember((member) {
+        if (library == compiler.mainApp
+            && member.name == const SourceString('Foo')) {
           Expect.isTrue(
-              compiler.backend.isNeededForReflection(classMember),
-              '$classMember');
-        });
-      } else {
-        Expect.isFalse(
-            compiler.backend.isNeededForReflection(member), '$member');
+              compiler.backend.isNeededForReflection(member), '$member');
+          member.forEachLocalMember((classMember) {
+            Expect.isTrue(
+                compiler.backend.isNeededForReflection(classMember),
+                '$classMember');
+          });
+        } else {
+          Expect.isFalse(
+              compiler.backend.isNeededForReflection(member), '$member');
+        }
+      });
+    }
+
+    // There should at least be three metadata constants:
+    // 1. The type literal 'Foo'.
+    // 2. The list 'const [Foo]'.
+    // 3. The constructed constant for 'MirrorsUsed'.
+    Expect.isTrue(compiler.metadataHandler.compiledConstants.length >= 3);
+
+    // Make sure that most of the metadata constants aren't included in the
+    // generated code.
+    for (Constant constant in compiler.metadataHandler.compiledConstants) {
+      if (constant is TypeConstant && '${constant.representedType}' == 'Foo') {
+        // The type literal 'Foo' is retained as a constant because it is being
+        // passed to reflectClass.
+        continue;
       }
-    });
-  }
-
-  // There should at least be three metadata constants:
-  // 1. The type literal 'Foo'.
-  // 2. The list 'const [Foo]'.
-  // 3. The constructed constant for 'MirrorsUsed'.
-  Expect.isTrue(compiler.metadataHandler.compiledConstants.length >= 3);
-
-  // Make sure that most of the metadata constants aren't included in the
-  // generated code.
-  for (Constant constant in compiler.metadataHandler.compiledConstants) {
-    if (constant is TypeConstant && '${constant.representedType}' == 'Foo') {
-      // The type literal 'Foo' is retained as a constant because it is being
-      // passed to reflectClass.
-      continue;
+      Expect.isFalse(
+          compiler.constantHandler.compiledConstants.contains(constant),
+          '$constant');
     }
-    Expect.isFalse(
-        compiler.constantHandler.compiledConstants.contains(constant),
-        '$constant');
-  }
 
-  // The type literal 'Foo' is both used as metadata, and as a plain value in
-  // the program. Make sure that it isn't duplicated.
-  int fooConstantCount = 0;
-  for (Constant constant in compiler.metadataHandler.compiledConstants) {
-    if (constant is TypeConstant && '${constant.representedType}' == 'Foo') {
-      fooConstantCount++;
+    // The type literal 'Foo' is both used as metadata, and as a plain value in
+    // the program. Make sure that it isn't duplicated.
+    int fooConstantCount = 0;
+    for (Constant constant in compiler.metadataHandler.compiledConstants) {
+      if (constant is TypeConstant && '${constant.representedType}' == 'Foo') {
+        fooConstantCount++;
+      }
     }
-  }
-  Expect.equals(
-      1, fooConstantCount, "The type literal 'Foo' is duplicated or missing.");
+    Expect.equals(
+        1, fooConstantCount,
+        "The type literal 'Foo' is duplicated or missing.");
+  }));
 }
 
 const MEMORY_SOURCE_FILES = const <String, String> {
diff --git a/tests/compiler/dart2js/missing_file_test.dart b/tests/compiler/dart2js/missing_file_test.dart
new file mode 100644
index 0000000..349b61c
--- /dev/null
+++ b/tests/compiler/dart2js/missing_file_test.dart
@@ -0,0 +1,78 @@
+// Copyright (c) 2013, 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.

+

+// Test that the compiler can handle imports when package root has not been set.

+

+library dart2js.test.missing_file;

+

+import 'package:expect/expect.dart';

+import "package:async_helper/async_helper.dart";

+import 'memory_source_file_helper.dart';

+

+import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'

+       show NullSink;

+

+import '../../../sdk/lib/_internal/compiler/compiler.dart'

+       show DiagnosticHandler, Diagnostic;

+

+import 'dart:async';

+

+import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart';

+import '../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart';

+

+const MEMORY_SOURCE_FILES = const {

+  'main.dart': '''

+

+import 'foo.dart';

+

+main() {}

+''',

+};

+

+void runCompiler(Uri main, String expectedMessage) {

+  Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));

+  Uri libraryRoot = script.resolve('../../../sdk/');

+

+  var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);

+  var handler = new FormattingDiagnosticHandler(provider);

+  var errors = [];

+

+  void diagnosticHandler(Uri uri, int begin, int end, String message,

+                         Diagnostic kind) {

+    if (kind == Diagnostic.ERROR) {

+      errors.add(message);

+    }

+    handler(uri, begin, end, message, kind);

+  }

+

+

+  EventSink<String> outputProvider(String name, String extension) {

+    if (name != '') throw 'Attempt to output file "$name.$extension"';

+    return new NullSink('$name.$extension');

+  }

+

+  Compiler compiler = new Compiler(provider,

+                                   outputProvider,

+                                   diagnosticHandler,

+                                   libraryRoot,

+                                   null,

+                                   []);

+

+  asyncTest(() => compiler.run(main).then((_) {

+    Expect.equals(1, errors.length);

+    Expect.equals(expectedMessage,

+                  errors[0]);

+  }));

+}

+

+void main() {

+  runCompiler(Uri.parse('memory:main.dart'),

+              "Error: Can't read 'memory:foo.dart' "

+              "(No such file memory:foo.dart).");

+  runCompiler(Uri.parse('memory:foo.dart'),

+              "Error: Can't read 'memory:foo.dart' "

+              "(No such file memory:foo.dart).");

+  runCompiler(Uri.parse('dart:foo'),

+              'Error: Library not found "dart:foo".');

+}

diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart
index c30295e..b4494bc 100644
--- a/tests/compiler/dart2js/mock_compiler.dart
+++ b/tests/compiler/dart2js/mock_compiler.dart
@@ -5,6 +5,7 @@
 library mock_compiler;
 
 import "package:expect/expect.dart";
+import 'dart:async';
 import 'dart:collection';
 
 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api;
@@ -23,8 +24,6 @@
 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
     hide TreeElementMapping;
 
-import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart';
-
 import '../../../sdk/lib/_internal/compiler/implementation/deferred_load.dart'
     show DeferredLoadTask;
 
@@ -101,6 +100,7 @@
   }
   abstract class JSIndexable {
     get length;
+    operator[](index);
   }
   abstract class JSMutableIndexable extends JSIndexable {}
   class JSArray extends Interceptor implements List, JSIndexable {
@@ -123,13 +123,13 @@
   }
   class JSNumber extends Interceptor implements num {
     // All these methods return a number to please type inferencing.
-    operator-() => (this is JSInt) ? 42 : 42.0;
-    operator +(other) => (this is JSInt) ? 42 : 42.0;
-    operator -(other) => (this is JSInt) ? 42 : 42.0;
+    operator-() => (this is JSInt) ? 42 : 42.2;
+    operator +(other) => (this is JSInt) ? 42 : 42.2;
+    operator -(other) => (this is JSInt) ? 42 : 42.2;
     operator ~/(other) => 42;
-    operator /(other) => (this is JSInt) ? 42 : 42.0;
-    operator *(other) => (this is JSInt) ? 42 : 42.0;
-    operator %(other) => (this is JSInt) ? 42 : 42.0;
+    operator /(other) => (this is JSInt) ? 42 : 42.2;
+    operator *(other) => (this is JSInt) ? 42 : 42.2;
+    operator %(other) => (this is JSInt) ? 42 : 42.2;
     operator <<(other) => 42;
     operator >>(other) => 42;
     operator |(other) => 42;
@@ -143,8 +143,8 @@
     operator ==(other) => true;
     get hashCode => throw "JSNumber.hashCode not implemented.";
 
-    abs() => (this is JSInt) ? 42 : 42.0;
-    remainder(other) => (this is JSInt) ? 42 : 42.0;
+    abs() => (this is JSInt) ? 42 : 42.2;
+    remainder(other) => (this is JSInt) ? 42 : 42.2;
     truncate() => 42;
   }
   class JSInt extends JSNumber implements int {
@@ -239,6 +239,7 @@
               emitJavaScript: emitJavaScript,
               preserveComments: preserveComments) {
     coreLibrary = createLibrary("core", coreSource);
+
     // We need to set the assert method to avoid calls with a 'null'
     // target being interpreted as a call to assert.
     jsHelperLibrary = createLibrary("helper", helperSource);
@@ -377,12 +378,14 @@
     parseUnit(text, this, library, registerSource);
   }
 
-  void scanBuiltinLibraries() {
+  Future scanBuiltinLibraries() {
     // Do nothing. The mock core library is already handled in the constructor.
+    return new Future.value();
   }
 
-  LibraryElement scanBuiltinLibrary(String name) {
+  Future<LibraryElement> scanBuiltinLibrary(String name) {
     // Do nothing. The mock core library is already handled in the constructor.
+    return new Future.value();
   }
 
   Uri translateResolvedUri(LibraryElement importingLibrary,
@@ -391,10 +394,10 @@
   // The mock library doesn't need any patches.
   Uri resolvePatchUri(String dartLibraryName) => null;
 
-  Script readScript(Uri uri, [Node node]) {
+  Future<Script> readScript(Uri uri, [Element element, Node node]) {
     SourceFile sourceFile = sourceFiles[uri.toString()];
     if (sourceFile == null) throw new ArgumentError(uri);
-    return new Script(uri, sourceFile);
+    return new Future.value(new Script(uri, sourceFile));
   }
 
   Element lookupElementIn(ScopeContainerElement container, name) {
@@ -467,3 +470,19 @@
     // Do nothing.
   }
 }
+
+api.DiagnosticHandler createHandler(MockCompiler compiler, String text) {
+  return (uri, int begin, int end, String message, kind) {
+    SourceFile sourceFile;
+    if (uri == null) {
+      sourceFile = new SourceFile('analysis', text);
+    } else {
+      sourceFile = compiler.sourceFiles[uri.toString()];
+    }
+    if (sourceFile != null && begin != null && end != null) {
+      print(sourceFile.getLocationMessage(message, begin, end, true, (x) => x));
+    } else {
+      print(message);
+    }
+  };
+}
diff --git a/tests/compiler/dart2js/no_constructor_body_test.dart b/tests/compiler/dart2js/no_constructor_body_test.dart
index 0a11b01..0a3b388 100644
--- a/tests/compiler/dart2js/no_constructor_body_test.dart
+++ b/tests/compiler/dart2js/no_constructor_body_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 const String TEST = r"""
@@ -17,7 +18,7 @@
 """;
 
 main() {
-  String generated = compileAll(TEST);
-  Expect.isTrue(
-      generated.contains('A: {"": "Object;", static:'));
+  asyncTest(() => compileAll(TEST).then((generated) {
+    Expect.isTrue(generated.contains('A: {"": "Object;", static:'));
+  }));
 }
diff --git a/tests/compiler/dart2js/no_duplicate_constructor_body2_test.dart b/tests/compiler/dart2js/no_duplicate_constructor_body2_test.dart
index f2de6cf..a306a0c 100644
--- a/tests/compiler/dart2js/no_duplicate_constructor_body2_test.dart
+++ b/tests/compiler/dart2js/no_duplicate_constructor_body2_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'compiler_helper.dart';
+import "package:async_helper/async_helper.dart";
 
 const String CODE = """
 var x = 0;
@@ -21,8 +22,9 @@
 """;
 
 main() {
-  String generated = compileAll(CODE);
-  RegExp regexp = new RegExp(r'A\$0: function');
-  Iterator<Match> matches = regexp.allMatches(generated).iterator;
-  checkNumberOfMatches(matches, 1);
+  asyncTest(() => compileAll(CODE).then((generated) {
+    RegExp regexp = new RegExp(r'A\$0: function');
+    Iterator<Match> matches = regexp.allMatches(generated).iterator;
+    checkNumberOfMatches(matches, 1);
+  }));
 }
diff --git a/tests/compiler/dart2js/no_duplicate_constructor_body_test.dart b/tests/compiler/dart2js/no_duplicate_constructor_body_test.dart
index 3942536..bad4b4c 100644
--- a/tests/compiler/dart2js/no_duplicate_constructor_body_test.dart
+++ b/tests/compiler/dart2js/no_duplicate_constructor_body_test.dart
@@ -2,6 +2,7 @@
 // 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 "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 const String CODE = """
@@ -15,8 +16,9 @@
 """;
 
 main() {
-  String generated = compileAll(CODE);
-  RegExp regexp = new RegExp(r'\A: {"": "[A-za-z]+;"');
-  Iterator<Match> matches = regexp.allMatches(generated).iterator;
-  checkNumberOfMatches(matches, 1);
+  asyncTest(() => compileAll(CODE).then((generated) {
+    RegExp regexp = new RegExp(r'\A: {"": "[A-za-z]+;"');
+    Iterator<Match> matches = regexp.allMatches(generated).iterator;
+    checkNumberOfMatches(matches, 1);
+  }));
 }
diff --git a/tests/compiler/dart2js/no_duplicate_stub_test.dart b/tests/compiler/dart2js/no_duplicate_stub_test.dart
index 3213529..8ace11b 100644
--- a/tests/compiler/dart2js/no_duplicate_stub_test.dart
+++ b/tests/compiler/dart2js/no_duplicate_stub_test.dart
@@ -2,6 +2,7 @@
 // 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 "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 const String TEST = r"""
@@ -28,8 +29,9 @@
 """;
 
 main() {
-  String generated = compileAll(TEST);
-  RegExp regexp = new RegExp('foo\\\$1\\\$a: function');
-  Iterator<Match> matches = regexp.allMatches(generated).iterator;
-  checkNumberOfMatches(matches, 1);
+  asyncTest(() => compileAll(TEST).then((generated) {
+    RegExp regexp = new RegExp('foo\\\$1\\\$a: function');
+    Iterator<Match> matches = regexp.allMatches(generated).iterator;
+    checkNumberOfMatches(matches, 1);
+  }));
 }
diff --git a/tests/compiler/dart2js/package_root_test.dart b/tests/compiler/dart2js/package_root_test.dart
index 62c106d..98b183b 100644
--- a/tests/compiler/dart2js/package_root_test.dart
+++ b/tests/compiler/dart2js/package_root_test.dart
@@ -7,6 +7,7 @@
 library dart2js.test.package_root;
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'memory_source_file_helper.dart';
 
 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
@@ -33,8 +34,7 @@
   Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
   Uri libraryRoot = script.resolve('../../../sdk/');
 
-  MemorySourceFileProvider.MEMORY_SOURCE_FILES = MEMORY_SOURCE_FILES;
-  var provider = new MemorySourceFileProvider();
+  var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);
   var handler = new FormattingDiagnosticHandler(provider);
   var errors = [];
 
@@ -52,18 +52,19 @@
     return new NullSink('$name.$extension');
   }
 
-  Compiler compiler = new Compiler(provider.readStringFromUri,
+  Compiler compiler = new Compiler(provider,
                                    outputProvider,
                                    diagnosticHandler,
                                    libraryRoot,
                                    null,
                                    []);
 
-  compiler.run(main);
-  Expect.equals(1, errors.length);
-  Expect.equals('Error: Cannot resolve "package:foo/foo.dart". '
-                'Package root has not been set.',
-                errors[0]);
+  asyncTest(() => compiler.run(main).then((_) {
+    Expect.equals(1, errors.length);
+    Expect.equals('Error: Cannot resolve "package:foo/foo.dart". '
+                  'Package root has not been set.',
+                  errors[0]);
+  }));
 }
 
 void main() {
diff --git a/tests/compiler/dart2js/part_of_test.dart b/tests/compiler/dart2js/part_of_test.dart
index 629c267..79eebf2 100644
--- a/tests/compiler/dart2js/part_of_test.dart
+++ b/tests/compiler/dart2js/part_of_test.dart
@@ -5,6 +5,7 @@
 library part_of_test;
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'mock_compiler.dart';
 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
     show MessageKind;
@@ -25,13 +26,16 @@
   compiler.registerSource(libraryUri, LIBRARY_SOURCE);
   compiler.registerSource(partUri, PART_SOURCE);
 
-  compiler.libraryLoader.loadLibrary(libraryUri, null, libraryUri);
-  print('errors: ${compiler.errors}');
-  print('warnings: ${compiler.warnings}');
-  Expect.isTrue(compiler.errors.isEmpty);
-  Expect.equals(1, compiler.warnings.length);
-  Expect.equals(MessageKind.LIBRARY_NAME_MISMATCH,
-                compiler.warnings[0].message.kind);
-  Expect.equals('foo',
-      compiler.warnings[0].message.arguments['libraryName'].toString());
+  asyncTest(() =>
+      compiler.libraryLoader.loadLibrary(libraryUri, null, libraryUri).
+      then((_) {
+    print('errors: ${compiler.errors}');
+    print('warnings: ${compiler.warnings}');
+    Expect.isTrue(compiler.errors.isEmpty);
+    Expect.equals(1, compiler.warnings.length);
+    Expect.equals(MessageKind.LIBRARY_NAME_MISMATCH,
+                  compiler.warnings[0].message.kind);
+    Expect.equals('foo',
+        compiler.warnings[0].message.arguments['libraryName'].toString());
+  }));
 }
diff --git a/tests/compiler/dart2js/patch_test.dart b/tests/compiler/dart2js/patch_test.dart
index 779efce..9881810 100644
--- a/tests/compiler/dart2js/patch_test.dart
+++ b/tests/compiler/dart2js/patch_test.dart
@@ -2,7 +2,9 @@
 // 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 'dart:async';
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart";
 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart";
 import "../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart";
@@ -10,8 +12,8 @@
 import "mock_compiler.dart";
 import "parser_helper.dart";
 
-Compiler applyPatch(String script, String patch,
-                    {bool analyzeAll: false, bool analyzeOnly: false}) {
+Future<Compiler> applyPatch(String script, String patch,
+                            {bool analyzeAll: false, bool analyzeOnly: false}) {
   String core = "$DEFAULT_CORELIB\n$script";
   MockCompiler compiler = new MockCompiler(coreSource: core,
                                            analyzeAll: analyzeAll,
@@ -19,9 +21,11 @@
   var uri = Uri.parse("core.dartp");
   compiler.sourceFiles[uri.toString()] = new MockFile(patch);
   var handler = new LibraryDependencyHandler(compiler);
-  compiler.patchParser.patchLibrary(handler, uri, compiler.coreLibrary);
-  handler.computeExports();
-  return compiler;
+  return compiler.patchParser.patchLibrary(handler, uri, compiler.coreLibrary)
+      .then((_) {
+    handler.computeExports();
+    return compiler;
+  });
 }
 
 void expectHasBody(compiler, Element element) {
@@ -106,22 +110,23 @@
 }
 
 testPatchFunction() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       "external test();",
-      "patch test() { return 'string'; } ");
-  ensure(compiler, "test", compiler.coreLibrary.find,
-         expectIsPatched: true, checkHasBody: true);
-  ensure(compiler, "test", compiler.coreLibrary.patch.find,
-         expectIsPatch: true, checkHasBody: true);
+      "patch test() { return 'string'; } ").then((compiler) {
+    ensure(compiler, "test", compiler.coreLibrary.find,
+           expectIsPatched: true, checkHasBody: true);
+    ensure(compiler, "test", compiler.coreLibrary.patch.find,
+           expectIsPatch: true, checkHasBody: true);
 
-  Expect.isTrue(compiler.warnings.isEmpty,
-                "Unexpected warnings: ${compiler.warnings}");
-  Expect.isTrue(compiler.errors.isEmpty,
-                "Unexpected errors: ${compiler.errors}");
+    Expect.isTrue(compiler.warnings.isEmpty,
+                  "Unexpected warnings: ${compiler.warnings}");
+    Expect.isTrue(compiler.errors.isEmpty,
+                  "Unexpected errors: ${compiler.errors}");
+  }));
 }
 
 testPatchConstructor() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       class Class {
         external Class();
@@ -131,34 +136,35 @@
       patch class Class {
         patch Class();
       }
-      """);
-  var classOrigin = ensure(compiler, "Class", compiler.coreLibrary.find,
-                           expectIsPatched: true);
-  classOrigin.ensureResolved(compiler);
-  var classPatch = ensure(compiler, "Class", compiler.coreLibrary.patch.find,
-                          expectIsPatch: true);
+      """).then((compiler) {
+    var classOrigin = ensure(compiler, "Class", compiler.coreLibrary.find,
+                             expectIsPatched: true);
+    classOrigin.ensureResolved(compiler);
+    var classPatch = ensure(compiler, "Class", compiler.coreLibrary.patch.find,
+                            expectIsPatch: true);
 
-  Expect.equals(classPatch, classOrigin.patch);
-  Expect.equals(classOrigin, classPatch.origin);
+    Expect.equals(classPatch, classOrigin.patch);
+    Expect.equals(classOrigin, classPatch.origin);
 
-  var constructorOrigin = ensure(compiler, "",
-                                 (name) => classOrigin.localLookup(name),
-                                 expectIsPatched: true);
-  var constructorPatch = ensure(compiler, "",
-                                (name) => classPatch.localLookup(name),
-                                expectIsPatch: true);
+    var constructorOrigin = ensure(compiler, "",
+                                   (name) => classOrigin.localLookup(name),
+                                   expectIsPatched: true);
+    var constructorPatch = ensure(compiler, "",
+                                  (name) => classPatch.localLookup(name),
+                                  expectIsPatch: true);
 
-  Expect.equals(constructorPatch, constructorOrigin.patch);
-  Expect.equals(constructorOrigin, constructorPatch.origin);
+    Expect.equals(constructorPatch, constructorOrigin.patch);
+    Expect.equals(constructorOrigin, constructorPatch.origin);
 
-  Expect.isTrue(compiler.warnings.isEmpty,
-                "Unexpected warnings: ${compiler.warnings}");
-  Expect.isTrue(compiler.errors.isEmpty,
-                "Unexpected errors: ${compiler.errors}");
+    Expect.isTrue(compiler.warnings.isEmpty,
+                  "Unexpected warnings: ${compiler.warnings}");
+    Expect.isTrue(compiler.errors.isEmpty,
+                  "Unexpected errors: ${compiler.errors}");
+  }));
 }
 
 testPatchMember() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       class Class {
         external String toString();
@@ -168,26 +174,27 @@
       patch class Class {
         patch String toString() => 'string';
       }
-      """);
-  var container = ensure(compiler, "Class", compiler.coreLibrary.find,
-                         expectIsPatched: true);
-  container.parseNode(compiler);
-  ensure(compiler, "Class", compiler.coreLibrary.patch.find,
-         expectIsPatch: true);
+      """).then((compiler) {
+    var container = ensure(compiler, "Class", compiler.coreLibrary.find,
+                           expectIsPatched: true);
+    container.parseNode(compiler);
+    ensure(compiler, "Class", compiler.coreLibrary.patch.find,
+           expectIsPatch: true);
 
-  ensure(compiler, "toString", container.lookupLocalMember,
-         expectIsPatched: true, checkHasBody: true);
-  ensure(compiler, "toString", container.patch.lookupLocalMember,
-         expectIsPatch: true, checkHasBody: true);
+    ensure(compiler, "toString", container.lookupLocalMember,
+           expectIsPatched: true, checkHasBody: true);
+    ensure(compiler, "toString", container.patch.lookupLocalMember,
+           expectIsPatch: true, checkHasBody: true);
 
-  Expect.isTrue(compiler.warnings.isEmpty,
-                "Unexpected warnings: ${compiler.warnings}");
-  Expect.isTrue(compiler.errors.isEmpty,
-                "Unexpected errors: ${compiler.errors}");
+    Expect.isTrue(compiler.warnings.isEmpty,
+                  "Unexpected warnings: ${compiler.warnings}");
+    Expect.isTrue(compiler.errors.isEmpty,
+                  "Unexpected errors: ${compiler.errors}");
+  }));
 }
 
 testPatchGetter() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       class Class {
         external int get field;
@@ -197,31 +204,32 @@
       patch class Class {
         patch int get field => 5;
       }
-      """);
-  var container = ensure(compiler, "Class", compiler.coreLibrary.find,
-                         expectIsPatched: true);
-  container.parseNode(compiler);
-  ensure(compiler,
-         "field",
-         container.lookupLocalMember,
-         expectIsGetter: true,
-         expectIsPatched: true,
-         checkHasBody: true);
-  ensure(compiler,
-         "field",
-         container.patch.lookupLocalMember,
-         expectIsGetter: true,
-         expectIsPatch: true,
-         checkHasBody: true);
+      """).then((compiler) {
+    var container = ensure(compiler, "Class", compiler.coreLibrary.find,
+                           expectIsPatched: true);
+    container.parseNode(compiler);
+    ensure(compiler,
+           "field",
+           container.lookupLocalMember,
+           expectIsGetter: true,
+           expectIsPatched: true,
+           checkHasBody: true);
+    ensure(compiler,
+           "field",
+           container.patch.lookupLocalMember,
+           expectIsGetter: true,
+           expectIsPatch: true,
+           checkHasBody: true);
 
-  Expect.isTrue(compiler.warnings.isEmpty,
-                "Unexpected warnings: ${compiler.warnings}");
-  Expect.isTrue(compiler.errors.isEmpty,
-                "Unexpected errors: ${compiler.errors}");
+    Expect.isTrue(compiler.warnings.isEmpty,
+                  "Unexpected warnings: ${compiler.warnings}");
+    Expect.isTrue(compiler.errors.isEmpty,
+                  "Unexpected errors: ${compiler.errors}");
+  }));
 }
 
 testRegularMember() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       class Class {
         void regular() {}
@@ -230,26 +238,27 @@
       """
       patch class Class {
       }
-      """);
-  var container = ensure(compiler, "Class", compiler.coreLibrary.find,
-                         expectIsPatched: true);
-  container.parseNode(compiler);
-  ensure(compiler, "Class", compiler.coreLibrary.patch.find,
-         expectIsPatch: true);
+      """).then((compiler) {
+    var container = ensure(compiler, "Class", compiler.coreLibrary.find,
+                           expectIsPatched: true);
+    container.parseNode(compiler);
+    ensure(compiler, "Class", compiler.coreLibrary.patch.find,
+           expectIsPatch: true);
 
-  ensure(compiler, "regular", container.lookupLocalMember,
-         checkHasBody: true, expectIsRegular: true);
-  ensure(compiler, "regular", container.patch.lookupLocalMember,
-         checkHasBody: true, expectIsRegular: true);
+    ensure(compiler, "regular", container.lookupLocalMember,
+           checkHasBody: true, expectIsRegular: true);
+    ensure(compiler, "regular", container.patch.lookupLocalMember,
+           checkHasBody: true, expectIsRegular: true);
 
-  Expect.isTrue(compiler.warnings.isEmpty,
-                "Unexpected warnings: ${compiler.warnings}");
-  Expect.isTrue(compiler.errors.isEmpty,
-                "Unexpected errors: ${compiler.errors}");
+    Expect.isTrue(compiler.warnings.isEmpty,
+                  "Unexpected warnings: ${compiler.warnings}");
+    Expect.isTrue(compiler.errors.isEmpty,
+                  "Unexpected errors: ${compiler.errors}");
+  }));
 }
 
 testGhostMember() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       class Class {
       }
@@ -258,45 +267,47 @@
       patch class Class {
         void ghost() {}
       }
-      """);
-  var container = ensure(compiler, "Class", compiler.coreLibrary.find,
-                         expectIsPatched: true);
-  container.parseNode(compiler);
-  ensure(compiler, "Class", compiler.coreLibrary.patch.find,
-         expectIsPatch: true);
+      """).then((compiler) {
+    var container = ensure(compiler, "Class", compiler.coreLibrary.find,
+                           expectIsPatched: true);
+    container.parseNode(compiler);
+    ensure(compiler, "Class", compiler.coreLibrary.patch.find,
+           expectIsPatch: true);
 
-  ensure(compiler, "ghost", container.lookupLocalMember,
-         expectIsFound: false);
-  ensure(compiler, "ghost", container.patch.lookupLocalMember,
-         checkHasBody: true, expectIsRegular: true);
+    ensure(compiler, "ghost", container.lookupLocalMember,
+           expectIsFound: false);
+    ensure(compiler, "ghost", container.patch.lookupLocalMember,
+           checkHasBody: true, expectIsRegular: true);
 
-  Expect.isTrue(compiler.warnings.isEmpty,
-                "Unexpected warnings: ${compiler.warnings}");
-  Expect.isTrue(compiler.errors.isEmpty,
-                "Unexpected errors: ${compiler.errors}");
+    Expect.isTrue(compiler.warnings.isEmpty,
+                  "Unexpected warnings: ${compiler.warnings}");
+    Expect.isTrue(compiler.errors.isEmpty,
+                  "Unexpected errors: ${compiler.errors}");
+  }));
 }
 
 testInjectFunction() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       "",
-      "int _function() => 5;");
-  ensure(compiler,
-         "_function",
-         compiler.coreLibrary.find,
-         expectIsFound: false);
-  ensure(compiler,
-         "_function",
-         compiler.coreLibrary.patch.find,
-         checkHasBody: true, expectIsRegular: true);
+      "int _function() => 5;").then((compiler) {
+    ensure(compiler,
+           "_function",
+           compiler.coreLibrary.find,
+           expectIsFound: false);
+    ensure(compiler,
+           "_function",
+           compiler.coreLibrary.patch.find,
+           checkHasBody: true, expectIsRegular: true);
 
-  Expect.isTrue(compiler.warnings.isEmpty,
-                "Unexpected warnings: ${compiler.warnings}");
-  Expect.isTrue(compiler.errors.isEmpty,
-                "Unexpected errors: ${compiler.errors}");
+    Expect.isTrue(compiler.warnings.isEmpty,
+                  "Unexpected warnings: ${compiler.warnings}");
+    Expect.isTrue(compiler.errors.isEmpty,
+                  "Unexpected errors: ${compiler.errors}");
+  }));
 }
 
 testPatchSignatureCheck() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       class Class {
         external String method1();
@@ -326,72 +337,78 @@
         patch void method10([int str]) {}
         patch void method11({int str}) {}
       }
-      """);
-  var container = ensure(compiler, "Class", compiler.coreLibrary.find,
-                         expectIsPatched: true);
-  container.ensureResolved(compiler);
-  container.parseNode(compiler);
+      """).then((compiler) {
+    var container = ensure(compiler, "Class", compiler.coreLibrary.find,
+                           expectIsPatched: true);
+    container.ensureResolved(compiler);
+    container.parseNode(compiler);
 
-  void expect(String methodName, List warnings, List errors) {
-    compiler.warnings.clear();
-    compiler.errors.clear();
-    compiler.resolver.resolveMethodElement(
-        ensure(compiler, methodName, container.lookupLocalMember,
-            expectIsPatched: true, checkHasBody: true));
-    Expect.equals(warnings.length, compiler.warnings.length,
-                  "Unexpected warnings: ${compiler.warnings} on $methodName");
-    for (int i = 0 ; i < warnings.length ; i++) {
-      Expect.equals(warnings[i], compiler.warnings[i].message.kind);
+    void expect(String methodName, List warnings, List errors) {
+      compiler.warnings.clear();
+      compiler.errors.clear();
+      compiler.resolver.resolveMethodElement(
+          ensure(compiler, methodName, container.lookupLocalMember,
+              expectIsPatched: true, checkHasBody: true));
+      Expect.equals(warnings.length, compiler.warnings.length,
+                    "Unexpected warnings: ${compiler.warnings} on $methodName");
+      for (int i = 0 ; i < warnings.length ; i++) {
+        Expect.equals(warnings[i], compiler.warnings[i].message.kind);
+      }
+      Expect.equals(errors.length, compiler.errors.length,
+                    "Unexpected errors: ${compiler.errors} on $methodName");
+      for (int i = 0 ; i < errors.length ; i++) {
+        Expect.equals(errors[i], compiler.errors[i].message.kind);
+      }
     }
-    Expect.equals(errors.length, compiler.errors.length,
-                  "Unexpected errors: ${compiler.errors} on $methodName");
-    for (int i = 0 ; i < errors.length ; i++) {
-      Expect.equals(errors[i], compiler.errors[i].message.kind);
-    }
-  }
 
-  expect("method1", [], [MessageKind.PATCH_RETURN_TYPE_MISMATCH]);
-  expect("method2", [], [MessageKind.PATCH_REQUIRED_PARAMETER_COUNT_MISMATCH]);
-  expect("method3", [MessageKind.PATCH_POINT_TO_PARAMETER],
-                    [MessageKind.PATCH_PARAMETER_MISMATCH]);
-  expect("method4", [], [MessageKind.PATCH_OPTIONAL_PARAMETER_COUNT_MISMATCH]);
-  expect("method5", [], [MessageKind.PATCH_OPTIONAL_PARAMETER_COUNT_MISMATCH]);
-  expect("method6", [], [MessageKind.PATCH_OPTIONAL_PARAMETER_NAMED_MISMATCH]);
-  expect("method7", [MessageKind.PATCH_POINT_TO_PARAMETER],
-                    [MessageKind.PATCH_PARAMETER_MISMATCH]);
-  expect("method8", [MessageKind.PATCH_POINT_TO_PARAMETER],
-                    [MessageKind.PATCH_PARAMETER_MISMATCH]);
-  expect("method9", [MessageKind.PATCH_POINT_TO_PARAMETER],
-                    [MessageKind.PATCH_PARAMETER_TYPE_MISMATCH]);
-  expect("method10", [MessageKind.PATCH_POINT_TO_PARAMETER],
-                     [MessageKind.PATCH_PARAMETER_TYPE_MISMATCH]);
-  expect("method11", [MessageKind.PATCH_POINT_TO_PARAMETER],
-                     [MessageKind.PATCH_PARAMETER_TYPE_MISMATCH]);
+    expect("method1", [], [MessageKind.PATCH_RETURN_TYPE_MISMATCH]);
+    expect("method2", [],
+           [MessageKind.PATCH_REQUIRED_PARAMETER_COUNT_MISMATCH]);
+    expect("method3", [MessageKind.PATCH_POINT_TO_PARAMETER],
+                      [MessageKind.PATCH_PARAMETER_MISMATCH]);
+    expect("method4", [],
+           [MessageKind.PATCH_OPTIONAL_PARAMETER_COUNT_MISMATCH]);
+    expect("method5", [],
+           [MessageKind.PATCH_OPTIONAL_PARAMETER_COUNT_MISMATCH]);
+    expect("method6", [],
+           [MessageKind.PATCH_OPTIONAL_PARAMETER_NAMED_MISMATCH]);
+    expect("method7", [MessageKind.PATCH_POINT_TO_PARAMETER],
+                      [MessageKind.PATCH_PARAMETER_MISMATCH]);
+    expect("method8", [MessageKind.PATCH_POINT_TO_PARAMETER],
+                      [MessageKind.PATCH_PARAMETER_MISMATCH]);
+    expect("method9", [MessageKind.PATCH_POINT_TO_PARAMETER],
+                      [MessageKind.PATCH_PARAMETER_TYPE_MISMATCH]);
+    expect("method10", [MessageKind.PATCH_POINT_TO_PARAMETER],
+                       [MessageKind.PATCH_PARAMETER_TYPE_MISMATCH]);
+    expect("method11", [MessageKind.PATCH_POINT_TO_PARAMETER],
+                       [MessageKind.PATCH_PARAMETER_TYPE_MISMATCH]);
+  }));
 }
 
 testExternalWithoutImplementationTopLevel() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       external void foo();
       """,
       """
       // patch void foo() {}
-      """);
-  var function = ensure(compiler, "foo", compiler.coreLibrary.find);
-  compiler.resolver.resolve(function);
-  Expect.isTrue(compiler.warnings.isEmpty,
-                "Unexpected warnings: ${compiler.warnings}");
-  print('testExternalWithoutImplementationTopLevel:${compiler.errors}');
-  Expect.equals(1, compiler.errors.length);
-  Expect.isTrue(
-      compiler.errors[0].message.kind ==
-          MessageKind.PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION);
-  Expect.stringEquals('Error: External method without an implementation.',
-                      compiler.errors[0].message.toString());
+      """).then((compiler) {
+    var function = ensure(compiler, "foo", compiler.coreLibrary.find);
+    compiler.resolver.resolve(function);
+    Expect.isTrue(compiler.warnings.isEmpty,
+                  "Unexpected warnings: ${compiler.warnings}");
+    print('testExternalWithoutImplementationTopLevel:${compiler.errors}');
+    Expect.equals(1, compiler.errors.length);
+    Expect.isTrue(
+        compiler.errors[0].message.kind ==
+            MessageKind.PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION);
+    Expect.stringEquals('Error: External method without an implementation.',
+                        compiler.errors[0].message.toString());
+  }));
 }
 
 testExternalWithoutImplementationMember() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       class Class {
         external void foo();
@@ -401,60 +418,63 @@
       patch class Class {
         // patch void foo() {}
       }
-      """);
-  var container = ensure(compiler, "Class", compiler.coreLibrary.find,
-                         expectIsPatched: true);
-  container.parseNode(compiler);
+      """).then((compiler) {
+    var container = ensure(compiler, "Class", compiler.coreLibrary.find,
+                           expectIsPatched: true);
+    container.parseNode(compiler);
 
-  compiler.warnings.clear();
-  compiler.errors.clear();
-  compiler.resolver.resolveMethodElement(
-      ensure(compiler, "foo", container.lookupLocalMember));
-  Expect.isTrue(compiler.warnings.isEmpty,
-                "Unexpected warnings: ${compiler.warnings}");
-  print('testExternalWithoutImplementationMember:${compiler.errors}');
-  Expect.equals(1, compiler.errors.length);
-  Expect.isTrue(
-      compiler.errors[0].message.kind ==
-          MessageKind.PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION);
-  Expect.stringEquals('Error: External method without an implementation.',
-                      compiler.errors[0].message.toString());
+    compiler.warnings.clear();
+    compiler.errors.clear();
+    compiler.resolver.resolveMethodElement(
+        ensure(compiler, "foo", container.lookupLocalMember));
+    Expect.isTrue(compiler.warnings.isEmpty,
+                  "Unexpected warnings: ${compiler.warnings}");
+    print('testExternalWithoutImplementationMember:${compiler.errors}');
+    Expect.equals(1, compiler.errors.length);
+    Expect.isTrue(
+        compiler.errors[0].message.kind ==
+            MessageKind.PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION);
+    Expect.stringEquals('Error: External method without an implementation.',
+                        compiler.errors[0].message.toString());
+  }));
 }
 
 testIsSubclass() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       class A {}
       """,
       """
       patch class A {}
-      """);
-  ClassElement cls = ensure(compiler, "A", compiler.coreLibrary.find,
-                            expectIsPatched: true);
-  ClassElement patch = cls.patch;
-  Expect.isTrue(cls != patch);
-  Expect.isTrue(cls.isSubclassOf(patch));
-  Expect.isTrue(patch.isSubclassOf(cls));
+      """).then((compiler) {
+    ClassElement cls = ensure(compiler, "A", compiler.coreLibrary.find,
+                              expectIsPatched: true);
+    ClassElement patch = cls.patch;
+    Expect.isTrue(cls != patch);
+    Expect.isTrue(cls.isSubclassOf(patch));
+    Expect.isTrue(patch.isSubclassOf(cls));
+  }));
 }
 
 testPatchNonExistingTopLevel() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       // class Class {}
       """,
       """
       patch class Class {}
-      """);
-  Expect.isTrue(compiler.warnings.isEmpty,
-                "Unexpected warnings: ${compiler.warnings}");
-  print('testPatchNonExistingTopLevel:${compiler.errors}');
-  Expect.equals(1, compiler.errors.length);
-  Expect.isTrue(
-      compiler.errors[0].message.kind == MessageKind.PATCH_NON_EXISTING);
+      """).then((compiler) {
+    Expect.isTrue(compiler.warnings.isEmpty,
+                  "Unexpected warnings: ${compiler.warnings}");
+    print('testPatchNonExistingTopLevel:${compiler.errors}');
+    Expect.equals(1, compiler.errors.length);
+    Expect.isTrue(
+        compiler.errors[0].message.kind == MessageKind.PATCH_NON_EXISTING);
+  }));
 }
 
 testPatchNonExistingMember() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       class Class {}
       """,
@@ -462,79 +482,83 @@
       patch class Class {
         patch void foo() {}
       }
-      """);
-  var container = ensure(compiler, "Class", compiler.coreLibrary.find,
-                         expectIsPatched: true);
-  container.parseNode(compiler);
+      """).then((compiler) {
+    var container = ensure(compiler, "Class", compiler.coreLibrary.find,
+                           expectIsPatched: true);
+    container.parseNode(compiler);
 
-  Expect.isTrue(compiler.warnings.isEmpty,
-                "Unexpected warnings: ${compiler.warnings}");
-  print('testPatchNonExistingMember:${compiler.errors}');
-  Expect.equals(1, compiler.errors.length);
-  Expect.isTrue(
-      compiler.errors[0].message.kind == MessageKind.PATCH_NON_EXISTING);
+    Expect.isTrue(compiler.warnings.isEmpty,
+                  "Unexpected warnings: ${compiler.warnings}");
+    print('testPatchNonExistingMember:${compiler.errors}');
+    Expect.equals(1, compiler.errors.length);
+    Expect.isTrue(
+        compiler.errors[0].message.kind == MessageKind.PATCH_NON_EXISTING);
+  }));
 }
 
 testPatchNonPatchablePatch() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       external get foo;
       """,
       """
       patch var foo;
-      """);
-  ensure(compiler, "foo", compiler.coreLibrary.find);
+      """).then((compiler) {
+    ensure(compiler, "foo", compiler.coreLibrary.find);
 
-  Expect.isTrue(compiler.warnings.isEmpty,
-                "Unexpected warnings: ${compiler.warnings}");
-  print('testPatchNonPatchablePatch:${compiler.errors}');
-  Expect.equals(1, compiler.errors.length);
-  Expect.isTrue(
-      compiler.errors[0].message.kind == MessageKind.PATCH_NONPATCHABLE);
+    Expect.isTrue(compiler.warnings.isEmpty,
+                  "Unexpected warnings: ${compiler.warnings}");
+    print('testPatchNonPatchablePatch:${compiler.errors}');
+    Expect.equals(1, compiler.errors.length);
+    Expect.isTrue(
+        compiler.errors[0].message.kind == MessageKind.PATCH_NONPATCHABLE);
+  }));
 }
 
 testPatchNonPatchableOrigin() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       external var foo;
       """,
       """
       patch get foo => 0;
-      """);
-  ensure(compiler, "foo", compiler.coreLibrary.find);
+      """).then((compiler) {
+    ensure(compiler, "foo", compiler.coreLibrary.find);
 
-  Expect.isTrue(compiler.warnings.isEmpty,
-                "Unexpected warnings: ${compiler.warnings}");
-  print('testPatchNonPatchableOrigin:${compiler.errors}');
-  Expect.equals(2, compiler.errors.length);
-  Expect.equals(
-      MessageKind.EXTRANEOUS_MODIFIER, compiler.errors[0].message.kind);
-  Expect.equals(
-      // TODO(ahe): Eventually, this error should be removed as it will be
-      // handled by the regular parser.
-      MessageKind.PATCH_NONPATCHABLE, compiler.errors[1].message.kind);
+    Expect.isTrue(compiler.warnings.isEmpty,
+                  "Unexpected warnings: ${compiler.warnings}");
+    print('testPatchNonPatchableOrigin:${compiler.errors}');
+    Expect.equals(2, compiler.errors.length);
+    Expect.equals(
+        MessageKind.EXTRANEOUS_MODIFIER, compiler.errors[0].message.kind);
+    Expect.equals(
+        // TODO(ahe): Eventually, this error should be removed as it will be
+        // handled by the regular parser.
+        MessageKind.PATCH_NONPATCHABLE, compiler.errors[1].message.kind);
+  }));
 }
 
 testPatchNonExternalTopLevel() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       void foo() {}
       """,
       """
       patch void foo() {}
-      """);
-  print('testPatchNonExternalTopLevel.errors:${compiler.errors}');
-  print('testPatchNonExternalTopLevel.warnings:${compiler.warnings}');
-  Expect.equals(1, compiler.errors.length);
-  Expect.isTrue(
-      compiler.errors[0].message.kind == MessageKind.PATCH_NON_EXTERNAL);
-  Expect.equals(1, compiler.warnings.length);
-  Expect.isTrue(
-      compiler.warnings[0].message.kind == MessageKind.PATCH_POINT_TO_FUNCTION);
+      """).then((compiler) {
+    print('testPatchNonExternalTopLevel.errors:${compiler.errors}');
+    print('testPatchNonExternalTopLevel.warnings:${compiler.warnings}');
+    Expect.equals(1, compiler.errors.length);
+    Expect.isTrue(
+        compiler.errors[0].message.kind == MessageKind.PATCH_NON_EXTERNAL);
+    Expect.equals(1, compiler.warnings.length);
+    Expect.isTrue(compiler.warnings[0].message.kind ==
+        MessageKind.PATCH_POINT_TO_FUNCTION);
+  }));
 }
 
 testPatchNonExternalMember() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       class Class {
         void foo() {}
@@ -544,131 +568,139 @@
       patch class Class {
         patch void foo() {}
       }
-      """);
-  var container = ensure(compiler, "Class", compiler.coreLibrary.find,
-                         expectIsPatched: true);
-  container.parseNode(compiler);
+      """).then((compiler) {
+    var container = ensure(compiler, "Class", compiler.coreLibrary.find,
+                           expectIsPatched: true);
+    container.parseNode(compiler);
 
-  print('testPatchNonExternalMember.errors:${compiler.errors}');
-  print('testPatchNonExternalMember.warnings:${compiler.warnings}');
-  Expect.equals(1, compiler.errors.length);
-  Expect.isTrue(
-      compiler.errors[0].message.kind == MessageKind.PATCH_NON_EXTERNAL);
-  Expect.equals(1, compiler.warnings.length);
-  Expect.isTrue(
-      compiler.warnings[0].message.kind == MessageKind.PATCH_POINT_TO_FUNCTION);
+    print('testPatchNonExternalMember.errors:${compiler.errors}');
+    print('testPatchNonExternalMember.warnings:${compiler.warnings}');
+    Expect.equals(1, compiler.errors.length);
+    Expect.isTrue(
+        compiler.errors[0].message.kind == MessageKind.PATCH_NON_EXTERNAL);
+    Expect.equals(1, compiler.warnings.length);
+    Expect.isTrue(compiler.warnings[0].message.kind ==
+        MessageKind.PATCH_POINT_TO_FUNCTION);
+  }));
 }
 
 testPatchNonClass() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       external void Class() {}
       """,
       """
       patch class Class {}
-      """);
-  print('testPatchNonClass.errors:${compiler.errors}');
-  print('testPatchNonClass.warnings:${compiler.warnings}');
-  Expect.equals(1, compiler.errors.length);
-  Expect.isTrue(
-      compiler.errors[0].message.kind == MessageKind.PATCH_NON_CLASS);
-  Expect.equals(1, compiler.warnings.length);
-  Expect.isTrue(
-      compiler.warnings[0].message.kind == MessageKind.PATCH_POINT_TO_CLASS);
+      """).then((compiler) {
+    print('testPatchNonClass.errors:${compiler.errors}');
+    print('testPatchNonClass.warnings:${compiler.warnings}');
+    Expect.equals(1, compiler.errors.length);
+    Expect.isTrue(
+        compiler.errors[0].message.kind == MessageKind.PATCH_NON_CLASS);
+    Expect.equals(1, compiler.warnings.length);
+    Expect.isTrue(
+        compiler.warnings[0].message.kind == MessageKind.PATCH_POINT_TO_CLASS);
+  }));
 }
 
 testPatchNonGetter() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       external void foo() {}
       """,
       """
       patch get foo => 0;
-      """);
-  print('testPatchNonClass.errors:${compiler.errors}');
-  print('testPatchNonClass.warnings:${compiler.warnings}');
-  Expect.equals(1, compiler.errors.length);
-  Expect.isTrue(
-      compiler.errors[0].message.kind == MessageKind.PATCH_NON_GETTER);
-  Expect.equals(1, compiler.warnings.length);
-  Expect.isTrue(
-      compiler.warnings[0].message.kind == MessageKind.PATCH_POINT_TO_GETTER);
+      """).then((compiler) {
+    print('testPatchNonClass.errors:${compiler.errors}');
+    print('testPatchNonClass.warnings:${compiler.warnings}');
+    Expect.equals(1, compiler.errors.length);
+    Expect.isTrue(
+        compiler.errors[0].message.kind == MessageKind.PATCH_NON_GETTER);
+    Expect.equals(1, compiler.warnings.length);
+    Expect.isTrue(
+        compiler.warnings[0].message.kind == MessageKind.PATCH_POINT_TO_GETTER);
+  }));
 }
 
 testPatchNoGetter() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       external set foo(var value) {}
       """,
       """
       patch get foo => 0;
-      """);
-  print('testPatchNonClass.errors:${compiler.errors}');
-  print('testPatchNonClass.warnings:${compiler.warnings}');
-  Expect.equals(1, compiler.errors.length);
-  Expect.isTrue(
-      compiler.errors[0].message.kind == MessageKind.PATCH_NO_GETTER);
-  Expect.equals(1, compiler.warnings.length);
-  Expect.isTrue(
-      compiler.warnings[0].message.kind == MessageKind.PATCH_POINT_TO_GETTER);
+      """).then((compiler) {
+    print('testPatchNonClass.errors:${compiler.errors}');
+    print('testPatchNonClass.warnings:${compiler.warnings}');
+    Expect.equals(1, compiler.errors.length);
+    Expect.isTrue(
+        compiler.errors[0].message.kind == MessageKind.PATCH_NO_GETTER);
+    Expect.equals(1, compiler.warnings.length);
+    Expect.isTrue(
+        compiler.warnings[0].message.kind == MessageKind.PATCH_POINT_TO_GETTER);
+  }));
 }
 
 testPatchNonSetter() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       external void foo() {}
       """,
       """
       patch set foo(var value) {}
-      """);
-  print('testPatchNonClass.errors:${compiler.errors}');
-  print('testPatchNonClass.warnings:${compiler.warnings}');
-  Expect.equals(1, compiler.errors.length);
-  Expect.isTrue(
-      compiler.errors[0].message.kind == MessageKind.PATCH_NON_SETTER);
-  Expect.equals(1, compiler.warnings.length);
-  Expect.isTrue(
-      compiler.warnings[0].message.kind == MessageKind.PATCH_POINT_TO_SETTER);
+      """).then((compiler) {
+    print('testPatchNonClass.errors:${compiler.errors}');
+    print('testPatchNonClass.warnings:${compiler.warnings}');
+    Expect.equals(1, compiler.errors.length);
+    Expect.isTrue(
+        compiler.errors[0].message.kind == MessageKind.PATCH_NON_SETTER);
+    Expect.equals(1, compiler.warnings.length);
+    Expect.isTrue(
+        compiler.warnings[0].message.kind == MessageKind.PATCH_POINT_TO_SETTER);
+  }));
 }
 
 testPatchNoSetter() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       external get foo;
       """,
       """
       patch set foo(var value) {}
-      """);
-  print('testPatchNonClass.errors:${compiler.errors}');
-  print('testPatchNonClass.warnings:${compiler.warnings}');
-  Expect.equals(1, compiler.errors.length);
-  Expect.isTrue(
-      compiler.errors[0].message.kind == MessageKind.PATCH_NO_SETTER);
-  Expect.equals(1, compiler.warnings.length);
-  Expect.isTrue(
-      compiler.warnings[0].message.kind == MessageKind.PATCH_POINT_TO_SETTER);
+      """).then((compiler) {
+    print('testPatchNonClass.errors:${compiler.errors}');
+    print('testPatchNonClass.warnings:${compiler.warnings}');
+    Expect.equals(1, compiler.errors.length);
+    Expect.isTrue(
+        compiler.errors[0].message.kind == MessageKind.PATCH_NO_SETTER);
+    Expect.equals(1, compiler.warnings.length);
+    Expect.isTrue(
+        compiler.warnings[0].message.kind == MessageKind.PATCH_POINT_TO_SETTER);
+  }));
 }
 
 testPatchNonFunction() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       external get foo;
       """,
       """
       patch void foo() {}
-      """);
-  print('testPatchNonClass.errors:${compiler.errors}');
-  print('testPatchNonClass.warnings:${compiler.warnings}');
-  Expect.equals(1, compiler.errors.length);
-  Expect.isTrue(
-      compiler.errors[0].message.kind == MessageKind.PATCH_NON_FUNCTION);
-  Expect.equals(1, compiler.warnings.length);
-  Expect.isTrue(
-      compiler.warnings[0].message.kind == MessageKind.PATCH_POINT_TO_FUNCTION);
+      """).then((compiler) {
+    print('testPatchNonClass.errors:${compiler.errors}');
+    print('testPatchNonClass.warnings:${compiler.warnings}');
+    Expect.equals(1, compiler.errors.length);
+    Expect.isTrue(
+        compiler.errors[0].message.kind == MessageKind.PATCH_NON_FUNCTION);
+    Expect.equals(1, compiler.warnings.length);
+    Expect.isTrue(
+        compiler.warnings[0].message.kind ==
+            MessageKind.PATCH_POINT_TO_FUNCTION);
+  }));
 }
 
 testPatchAndSelector() {
-  var compiler = applyPatch(
+  asyncTest(() => applyPatch(
       """
       class A {
         external void clear();
@@ -681,45 +713,46 @@
         int method() => 0;
         patch void clear() {}
       }
-      """);
-  ClassElement cls = ensure(compiler, "A", compiler.coreLibrary.find,
-                            expectIsPatched: true);
-  cls.ensureResolved(compiler);
+      """).then((compiler) {
+    ClassElement cls = ensure(compiler, "A", compiler.coreLibrary.find,
+                              expectIsPatched: true);
+    cls.ensureResolved(compiler);
 
-  ensure(compiler, "method", cls.patch.lookupLocalMember,
-         checkHasBody: true, expectIsRegular: true);
+    ensure(compiler, "method", cls.patch.lookupLocalMember,
+           checkHasBody: true, expectIsRegular: true);
 
-  ensure(compiler, "clear", cls.lookupLocalMember,
-         checkHasBody: true, expectIsPatched: true);
+    ensure(compiler, "clear", cls.lookupLocalMember,
+           checkHasBody: true, expectIsPatched: true);
 
-  compiler.phase = Compiler.PHASE_DONE_RESOLVING;
+    compiler.phase = Compiler.PHASE_DONE_RESOLVING;
 
-  // Check that a method just in the patch class is a target for a
-  // typed selector.
-  var selector = new Selector.call(
-      buildSourceString('method'), compiler.coreLibrary, 0);
-  var typedSelector = new TypedSelector.exact(cls.rawType, selector);
-  Element method =
-      cls.implementation.lookupLocalMember(buildSourceString('method'));
-  Expect.isTrue(selector.applies(method, compiler));
-  Expect.isTrue(typedSelector.applies(method, compiler));
+    // Check that a method just in the patch class is a target for a
+    // typed selector.
+    var selector = new Selector.call(
+        buildSourceString('method'), compiler.coreLibrary, 0);
+    var typedSelector = new TypedSelector.exact(cls.rawType, selector);
+    Element method =
+        cls.implementation.lookupLocalMember(buildSourceString('method'));
+    Expect.isTrue(selector.applies(method, compiler));
+    Expect.isTrue(typedSelector.applies(method, compiler));
 
-  // Check that the declaration method in the declaration class is a target
-  // for a typed selector.
-  selector = new Selector.call(
-      buildSourceString('clear'), compiler.coreLibrary, 0);
-  typedSelector = new TypedSelector.exact(cls.rawType, selector);
-  method = cls.lookupLocalMember(buildSourceString('clear'));
-  Expect.isTrue(selector.applies(method, compiler));
-  Expect.isTrue(typedSelector.applies(method, compiler));
+    // Check that the declaration method in the declaration class is a target
+    // for a typed selector.
+    selector = new Selector.call(
+        buildSourceString('clear'), compiler.coreLibrary, 0);
+    typedSelector = new TypedSelector.exact(cls.rawType, selector);
+    method = cls.lookupLocalMember(buildSourceString('clear'));
+    Expect.isTrue(selector.applies(method, compiler));
+    Expect.isTrue(typedSelector.applies(method, compiler));
 
-  // Check that the declaration method in the declaration class is a target
-  // for a typed selector on a subclass.
-  cls = ensure(compiler, "B", compiler.coreLibrary.find);
-  cls.ensureResolved(compiler);
-  typedSelector = new TypedSelector.exact(cls.rawType, selector);
-  Expect.isTrue(selector.applies(method, compiler));
-  Expect.isTrue(typedSelector.applies(method, compiler));
+    // Check that the declaration method in the declaration class is a target
+    // for a typed selector on a subclass.
+    cls = ensure(compiler, "B", compiler.coreLibrary.find);
+    cls.ensureResolved(compiler);
+    typedSelector = new TypedSelector.exact(cls.rawType, selector);
+    Expect.isTrue(selector.applies(method, compiler));
+    Expect.isTrue(typedSelector.applies(method, compiler));
+  }));
 }
 
 void testAnalyzeAllInjectedMembers() {
@@ -729,11 +762,13 @@
       expectedWarnings = <MessageKind>[expectedWarnings];
     }
 
-    var compiler = applyPatch('', patchText,
-                              analyzeAll: true, analyzeOnly: true);
-    compiler.librariesToAnalyzeWhenRun = [Uri.parse('dart:core')];
-    compiler.runCompiler(null);
-    compareWarningKinds(patchText, expectedWarnings, compiler.warnings);
+    asyncTest(() => applyPatch('', patchText, analyzeAll: true,
+               analyzeOnly: true).then((compiler) {
+      compiler.librariesToAnalyzeWhenRun = [Uri.parse('dart:core')];
+      return compiler.runCompiler(null).then((_) {
+        compareWarningKinds(patchText, expectedWarnings, compiler.warnings);
+      });
+    }));
   }
 
   expect('String s = 0;', MessageKind.NOT_ASSIGNABLE.warning);
@@ -761,12 +796,14 @@
                        String s = 0;
                      }
                      """;
-  var compiler = applyPatch(originText, patchText,
-                            analyzeAll: true, analyzeOnly: true);
-  compiler.librariesToAnalyzeWhenRun = [Uri.parse('dart:core')];
-  compiler.runCompiler(null);
-  compareWarningKinds(patchText,
-      [MessageKind.NOT_ASSIGNABLE.warning], compiler.warnings);
+  asyncTest(() => applyPatch(originText, patchText,
+             analyzeAll: true, analyzeOnly: true).then((compiler) {
+    compiler.librariesToAnalyzeWhenRun = [Uri.parse('dart:core')];
+    return compiler.runCompiler(null).then((_) {
+      compareWarningKinds(patchText,
+          [MessageKind.NOT_ASSIGNABLE.warning], compiler.warnings);
+    });
+  }));
 }
 
 main() {
diff --git a/tests/compiler/dart2js/private_test.dart b/tests/compiler/dart2js/private_test.dart
index c8918a7..2bb9f19 100644
--- a/tests/compiler/dart2js/private_test.dart
+++ b/tests/compiler/dart2js/private_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'mock_compiler.dart';
 
 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart';
@@ -68,8 +69,9 @@
                   ''';
   Uri uri = Uri.parse('src:public');
   compiler.registerSource(uri, source);
-  compiler.runCompiler(uri);
-  compareWarningKinds(text, expectedWarnings, compiler.warnings);
+  asyncTest(() => compiler.runCompiler(uri).then((_) {
+    compareWarningKinds(text, expectedWarnings, compiler.warnings);
+  }));
 }
 
 void main() {
diff --git a/tests/compiler/dart2js/reexport_handled_test.dart b/tests/compiler/dart2js/reexport_handled_test.dart
index d309fcd..401afb1 100644
--- a/tests/compiler/dart2js/reexport_handled_test.dart
+++ b/tests/compiler/dart2js/reexport_handled_test.dart
@@ -5,6 +5,7 @@
 library reexport_handled_test;
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'mock_compiler.dart';
 import '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart'
     show Element,
@@ -28,19 +29,21 @@
   compiler.registerSource(reexportingLibraryUri, REEXPORTING_LIBRARY_SOURCE);
 
   // Load exporting library before the reexporting library.
-  var exportingLibrary = compiler.libraryLoader.loadLibrary(
-      exportingLibraryUri, null, exportingLibraryUri);
-  Expect.isTrue(exportingLibrary.exportsHandled);
-  var foo = findInExports(exportingLibrary, 'foo');
-  Expect.isNotNull(foo);
-  Expect.isTrue(foo.isField());
+  asyncTest(() => compiler.libraryLoader.loadLibrary(
+      exportingLibraryUri, null, exportingLibraryUri).then((exportingLibrary) {
+    Expect.isTrue(exportingLibrary.exportsHandled);
+    var foo = findInExports(exportingLibrary, 'foo');
+    Expect.isNotNull(foo);
+    Expect.isTrue(foo.isField());
 
-  // Load reexporting library when exports are handled on the exporting library.
-  var reexportingLibrary = compiler.libraryLoader.loadLibrary(
-      reexportingLibraryUri, null, reexportingLibraryUri);
-  foo = findInExports(reexportingLibrary, 'foo');
-  Expect.isNotNull(foo);
-  Expect.isTrue(foo.isField());
+    // Load reexporting library when exports are handled on the exporting library.
+    return compiler.libraryLoader.loadLibrary(
+        reexportingLibraryUri, null, reexportingLibraryUri);
+  }).then((reexportingLibrary) {
+    var foo = findInExports(reexportingLibrary, 'foo');
+    Expect.isNotNull(foo);
+    Expect.isTrue(foo.isField());
+  }));
 }
 
 Element findInExports(LibraryElement library, String name) {
diff --git a/tests/compiler/dart2js/regress_10231_test.dart b/tests/compiler/dart2js/regress_10231_test.dart
index bc3a36f..2e06461 100644
--- a/tests/compiler/dart2js/regress_10231_test.dart
+++ b/tests/compiler/dart2js/regress_10231_test.dart
@@ -5,13 +5,16 @@
 // Regression test for http://dartbug.com/10231.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'codegen_helper.dart';
 
 void main() {
-  var code = generate(SOURCE)['test'];
-  Expect.isNotNull(code);
-  Expect.equals(0, new RegExp('add').allMatches(code).length);
-  Expect.equals(3, new RegExp('\\+').allMatches(code).length);
+  asyncTest(() => generate(SOURCE).then((result) {
+    var code = result['test'];
+    Expect.isNotNull(code);
+    Expect.equals(0, new RegExp('add').allMatches(code).length);
+    Expect.equals(3, new RegExp('\\+').allMatches(code).length);
+  }));
 }
 
 const String SOURCE = """
diff --git a/tests/compiler/dart2js/resolution_test.dart b/tests/compiler/dart2js/resolution_test.dart
index 32f5945..ac97858 100644
--- a/tests/compiler/dart2js/resolution_test.dart
+++ b/tests/compiler/dart2js/resolution_test.dart
@@ -6,6 +6,7 @@
 // needed by the backend.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 import 'parser_helper.dart';
 
@@ -94,8 +95,9 @@
 void test(String code, void check(Compiler compiler)) {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(code, uri);
-  compiler.runCompiler(uri);
-  check(compiler);
+  asyncTest(() => compiler.runCompiler(uri).then((_) {
+    check(compiler);
+  }));
 }
 
 void testHasRuntimeType(String code) {
diff --git a/tests/compiler/dart2js/resolver_test.dart b/tests/compiler/dart2js/resolver_test.dart
index 8587e3e..cd4e373 100644
--- a/tests/compiler/dart2js/resolver_test.dart
+++ b/tests/compiler/dart2js/resolver_test.dart
@@ -3,6 +3,8 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import 'dart:async';
+import "package:async_helper/async_helper.dart";
 import 'dart:collection';
 
 import "../../../sdk/lib/_internal/compiler/implementation/resolution/resolution.dart";
@@ -77,6 +79,7 @@
   testOverrideHashCodeCheck();
   testSupertypeOrder();
   testConstructorArgumentMismatch();
+  testConstConstructorAndNonFinalFields();
 }
 
 testSupertypeOrder() {
@@ -841,11 +844,13 @@
   return result;
 }
 
-compileScript(String source) {
+Future compileScript(String source) {
   Uri uri = new Uri(scheme: 'source');
   MockCompiler compiler = compilerFor(source, uri);
-  compiler.runCompiler(uri);
-  return compiler;
+  compiler.diagnosticHandler = createHandler(compiler, source);
+  return compiler.runCompiler(uri).then((_) {
+    return compiler;
+  });
 }
 
 checkMemberResolved(compiler, className, memberName) {
@@ -858,9 +863,9 @@
 
 testToString() {
   final script = r"class C { toString() => 'C'; } main() { '${new C()}'; }";
-  final compiler = compileScript(script);
-
-  checkMemberResolved(compiler, 'C', buildSourceString('toString'));
+  asyncTest(() => compileScript(script).then((compiler) {
+    checkMemberResolved(compiler, 'C', buildSourceString('toString'));
+  }));
 }
 
 operatorName(op, isUnary) {
@@ -874,10 +879,10 @@
         operator[]=(ix, v) {}
       }
       main() { var c = new C(); c[0]++; }""";
-  final compiler = compileScript(script);
-
-  checkMemberResolved(compiler, 'C', operatorName('[]', false));
-  checkMemberResolved(compiler, 'C', operatorName('[]=', false));
+  asyncTest(() => compileScript(script).then((compiler) {
+    checkMemberResolved(compiler, 'C', operatorName('[]', false));
+    checkMemberResolved(compiler, 'C', operatorName('[]=', false));
+  }));
 }
 
 testIncrementsAndDecrements() {
@@ -896,12 +901,12 @@
         var d = new D();
         --d;
       }""";
-  final compiler = compileScript(script);
-
-  checkMemberResolved(compiler, 'A', operatorName('+', false));
-  checkMemberResolved(compiler, 'B', operatorName('+', false));
-  checkMemberResolved(compiler, 'C', operatorName('-', false));
-  checkMemberResolved(compiler, 'D', operatorName('-', false));
+  asyncTest(() => compileScript(script).then((compiler) {
+    checkMemberResolved(compiler, 'A', operatorName('+', false));
+    checkMemberResolved(compiler, 'B', operatorName('+', false));
+    checkMemberResolved(compiler, 'C', operatorName('-', false));
+    checkMemberResolved(compiler, 'D', operatorName('-', false));
+  }));
 }
 
 testOverrideHashCodeCheck() {
@@ -916,9 +921,56 @@
       main() {
         new A() == new B();
       }""";
-  final compiler = compileScript(script);
-  Expect.equals(1, compiler.warnings.length);
-  Expect.equals(MessageKind.OVERRIDE_EQUALS_NOT_HASH_CODE,
-                compiler.warnings[0].message.kind);
-  Expect.equals(0, compiler.errors.length);
+  asyncTest(() => compileScript(script).then((compiler) {
+    Expect.equals(1, compiler.warnings.length);
+    Expect.equals(MessageKind.OVERRIDE_EQUALS_NOT_HASH_CODE,
+                  compiler.warnings[0].message.kind);
+    Expect.equals(0, compiler.errors.length);
+  }));
+}
+
+testConstConstructorAndNonFinalFields() {
+  void expect(compiler, List errors, List warnings) {
+    Expect.equals(errors.length, compiler.errors.length);
+    for (int i = 0 ; i < errors.length ; i++) {
+      Expect.equals(errors[i], compiler.errors[i].message.kind);
+    }
+    Expect.equals(warnings.length, compiler.warnings.length);
+    for (int i = 0 ; i < warnings.length ; i++) {
+      Expect.equals(warnings[i], compiler.warnings[i].message.kind);
+    }
+  }
+
+  final script1 = r"""
+      class A {
+        var a;
+        const A(this.a);
+      }
+      main() {
+        new A(0);
+      }""";
+  asyncTest(() => compileScript(script1).then((compiler) {
+    expect(compiler,
+           [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS],
+           [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD]);
+  }));
+
+  final script2 = r"""
+      class A {
+        var a;
+        var b;
+        const A(this.a, this.b);
+        const A.named(this.a, this.b);
+      }
+      main() {
+        new A(0, 1);
+      }""";
+  asyncTest(() => compileScript(script2).then((compiler) {
+    expect(compiler,
+        [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS],
+        [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR,
+         MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR,
+         MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD,
+         MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD]);
+  }));
 }
diff --git a/tests/compiler/dart2js/rewrite_better_user_test.dart b/tests/compiler/dart2js/rewrite_better_user_test.dart
index 6d1fbfe6..ec1fcbc 100644
--- a/tests/compiler/dart2js/rewrite_better_user_test.dart
+++ b/tests/compiler/dart2js/rewrite_better_user_test.dart
@@ -5,6 +5,7 @@
 // field is being gvn'ed.
 
 import 'compiler_helper.dart';
+import "package:async_helper/async_helper.dart";
 
 const String TEST = r"""
 class A {
@@ -25,11 +26,12 @@
 """;
 
 main() {
-  String generated = compileAll(TEST);
-  RegExp regexp = new RegExp('foo\\\$0\\\$bailout');
-  Iterator matches = regexp.allMatches(generated).iterator;
+  asyncTest(() => compileAll(TEST).then((generated) {
+    RegExp regexp = new RegExp('foo\\\$0\\\$bailout');
+    Iterator matches = regexp.allMatches(generated).iterator;
 
-  // We check that there is only one call to the bailout method.
-  // One match for the call, one for the definition.
-  checkNumberOfMatches(matches, 2);
+    // We check that there is only one call to the bailout method.
+    // One match for the call, one for the definition.
+    checkNumberOfMatches(matches, 2);
+  }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_and_or_test.dart b/tests/compiler/dart2js/simple_inferrer_and_or_test.dart
index 22ec51a..19926f0 100644
--- a/tests/compiler/dart2js/simple_inferrer_and_or_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_and_or_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 const String TEST = """
@@ -57,22 +58,23 @@
 void main() {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri);
-  compiler.runCompiler(uri);
-  var typesInferrer = compiler.typesTask.typesInferrer;
+  asyncTest(() => compiler.runCompiler(uri).then((_) {
+    var typesInferrer = compiler.typesTask.typesInferrer;
 
-  checkReturn(String name, type) {
-    var element = findElement(compiler, name);
-    Expect.equals(type,
-        typesInferrer.getReturnTypeOfElement(element).simplify(compiler));
-  }
+    checkReturn(String name, type) {
+      var element = findElement(compiler, name);
+      Expect.equals(type,
+          typesInferrer.getReturnTypeOfElement(element).simplify(compiler));
+    }
 
-  var subclassOfInterceptor =
-      findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
+    var subclassOfInterceptor =
+        findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
 
-  checkReturn('returnDyn1', subclassOfInterceptor);
-  checkReturn('returnDyn2', subclassOfInterceptor);
-  checkReturn('returnDyn3', subclassOfInterceptor);
-  checkReturn('returnDyn4', compiler.typesTask.dynamicType.nonNullable());
-  checkReturn('returnDyn5', compiler.typesTask.dynamicType.nonNullable());
-  checkReturn('returnDyn6', compiler.typesTask.dynamicType.nonNullable());
+    checkReturn('returnDyn1', subclassOfInterceptor);
+    checkReturn('returnDyn2', subclassOfInterceptor);
+    checkReturn('returnDyn3', subclassOfInterceptor);
+    checkReturn('returnDyn4', compiler.typesTask.dynamicType.nonNullable());
+    checkReturn('returnDyn5', compiler.typesTask.dynamicType.nonNullable());
+    checkReturn('returnDyn6', compiler.typesTask.dynamicType.nonNullable());
+  }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_closure_test.dart b/tests/compiler/dart2js/simple_inferrer_closure_test.dart
index 6c6e1c3..2ea06ba 100644
--- a/tests/compiler/dart2js/simple_inferrer_closure_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_closure_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 const String TEST = """
@@ -97,22 +98,23 @@
 void main() {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri);
-  compiler.runCompiler(uri);
-  var typesInferrer = compiler.typesTask.typesInferrer;
+  asyncTest(() => compiler.runCompiler(uri).then((_) {
+    var typesInferrer = compiler.typesTask.typesInferrer;
 
-  checkReturn(String name, type) {
-    var element = findElement(compiler, name);
-    Expect.equals(type,
-        typesInferrer.getReturnTypeOfElement(element).simplify(compiler));
-  }
+    checkReturn(String name, type) {
+      var element = findElement(compiler, name);
+      Expect.equals(type,
+          typesInferrer.getReturnTypeOfElement(element).simplify(compiler));
+    }
 
-  checkReturn('returnInt1', compiler.typesTask.intType);
-  checkReturn('returnInt2', compiler.typesTask.intType.nullable());
-  checkReturn('returnInt3', compiler.typesTask.intType);
-  checkReturn('returnInt4', compiler.typesTask.intType);
+    checkReturn('returnInt1', compiler.typesTask.intType);
+    checkReturn('returnInt2', compiler.typesTask.intType.nullable());
+    checkReturn('returnInt3', compiler.typesTask.intType);
+    checkReturn('returnInt4', compiler.typesTask.intType);
 
-  checkReturn('returnDyn1', compiler.typesTask.dynamicType);
-  checkReturn('returnDyn2', compiler.typesTask.dynamicType);
-  checkReturn('returnDyn3', compiler.typesTask.dynamicType);
-  checkReturn('returnNum1', compiler.typesTask.numType);
+    checkReturn('returnDyn1', compiler.typesTask.dynamicType);
+    checkReturn('returnDyn2', compiler.typesTask.dynamicType);
+    checkReturn('returnDyn3', compiler.typesTask.dynamicType);
+    checkReturn('returnNum1', compiler.typesTask.numType);
+  }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_final_field2_test.dart b/tests/compiler/dart2js/simple_inferrer_final_field2_test.dart
index 75bf803..fa7b6f5 100644
--- a/tests/compiler/dart2js/simple_inferrer_final_field2_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_final_field2_test.dart
@@ -6,6 +6,7 @@
 // infering types for fields.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 import 'parser_helper.dart';
 
@@ -26,15 +27,16 @@
 void main() {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri);
-  compiler.runCompiler(uri);
-  var typesInferrer = compiler.typesTask.typesInferrer;
+  asyncTest(() => compiler.runCompiler(uri).then((_) {
+    var typesInferrer = compiler.typesTask.typesInferrer;
 
-  checkFieldTypeInClass(String className, String fieldName, type) {
-    var cls = findElement(compiler, className);
-    var element = cls.lookupLocalMember(buildSourceString(fieldName));
-    Expect.equals(type, typesInferrer.getTypeOfElement(element));
-  }
+    checkFieldTypeInClass(String className, String fieldName, type) {
+      var cls = findElement(compiler, className);
+      var element = cls.lookupLocalMember(buildSourceString(fieldName));
+      Expect.equals(type, typesInferrer.getTypeOfElement(element));
+    }
 
-  checkFieldTypeInClass('A', 'intField', compiler.typesTask.intType);
-  checkFieldTypeInClass('A', 'stringField', compiler.typesTask.stringType);
+    checkFieldTypeInClass('A', 'intField', compiler.typesTask.intType);
+    checkFieldTypeInClass('A', 'stringField', compiler.typesTask.stringType);
+  }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_final_field3_test.dart b/tests/compiler/dart2js/simple_inferrer_final_field3_test.dart
index a4a4e1f..9c76b76 100644
--- a/tests/compiler/dart2js/simple_inferrer_final_field3_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_final_field3_test.dart
@@ -5,6 +5,7 @@
 // Test that we are analyzing field parameters correctly.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 import 'parser_helper.dart';
 
@@ -25,16 +26,17 @@
 void main() {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri);
-  compiler.runCompiler(uri);
-  var typesInferrer = compiler.typesTask.typesInferrer;
+  asyncTest(() => compiler.runCompiler(uri).then((_) {
+    var typesInferrer = compiler.typesTask.typesInferrer;
 
-  checkFieldTypeInClass(String className, String fieldName, type) {
-    var cls = findElement(compiler, className);
-    var element = cls.lookupLocalMember(buildSourceString(fieldName));
-    Expect.equals(type,
-        typesInferrer.getTypeOfElement(element).simplify(compiler));
-  }
+    checkFieldTypeInClass(String className, String fieldName, type) {
+      var cls = findElement(compiler, className);
+      var element = cls.lookupLocalMember(buildSourceString(fieldName));
+      Expect.equals(type,
+          typesInferrer.getTypeOfElement(element).simplify(compiler));
+    }
 
-  checkFieldTypeInClass('A', 'dynamicField',
-      findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'));
+    checkFieldTypeInClass('A', 'dynamicField',
+        findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'));
+  }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_final_field_test.dart b/tests/compiler/dart2js/simple_inferrer_final_field_test.dart
index f4d5d04..6eaa89b 100644
--- a/tests/compiler/dart2js/simple_inferrer_final_field_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_final_field_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 import 'parser_helper.dart';
 
@@ -28,20 +29,21 @@
 void main() {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri);
-  compiler.runCompiler(uri);
-  var typesInferrer = compiler.typesTask.typesInferrer;
+  asyncTest(() => compiler.runCompiler(uri).then((_) {
+    var typesInferrer = compiler.typesTask.typesInferrer;
 
-  checkFieldTypeInClass(String className, String fieldName, type) {
-    var cls = findElement(compiler, className);
-    var element = cls.lookupLocalMember(buildSourceString(fieldName));
-    Expect.equals(type,
-        typesInferrer.getTypeOfElement(element).simplify(compiler));
-  }
+    checkFieldTypeInClass(String className, String fieldName, type) {
+      var cls = findElement(compiler, className);
+      var element = cls.lookupLocalMember(buildSourceString(fieldName));
+      Expect.equals(type,
+          typesInferrer.getTypeOfElement(element).simplify(compiler));
+    }
 
-  checkFieldTypeInClass('A', 'intField', compiler.typesTask.intType);
-  checkFieldTypeInClass('A', 'giveUpField1',
-      findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'));
-  checkFieldTypeInClass('A', 'giveUpField2',
-      compiler.typesTask.dynamicType.nonNullable());
-  checkFieldTypeInClass('A', 'fieldParameter', compiler.typesTask.intType);
+    checkFieldTypeInClass('A', 'intField', compiler.typesTask.intType);
+    checkFieldTypeInClass('A', 'giveUpField1',
+        findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'));
+    checkFieldTypeInClass('A', 'giveUpField2',
+        compiler.typesTask.dynamicType.nonNullable());
+    checkFieldTypeInClass('A', 'fieldParameter', compiler.typesTask.intType);
+  }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_no_such_method_test.dart b/tests/compiler/dart2js/simple_inferrer_no_such_method_test.dart
index 45669dd..45b3878 100644
--- a/tests/compiler/dart2js/simple_inferrer_no_such_method_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_no_such_method_test.dart
@@ -4,6 +4,7 @@
 
 import 'package:expect/expect.dart';
 
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 import 'parser_helper.dart';
 
@@ -95,11 +96,8 @@
 main() {
   Uri uri = new Uri(scheme: 'source');
 
-  var compiler = compilerFor(TEST1, uri);
-  compiler.runCompiler(uri);
-  var typesInferrer = compiler.typesTask.typesInferrer;
-
-  checkReturn(String name, type) {
+  checkReturn(MockCompiler compiler, String name, type) {
+    var typesInferrer = compiler.typesTask.typesInferrer;
     var element = findElement(compiler, name);
     Expect.equals(
         type,
@@ -107,27 +105,33 @@
         name);
   }
 
-  checkReturn('test1', compiler.typesTask.intType);
-  checkReturn('test2', compiler.typesTask.dynamicType.nonNullable());
-  checkReturn('test3', compiler.typesTask.intType);
-  checkReturn('test4', compiler.typesTask.mapType);
-  checkReturn('test5', compiler.typesTask.dynamicType.nonNullable());
-  checkReturn('test6', compiler.typesTask.dynamicType.nonNullable());
+  var compiler1 = compilerFor(TEST1, uri);
+  asyncTest(() => compiler1.runCompiler(uri).then((_) {
+    checkReturn(compiler1, 'test1', compiler1.typesTask.intType);
+    checkReturn(compiler1, 'test2',
+        compiler1.typesTask.dynamicType.nonNullable());
+    checkReturn(compiler1, 'test3', compiler1.typesTask.intType);
+    checkReturn(compiler1, 'test4', compiler1.typesTask.mapType);
+    checkReturn(compiler1, 'test5',
+        compiler1.typesTask.dynamicType.nonNullable());
+    checkReturn(compiler1, 'test6',
+        compiler1.typesTask.dynamicType.nonNullable());
+  }));
 
-  compiler = compilerFor(TEST2, uri);
-  compiler.runCompiler(uri);
-  typesInferrer = compiler.typesTask.typesInferrer;
+  var compiler2 = compilerFor(TEST2, uri);
+  asyncTest(() => compiler2.runCompiler(uri).then((_) {
+    checkReturn(compiler2, 'test1',
+        compiler2.typesTask.dynamicType.nonNullable());
+    checkReturn(compiler2, 'test2', compiler2.typesTask.mapType);
+    checkReturn(compiler2, 'test3', compiler2.typesTask.mapType);
+    checkReturn(compiler2, 'test4', compiler2.typesTask.mapType);
+    checkReturn(compiler2, 'test5', compiler2.typesTask.mapType);
 
-  checkReturn('test1', compiler.typesTask.dynamicType.nonNullable());
-  checkReturn('test2', compiler.typesTask.mapType);
-  checkReturn('test3', compiler.typesTask.mapType);
-  checkReturn('test4', compiler.typesTask.mapType);
-  checkReturn('test5', compiler.typesTask.mapType);
-
-  checkReturn('test6', compiler.typesTask.numType);
-  checkReturn('test7', compiler.typesTask.intType);
-  checkReturn('test8', compiler.typesTask.intType);
-  checkReturn('test9', compiler.typesTask.intType);
-  checkReturn('test10', compiler.typesTask.numType);
-  checkReturn('test11', compiler.typesTask.doubleType);
+    checkReturn(compiler2, 'test6', compiler2.typesTask.numType);
+    checkReturn(compiler2, 'test7', compiler2.typesTask.intType);
+    checkReturn(compiler2, 'test8', compiler2.typesTask.intType);
+    checkReturn(compiler2, 'test9', compiler2.typesTask.intType);
+    checkReturn(compiler2, 'test10', compiler2.typesTask.numType);
+    checkReturn(compiler2, 'test11', compiler2.typesTask.doubleType);
+  }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_postfix_prefix_test.dart b/tests/compiler/dart2js/simple_inferrer_postfix_prefix_test.dart
index 6ae3174..427e64d 100644
--- a/tests/compiler/dart2js/simple_inferrer_postfix_prefix_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_postfix_prefix_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 import 'parser_helper.dart';
 
@@ -13,7 +14,7 @@
   set foo(value) {}
   operator[](index) => 'string';
   operator[]=(index, value) {}
-  
+
   returnDynamic1() => foo--;
   returnNum1() => --foo;
   returnNum2() => foo -= 42;
@@ -63,34 +64,35 @@
 void main() {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri);
-  compiler.runCompiler(uri);
-  var typesTask = compiler.typesTask;
-  var typesInferrer = typesTask.typesInferrer;
+  asyncTest(() => compiler.runCompiler(uri).then((_) {
+    var typesTask = compiler.typesTask;
+    var typesInferrer = typesTask.typesInferrer;
 
-  checkReturnInClass(String className, String methodName, type) {
-    var cls = findElement(compiler, className);
-    var element = cls.lookupLocalMember(buildSourceString(methodName));
-    Expect.equals(type,
-        typesInferrer.getReturnTypeOfElement(element).simplify(compiler));
-  }
+    checkReturnInClass(String className, String methodName, type) {
+      var cls = findElement(compiler, className);
+      var element = cls.lookupLocalMember(buildSourceString(methodName));
+      Expect.equals(type,
+          typesInferrer.getReturnTypeOfElement(element).simplify(compiler));
+    }
 
-  var subclassOfInterceptor =
-      findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
+    var subclassOfInterceptor =
+        findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
 
-  checkReturnInClass('A', 'returnNum1', typesTask.numType);
-  checkReturnInClass('A', 'returnNum2', typesTask.numType);
-  checkReturnInClass('A', 'returnNum3', typesTask.numType);
-  checkReturnInClass('A', 'returnNum4', typesTask.numType);
-  checkReturnInClass('A', 'returnNum5', typesTask.numType);
-  checkReturnInClass('A', 'returnNum6', typesTask.numType);
-  checkReturnInClass('A', 'returnDynamic1', subclassOfInterceptor);
-  checkReturnInClass('A', 'returnDynamic2', subclassOfInterceptor);
-  checkReturnInClass('A', 'returnDynamic3', typesTask.dynamicType);
+    checkReturnInClass('A', 'returnNum1', typesTask.numType);
+    checkReturnInClass('A', 'returnNum2', typesTask.numType);
+    checkReturnInClass('A', 'returnNum3', typesTask.numType);
+    checkReturnInClass('A', 'returnNum4', typesTask.numType);
+    checkReturnInClass('A', 'returnNum5', typesTask.numType);
+    checkReturnInClass('A', 'returnNum6', typesTask.numType);
+    checkReturnInClass('A', 'returnDynamic1', subclassOfInterceptor);
+    checkReturnInClass('A', 'returnDynamic2', subclassOfInterceptor);
+    checkReturnInClass('A', 'returnDynamic3', typesTask.dynamicType);
 
-  checkReturnInClass('B', 'returnString1', typesTask.stringType);
-  checkReturnInClass('B', 'returnString2', typesTask.stringType);
-  checkReturnInClass('B', 'returnDynamic1', typesTask.dynamicType);
-  checkReturnInClass('B', 'returnDynamic2', typesTask.dynamicType);
-  checkReturnInClass('B', 'returnDynamic3', typesTask.dynamicType);
-  checkReturnInClass('B', 'returnDynamic4', typesTask.dynamicType);
+    checkReturnInClass('B', 'returnString1', typesTask.stringType);
+    checkReturnInClass('B', 'returnString2', typesTask.stringType);
+    checkReturnInClass('B', 'returnDynamic1', typesTask.dynamicType);
+    checkReturnInClass('B', 'returnDynamic2', typesTask.dynamicType);
+    checkReturnInClass('B', 'returnDynamic3', typesTask.dynamicType);
+    checkReturnInClass('B', 'returnDynamic4', typesTask.dynamicType);
+  }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_relations_test.dart b/tests/compiler/dart2js/simple_inferrer_relations_test.dart
index 4b3af4a..313154a 100644
--- a/tests/compiler/dart2js/simple_inferrer_relations_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_relations_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import
     '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'
     show TypeMask;
@@ -51,9 +52,10 @@
 """;
 
 void main() {
-  String generated = compileAll(TEST);
-  if (generated.contains(r'=== true')) {
-    print(generated);
-    Expect.fail("missing elision of '=== true'");
-  }
+  asyncTest(() => compileAll(TEST).then((generated) {
+    if (generated.contains(r'=== true')) {
+      print(generated);
+      Expect.fail("missing elision of '=== true'");
+    }
+  }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_test.dart b/tests/compiler/dart2js/simple_inferrer_test.dart
index 5eb96d2..cfc2a07 100644
--- a/tests/compiler/dart2js/simple_inferrer_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import
     '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'
     show TypeMask;
@@ -13,11 +14,11 @@
 const String TEST = """
 returnNum1(a) {
   if (a) return 1;
-  else return 2.0;
+  else return 2.5;
 }
 
 returnNum2(a) {
-  if (a) return 1.0;
+  if (a) return 1.4;
   else return 2;
 }
 
@@ -27,8 +28,8 @@
 }
 
 returnDouble(a) {
-  if (a) return 1.0;
-  else return 2.0;
+  if (a) return 1.5;
+  else return 2.5;
 }
 
 returnGiveUp(a) {
@@ -233,6 +234,18 @@
   }
 }
 
+testIsCheck21(a) {
+  if (a is int || a is List) {
+    return a;
+  } else {
+    return 42;
+  }
+}
+
+testIsCheck22(a) {
+  return (a is int || a is List) ? a : 42;
+}
+
 testIf1(a) {
   var c = null;
   if (a) {
@@ -544,6 +557,8 @@
   testIsCheck18(topLevelGetter());
   testIsCheck19(topLevelGetter());
   testIsCheck20();
+  testIsCheck21(topLevelGetter());
+  testIsCheck22(topLevelGetter());
   testIf1(topLevelGetter());
   testIf2(topLevelGetter());
   returnAsString();
@@ -597,123 +612,127 @@
 void main() {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri);
-  compiler.runCompiler(uri);
-  var typesTask = compiler.typesTask;
-  var typesInferrer = typesTask.typesInferrer;
+  asyncTest(() => compiler.runCompiler(uri).then((_) {
+    var typesTask = compiler.typesTask;
+    var typesInferrer = typesTask.typesInferrer;
 
-  checkReturn(String name, type) {
-    var element = findElement(compiler, name);
-    Expect.equals(
-        type,
-        typesInferrer.getReturnTypeOfElement(element).simplify(compiler),
-        name);
-  }
-  var interceptorType =
-      findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
+    checkReturn(String name, type) {
+      var element = findElement(compiler, name);
+      Expect.equals(
+          type,
+          typesInferrer.getReturnTypeOfElement(element).simplify(compiler),
+          name);
+    }
+    var interceptorType =
+        findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
 
-  checkReturn('returnNum1', typesTask.numType);
-  checkReturn('returnNum2', typesTask.numType);
-  checkReturn('returnInt1', typesTask.intType);
-  checkReturn('returnInt2', typesTask.intType);
-  checkReturn('returnDouble', typesTask.doubleType);
-  checkReturn('returnGiveUp', interceptorType);
-  checkReturn('returnInt5', typesTask.intType);
-  checkReturn('returnInt6', typesTask.intType);
-  checkReturn('returnIntOrNull', typesTask.intType.nullable());
-  checkReturn('returnInt3', typesTask.intType);
-  checkReturn('returnDynamic', typesTask.dynamicType);
-  checkReturn('returnInt4', typesTask.intType);
-  checkReturn('returnInt7', typesTask.intType);
-  checkReturn('returnInt8', typesTask.intType);
-  checkReturn('returnDynamic1', typesTask.dynamicType);
-  checkReturn('returnDynamic2', typesTask.dynamicType);
-  TypeMask intType = new TypeMask.nonNullSubtype(compiler.intClass.rawType);
-  checkReturn('testIsCheck1', intType);
-  checkReturn('testIsCheck2', intType);
-  checkReturn('testIsCheck3', intType.nullable());
-  checkReturn('testIsCheck4', intType);
-  checkReturn('testIsCheck5', intType);
-  checkReturn('testIsCheck6', typesTask.dynamicType);
-  checkReturn('testIsCheck7', intType);
-  checkReturn('testIsCheck8', typesTask.dynamicType);
-  checkReturn('testIsCheck9', intType);
-  checkReturn('testIsCheck10', typesTask.dynamicType);
-  checkReturn('testIsCheck11', intType);
-  checkReturn('testIsCheck12', typesTask.dynamicType);
-  checkReturn('testIsCheck13', intType);
-  checkReturn('testIsCheck14', typesTask.dynamicType);
-  checkReturn('testIsCheck15', intType);
-  checkReturn('testIsCheck16', typesTask.dynamicType);
-  checkReturn('testIsCheck17', intType);
-  checkReturn('testIsCheck18', typesTask.dynamicType);
-  checkReturn('testIsCheck19', typesTask.dynamicType);
-  checkReturn('testIsCheck20', typesTask.dynamicType.nonNullable());
-  checkReturn('testIf1', typesTask.intType.nullable());
-  checkReturn('testIf2', typesTask.intType.nullable());
-  checkReturn('returnAsString',
-      new TypeMask.subtype(compiler.stringClass.computeType(compiler)));
-  checkReturn('returnIntAsNum', typesTask.intType);
-  checkReturn('returnAsTypedef', typesTask.functionType.nullable());
-  checkReturn('returnTopLevelGetter', typesTask.intType);
-  checkReturn('testDeadCode', typesTask.intType);
-  checkReturn('testLabeledIf', typesTask.intType.nullable());
-  checkReturn('testSwitch1', typesTask.intType
-      .union(typesTask.doubleType, compiler).nullable().simplify(compiler));
-  checkReturn('testSwitch2', typesTask.intType);
-  checkReturn('testSwitch3', interceptorType.nullable());
-  checkReturn('testSwitch4', typesTask.intType);
-  checkReturn('testSwitch5', typesTask.intType);
-  checkReturn('testContinue1', interceptorType.nullable());
-  checkReturn('testBreak1', interceptorType.nullable());
-  checkReturn('testContinue2', interceptorType.nullable());
-  checkReturn('testBreak2', typesTask.intType.nullable());
-  checkReturn('testReturnElementOfConstList1', typesTask.intType);
-  checkReturn('testReturnElementOfConstList2', typesTask.intType);
-  checkReturn('testReturnItselfOrInt', typesTask.intType);
-  checkReturn('testReturnInvokeDynamicGetter', typesTask.dynamicType);
+    checkReturn('returnNum1', typesTask.numType);
+    checkReturn('returnNum2', typesTask.numType);
+    checkReturn('returnInt1', typesTask.intType);
+    checkReturn('returnInt2', typesTask.intType);
+    checkReturn('returnDouble', typesTask.doubleType);
+    checkReturn('returnGiveUp', interceptorType);
+    checkReturn('returnInt5', typesTask.intType);
+    checkReturn('returnInt6', typesTask.intType);
+    checkReturn('returnIntOrNull', typesTask.intType.nullable());
+    checkReturn('returnInt3', typesTask.intType);
+    checkReturn('returnDynamic', typesTask.dynamicType);
+    checkReturn('returnInt4', typesTask.intType);
+    checkReturn('returnInt7', typesTask.intType);
+    checkReturn('returnInt8', typesTask.intType);
+    checkReturn('returnDynamic1', typesTask.dynamicType);
+    checkReturn('returnDynamic2', typesTask.dynamicType);
+    TypeMask intType = new TypeMask.nonNullSubtype(compiler.intClass.rawType);
+    checkReturn('testIsCheck1', intType);
+    checkReturn('testIsCheck2', intType);
+    checkReturn('testIsCheck3', intType.nullable());
+    checkReturn('testIsCheck4', intType);
+    checkReturn('testIsCheck5', intType);
+    checkReturn('testIsCheck6', typesTask.dynamicType);
+    checkReturn('testIsCheck7', intType);
+    checkReturn('testIsCheck8', typesTask.dynamicType);
+    checkReturn('testIsCheck9', intType);
+    checkReturn('testIsCheck10', typesTask.dynamicType);
+    checkReturn('testIsCheck11', intType);
+    checkReturn('testIsCheck12', typesTask.dynamicType);
+    checkReturn('testIsCheck13', intType);
+    checkReturn('testIsCheck14', typesTask.dynamicType);
+    checkReturn('testIsCheck15', intType);
+    checkReturn('testIsCheck16', typesTask.dynamicType);
+    checkReturn('testIsCheck17', intType);
+    checkReturn('testIsCheck18', typesTask.dynamicType);
+    checkReturn('testIsCheck19', typesTask.dynamicType);
+    checkReturn('testIsCheck20', typesTask.dynamicType.nonNullable());
+    checkReturn('testIsCheck21', typesTask.dynamicType);
+    checkReturn('testIsCheck22', typesTask.dynamicType);
+    checkReturn('testIf1', typesTask.intType.nullable());
+    checkReturn('testIf2', typesTask.intType.nullable());
+    checkReturn('returnAsString',
+        new TypeMask.subtype(compiler.stringClass.computeType(compiler)));
+    checkReturn('returnIntAsNum', typesTask.intType);
+    checkReturn('returnAsTypedef', typesTask.functionType.nullable());
+    checkReturn('returnTopLevelGetter', typesTask.intType);
+    checkReturn('testDeadCode', typesTask.intType);
+    checkReturn('testLabeledIf', typesTask.intType.nullable());
+    checkReturn('testSwitch1', typesTask.intType
+        .union(typesTask.doubleType, compiler)
+        .nullable().simplify(compiler));
+    checkReturn('testSwitch2', typesTask.intType);
+    checkReturn('testSwitch3', interceptorType.nullable());
+    checkReturn('testSwitch4', typesTask.intType);
+    checkReturn('testSwitch5', typesTask.intType);
+    checkReturn('testContinue1', interceptorType.nullable());
+    checkReturn('testBreak1', interceptorType.nullable());
+    checkReturn('testContinue2', interceptorType.nullable());
+    checkReturn('testBreak2', typesTask.intType.nullable());
+    checkReturn('testReturnElementOfConstList1', typesTask.intType);
+    checkReturn('testReturnElementOfConstList2', typesTask.intType);
+    checkReturn('testReturnItselfOrInt', typesTask.intType);
+    checkReturn('testReturnInvokeDynamicGetter', typesTask.dynamicType);
 
-  checkReturn('testDoWhile1', typesTask.stringType);
-  checkReturn('testDoWhile2', typesTask.nullType);
-  checkReturn('testDoWhile3', interceptorType);
-  checkReturn('testDoWhile4', typesTask.numType);
+    checkReturn('testDoWhile1', typesTask.stringType);
+    checkReturn('testDoWhile2', typesTask.nullType);
+    checkReturn('testDoWhile3', typesTask.intType);
+    checkReturn('testDoWhile4', typesTask.numType);
 
-  checkReturnInClass(String className, String methodName, type) {
-    var cls = findElement(compiler, className);
-    var element = cls.lookupLocalMember(buildSourceString(methodName));
-    Expect.equals(type,
-        typesInferrer.getReturnTypeOfElement(element).simplify(compiler));
-  }
+    checkReturnInClass(String className, String methodName, type) {
+      var cls = findElement(compiler, className);
+      var element = cls.lookupLocalMember(buildSourceString(methodName));
+      Expect.equals(type,
+          typesInferrer.getReturnTypeOfElement(element).simplify(compiler));
+    }
 
-  checkReturnInClass('A', 'returnInt1', typesTask.intType);
-  checkReturnInClass('A', 'returnInt2', typesTask.intType);
-  checkReturnInClass('A', 'returnInt3', typesTask.intType);
-  checkReturnInClass('A', 'returnInt4', typesTask.intType);
-  checkReturnInClass('A', 'returnInt5', typesTask.intType);
-  checkReturnInClass('A', 'returnInt6', typesTask.intType);
-  checkReturnInClass('A', '==', interceptorType);
+    checkReturnInClass('A', 'returnInt1', typesTask.intType);
+    checkReturnInClass('A', 'returnInt2', typesTask.intType);
+    checkReturnInClass('A', 'returnInt3', typesTask.intType);
+    checkReturnInClass('A', 'returnInt4', typesTask.intType);
+    checkReturnInClass('A', 'returnInt5', typesTask.intType);
+    checkReturnInClass('A', 'returnInt6', typesTask.intType);
+    checkReturnInClass('A', '==', interceptorType);
 
-  checkReturnInClass('B', 'returnInt1', typesTask.intType);
-  checkReturnInClass('B', 'returnInt2', typesTask.intType);
-  checkReturnInClass('B', 'returnInt3', typesTask.intType);
-  checkReturnInClass('B', 'returnInt4', typesTask.intType);
-  checkReturnInClass('B', 'returnInt5', typesTask.intType);
-  checkReturnInClass('B', 'returnInt6', typesTask.intType);
-  checkReturnInClass('B', 'returnInt7', typesTask.intType);
-  checkReturnInClass('B', 'returnInt8', typesTask.intType);
-  checkReturnInClass('B', 'returnInt9', typesTask.intType);
+    checkReturnInClass('B', 'returnInt1', typesTask.intType);
+    checkReturnInClass('B', 'returnInt2', typesTask.intType);
+    checkReturnInClass('B', 'returnInt3', typesTask.intType);
+    checkReturnInClass('B', 'returnInt4', typesTask.intType);
+    checkReturnInClass('B', 'returnInt5', typesTask.intType);
+    checkReturnInClass('B', 'returnInt6', typesTask.intType);
+    checkReturnInClass('B', 'returnInt7', typesTask.intType);
+    checkReturnInClass('B', 'returnInt8', typesTask.intType);
+    checkReturnInClass('B', 'returnInt9', typesTask.intType);
 
-  checkFactoryConstructor(String className, String factoryName) {
-    var cls = findElement(compiler, className);
-    var element = cls.localLookup(buildSourceString(factoryName));
-    Expect.equals(new TypeMask.nonNullExact(cls.rawType),
-                  typesInferrer.getReturnTypeOfElement(element));
-  }
-  checkFactoryConstructor('A', '');
+    checkFactoryConstructor(String className, String factoryName) {
+      var cls = findElement(compiler, className);
+      var element = cls.localLookup(buildSourceString(factoryName));
+      Expect.equals(new TypeMask.nonNullExact(cls.rawType),
+                    typesInferrer.getReturnTypeOfElement(element));
+    }
+    checkFactoryConstructor('A', '');
 
-  checkReturn('testCascade1', typesTask.growableListType);
-  checkReturn('testCascade2', new TypeMask.nonNullExact(
-      typesTask.rawTypeOf(findElement(compiler, 'CascadeHelper'))));
-  checkReturn('testSpecialization1', typesTask.numType);
-  checkReturn('testSpecialization2', typesTask.dynamicType);
-  checkReturn('testSpecialization3', typesTask.intType.nullable());
+    checkReturn('testCascade1', typesTask.growableListType);
+    checkReturn('testCascade2', new TypeMask.nonNullExact(
+        typesTask.rawTypeOf(findElement(compiler, 'CascadeHelper'))));
+    checkReturn('testSpecialization1', typesTask.numType);
+    checkReturn('testSpecialization2', typesTask.dynamicType);
+    checkReturn('testSpecialization3', typesTask.intType.nullable());
+  }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_try_catch_test.dart b/tests/compiler/dart2js/simple_inferrer_try_catch_test.dart
index 8e47f93..aa29c72 100644
--- a/tests/compiler/dart2js/simple_inferrer_try_catch_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_try_catch_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'
     show TypeMask;
 
@@ -166,32 +167,32 @@
 void main() {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri);
-  compiler.runCompiler(uri);
-  var typesTask = compiler.typesTask;
-  var typesInferrer = typesTask.typesInferrer;
+  asyncTest(() => compiler.runCompiler(uri).then((_) {
+    var typesTask = compiler.typesTask;
+    var typesInferrer = typesTask.typesInferrer;
 
-  checkReturn(String name, type) {
-    var element = findElement(compiler, name);
-    Expect.equals(type,
-        typesInferrer.getReturnTypeOfElement(element).simplify(compiler));
-  }
+    checkReturn(String name, type) {
+      var element = findElement(compiler, name);
+      Expect.equals(type,
+          typesInferrer.getReturnTypeOfElement(element).simplify(compiler));
+    }
 
-  checkReturn('returnInt1', typesTask.intType);
-  checkReturn('returnInt2', typesTask.intType);
-  checkReturn('returnInt3', typesTask.intType);
-  checkReturn('returnInt4', typesTask.intType);
-  checkReturn('returnInt5', typesTask.intType);
-  checkReturn('returnInt6',
-      new TypeMask.nonNullSubtype(compiler.intClass.rawType));
-  checkReturn('returnInt7', typesTask.intType);
+    checkReturn('returnInt1', typesTask.intType);
+    checkReturn('returnInt2', typesTask.intType);
+    checkReturn('returnInt3', typesTask.intType);
+    checkReturn('returnInt4', typesTask.intType);
+    checkReturn('returnInt5', typesTask.intType);
+    checkReturn('returnInt6',
+        new TypeMask.nonNullSubtype(compiler.intClass.rawType));
 
-  var subclassOfInterceptor =
-      findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
+    var subclassOfInterceptor =
+        findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
 
-  checkReturn('returnDyn1', subclassOfInterceptor);
-  checkReturn('returnDyn2', subclassOfInterceptor);
-  checkReturn('returnDyn3', subclassOfInterceptor);
-  checkReturn('returnDyn4', subclassOfInterceptor);
-  checkReturn('returnDyn5', subclassOfInterceptor);
-  checkReturn('returnDyn6', typesTask.dynamicType);
+    checkReturn('returnDyn1', subclassOfInterceptor);
+    checkReturn('returnDyn2', subclassOfInterceptor);
+    checkReturn('returnDyn3', subclassOfInterceptor);
+    checkReturn('returnDyn4', subclassOfInterceptor);
+    checkReturn('returnDyn5', subclassOfInterceptor);
+    checkReturn('returnDyn6', typesTask.dynamicType);
+  }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_unregister_call_test.dart b/tests/compiler/dart2js/simple_inferrer_unregister_call_test.dart
index 81bbe0f..35a2994 100644
--- a/tests/compiler/dart2js/simple_inferrer_unregister_call_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_unregister_call_test.dart
@@ -3,7 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:expect/expect.dart';
-
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 import 'parser_helper.dart';
 
@@ -32,14 +32,15 @@
 void main() {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri);
-  compiler.runCompiler(uri);
-  var typesInferrer = compiler.typesTask.typesInferrer;
+  asyncTest(() => compiler.runCompiler(uri).then((_) {
+    var typesInferrer = compiler.typesTask.typesInferrer;
 
-  checkReturnInClass(String className, String methodName, type) {
-    var cls = findElement(compiler, className);
-    var element = cls.lookupLocalMember(buildSourceString(methodName));
-    Expect.equals(type, typesInferrer.getReturnTypeOfElement(element));
-  }
+    checkReturnInClass(String className, String methodName, type) {
+      var cls = findElement(compiler, className);
+      var element = cls.lookupLocalMember(buildSourceString(methodName));
+      Expect.equals(type, typesInferrer.getReturnTypeOfElement(element));
+    }
 
-  checkReturnInClass('A', '+', compiler.typesTask.intType);
+    checkReturnInClass('A', '+', compiler.typesTask.intType);
+  }));
 }
diff --git a/tests/compiler/dart2js/size_test.dart b/tests/compiler/dart2js/size_test.dart
index 446a6dc..96b5276 100644
--- a/tests/compiler/dart2js/size_test.dart
+++ b/tests/compiler/dart2js/size_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import "compiler_helper.dart";
 
 const String TEST = "main() => [];";
@@ -25,10 +26,12 @@
 ''';
 
 main() {
-  String generated = compileAll(TEST, coreSource: DEFAULT_CORELIB_WITH_LIST);
-  MockCompiler compiler = new MockCompiler();
-  var backend = compiler.backend;
+  asyncTest(() => compileAll(TEST, coreSource: DEFAULT_CORELIB_WITH_LIST).
+      then((generated) {
+    MockCompiler compiler = new MockCompiler();
+    var backend = compiler.backend;
 
-  // Make sure no class is emitted.
-  Expect.isFalse(generated.contains(backend.emitter.finishClassesName));
+    // Make sure no class is emitted.
+    Expect.isFalse(generated.contains(backend.emitter.finishClassesName));
+  }));
 }
diff --git a/tests/compiler/dart2js/source_mapping_test.dart b/tests/compiler/dart2js/source_mapping_test.dart
index e204f2b..8d404f8 100644
--- a/tests/compiler/dart2js/source_mapping_test.dart
+++ b/tests/compiler/dart2js/source_mapping_test.dart
@@ -2,19 +2,21 @@
 // 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 'dart:async';
 import "package:expect/expect.dart";
-
+import "package:async_helper/async_helper.dart";
 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart";
 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart';
 import "mock_compiler.dart";
 import 'parser_helper.dart';
 
-CodeBuffer compileAll(SourceFile sourceFile) {
+Future<CodeBuffer> compileAll(SourceFile sourceFile) {
   MockCompiler compiler = new MockCompiler();
   Uri uri = new Uri(path: sourceFile.filename);
   compiler.sourceFiles[uri.toString()] = sourceFile;
-  compiler.runCompiler(uri);
-  return compiler.backend.emitter.mainBuffer;
+  return compiler.runCompiler(uri).then((_) {
+    return compiler.backend.emitter.mainBuffer;
+  });
 }
 
 void testSourceMapLocations(String codeWithMarkers) {
@@ -27,27 +29,27 @@
   String code = codeWithMarkers.replaceAll('@', '');
 
   SourceFile sourceFile = new SourceFile('<test script>', code);
-  CodeBuffer buffer = compileAll(sourceFile);
+  asyncTest(() => compileAll(sourceFile).then((CodeBuffer buffer) {
+    Set<int> locations = new Set<int>();
+    buffer.forEachSourceLocation((int offset, var sourcePosition) {
+      if (sourcePosition != null && sourcePosition.sourceFile == sourceFile) {
+        locations.add(sourcePosition.token.charOffset);
+      }
+    });
 
-  Set<int> locations = new Set<int>();
-  buffer.forEachSourceLocation((int offset, var sourcePosition) {
-    if (sourcePosition != null && sourcePosition.sourceFile == sourceFile) {
-      locations.add(sourcePosition.token.charOffset);
+    for (int i = 0; i < expectedLocations.length; ++i) {
+      int expectedLocation = expectedLocations[i];
+      if (!locations.contains(expectedLocation)) {
+        int originalLocation = expectedLocation + i;
+        SourceFile sourceFileWithMarkers = new SourceFile('<test script>',
+                                                          codeWithMarkers);
+        String message = sourceFileWithMarkers.getLocationMessage(
+            'Missing location', originalLocation, originalLocation + 1, true,
+            (s) => s);
+        Expect.fail(message);
+      }
     }
-  });
-
-  for (int i = 0; i < expectedLocations.length; ++i) {
-    int expectedLocation = expectedLocations[i];
-    if (!locations.contains(expectedLocation)) {
-      int originalLocation = expectedLocation + i;
-      SourceFile sourceFileWithMarkers = new SourceFile('<test script>',
-                                                        codeWithMarkers);
-      String message = sourceFileWithMarkers.getLocationMessage(
-          'Missing location', originalLocation, originalLocation + 1, true,
-          (s) => s);
-      Expect.fail(message);
-    }
-  }
+  }));
 }
 
 String FUNCTIONS_TEST = '''
diff --git a/tests/compiler/dart2js/static_closure_test.dart b/tests/compiler/dart2js/static_closure_test.dart
index 4003c61..622def2 100644
--- a/tests/compiler/dart2js/static_closure_test.dart
+++ b/tests/compiler/dart2js/static_closure_test.dart
@@ -5,17 +5,19 @@
 // Test that static functions are closurized as expected.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 main() {
-  String code = compileAll(r'''main() { print(main); }''');
+  asyncTest(() => compileAll(r'''main() { print(main); }''').then((code) {
+    // At some point, we will have to closurize global functions
+    // differently, at which point this test will break. Then it is time
+    // to implement a way to call a Dart closure from JS foreign
+    // functions.
 
-  // At some point, we will have to closurize global functions
-  // differently, at which point this test will break. Then it is time
-  // to implement a way to call a Dart closure from JS foreign
-  // functions.
-
-  // If this test fail, please take a look at the use of
-  // toStringWrapper in captureStackTrace in js_helper.dart.
-  Expect.isTrue(code.contains(new RegExp(r'print\([$a-z]+\.main\$closure\);')));
+    // If this test fail, please take a look at the use of
+    // toStringWrapper in captureStackTrace in js_helper.dart.
+    Expect.isTrue(code.contains(
+        new RegExp(r'print\([$a-z]+\.main\$closure\);')));
+  }));
 }
diff --git a/tests/compiler/dart2js/string_interpolation_test.dart b/tests/compiler/dart2js/string_interpolation_test.dart
index f6e3bca..01ea1bb 100644
--- a/tests/compiler/dart2js/string_interpolation_test.dart
+++ b/tests/compiler/dart2js/string_interpolation_test.dart
@@ -3,13 +3,17 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 main() {
-  String code =
-      compileAll(r'''main() { return "${2}${true}${'a'}${3.14}"; }''');
-  Expect.isTrue(code.contains(r'2truea3.14'));
+  asyncTest(() => compileAll(
+      r'''main() { return "${2}${true}${'a'}${3.14}"; }''').then((code) {
+    Expect.isTrue(code.contains(r'2truea3.14'));
+  }));
 
-  code = compileAll(r'''main() { return "foo ${new Object()}"; }''');
-  Expect.isFalse(code.contains(r'concat'));
+  asyncTest(() => compileAll(
+      r'''main() { return "foo ${new Object()}"; }''').then((code) {
+    Expect.isFalse(code.contains(r'concat'));
+  }));
 }
diff --git a/tests/compiler/dart2js/subtype_test.dart b/tests/compiler/dart2js/subtype_test.dart
index 35a4651..2322ee0 100644
--- a/tests/compiler/dart2js/subtype_test.dart
+++ b/tests/compiler/dart2js/subtype_test.dart
@@ -5,6 +5,7 @@
 library subtype_test;
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'type_test_helper.dart';
 import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart';
 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart"
@@ -23,210 +24,210 @@
 }
 
 void testInterfaceSubtype() {
-  var env = new TypeEnvironment(r"""
+  asyncTest(() => TypeEnvironment.create(r"""
       class A<T> {}
       class B<T1, T2> extends A<T1> {}
       // TODO(johnniwinther): Inheritance with different type arguments is
       // currently not supported by the implementation.
       class C<T1, T2> extends B<T2, T1> /*implements A<A<T1>>*/ {}
-      """);
+      """).then((env) {
 
-  void expect(bool value, DartType T, DartType S) {
-    Expect.equals(value, env.isSubtype(T, S), '$T <: $S');
-  }
+    void expect(bool value, DartType T, DartType S) {
+      Expect.equals(value, env.isSubtype(T, S), '$T <: $S');
+    }
 
-  ClassElement A = env.getElement('A');
-  ClassElement B = env.getElement('B');
-  ClassElement C = env.getElement('C');
-  DartType Object_ = env['Object'];
-  DartType num_ = env['num'];
-  DartType int_ = env['int'];
-  DartType String_ = env['String'];
-  DartType dynamic_ = env['dynamic'];
+    ClassElement A = env.getElement('A');
+    ClassElement B = env.getElement('B');
+    ClassElement C = env.getElement('C');
+    DartType Object_ = env['Object'];
+    DartType num_ = env['num'];
+    DartType int_ = env['int'];
+    DartType String_ = env['String'];
+    DartType dynamic_ = env['dynamic'];
 
-  expect(true, Object_, Object_);
-  expect(true, num_, Object_);
-  expect(true, int_, Object_);
-  expect(true, String_, Object_);
-  expect(true, dynamic_, Object_);
+    expect(true, Object_, Object_);
+    expect(true, num_, Object_);
+    expect(true, int_, Object_);
+    expect(true, String_, Object_);
+    expect(true, dynamic_, Object_);
 
-  expect(false, Object_, num_);
-  expect(true, num_, num_);
-  expect(true, int_, num_);
-  expect(false, String_, num_);
-  expect(true, dynamic_, num_);
+    expect(false, Object_, num_);
+    expect(true, num_, num_);
+    expect(true, int_, num_);
+    expect(false, String_, num_);
+    expect(true, dynamic_, num_);
 
-  expect(false, Object_, int_);
-  expect(false, num_, int_);
-  expect(true, int_, int_);
-  expect(false, String_, int_);
-  expect(true, dynamic_, int_);
+    expect(false, Object_, int_);
+    expect(false, num_, int_);
+    expect(true, int_, int_);
+    expect(false, String_, int_);
+    expect(true, dynamic_, int_);
 
-  expect(false, Object_, String_);
-  expect(false, num_, String_);
-  expect(false, int_, String_);
-  expect(true, String_, String_);
-  expect(true, dynamic_, String_);
+    expect(false, Object_, String_);
+    expect(false, num_, String_);
+    expect(false, int_, String_);
+    expect(true, String_, String_);
+    expect(true, dynamic_, String_);
 
-  expect(true, Object_, dynamic_);
-  expect(true, num_, dynamic_);
-  expect(true, int_, dynamic_);
-  expect(true, String_, dynamic_);
-  expect(true, dynamic_, dynamic_);
+    expect(true, Object_, dynamic_);
+    expect(true, num_, dynamic_);
+    expect(true, int_, dynamic_);
+    expect(true, String_, dynamic_);
+    expect(true, dynamic_, dynamic_);
 
-  DartType A_Object = instantiate(A, [Object_]);
-  DartType A_num = instantiate(A, [num_]);
-  DartType A_int = instantiate(A, [int_]);
-  DartType A_String = instantiate(A, [String_]);
-  DartType A_dynamic = instantiate(A, [dynamic_]);
+    DartType A_Object = instantiate(A, [Object_]);
+    DartType A_num = instantiate(A, [num_]);
+    DartType A_int = instantiate(A, [int_]);
+    DartType A_String = instantiate(A, [String_]);
+    DartType A_dynamic = instantiate(A, [dynamic_]);
 
-  expect(true, A_Object, Object_);
-  expect(false, A_Object, num_);
-  expect(false, A_Object, int_);
-  expect(false, A_Object, String_);
-  expect(true, A_Object, dynamic_);
+    expect(true, A_Object, Object_);
+    expect(false, A_Object, num_);
+    expect(false, A_Object, int_);
+    expect(false, A_Object, String_);
+    expect(true, A_Object, dynamic_);
 
-  expect(true, A_Object, A_Object);
-  expect(true, A_num, A_Object);
-  expect(true, A_int, A_Object);
-  expect(true, A_String, A_Object);
-  expect(true, A_dynamic, A_Object);
+    expect(true, A_Object, A_Object);
+    expect(true, A_num, A_Object);
+    expect(true, A_int, A_Object);
+    expect(true, A_String, A_Object);
+    expect(true, A_dynamic, A_Object);
 
-  expect(false, A_Object, A_num);
-  expect(true, A_num, A_num);
-  expect(true, A_int, A_num);
-  expect(false, A_String, A_num);
-  expect(true, A_dynamic, A_num);
+    expect(false, A_Object, A_num);
+    expect(true, A_num, A_num);
+    expect(true, A_int, A_num);
+    expect(false, A_String, A_num);
+    expect(true, A_dynamic, A_num);
 
-  expect(false, A_Object, A_int);
-  expect(false, A_num, A_int);
-  expect(true, A_int, A_int);
-  expect(false, A_String, A_int);
-  expect(true, A_dynamic, A_int);
+    expect(false, A_Object, A_int);
+    expect(false, A_num, A_int);
+    expect(true, A_int, A_int);
+    expect(false, A_String, A_int);
+    expect(true, A_dynamic, A_int);
 
-  expect(false, A_Object, A_String);
-  expect(false, A_num, A_String);
-  expect(false, A_int, A_String);
-  expect(true, A_String, A_String);
-  expect(true, A_dynamic, A_String);
+    expect(false, A_Object, A_String);
+    expect(false, A_num, A_String);
+    expect(false, A_int, A_String);
+    expect(true, A_String, A_String);
+    expect(true, A_dynamic, A_String);
 
-  expect(true, A_Object, A_dynamic);
-  expect(true, A_num, A_dynamic);
-  expect(true, A_int, A_dynamic);
-  expect(true, A_String, A_dynamic);
-  expect(true, A_dynamic, A_dynamic);
+    expect(true, A_Object, A_dynamic);
+    expect(true, A_num, A_dynamic);
+    expect(true, A_int, A_dynamic);
+    expect(true, A_String, A_dynamic);
+    expect(true, A_dynamic, A_dynamic);
 
-  DartType B_Object_Object = instantiate(B, [Object_, Object_]);
-  DartType B_num_num = instantiate(B, [num_, num_]);
-  DartType B_int_num = instantiate(B, [int_, num_]);
-  DartType B_dynamic_dynamic = instantiate(B, [dynamic_, dynamic_]);
-  DartType B_String_dynamic = instantiate(B, [String_, dynamic_]);
+    DartType B_Object_Object = instantiate(B, [Object_, Object_]);
+    DartType B_num_num = instantiate(B, [num_, num_]);
+    DartType B_int_num = instantiate(B, [int_, num_]);
+    DartType B_dynamic_dynamic = instantiate(B, [dynamic_, dynamic_]);
+    DartType B_String_dynamic = instantiate(B, [String_, dynamic_]);
 
-  expect(true, B_Object_Object, Object_);
-  expect(true, B_Object_Object, A_Object);
-  expect(false, B_Object_Object, A_num);
-  expect(false, B_Object_Object, A_int);
-  expect(false, B_Object_Object, A_String);
-  expect(true, B_Object_Object, A_dynamic);
+    expect(true, B_Object_Object, Object_);
+    expect(true, B_Object_Object, A_Object);
+    expect(false, B_Object_Object, A_num);
+    expect(false, B_Object_Object, A_int);
+    expect(false, B_Object_Object, A_String);
+    expect(true, B_Object_Object, A_dynamic);
 
-  expect(true, B_num_num, Object_);
-  expect(true, B_num_num, A_Object);
-  expect(true, B_num_num, A_num);
-  expect(false, B_num_num, A_int);
-  expect(false, B_num_num, A_String);
-  expect(true, B_num_num, A_dynamic);
+    expect(true, B_num_num, Object_);
+    expect(true, B_num_num, A_Object);
+    expect(true, B_num_num, A_num);
+    expect(false, B_num_num, A_int);
+    expect(false, B_num_num, A_String);
+    expect(true, B_num_num, A_dynamic);
 
-  expect(true, B_int_num, Object_);
-  expect(true, B_int_num, A_Object);
-  expect(true, B_int_num, A_num);
-  expect(true, B_int_num, A_int);
-  expect(false, B_int_num, A_String);
-  expect(true, B_int_num, A_dynamic);
+    expect(true, B_int_num, Object_);
+    expect(true, B_int_num, A_Object);
+    expect(true, B_int_num, A_num);
+    expect(true, B_int_num, A_int);
+    expect(false, B_int_num, A_String);
+    expect(true, B_int_num, A_dynamic);
 
-  expect(true, B_dynamic_dynamic, Object_);
-  expect(true, B_dynamic_dynamic, A_Object);
-  expect(true, B_dynamic_dynamic, A_num);
-  expect(true, B_dynamic_dynamic, A_int);
-  expect(true, B_dynamic_dynamic, A_String);
-  expect(true, B_dynamic_dynamic, A_dynamic);
+    expect(true, B_dynamic_dynamic, Object_);
+    expect(true, B_dynamic_dynamic, A_Object);
+    expect(true, B_dynamic_dynamic, A_num);
+    expect(true, B_dynamic_dynamic, A_int);
+    expect(true, B_dynamic_dynamic, A_String);
+    expect(true, B_dynamic_dynamic, A_dynamic);
 
-  expect(true, B_String_dynamic, Object_);
-  expect(true, B_String_dynamic, A_Object);
-  expect(false, B_String_dynamic, A_num);
-  expect(false, B_String_dynamic, A_int);
-  expect(true, B_String_dynamic, A_String);
-  expect(true, B_String_dynamic, A_dynamic);
+    expect(true, B_String_dynamic, Object_);
+    expect(true, B_String_dynamic, A_Object);
+    expect(false, B_String_dynamic, A_num);
+    expect(false, B_String_dynamic, A_int);
+    expect(true, B_String_dynamic, A_String);
+    expect(true, B_String_dynamic, A_dynamic);
 
-  expect(true, B_Object_Object, B_Object_Object);
-  expect(true, B_num_num, B_Object_Object);
-  expect(true, B_int_num, B_Object_Object);
-  expect(true, B_dynamic_dynamic, B_Object_Object);
-  expect(true, B_String_dynamic, B_Object_Object);
+    expect(true, B_Object_Object, B_Object_Object);
+    expect(true, B_num_num, B_Object_Object);
+    expect(true, B_int_num, B_Object_Object);
+    expect(true, B_dynamic_dynamic, B_Object_Object);
+    expect(true, B_String_dynamic, B_Object_Object);
 
-  expect(false, B_Object_Object, B_num_num);
-  expect(true, B_num_num, B_num_num);
-  expect(true, B_int_num, B_num_num);
-  expect(true, B_dynamic_dynamic, B_num_num);
-  expect(false, B_String_dynamic, B_num_num);
+    expect(false, B_Object_Object, B_num_num);
+    expect(true, B_num_num, B_num_num);
+    expect(true, B_int_num, B_num_num);
+    expect(true, B_dynamic_dynamic, B_num_num);
+    expect(false, B_String_dynamic, B_num_num);
 
-  expect(false, B_Object_Object, B_int_num);
-  expect(false, B_num_num, B_int_num);
-  expect(true, B_int_num, B_int_num);
-  expect(true, B_dynamic_dynamic, B_int_num);
-  expect(false, B_String_dynamic, B_int_num);
+    expect(false, B_Object_Object, B_int_num);
+    expect(false, B_num_num, B_int_num);
+    expect(true, B_int_num, B_int_num);
+    expect(true, B_dynamic_dynamic, B_int_num);
+    expect(false, B_String_dynamic, B_int_num);
 
-  expect(true, B_Object_Object, B_dynamic_dynamic);
-  expect(true, B_num_num, B_dynamic_dynamic);
-  expect(true, B_int_num, B_dynamic_dynamic);
-  expect(true, B_dynamic_dynamic, B_dynamic_dynamic);
-  expect(true, B_String_dynamic, B_dynamic_dynamic);
+    expect(true, B_Object_Object, B_dynamic_dynamic);
+    expect(true, B_num_num, B_dynamic_dynamic);
+    expect(true, B_int_num, B_dynamic_dynamic);
+    expect(true, B_dynamic_dynamic, B_dynamic_dynamic);
+    expect(true, B_String_dynamic, B_dynamic_dynamic);
 
-  expect(false, B_Object_Object, B_String_dynamic);
-  expect(false, B_num_num, B_String_dynamic);
-  expect(false, B_int_num, B_String_dynamic);
-  expect(true, B_dynamic_dynamic, B_String_dynamic);
-  expect(true, B_String_dynamic, B_String_dynamic);
+    expect(false, B_Object_Object, B_String_dynamic);
+    expect(false, B_num_num, B_String_dynamic);
+    expect(false, B_int_num, B_String_dynamic);
+    expect(true, B_dynamic_dynamic, B_String_dynamic);
+    expect(true, B_String_dynamic, B_String_dynamic);
 
-  DartType C_Object_Object = instantiate(C, [Object_, Object_]);
-  DartType C_num_num = instantiate(C, [num_, num_]);
-  DartType C_int_String = instantiate(C, [int_, String_]);
-  DartType C_dynamic_dynamic = instantiate(C, [dynamic_, dynamic_]);
+    DartType C_Object_Object = instantiate(C, [Object_, Object_]);
+    DartType C_num_num = instantiate(C, [num_, num_]);
+    DartType C_int_String = instantiate(C, [int_, String_]);
+    DartType C_dynamic_dynamic = instantiate(C, [dynamic_, dynamic_]);
 
-  expect(true, C_Object_Object, B_Object_Object);
-  expect(false, C_Object_Object, B_num_num);
-  expect(false, C_Object_Object, B_int_num);
-  expect(true, C_Object_Object, B_dynamic_dynamic);
-  expect(false, C_Object_Object, B_String_dynamic);
+    expect(true, C_Object_Object, B_Object_Object);
+    expect(false, C_Object_Object, B_num_num);
+    expect(false, C_Object_Object, B_int_num);
+    expect(true, C_Object_Object, B_dynamic_dynamic);
+    expect(false, C_Object_Object, B_String_dynamic);
 
-  expect(true, C_num_num, B_Object_Object);
-  expect(true, C_num_num, B_num_num);
-  expect(false, C_num_num, B_int_num);
-  expect(true, C_num_num, B_dynamic_dynamic);
-  expect(false, C_num_num, B_String_dynamic);
+    expect(true, C_num_num, B_Object_Object);
+    expect(true, C_num_num, B_num_num);
+    expect(false, C_num_num, B_int_num);
+    expect(true, C_num_num, B_dynamic_dynamic);
+    expect(false, C_num_num, B_String_dynamic);
 
-  expect(true, C_int_String, B_Object_Object);
-  expect(false, C_int_String, B_num_num);
-  expect(false, C_int_String, B_int_num);
-  expect(true, C_int_String, B_dynamic_dynamic);
-  expect(true, C_int_String, B_String_dynamic);
+    expect(true, C_int_String, B_Object_Object);
+    expect(false, C_int_String, B_num_num);
+    expect(false, C_int_String, B_int_num);
+    expect(true, C_int_String, B_dynamic_dynamic);
+    expect(true, C_int_String, B_String_dynamic);
 
-  expect(true, C_dynamic_dynamic, B_Object_Object);
-  expect(true, C_dynamic_dynamic, B_num_num);
-  expect(true, C_dynamic_dynamic, B_int_num);
-  expect(true, C_dynamic_dynamic, B_dynamic_dynamic);
-  expect(true, C_dynamic_dynamic, B_String_dynamic);
+    expect(true, C_dynamic_dynamic, B_Object_Object);
+    expect(true, C_dynamic_dynamic, B_num_num);
+    expect(true, C_dynamic_dynamic, B_int_num);
+    expect(true, C_dynamic_dynamic, B_dynamic_dynamic);
+    expect(true, C_dynamic_dynamic, B_String_dynamic);
 
-  expect(false, C_int_String, A_int);
-  expect(true, C_int_String, A_String);
-  // TODO(johnniwinther): Inheritance with different type arguments is
-  // currently not supported by the implementation.
-  //expect(true, C_int_String, instantiate(A, [A_int]));
-  expect(false, C_int_String, instantiate(A, [A_String]));
+    expect(false, C_int_String, A_int);
+    expect(true, C_int_String, A_String);
+    // TODO(johnniwinther): Inheritance with different type arguments is
+    // currently not supported by the implementation.
+    //expect(true, C_int_String, instantiate(A, [A_int]));
+    expect(false, C_int_String, instantiate(A, [A_String]));
+  }));
 }
 
 void testCallableSubtype() {
-
-  var env = new TypeEnvironment(r"""
+  asyncTest(() => TypeEnvironment.create(r"""
       class U {}
       class V extends U {}
       class W extends V {}
@@ -239,31 +240,31 @@
         int m4(V v, U u);
         void m5(V v, int i);
       }
-      """);
+      """).then((env) {
+    void expect(bool value, DartType T, DartType S) {
+      Expect.equals(value, env.isSubtype(T, S), '$T <: $S');
+    }
 
-  void expect(bool value, DartType T, DartType S) {
-    Expect.equals(value, env.isSubtype(T, S), '$T <: $S');
-  }
+    ClassElement classA = env.getElement('A');
+    DartType A = classA.rawType;
+    DartType function = env['Function'];
+    DartType m1 = env.getMemberType(classA, 'm1');
+    DartType m2 = env.getMemberType(classA, 'm2');
+    DartType m3 = env.getMemberType(classA, 'm3');
+    DartType m4 = env.getMemberType(classA, 'm4');
+    DartType m5 = env.getMemberType(classA, 'm5');
 
-  ClassElement classA = env.getElement('A');
-  DartType A = classA.rawType;
-  DartType function = env['Function'];
-  DartType m1 = env.getMemberType(classA, 'm1');
-  DartType m2 = env.getMemberType(classA, 'm2');
-  DartType m3 = env.getMemberType(classA, 'm3');
-  DartType m4 = env.getMemberType(classA, 'm4');
-  DartType m5 = env.getMemberType(classA, 'm5');
-
-  expect(true, A, function);
-  expect(true, A, m1);
-  expect(true, A, m2);
-  expect(false, A, m3);
-  expect(false, A, m4);
-  expect(true, A, m5);
+    expect(true, A, function);
+    expect(true, A, m1);
+    expect(true, A, m2);
+    expect(false, A, m3);
+    expect(false, A, m4);
+    expect(true, A, m5);
+  }));
 }
 
 testFunctionSubtyping() {
-  var env = new TypeEnvironment(r"""
+  asyncTest(() => TypeEnvironment.create(r"""
       _() => null;
       void void_() {}
       void void_2() {}
@@ -280,12 +281,11 @@
       int int__int_int(int i1, int i2) => 0;
       void inline_void_(void f()) {}
       void inline_void__int(void f(int i)) {}
-      """);
-  functionSubtypingHelper(env);
+      """).then(functionSubtypingHelper));
 }
 
 testTypedefSubtyping() {
-  var env = new TypeEnvironment(r"""
+  asyncTest(() => TypeEnvironment.create(r"""
       typedef _();
       typedef void void_();
       typedef void void_2();
@@ -302,8 +302,7 @@
       typedef int int__int_int(int i1, int i2);
       typedef void inline_void_(void f());
       typedef void inline_void__int(void f(int i));
-      """);
-  functionSubtypingHelper(env);
+      """).then(functionSubtypingHelper));
 }
 
 functionSubtypingHelper(TypeEnvironment env) {
@@ -363,7 +362,7 @@
 }
 
 testFunctionSubtypingOptional() {
-  var env = new TypeEnvironment(r"""
+  asyncTest(() => TypeEnvironment.create(r"""
       void void_() {}
       void void__int(int i) {}
       void void___int([int i]) {}
@@ -376,12 +375,11 @@
       void void___int_int([int i1, int i2]) {}
       void void___int_int_int([int i1, int i2, int i3]);
       void void___Object_int([Object o, int i]) {}
-      """);
-  functionSubtypingOptionalHelper(env);
+      """).then(functionSubtypingOptionalHelper));
 }
 
 testTypedefSubtypingOptional() {
-  var env = new TypeEnvironment(r"""
+  asyncTest(() => TypeEnvironment.create(r"""
       typedef void void_();
       typedef void void__int(int i);
       typedef void void___int([int i]);
@@ -394,8 +392,7 @@
       typedef void void___int_int([int i1, int i2]);
       typedef void void___int_int_int([int i1, int i2, int i3]);
       typedef void void___Object_int([Object o, int i]);
-      """);
-  functionSubtypingOptionalHelper(env);
+      """).then(functionSubtypingOptionalHelper));
 }
 
 functionSubtypingOptionalHelper(TypeEnvironment env) {
@@ -443,7 +440,7 @@
 }
 
 testFunctionSubtypingNamed() {
-  var env = new TypeEnvironment(r"""
+  asyncTest(() => TypeEnvironment.create(r"""
       void void_() {}
       void void__int(int i) {}
       void void___a_int({int a}) {}
@@ -458,12 +455,11 @@
       void void___a_int_c_int({int a, int c}) {}
       void void___b_int_c_int({int b, int c}) {}
       void void___c_int({int c}) {}
-      """);
-  functionSubtypingNamedHelper(env);
+      """).then(functionSubtypingNamedHelper));
 }
 
 testTypedefSubtypingNamed() {
-  var env = new TypeEnvironment(r"""
+  asyncTest(() => TypeEnvironment.create(r"""
       typedef void void_();
       typedef void void__int(int i);
       typedef void void___a_int({int a});
@@ -478,8 +474,7 @@
       typedef void void___a_int_c_int({int a, int c});
       typedef void void___b_int_c_int({int b, int c});
       typedef void void___c_int({int c});
-      """);
-  functionSubtypingNamedHelper(env);
+      """).then(functionSubtypingNamedHelper));
 }
 
 functionSubtypingNamedHelper(TypeEnvironment env) {
@@ -521,7 +516,7 @@
 }
 
 void testTypeVariableSubtype() {
-  var env = new TypeEnvironment(r"""
+  asyncTest(() => TypeEnvironment.create(r"""
       class A<T> {}
       class B<T extends Object> {}
       class C<T extends num> {}
@@ -532,207 +527,207 @@
       class H<T extends S, S extends T> {}
       class I<T extends S, S extends U, U extends T> {}
       class J<T extends S, S extends U, U extends S> {}
-      """);
+      """).then((env) {
+    void expect(bool value, DartType T, DartType S) {
+      Expect.equals(value, env.isSubtype(T, S), '$T <: $S');
+    }
 
-  void expect(bool value, DartType T, DartType S) {
-    Expect.equals(value, env.isSubtype(T, S), '$T <: $S');
-  }
+    ClassElement A = env.getElement('A');
+    TypeVariableType A_T = A.thisType.typeArguments.head;
+    ClassElement B = env.getElement('B');
+    TypeVariableType B_T = B.thisType.typeArguments.head;
+    ClassElement C = env.getElement('C');
+    TypeVariableType C_T = C.thisType.typeArguments.head;
+    ClassElement D = env.getElement('D');
+    TypeVariableType D_T = D.thisType.typeArguments.head;
+    ClassElement E = env.getElement('E');
+    TypeVariableType E_T = E.thisType.typeArguments.head;
+    TypeVariableType E_S = E.thisType.typeArguments.tail.head;
+    ClassElement F = env.getElement('F');
+    TypeVariableType F_T = F.thisType.typeArguments.head;
+    TypeVariableType F_S = F.thisType.typeArguments.tail.head;
+    ClassElement G = env.getElement('G');
+    TypeVariableType G_T = G.thisType.typeArguments.head;
+    ClassElement H = env.getElement('H');
+    TypeVariableType H_T = H.thisType.typeArguments.head;
+    TypeVariableType H_S = H.thisType.typeArguments.tail.head;
+    ClassElement I = env.getElement('I');
+    TypeVariableType I_T = I.thisType.typeArguments.head;
+    TypeVariableType I_S = I.thisType.typeArguments.tail.head;
+    TypeVariableType I_U = I.thisType.typeArguments.tail.tail.head;
+    ClassElement J = env.getElement('J');
+    TypeVariableType J_T = J.thisType.typeArguments.head;
+    TypeVariableType J_S = J.thisType.typeArguments.tail.head;
+    TypeVariableType J_U = J.thisType.typeArguments.tail.tail.head;
 
-  ClassElement A = env.getElement('A');
-  TypeVariableType A_T = A.thisType.typeArguments.head;
-  ClassElement B = env.getElement('B');
-  TypeVariableType B_T = B.thisType.typeArguments.head;
-  ClassElement C = env.getElement('C');
-  TypeVariableType C_T = C.thisType.typeArguments.head;
-  ClassElement D = env.getElement('D');
-  TypeVariableType D_T = D.thisType.typeArguments.head;
-  ClassElement E = env.getElement('E');
-  TypeVariableType E_T = E.thisType.typeArguments.head;
-  TypeVariableType E_S = E.thisType.typeArguments.tail.head;
-  ClassElement F = env.getElement('F');
-  TypeVariableType F_T = F.thisType.typeArguments.head;
-  TypeVariableType F_S = F.thisType.typeArguments.tail.head;
-  ClassElement G = env.getElement('G');
-  TypeVariableType G_T = G.thisType.typeArguments.head;
-  ClassElement H = env.getElement('H');
-  TypeVariableType H_T = H.thisType.typeArguments.head;
-  TypeVariableType H_S = H.thisType.typeArguments.tail.head;
-  ClassElement I = env.getElement('I');
-  TypeVariableType I_T = I.thisType.typeArguments.head;
-  TypeVariableType I_S = I.thisType.typeArguments.tail.head;
-  TypeVariableType I_U = I.thisType.typeArguments.tail.tail.head;
-  ClassElement J = env.getElement('J');
-  TypeVariableType J_T = J.thisType.typeArguments.head;
-  TypeVariableType J_S = J.thisType.typeArguments.tail.head;
-  TypeVariableType J_U = J.thisType.typeArguments.tail.tail.head;
+    DartType Object_ = env['Object'];
+    DartType num_ = env['num'];
+    DartType int_ = env['int'];
+    DartType String_ = env['String'];
+    DartType dynamic_ = env['dynamic'];
 
-  DartType Object_ = env['Object'];
-  DartType num_ = env['num'];
-  DartType int_ = env['int'];
-  DartType String_ = env['String'];
-  DartType dynamic_ = env['dynamic'];
+    // class A<T> {}
+    expect(true, A_T, Object_);
+    expect(false, A_T, num_);
+    expect(false, A_T, int_);
+    expect(false, A_T, String_);
+    expect(true, A_T, dynamic_);
+    expect(true, A_T, A_T);
+    expect(false, A_T, B_T);
 
-  // class A<T> {}
-  expect(true, A_T, Object_);
-  expect(false, A_T, num_);
-  expect(false, A_T, int_);
-  expect(false, A_T, String_);
-  expect(true, A_T, dynamic_);
-  expect(true, A_T, A_T);
-  expect(false, A_T, B_T);
+    // class B<T extends Object> {}
+    expect(true, B_T, Object_);
+    expect(false, B_T, num_);
+    expect(false, B_T, int_);
+    expect(false, B_T, String_);
+    expect(true, B_T, dynamic_);
+    expect(true, B_T, B_T);
+    expect(false, B_T, A_T);
 
-  // class B<T extends Object> {}
-  expect(true, B_T, Object_);
-  expect(false, B_T, num_);
-  expect(false, B_T, int_);
-  expect(false, B_T, String_);
-  expect(true, B_T, dynamic_);
-  expect(true, B_T, B_T);
-  expect(false, B_T, A_T);
+    // class C<T extends num> {}
+    expect(true, C_T, Object_);
+    expect(true, C_T, num_);
+    expect(false, C_T, int_);
+    expect(false, C_T, String_);
+    expect(true, C_T, dynamic_);
+    expect(true, C_T, C_T);
+    expect(false, C_T, A_T);
 
-  // class C<T extends num> {}
-  expect(true, C_T, Object_);
-  expect(true, C_T, num_);
-  expect(false, C_T, int_);
-  expect(false, C_T, String_);
-  expect(true, C_T, dynamic_);
-  expect(true, C_T, C_T);
-  expect(false, C_T, A_T);
+    // class D<T extends int> {}
+    expect(true, D_T, Object_);
+    expect(true, D_T, num_);
+    expect(true, D_T, int_);
+    expect(false, D_T, String_);
+    expect(true, D_T, dynamic_);
+    expect(true, D_T, D_T);
+    expect(false, D_T, A_T);
 
-  // class D<T extends int> {}
-  expect(true, D_T, Object_);
-  expect(true, D_T, num_);
-  expect(true, D_T, int_);
-  expect(false, D_T, String_);
-  expect(true, D_T, dynamic_);
-  expect(true, D_T, D_T);
-  expect(false, D_T, A_T);
+    // class E<T extends S, S extends num> {}
+    expect(true, E_T, Object_);
+    expect(true, E_T, num_);
+    expect(false, E_T, int_);
+    expect(false, E_T, String_);
+    expect(true, E_T, dynamic_);
+    expect(true, E_T, E_T);
+    expect(true, E_T, E_S);
+    expect(false, E_T, A_T);
 
-  // class E<T extends S, S extends num> {}
-  expect(true, E_T, Object_);
-  expect(true, E_T, num_);
-  expect(false, E_T, int_);
-  expect(false, E_T, String_);
-  expect(true, E_T, dynamic_);
-  expect(true, E_T, E_T);
-  expect(true, E_T, E_S);
-  expect(false, E_T, A_T);
+    expect(true, E_S, Object_);
+    expect(true, E_S, num_);
+    expect(false, E_S, int_);
+    expect(false, E_S, String_);
+    expect(true, E_S, dynamic_);
+    expect(false, E_S, E_T);
+    expect(true, E_S, E_S);
+    expect(false, E_S, A_T);
 
-  expect(true, E_S, Object_);
-  expect(true, E_S, num_);
-  expect(false, E_S, int_);
-  expect(false, E_S, String_);
-  expect(true, E_S, dynamic_);
-  expect(false, E_S, E_T);
-  expect(true, E_S, E_S);
-  expect(false, E_S, A_T);
+    // class F<T extends num, S extends T> {}
+    expect(true, F_T, Object_);
+    expect(true, F_T, num_);
+    expect(false, F_T, int_);
+    expect(false, F_T, String_);
+    expect(true, F_T, dynamic_);
+    expect(false, F_T, F_S);
+    expect(true, F_T, F_T);
+    expect(false, F_T, A_T);
 
-  // class F<T extends num, S extends T> {}
-  expect(true, F_T, Object_);
-  expect(true, F_T, num_);
-  expect(false, F_T, int_);
-  expect(false, F_T, String_);
-  expect(true, F_T, dynamic_);
-  expect(false, F_T, F_S);
-  expect(true, F_T, F_T);
-  expect(false, F_T, A_T);
+    expect(true, F_S, Object_);
+    expect(true, F_S, num_);
+    expect(false, F_S, int_);
+    expect(false, F_S, String_);
+    expect(true, F_S, dynamic_);
+    expect(true, F_S, F_S);
+    expect(true, F_S, F_T);
+    expect(false, F_S, A_T);
 
-  expect(true, F_S, Object_);
-  expect(true, F_S, num_);
-  expect(false, F_S, int_);
-  expect(false, F_S, String_);
-  expect(true, F_S, dynamic_);
-  expect(true, F_S, F_S);
-  expect(true, F_S, F_T);
-  expect(false, F_S, A_T);
+    // class G<T extends T> {}
+    expect(true, G_T, Object_);
+    expect(false, G_T, num_);
+    expect(false, G_T, int_);
+    expect(false, G_T, String_);
+    expect(true, G_T, dynamic_);
+    expect(true, G_T, G_T);
+    expect(false, G_T, A_T);
 
-  // class G<T extends T> {}
-  expect(true, G_T, Object_);
-  expect(false, G_T, num_);
-  expect(false, G_T, int_);
-  expect(false, G_T, String_);
-  expect(true, G_T, dynamic_);
-  expect(true, G_T, G_T);
-  expect(false, G_T, A_T);
+    // class H<T extends S, S extends T> {}
+    expect(true, H_T, Object_);
+    expect(false, H_T, num_);
+    expect(false, H_T, int_);
+    expect(false, H_T, String_);
+    expect(true, H_T, dynamic_);
+    expect(true, H_T, H_T);
+    expect(true, H_T, H_S);
+    expect(false, H_T, A_T);
 
-  // class H<T extends S, S extends T> {}
-  expect(true, H_T, Object_);
-  expect(false, H_T, num_);
-  expect(false, H_T, int_);
-  expect(false, H_T, String_);
-  expect(true, H_T, dynamic_);
-  expect(true, H_T, H_T);
-  expect(true, H_T, H_S);
-  expect(false, H_T, A_T);
+    expect(true, H_S, Object_);
+    expect(false, H_S, num_);
+    expect(false, H_S, int_);
+    expect(false, H_S, String_);
+    expect(true, H_S, dynamic_);
+    expect(true, H_S, H_T);
+    expect(true, H_S, H_S);
+    expect(false, H_S, A_T);
 
-  expect(true, H_S, Object_);
-  expect(false, H_S, num_);
-  expect(false, H_S, int_);
-  expect(false, H_S, String_);
-  expect(true, H_S, dynamic_);
-  expect(true, H_S, H_T);
-  expect(true, H_S, H_S);
-  expect(false, H_S, A_T);
+    // class I<T extends S, S extends U, U extends T> {}
+    expect(true, I_T, Object_);
+    expect(false, I_T, num_);
+    expect(false, I_T, int_);
+    expect(false, I_T, String_);
+    expect(true, I_T, dynamic_);
+    expect(true, I_T, I_T);
+    expect(true, I_T, I_S);
+    expect(true, I_T, I_U);
+    expect(false, I_T, A_T);
 
-  // class I<T extends S, S extends U, U extends T> {}
-  expect(true, I_T, Object_);
-  expect(false, I_T, num_);
-  expect(false, I_T, int_);
-  expect(false, I_T, String_);
-  expect(true, I_T, dynamic_);
-  expect(true, I_T, I_T);
-  expect(true, I_T, I_S);
-  expect(true, I_T, I_U);
-  expect(false, I_T, A_T);
+    expect(true, I_S, Object_);
+    expect(false, I_S, num_);
+    expect(false, I_S, int_);
+    expect(false, I_S, String_);
+    expect(true, I_S, dynamic_);
+    expect(true, I_S, I_T);
+    expect(true, I_S, I_S);
+    expect(true, I_S, I_U);
+    expect(false, I_S, A_T);
 
-  expect(true, I_S, Object_);
-  expect(false, I_S, num_);
-  expect(false, I_S, int_);
-  expect(false, I_S, String_);
-  expect(true, I_S, dynamic_);
-  expect(true, I_S, I_T);
-  expect(true, I_S, I_S);
-  expect(true, I_S, I_U);
-  expect(false, I_S, A_T);
+    expect(true, I_U, Object_);
+    expect(false, I_U, num_);
+    expect(false, I_U, int_);
+    expect(false, I_U, String_);
+    expect(true, I_U, dynamic_);
+    expect(true, I_U, I_T);
+    expect(true, I_U, I_S);
+    expect(true, I_U, I_U);
+    expect(false, I_U, A_T);
 
-  expect(true, I_U, Object_);
-  expect(false, I_U, num_);
-  expect(false, I_U, int_);
-  expect(false, I_U, String_);
-  expect(true, I_U, dynamic_);
-  expect(true, I_U, I_T);
-  expect(true, I_U, I_S);
-  expect(true, I_U, I_U);
-  expect(false, I_U, A_T);
+    // class J<T extends S, S extends U, U extends S> {}
+    expect(true, J_T, Object_);
+    expect(false, J_T, num_);
+    expect(false, J_T, int_);
+    expect(false, J_T, String_);
+    expect(true, J_T, dynamic_);
+    expect(true, J_T, J_T);
+    expect(true, J_T, J_S);
+    expect(true, J_T, J_U);
+    expect(false, J_T, A_T);
 
-  // class J<T extends S, S extends U, U extends S> {}
-  expect(true, J_T, Object_);
-  expect(false, J_T, num_);
-  expect(false, J_T, int_);
-  expect(false, J_T, String_);
-  expect(true, J_T, dynamic_);
-  expect(true, J_T, J_T);
-  expect(true, J_T, J_S);
-  expect(true, J_T, J_U);
-  expect(false, J_T, A_T);
+    expect(true, J_S, Object_);
+    expect(false, J_S, num_);
+    expect(false, J_S, int_);
+    expect(false, J_S, String_);
+    expect(true, J_S, dynamic_);
+    expect(false, J_S, J_T);
+    expect(true, J_S, J_S);
+    expect(true, J_S, J_U);
+    expect(false, J_S, A_T);
 
-  expect(true, J_S, Object_);
-  expect(false, J_S, num_);
-  expect(false, J_S, int_);
-  expect(false, J_S, String_);
-  expect(true, J_S, dynamic_);
-  expect(false, J_S, J_T);
-  expect(true, J_S, J_S);
-  expect(true, J_S, J_U);
-  expect(false, J_S, A_T);
-
-  expect(true, J_U, Object_);
-  expect(false, J_U, num_);
-  expect(false, J_U, int_);
-  expect(false, J_U, String_);
-  expect(true, J_U, dynamic_);
-  expect(false, J_U, J_T);
-  expect(true, J_U, J_S);
-  expect(true, J_U, J_U);
-  expect(false, J_U, A_T);
+    expect(true, J_U, Object_);
+    expect(false, J_U, num_);
+    expect(false, J_U, int_);
+    expect(false, J_U, String_);
+    expect(true, J_U, dynamic_);
+    expect(false, J_U, J_T);
+    expect(true, J_U, J_S);
+    expect(true, J_U, J_U);
+    expect(false, J_U, A_T);
+  }));
 }
\ No newline at end of file
diff --git a/tests/compiler/dart2js/tag_mapping_test.dart b/tests/compiler/dart2js/tag_mapping_test.dart
index a669a20..3ae88f4 100644
--- a/tests/compiler/dart2js/tag_mapping_test.dart
+++ b/tests/compiler/dart2js/tag_mapping_test.dart
@@ -5,6 +5,7 @@
 // Test of import tag to library mapping.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 const MAIN_CODE = """
@@ -24,7 +25,7 @@
     'library.dart': LIB_CODE,
   };
 
-  compileSources(sources, (MockCompiler compiler) {
+  asyncTest(() => compileSources(sources, (MockCompiler compiler) {
     LibraryElement mainApp = compiler.libraries['source:/main.dart'];
     LibraryElement lib = compiler.libraries['source:/library.dart'];
     Expect.isNotNull(mainApp, 'Could not find main.dart library');
@@ -36,5 +37,5 @@
     // Test that we can get from the import tag in main.dart to the
     // library element representing library.dart.
     Expect.identical(lib, mainApp.getLibraryFromTag(tag));
-  });
+  }));
 }
diff --git a/tests/compiler/dart2js/tree_shaking_test.dart b/tests/compiler/dart2js/tree_shaking_test.dart
index 5158015..541956f 100644
--- a/tests/compiler/dart2js/tree_shaking_test.dart
+++ b/tests/compiler/dart2js/tree_shaking_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 const String TEST = r"""
@@ -25,8 +26,9 @@
 """;
 
 void main() {
-  String generated = compileAll(TEST);
-  Expect.isTrue(generated.contains('return 42'));
-  Expect.isTrue(generated.contains('return 54'));
-  Expect.isFalse(generated.contains('return 68'));
+  asyncTest(() => compileAll(TEST).then((generated) {
+    Expect.isTrue(generated.contains('return 42'));
+    Expect.isTrue(generated.contains('return 54'));
+    Expect.isFalse(generated.contains('return 68'));
+  }));
 }
diff --git a/tests/compiler/dart2js/type_checker_test.dart b/tests/compiler/dart2js/type_checker_test.dart
index e543480..95c0e0d 100644
--- a/tests/compiler/dart2js/type_checker_test.dart
+++ b/tests/compiler/dart2js/type_checker_test.dart
@@ -150,8 +150,8 @@
   analyze("switch (1.0) { case 1.0: break; case 1.5: break; }",
       [], []);
   analyze("switch (null) { case 1.0: break; case 2: break; }",
-      [MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE, 
-       MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE], 
+      [MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE,
+       MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE],
       [MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL]);
 }
 
@@ -1497,7 +1497,7 @@
   if (expectedWarnings == null) expectedWarnings = [];
   if (expectedWarnings is !List) expectedWarnings = [expectedWarnings];
 
-  compiler.diagnosticHandler = createHandler(text);
+  compiler.diagnosticHandler = createHandler(compiler, text);
 
   LibraryElement library = mockLibrary(compiler, text);
 
@@ -1536,29 +1536,13 @@
   compiler.diagnosticHandler = null;
 }
 
-api.DiagnosticHandler createHandler(String text) {
-  return (uri, int begin, int end, String message, kind) {
-    SourceFile sourceFile;
-    if (uri == null) {
-      sourceFile = new SourceFile('analysis', text);
-    } else {
-      sourceFile = compiler.sourceFiles[uri.toString()];
-    }
-    if (sourceFile != null) {
-      print(sourceFile.getLocationMessage(message, begin, end, true, (x) => x));
-    } else {
-      print(message);
-    }
-  };
-}
-
 analyze(String text, [expectedWarnings, expectedErrors]) {
   if (expectedWarnings == null) expectedWarnings = [];
   if (expectedWarnings is !List) expectedWarnings = [expectedWarnings];
   if (expectedErrors == null) expectedErrors = [];
   if (expectedErrors is !List) expectedErrors = [expectedErrors];
 
-  compiler.diagnosticHandler = createHandler(text);
+  compiler.diagnosticHandler = createHandler(compiler, text);
 
   Token tokens = scan(text);
   NodeListener listener = new NodeListener(compiler, null);
diff --git a/tests/compiler/dart2js/type_equals_test.dart b/tests/compiler/dart2js/type_equals_test.dart
index 2493d8c..4997583 100644
--- a/tests/compiler/dart2js/type_equals_test.dart
+++ b/tests/compiler/dart2js/type_equals_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart';
 import "compiler_helper.dart";
 import "parser_helper.dart";
@@ -87,30 +88,30 @@
       """,
       uri,
       analyzeAll: true, analyzeOnly: true);
-  compiler.runCompiler(uri);
+  asyncTest(() => compiler.runCompiler(uri).then((_) {
+    test(compiler, "void1", "void2", expect: true);
+    test(compiler, "int1", "int2", expect: true);
+    test(compiler, "String1", "String2", expect: true);
+    test(compiler, "ListInt1", "ListInt2", expect: true);
+    test(compiler, "ListString1", "ListString2", expect: true);
+    test(compiler, "MapIntString1", "MapIntString2", expect: true);
+    test(compiler, "TypeVar1", "TypeVar2", expect: true);
+    test(compiler, "Function1a", "Function2a", expect: true);
+    test(compiler, "Function1b", "Function2b", expect: true);
+    test(compiler, "Typedef1a", "Typedef2a", expect: true);
+    test(compiler, "Typedef1b", "Typedef2b", expect: true);
+    test(compiler, "Typedef1c", "Typedef2c", expect: true);
 
-  test(compiler, "void1", "void2", expect: true);
-  test(compiler, "int1", "int2", expect: true);
-  test(compiler, "String1", "String2", expect: true);
-  test(compiler, "ListInt1", "ListInt2", expect: true);
-  test(compiler, "ListString1", "ListString2", expect: true);
-  test(compiler, "MapIntString1", "MapIntString2", expect: true);
-  test(compiler, "TypeVar1", "TypeVar2", expect: true);
-  test(compiler, "Function1a", "Function2a", expect: true);
-  test(compiler, "Function1b", "Function2b", expect: true);
-  test(compiler, "Typedef1a", "Typedef2a", expect: true);
-  test(compiler, "Typedef1b", "Typedef2b", expect: true);
-  test(compiler, "Typedef1c", "Typedef2c", expect: true);
-
-  test(compiler, "void1", "int1", expect: false);
-  test(compiler, "int1", "String1", expect: false);
-  test(compiler, "String1", "ListInt1", expect: false);
-  test(compiler, "ListInt1", "ListString1", expect: false);
-  test(compiler, "ListString1", "MapIntString1", expect: false);
-  test(compiler, "MapIntString1", "TypeVar1", expect: false);
-  test(compiler, "TypeVar1", "Function1a", expect: false);
-  test(compiler, "Function1a", "Function1b", expect: false);
-  test(compiler, "Function1b", "Typedef1a", expect: false);
-  test(compiler, "Typedef1a", "Typedef1b", expect: false);
-  test(compiler, "Typedef1b", "Typedef1c", expect: false);
+    test(compiler, "void1", "int1", expect: false);
+    test(compiler, "int1", "String1", expect: false);
+    test(compiler, "String1", "ListInt1", expect: false);
+    test(compiler, "ListInt1", "ListString1", expect: false);
+    test(compiler, "ListString1", "MapIntString1", expect: false);
+    test(compiler, "MapIntString1", "TypeVar1", expect: false);
+    test(compiler, "TypeVar1", "Function1a", expect: false);
+    test(compiler, "Function1a", "Function1b", expect: false);
+    test(compiler, "Function1b", "Typedef1a", expect: false);
+    test(compiler, "Typedef1a", "Typedef1b", expect: false);
+    test(compiler, "Typedef1b", "Typedef1c", expect: false);
+  }));
 }
diff --git a/tests/compiler/dart2js/type_order_test.dart b/tests/compiler/dart2js/type_order_test.dart
new file mode 100644
index 0000000..eb6a7c5
--- /dev/null
+++ b/tests/compiler/dart2js/type_order_test.dart
@@ -0,0 +1,72 @@
+// Copyright (c) 2013, 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 subtype_test;

+

+import 'package:expect/expect.dart';

+import 'package:async_helper/async_helper.dart';

+import 'type_test_helper.dart';

+import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart';

+import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart"

+       show Element, ClassElement, TypedefElement;

+

+void main() {

+  asyncTest(() => TypeEnvironment.create(r"""

+      class A<AT, AS> {}

+      typedef BS B<BT, BS>(BT t);

+      class C<CT, CS> extends A<CS, CT> {}

+      class X {}

+      class Y {}

+      class Z {}

+      """).then((env) {

+

+    List types = [];

+    DartType add(DartType type) {

+      types.add(type);

+      return type;

+    }

+

+    DartType dynamic_ = add(env['dynamic']);

+    DartType void_ = add(env['void']);

+

+    ClassElement A = env.getElement('A');

+    TypedefElement B = env.getElement('B');

+    ClassElement C = env.getElement('C');

+    DartType X = add(env['X']);

+    DartType Y = add(env['Y']);

+    DartType Z = add(env['Z']);

+

+    InterfaceType A_this = add(A.thisType);

+    InterfaceType A_raw = add(A.rawType);

+    TypeVariableType AT = add(A_this.typeArguments.head);

+    TypeVariableType AS = add(A_this.typeArguments.tail.head);

+    InterfaceType A_X_Y = add(instantiate(A, [X, Y]));

+    InterfaceType A_Y_X = add(instantiate(A, [Y, X]));

+

+    TypedefType B_this = add(B.computeType(env.compiler));

+    TypedefType B_raw = add(B.rawType);

+    TypeVariableType BT = add(B_this.typeArguments.head);

+    TypeVariableType BS = add(B_this.typeArguments.tail.head);

+    FunctionType B_this_alias = add(B.alias);

+    TypedefType B_X_Y = add(instantiate(B, [X, Y]));

+    FunctionType B_X_Y_alias = add(B_X_Y.unalias(env.compiler));

+    TypedefType B_Y_X = add(instantiate(B, [Y, X]));

+    FunctionType B_Y_X_alias = add(B_Y_X.unalias(env.compiler));

+

+    InterfaceType C_this = add(C.thisType);

+    InterfaceType C_raw = add(C.rawType);

+    TypeVariableType CT = add(C_this.typeArguments.head);

+    TypeVariableType CS = add(C_this.typeArguments.tail.head);

+

+    Expect.listEquals(

+        [void_, dynamic_,

+         A_raw, A_this, A_X_Y, A_Y_X, AT, AS,

+         B_raw, B_this, B_X_Y, B_Y_X, BT, BS,

+         C_raw, C_this, CT, CS,

+         X, Y, Z,

+         B_this_alias, B_Y_X_alias, B_X_Y_alias,

+        ],

+        Types.sorted(types));

+  }));

+}
\ No newline at end of file
diff --git a/tests/compiler/dart2js/type_representation_test.dart b/tests/compiler/dart2js/type_representation_test.dart
index 8c651f6..5e6b7c5 100644
--- a/tests/compiler/dart2js/type_representation_test.dart
+++ b/tests/compiler/dart2js/type_representation_test.dart
@@ -5,6 +5,7 @@
 library subtype_test;
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'type_test_helper.dart';
 import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart';
 import '../../../sdk/lib/_internal/compiler/implementation/js/js.dart';
@@ -18,7 +19,7 @@
 }
 
 void testTypeRepresentations() {
-  var env = new TypeEnvironment(r"""
+  asyncTest(() => TypeEnvironment.create(r"""
       typedef void Typedef();
 
       void m1() {}
@@ -31,133 +32,133 @@
       m8(int a, {String b}) {}
       m9(int a, String b, {List<int> c, d}) {}
       m10(void f(int a, [b])) {}
-      """);
+      """).then((env) {
+    TypeRepresentationGenerator typeRepresentation =
+        new TypeRepresentationGenerator(env.compiler);
 
-  TypeRepresentationGenerator typeRepresentation =
-      new TypeRepresentationGenerator(env.compiler);
+    Expression onVariable(TypeVariableType variable) {
+      return new VariableUse(variable.name.slowToString());
+    }
 
-  Expression onVariable(TypeVariableType variable) {
-    return new VariableUse(variable.name.slowToString());
-  }
+    String stringify(Expression expression) {
+      return prettyPrint(expression, env.compiler).buffer.toString();
+    }
 
-  String stringify(Expression expression) {
-    return prettyPrint(expression, env.compiler).buffer.toString();
-  }
+    void expect(String expectedRepresentation, DartType type) {
+      Expression expression =
+          typeRepresentation.getTypeRepresentation(type, onVariable);
+      Expect.stringEquals(expectedRepresentation, stringify(expression));
+    }
 
-  void expect(String expectedRepresentation, DartType type) {
-    Expression expression =
-        typeRepresentation.getTypeRepresentation(type, onVariable);
-    Expect.stringEquals(expectedRepresentation, stringify(expression));
-  }
+    String getJsName(ClassElement cls) {
+      Expression name = typeRepresentation.getJavaScriptClassName(cls);
+      return stringify(name);
+    }
 
-  String getJsName(ClassElement cls) {
-    Expression name = typeRepresentation.getJavaScriptClassName(cls);
-    return stringify(name);
-  }
+    JavaScriptBackend backend = env.compiler.backend;
+    String func = backend.namer.functionTypeTag();
+    String retvoid = backend.namer.functionTypeVoidReturnTag();
+    String ret = backend.namer.functionTypeReturnTypeTag();
+    String args = backend.namer.functionTypeRequiredParametersTag();
+    String opt = backend.namer.functionTypeOptionalParametersTag();
+    String named = backend.namer.functionTypeNamedParametersTag();
 
-  JavaScriptBackend backend = env.compiler.backend;
-  String func = backend.namer.functionTypeTag();
-  String retvoid = backend.namer.functionTypeVoidReturnTag();
-  String ret = backend.namer.functionTypeReturnTypeTag();
-  String args = backend.namer.functionTypeRequiredParametersTag();
-  String opt = backend.namer.functionTypeOptionalParametersTag();
-  String named = backend.namer.functionTypeNamedParametersTag();
+    ClassElement List_ = env.getElement('List');
+    TypeVariableType List_E = List_.typeVariables.head;
+    ClassElement Map_ = env.getElement('Map');
+    TypeVariableType Map_K = Map_.typeVariables.head;
+    TypeVariableType Map_V = Map_.typeVariables.tail.head;
 
-  ClassElement List_ = env.getElement('List');
-  TypeVariableType List_E = List_.typeVariables.head;
-  ClassElement Map_ = env.getElement('Map');
-  TypeVariableType Map_K = Map_.typeVariables.head;
-  TypeVariableType Map_V = Map_.typeVariables.tail.head;
+    DartType Object_ = env['Object'];
+    DartType int_ = env['int'];
+    DartType String_ = env['String'];
+    DartType dynamic_ = env['dynamic'];
+    DartType Typedef_ = env['Typedef'];
 
-  DartType Object_ = env['Object'];
-  DartType int_ = env['int'];
-  DartType String_ = env['String'];
-  DartType dynamic_ = env['dynamic'];
-  DartType Typedef_ = env['Typedef'];
+    String List_rep = getJsName(List_);
+    String List_E_rep = stringify(onVariable(List_E));
+    String Map_rep = getJsName(Map_);
+    String Map_K_rep = stringify(onVariable(Map_K));
+    String Map_V_rep = stringify(onVariable(Map_V));
 
-  String List_rep = getJsName(List_);
-  String List_E_rep = stringify(onVariable(List_E));
-  String Map_rep = getJsName(Map_);
-  String Map_K_rep = stringify(onVariable(Map_K));
-  String Map_V_rep = stringify(onVariable(Map_V));
+    String Object_rep = getJsName(Object_.element);
+    String int_rep = getJsName(int_.element);
+    String String_rep = getJsName(String_.element);
 
-  String Object_rep = getJsName(Object_.element);
-  String int_rep = getJsName(int_.element);
-  String String_rep = getJsName(String_.element);
+    expect('$int_rep', int_);
+    expect('$String_rep', String_);
+    expect('null', dynamic_);
 
-  expect('$int_rep', int_);
-  expect('$String_rep', String_);
-  expect('null', dynamic_);
+    // List<E>
+    expect('[$List_rep, $List_E_rep]', List_.computeType(env.compiler));
+    // List
+    expect('$List_rep', List_.rawType);
+    // List<dynamic>
+    expect('[$List_rep, null]', instantiate(List_, [dynamic_]));
+    // List<int>
+    expect('[$List_rep, $int_rep]', instantiate(List_, [int_]));
+    // List<Typedef>
+    expect('[$List_rep, {$func: "void_", $retvoid: true}]',
+        instantiate(List_, [Typedef_]));
 
-  // List<E>
-  expect('[$List_rep, $List_E_rep]', List_.computeType(env.compiler));
-  // List
-  expect('$List_rep', List_.rawType);
-  // List<dynamic>
-  expect('[$List_rep, null]', instantiate(List_, [dynamic_]));
-  // List<int>
-  expect('[$List_rep, $int_rep]', instantiate(List_, [int_]));
-  // List<Typedef>
-  expect('[$List_rep, {$func: "void_", $retvoid: true}]',
-      instantiate(List_, [Typedef_]));
+    // Map<K,V>
+    expect('[$Map_rep, $Map_K_rep, $Map_V_rep]', Map_.computeType(env.compiler));
+    // Map
+    expect('$Map_rep', Map_.rawType);
+    // Map<dynamic,dynamic>
+    expect('[$Map_rep, null, null]', instantiate(Map_, [dynamic_, dynamic_]));
+    // Map<int,String>
+    expect('[$Map_rep, $int_rep, $String_rep]',
+        instantiate(Map_, [int_, String_]));
 
-  // Map<K,V>
-  expect('[$Map_rep, $Map_K_rep, $Map_V_rep]', Map_.computeType(env.compiler));
-  // Map
-  expect('$Map_rep', Map_.rawType);
-  // Map<dynamic,dynamic>
-  expect('[$Map_rep, null, null]', instantiate(Map_, [dynamic_, dynamic_]));
-  // Map<int,String>
-  expect('[$Map_rep, $int_rep, $String_rep]',
-      instantiate(Map_, [int_, String_]));
+    // void m1() {}
+    expect('{$func: "void_", $retvoid: true}',
+        env.getElement('m1').computeType(env.compiler));
 
-  // void m1() {}
-  expect('{$func: "void_", $retvoid: true}',
-      env.getElement('m1').computeType(env.compiler));
+    // int m2() => 0;
+    expect('{$func: "int_", $ret: $int_rep}',
+        env.getElement('m2').computeType(env.compiler));
 
-  // int m2() => 0;
-  expect('{$func: "int_", $ret: $int_rep}',
-      env.getElement('m2').computeType(env.compiler));
+    // List<int> m3() => null;
+    expect('{$func: "List_", $ret: [$List_rep, $int_rep]}',
+        env.getElement('m3').computeType(env.compiler));
 
-  // List<int> m3() => null;
-  expect('{$func: "List_", $ret: [$List_rep, $int_rep]}',
-      env.getElement('m3').computeType(env.compiler));
+    // m4() {}
+    expect('{$func: "args0"}',
+        env.getElement('m4').computeType(env.compiler));
 
-  // m4() {}
-  expect('{$func: "args0"}',
-      env.getElement('m4').computeType(env.compiler));
+    // m5(int a, String b) {}
+    expect('{$func: "dynamic__int_String", $args: [$int_rep, $String_rep]}',
+        env.getElement('m5').computeType(env.compiler));
 
-  // m5(int a, String b) {}
-  expect('{$func: "dynamic__int_String", $args: [$int_rep, $String_rep]}',
-      env.getElement('m5').computeType(env.compiler));
+    // m6(int a, [String b]) {}
+    expect('{$func: "dynamic__int__String", $args: [$int_rep],'
+           ' $opt: [$String_rep]}',
+        env.getElement('m6').computeType(env.compiler));
 
-  // m6(int a, [String b]) {}
-  expect('{$func: "dynamic__int__String", $args: [$int_rep],'
-         ' $opt: [$String_rep]}',
-      env.getElement('m6').computeType(env.compiler));
+    // m7(int a, String b, [List<int> c, d]) {}
+    expect('{$func: "dynamic__int_String__List_dynamic",'
+           ' $args: [$int_rep, $String_rep],'
+           ' $opt: [[$List_rep, $int_rep], null]}',
+        env.getElement('m7').computeType(env.compiler));
 
-  // m7(int a, String b, [List<int> c, d]) {}
-  expect('{$func: "dynamic__int_String__List_dynamic",'
-         ' $args: [$int_rep, $String_rep],'
-         ' $opt: [[$List_rep, $int_rep], null]}',
-      env.getElement('m7').computeType(env.compiler));
+    // m8(int a, {String b}) {}
+    expect('{$func: "dynamic__int__String0",'
+           ' $args: [$int_rep], $named: {b: $String_rep}}',
+        env.getElement('m8').computeType(env.compiler));
 
-  // m8(int a, {String b}) {}
-  expect('{$func: "dynamic__int__String0",'
-         ' $args: [$int_rep], $named: {b: $String_rep}}',
-      env.getElement('m8').computeType(env.compiler));
+    // m9(int a, String b, {List<int> c, d}) {}
+    expect('{$func: "dynamic__int_String__List_dynamic0",'
+           ' $args: [$int_rep, $String_rep],'
+           ' $named: {c: [$List_rep, $int_rep], d: null}}',
+        env.getElement('m9').computeType(env.compiler));
 
-  // m9(int a, String b, {List<int> c, d}) {}
-  expect('{$func: "dynamic__int_String__List_dynamic0",'
-         ' $args: [$int_rep, $String_rep],'
-         ' $named: {c: [$List_rep, $int_rep], d: null}}',
-      env.getElement('m9').computeType(env.compiler));
-
-  // m10(void f(int a, [b])) {}
-  expect('{$func: "dynamic__void__int__dynamic", $args:'
-         ' [{$func: "void__int__dynamic",'
-         ' $retvoid: true, $args: [$int_rep], $opt: [null]}]}',
-      env.getElement('m10').computeType(env.compiler));
+    // m10(void f(int a, [b])) {}
+    expect('{$func: "dynamic__void__int__dynamic", $args:'
+           ' [{$func: "void__int__dynamic",'
+           ' $retvoid: true, $args: [$int_rep], $opt: [null]}]}',
+        env.getElement('m10').computeType(env.compiler));
+  }));
 }
 
 
diff --git a/tests/compiler/dart2js/type_substitution_test.dart b/tests/compiler/dart2js/type_substitution_test.dart
index 7f2d9df..483e506 100644
--- a/tests/compiler/dart2js/type_substitution_test.dart
+++ b/tests/compiler/dart2js/type_substitution_test.dart
@@ -5,6 +5,7 @@
 library type_substitution_test;
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart';
 import "compiler_helper.dart";
 import "parser_helper.dart";
@@ -48,43 +49,46 @@
 }
 
 void testAsInstanceOf() {
-  var env = new TypeEnvironment('''
+  asyncTest(() => TypeEnvironment.create('''
       class A<T> {}
       class B<T> {}
       class C<T> extends A<T> {}
       class D<T> extends A<int> {}
       class E<T> extends A<A<T>> {}
-      class F<T, U> extends B<F<T, String>> implements A<F<B<U>, int>> {}''');
-  var compiler = env.compiler;
+      class F<T, U> extends B<F<T, String>> implements A<F<B<U>, int>> {}
+      ''').then((env) {
+    var compiler = env.compiler;
 
-  ClassElement A = env.getElement("A");
-  ClassElement B = env.getElement("B");
-  ClassElement C = env.getElement("C");
-  ClassElement D = env.getElement("D");
-  ClassElement E = env.getElement("E");
-  ClassElement F = env.getElement("F");
+    ClassElement A = env.getElement("A");
+    ClassElement B = env.getElement("B");
+    ClassElement C = env.getElement("C");
+    ClassElement D = env.getElement("D");
+    ClassElement E = env.getElement("E");
+    ClassElement F = env.getElement("F");
 
-  DartType numType = env['num'];
-  DartType intType = env['int'];
-  DartType stringType = env['String'];
+    DartType numType = env['num'];
+    DartType intType = env['int'];
+    DartType stringType = env['String'];
 
-  InterfaceType C_int = instantiate(C, [intType]);
-  Expect.equals(instantiate(C, [intType]), C_int);
-  Expect.equals(instantiate(A, [intType]), C_int.asInstanceOf(A));
+    InterfaceType C_int = instantiate(C, [intType]);
+    Expect.equals(instantiate(C, [intType]), C_int);
+    Expect.equals(instantiate(A, [intType]), C_int.asInstanceOf(A));
 
-  InterfaceType D_int = instantiate(D, [stringType]);
-  Expect.equals(instantiate(A, [intType]), D_int.asInstanceOf(A));
+    InterfaceType D_int = instantiate(D, [stringType]);
+    Expect.equals(instantiate(A, [intType]), D_int.asInstanceOf(A));
 
-  InterfaceType E_int = instantiate(E, [intType]);
-  Expect.equals(instantiate(A, [instantiate(A, [intType])]),
-                E_int.asInstanceOf(A));
+    InterfaceType E_int = instantiate(E, [intType]);
+    Expect.equals(instantiate(A, [instantiate(A, [intType])]),
+                  E_int.asInstanceOf(A));
 
-  InterfaceType F_int_string = instantiate(F, [intType, stringType]);
-  Expect.equals(instantiate(B, [instantiate(F, [intType, stringType])]),
-                F_int_string.asInstanceOf(B));
-  Expect.equals(instantiate(A, [instantiate(F, [instantiate(B, [stringType]),
-						intType])]),
-                F_int_string.asInstanceOf(A));
+    InterfaceType F_int_string = instantiate(F, [intType, stringType]);
+    Expect.equals(instantiate(B, [instantiate(F, [intType, stringType])]),
+                  F_int_string.asInstanceOf(B));
+    Expect.equals(instantiate(A, [instantiate(F, [instantiate(B, [stringType]),
+                  intType])]),
+                  F_int_string.asInstanceOf(A));
+
+  }));
 }
 
 /**
@@ -101,7 +105,7 @@
 }
 
 void testTypeSubstitution() {
-  var env = new TypeEnvironment(r"""
+  asyncTest(() => TypeEnvironment.create(r"""
       typedef void Typedef1<X,Y>(X x1, Y y2);
       typedef void Typedef2<Z>(Z z1);
 
@@ -153,78 +157,79 @@
         void Typedef1e(Typedef2<S> a) {}
         void Typedef2e(Typedef2<String> b) {}
       }
-      """);
-  var compiler = env.compiler;
+      """).then((env) {
+    var compiler = env.compiler;
 
-  InterfaceType Class_T_S = env["Class"];
-  Expect.isNotNull(Class_T_S);
-  Expect.identical(Class_T_S.kind, TypeKind.INTERFACE);
-  Expect.equals(2, length(Class_T_S.typeArguments));
+    InterfaceType Class_T_S = env["Class"];
+    Expect.isNotNull(Class_T_S);
+    Expect.identical(Class_T_S.kind, TypeKind.INTERFACE);
+    Expect.equals(2, length(Class_T_S.typeArguments));
 
-  DartType T = Class_T_S.typeArguments.head;
-  Expect.isNotNull(T);
-  Expect.identical(T.kind, TypeKind.TYPE_VARIABLE);
+    DartType T = Class_T_S.typeArguments.head;
+    Expect.isNotNull(T);
+    Expect.identical(T.kind, TypeKind.TYPE_VARIABLE);
 
-  DartType S = Class_T_S.typeArguments.tail.head;
-  Expect.isNotNull(S);
-  Expect.identical(S.kind, TypeKind.TYPE_VARIABLE);
+    DartType S = Class_T_S.typeArguments.tail.head;
+    Expect.isNotNull(S);
+    Expect.identical(S.kind, TypeKind.TYPE_VARIABLE);
 
-  DartType intType = env['int'];//getType(compiler, "int1");
-  Expect.isNotNull(intType);
-  Expect.identical(intType.kind, TypeKind.INTERFACE);
+    DartType intType = env['int'];//getType(compiler, "int1");
+    Expect.isNotNull(intType);
+    Expect.identical(intType.kind, TypeKind.INTERFACE);
 
-  DartType StringType = env['String'];//getType(compiler, "String1");
-  Expect.isNotNull(StringType);
-  Expect.identical(StringType.kind, TypeKind.INTERFACE);
+    DartType StringType = env['String'];//getType(compiler, "String1");
+    Expect.isNotNull(StringType);
+    Expect.identical(StringType.kind, TypeKind.INTERFACE);
 
-  var parameters = new Link<DartType>.fromList(<DartType>[T, S]);
-  var arguments = new Link<DartType>.fromList(<DartType>[intType, StringType]);
+    var parameters = new Link<DartType>.fromList(<DartType>[T, S]);
+    var arguments = new Link<DartType>.fromList(<DartType>[intType, StringType]);
 
-  // TODO(johnniwinther): Create types directly from strings to improve test
-  // readability.
+    // TODO(johnniwinther): Create types directly from strings to improve test
+    // readability.
 
-  testSubstitution(compiler, arguments, parameters, "void1", "void2");
-  testSubstitution(compiler, arguments, parameters, "dynamic1", "dynamic2");
-  testSubstitution(compiler, arguments, parameters, "int1", "int2");
-  testSubstitution(compiler, arguments, parameters, "String1", "String2");
-  testSubstitution(compiler, arguments, parameters, "ListInt1", "ListInt2");
-  testSubstitution(compiler, arguments, parameters, "ListT1", "ListT2");
-  testSubstitution(compiler, arguments, parameters, "ListS1", "ListS2");
-  testSubstitution(compiler, arguments, parameters, "ListListT1", "ListListT2");
-  testSubstitution(compiler, arguments, parameters, "ListRaw1", "ListRaw2");
-  testSubstitution(compiler, arguments, parameters,
-                    "ListDynamic1", "ListDynamic2");
-  testSubstitution(compiler, arguments, parameters,
-                   "MapIntString1", "MapIntString2");
-  testSubstitution(compiler, arguments, parameters,
-                   "MapTString1", "MapTString2");
-  testSubstitution(compiler, arguments, parameters,
-                   "MapDynamicString1", "MapDynamicString2");
-  testSubstitution(compiler, arguments, parameters, "TypeVarT1", "TypeVarT2");
-  testSubstitution(compiler, arguments, parameters, "TypeVarS1", "TypeVarS2");
-  testSubstitution(compiler, arguments, parameters, "Function1a", "Function2a");
-  testSubstitution(compiler, arguments, parameters, "Function1b", "Function2b");
-  testSubstitution(compiler, arguments, parameters, "Function1c", "Function2c");
-  testSubstitution(compiler, arguments, parameters, "Typedef1a", "Typedef2a");
-  testSubstitution(compiler, arguments, parameters, "Typedef1b", "Typedef2b");
-  testSubstitution(compiler, arguments, parameters, "Typedef1c", "Typedef2c");
-  testSubstitution(compiler, arguments, parameters, "Typedef1d", "Typedef2d");
-  testSubstitution(compiler, arguments, parameters, "Typedef1e", "Typedef2e");
+    testSubstitution(compiler, arguments, parameters, "void1", "void2");
+    testSubstitution(compiler, arguments, parameters, "dynamic1", "dynamic2");
+    testSubstitution(compiler, arguments, parameters, "int1", "int2");
+    testSubstitution(compiler, arguments, parameters, "String1", "String2");
+    testSubstitution(compiler, arguments, parameters, "ListInt1", "ListInt2");
+    testSubstitution(compiler, arguments, parameters, "ListT1", "ListT2");
+    testSubstitution(compiler, arguments, parameters, "ListS1", "ListS2");
+    testSubstitution(compiler, arguments, parameters, "ListListT1", "ListListT2");
+    testSubstitution(compiler, arguments, parameters, "ListRaw1", "ListRaw2");
+    testSubstitution(compiler, arguments, parameters,
+                      "ListDynamic1", "ListDynamic2");
+    testSubstitution(compiler, arguments, parameters,
+                     "MapIntString1", "MapIntString2");
+    testSubstitution(compiler, arguments, parameters,
+                     "MapTString1", "MapTString2");
+    testSubstitution(compiler, arguments, parameters,
+                     "MapDynamicString1", "MapDynamicString2");
+    testSubstitution(compiler, arguments, parameters, "TypeVarT1", "TypeVarT2");
+    testSubstitution(compiler, arguments, parameters, "TypeVarS1", "TypeVarS2");
+    testSubstitution(compiler, arguments, parameters, "Function1a", "Function2a");
+    testSubstitution(compiler, arguments, parameters, "Function1b", "Function2b");
+    testSubstitution(compiler, arguments, parameters, "Function1c", "Function2c");
+    testSubstitution(compiler, arguments, parameters, "Typedef1a", "Typedef2a");
+    testSubstitution(compiler, arguments, parameters, "Typedef1b", "Typedef2b");
+    testSubstitution(compiler, arguments, parameters, "Typedef1c", "Typedef2c");
+    testSubstitution(compiler, arguments, parameters, "Typedef1d", "Typedef2d");
+    testSubstitution(compiler, arguments, parameters, "Typedef1e", "Typedef2e");
 
-  // Substitution in unalias.
-  DartType Typedef2_int_String = getType(compiler, "Typedef2a");
-  Expect.isNotNull(Typedef2_int_String);
-  DartType Function_int_String = getType(compiler, "Function2b");
-  Expect.isNotNull(Function_int_String);
-  DartType unalias1 = Typedef2_int_String.unalias(compiler);
-  Expect.equals(Function_int_String, unalias1,
-      '$Typedef2_int_String.unalias=$unalias1 != $Function_int_String');
+    // Substitution in unalias.
+    DartType Typedef2_int_String = getType(compiler, "Typedef2a");
+    Expect.isNotNull(Typedef2_int_String);
+    DartType Function_int_String = getType(compiler, "Function2b");
+    Expect.isNotNull(Function_int_String);
+    DartType unalias1 = Typedef2_int_String.unalias(compiler);
+    Expect.equals(Function_int_String, unalias1,
+        '$Typedef2_int_String.unalias=$unalias1 != $Function_int_String');
 
-  DartType Typedef1 = getType(compiler, "Typedef1c");
-  Expect.isNotNull(Typedef1);
-  DartType Function_dynamic_dynamic = getType(compiler, "Function1c");
-  Expect.isNotNull(Function_dynamic_dynamic);
-  DartType unalias2 = Typedef1.unalias(compiler);
-  Expect.equals(Function_dynamic_dynamic, unalias2,
-      '$Typedef1.unalias=$unalias2 != $Function_dynamic_dynamic');
+    DartType Typedef1 = getType(compiler, "Typedef1c");
+    Expect.isNotNull(Typedef1);
+    DartType Function_dynamic_dynamic = getType(compiler, "Function1c");
+    Expect.isNotNull(Function_dynamic_dynamic);
+    DartType unalias2 = Typedef1.unalias(compiler);
+    Expect.equals(Function_dynamic_dynamic, unalias2,
+        '$Typedef1.unalias=$unalias2 != $Function_dynamic_dynamic');
+  }));
 }
diff --git a/tests/compiler/dart2js/type_test_helper.dart b/tests/compiler/dart2js/type_test_helper.dart
index db1a43f..86d66fb 100644
--- a/tests/compiler/dart2js/type_test_helper.dart
+++ b/tests/compiler/dart2js/type_test_helper.dart
@@ -4,6 +4,7 @@
 
 library type_test_helper;
 
+import 'dart:async';
 import "package:expect/expect.dart";
 import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart';
 import "parser_helper.dart" show SourceString;
@@ -22,7 +23,7 @@
 class TypeEnvironment {
   final MockCompiler compiler;
 
-  factory TypeEnvironment(String source) {
+  static Future<TypeEnvironment> create(String source) {
     var uri = new Uri(scheme: 'source');
     MockCompiler compiler = compilerFor('''
         main() {}
@@ -30,8 +31,9 @@
         uri,
         analyzeAll: true,
         analyzeOnly: true);
-    compiler.runCompiler(uri);
-    return new TypeEnvironment._(compiler);
+    return compiler.runCompiler(uri).then((_) {
+      return new TypeEnvironment._(compiler);
+    });
   }
 
   TypeEnvironment._(MockCompiler this.compiler);
@@ -53,6 +55,7 @@
 
   DartType operator[] (String name) {
     if (name == 'dynamic') return compiler.types.dynamicType;
+    if (name == 'void') return compiler.types.voidType;
     return getElementType(name);
   }
 
diff --git a/tests/compiler/dart2js/type_variable_bound_test.dart b/tests/compiler/dart2js/type_variable_bound_test.dart
index 01761c4..5c9b720 100644
--- a/tests/compiler/dart2js/type_variable_bound_test.dart
+++ b/tests/compiler/dart2js/type_variable_bound_test.dart
@@ -2,110 +2,113 @@
 // 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 'dart:async';
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 import "package:expect/expect.dart";
 
-compile(String source) {
+Future compile(String source) {
   Uri uri = Uri.parse('test:code');
   var compiler = compilerFor(source, uri);
-  compiler.runCompiler(uri);
-  return compiler;
+  return compiler.runCompiler(uri).then((_) {
+    return compiler;
+  });
 }
 
 test1() {
-  var compiler = compile(r"""
+  asyncTest(() => compile(r"""
 class A<T extends T> {}
 
 void main() {
   new A();
 }
-""");
+""").then((compiler) {
+    Expect.isFalse(compiler.compilationFailed);
+    Expect.isTrue(compiler.errors.isEmpty,
+                  'unexpected errors: ${compiler.errors}');
+    Expect.equals(1, compiler.warnings.length,
+                  'expected exactly one warning, but got ${compiler.warnings}');
 
-  Expect.isFalse(compiler.compilationFailed);
-  Expect.isTrue(compiler.errors.isEmpty,
-                'unexpected errors: ${compiler.errors}');
-  Expect.equals(1, compiler.warnings.length,
-                'expected exactly one warning, but got ${compiler.warnings}');
-
-  Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
-                compiler.warnings[0].message.kind);
-  Expect.equals("T", compiler.warnings[0].node.toString());
+    Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
+                  compiler.warnings[0].message.kind);
+    Expect.equals("T", compiler.warnings[0].node.toString());
+  }));
 }
 
 test2() {
-  var compiler = compile(r"""
+  asyncTest(() => compile(r"""
 class B<T extends S, S extends T> {}
 
 void main() {
   new B();
 }
-""");
+""").then((compiler) {
+    Expect.isFalse(compiler.compilationFailed);
+    print(compiler.errors);
+    Expect.isTrue(compiler.errors.isEmpty, 'unexpected errors');
+    Expect.equals(2, compiler.warnings.length,
+                  'expected exactly one error, but got ${compiler.warnings}');
 
-  Expect.isFalse(compiler.compilationFailed);
-  print(compiler.errors);
-  Expect.isTrue(compiler.errors.isEmpty, 'unexpected errors');
-  Expect.equals(2, compiler.warnings.length,
-                'expected exactly one error, but got ${compiler.warnings}');
+    Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
+                  compiler.warnings[0].message.kind);
+    Expect.equals("T", compiler.warnings[0].node.toString());
 
-  Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
-                compiler.warnings[0].message.kind);
-  Expect.equals("T", compiler.warnings[0].node.toString());
-
-  Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
-                compiler.warnings[1].message.kind);
-  Expect.equals("S", compiler.warnings[1].node.toString());
+    Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
+                  compiler.warnings[1].message.kind);
+    Expect.equals("S", compiler.warnings[1].node.toString());
+  }));
 }
 
 test3() {
-  var compiler = compile(r"""
+  asyncTest(() => compile(r"""
 class C<T extends S, S extends U, U extends T> {}
 
 void main() {
   new C();
 }
-""");
+""").then((compiler) {
+    Expect.isFalse(compiler.compilationFailed);
+    print(compiler.errors);
+    Expect.isTrue(compiler.errors.isEmpty, 'unexpected errors');
+    Expect.equals(3, compiler.warnings.length,
+                  'expected exactly one error, but got ${compiler.warnings}');
 
-  Expect.isFalse(compiler.compilationFailed);
-  print(compiler.errors);
-  Expect.isTrue(compiler.errors.isEmpty, 'unexpected errors');
-  Expect.equals(3, compiler.warnings.length,
-                'expected exactly one error, but got ${compiler.warnings}');
+    Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
+                  compiler.warnings[0].message.kind);
+    Expect.equals("T", compiler.warnings[0].node.toString());
 
-  Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
-                compiler.warnings[0].message.kind);
-  Expect.equals("T", compiler.warnings[0].node.toString());
+    Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
+                  compiler.warnings[1].message.kind);
+    Expect.equals("S", compiler.warnings[1].node.toString());
 
-  Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
-                compiler.warnings[1].message.kind);
-  Expect.equals("S", compiler.warnings[1].node.toString());
-
-  Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
-                compiler.warnings[2].message.kind);
-  Expect.equals("U", compiler.warnings[2].node.toString());
+    Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
+                  compiler.warnings[2].message.kind);
+    Expect.equals("U", compiler.warnings[2].node.toString());
+  }));
 }
 
 test4() {
-  var compiler = compile(r"""
+  asyncTest(() => compile(r"""
 class D<T extends S, S extends U, U extends S> {}
 
 void main() {
   new D();
 }
-""");
+""").then((compiler) {
+    Expect.isFalse(compiler.compilationFailed);
+    print(compiler.errors);
+    Expect.isTrue(compiler.errors.isEmpty, 'unexpected errors');
+    Expect.equals(2, compiler.warnings.length,
+                  'expected exactly one error, but got ${compiler.warnings}');
 
-  Expect.isFalse(compiler.compilationFailed);
-  print(compiler.errors);
-  Expect.isTrue(compiler.errors.isEmpty, 'unexpected errors');
-  Expect.equals(2, compiler.warnings.length,
-                'expected exactly one error, but got ${compiler.warnings}');
+    Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
+                  compiler.warnings[0].message.kind);
+    Expect.equals("S", compiler.warnings[0].node.toString());
 
-  Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
-                compiler.warnings[0].message.kind);
-  Expect.equals("S", compiler.warnings[0].node.toString());
-
-  Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
-                compiler.warnings[1].message.kind);
-  Expect.equals("U", compiler.warnings[1].node.toString());
+    Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
+                  compiler.warnings[1].message.kind);
+    Expect.equals("U", compiler.warnings[1].node.toString());
+  }));
 }
 
 main() {
diff --git a/tests/compiler/dart2js/type_variable_occurrence_test.dart b/tests/compiler/dart2js/type_variable_occurrence_test.dart
index c9a28b9..1d51adf 100644
--- a/tests/compiler/dart2js/type_variable_occurrence_test.dart
+++ b/tests/compiler/dart2js/type_variable_occurrence_test.dart
@@ -5,6 +5,7 @@
 library subtype_test;
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'type_test_helper.dart';
 import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart';
 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart"
@@ -15,7 +16,7 @@
 }
 
 testTypeVariableOccurrence() {
-  var env = new TypeEnvironment(r"""
+  asyncTest(() => TypeEnvironment.create(r"""
       typedef S Typedef1<S>();
       typedef void Typedef2<S>(S s);
       typedef void Typedef3<S>(A<S> a);
@@ -27,7 +28,7 @@
         A<T> field4;
         A<A<int>> field5;
         A<A<T>> field6;
-    
+
         Typedef1 field7;
         Typedef1<int> field8;
         Typedef1<T> field9;
@@ -52,77 +53,77 @@
         void method7([T t]) {}
         void method8({T t}) {}
       }
-      """);
+      """).then((env) {
 
-  ClassElement A = env.getElement('A');
+    ClassElement A = env.getElement('A');
 
-  expect(bool expect, String memberName) {
-    DartType memberType = env.getMemberType(A, memberName);
-    TypeVariableType typeVariable = memberType.typeVariableOccurrence;
-    if (expect) {
-      Expect.isNotNull(typeVariable);
-      Expect.equals(A, Types.getClassContext(memberType));
-    } else {
-      Expect.isNull(typeVariable);
-      Expect.isNull(Types.getClassContext(memberType));
+    expect(bool expect, String memberName) {
+      DartType memberType = env.getMemberType(A, memberName);
+      TypeVariableType typeVariable = memberType.typeVariableOccurrence;
+      if (expect) {
+        Expect.isNotNull(typeVariable);
+        Expect.equals(A, Types.getClassContext(memberType));
+      } else {
+        Expect.isNull(typeVariable);
+        Expect.isNull(Types.getClassContext(memberType));
+      }
     }
-  }
 
-  // int field1;
-  expect(false, 'field1');
-  // T field2;
-  expect(true, 'field2');
-  // A<int> field3;
-  expect(false, 'field3');
-  // A<T> field4;
-  expect(true, 'field4');
-  // A<A<int>> field5;
-  expect(false, 'field5');
-  // A<A<T>> field6;
-  expect(true, 'field6');
+    // int field1;
+    expect(false, 'field1');
+    // T field2;
+    expect(true, 'field2');
+    // A<int> field3;
+    expect(false, 'field3');
+    // A<T> field4;
+    expect(true, 'field4');
+    // A<A<int>> field5;
+    expect(false, 'field5');
+    // A<A<T>> field6;
+    expect(true, 'field6');
 
-  // Typedef1 field7;
-  expect(false, 'field7');
-  // Typedef1<int> field8;
-  expect(false, 'field8');
-  // Typedef1<T> field9;
-  expect(true, 'field9');
-  // Typedef1<Typedef1<T>> field10;
-  expect(true, 'field10');
+    // Typedef1 field7;
+    expect(false, 'field7');
+    // Typedef1<int> field8;
+    expect(false, 'field8');
+    // Typedef1<T> field9;
+    expect(true, 'field9');
+    // Typedef1<Typedef1<T>> field10;
+    expect(true, 'field10');
 
-  // Typedef2 field11;
-  expect(false, 'field11');
-  // Typedef2<int> field12;
-  expect(false, 'field12');
-  // Typedef2<T> field13;
-  expect(true, 'field13');
-  // Typedef2<Typedef1<T>> field14;
-  expect(true, 'field14');
+    // Typedef2 field11;
+    expect(false, 'field11');
+    // Typedef2<int> field12;
+    expect(false, 'field12');
+    // Typedef2<T> field13;
+    expect(true, 'field13');
+    // Typedef2<Typedef1<T>> field14;
+    expect(true, 'field14');
 
-  // Typedef3 field15;
-  expect(false, 'field15');
-  // Typedef3<int> field16;
-  expect(false, 'field16');
-  // Typedef3<T> field17;
-  expect(true, 'field17');
-  // Typedef3<Typedef1<T>> field18;
-  expect(true, 'field18');
+    // Typedef3 field15;
+    expect(false, 'field15');
+    // Typedef3<int> field16;
+    expect(false, 'field16');
+    // Typedef3<T> field17;
+    expect(true, 'field17');
+    // Typedef3<Typedef1<T>> field18;
+    expect(true, 'field18');
 
-  // void method1() {}
-  expect(false, 'method1');
-  // T method2() => null;
-  expect(true, 'method2');
-  // A<T> method3() => null;
-  expect(true, 'method3');
-  // void method4(T t) {}
-  expect(true, 'method4');
-  // void method5(A<T> t) {}
-  expect(true, 'method5');
-  // void method6(void foo(T t)) {}
-  expect(true, 'method6');
-  // void method7([T t]);
-  expect(true, 'method7');
-  // void method8({T t});
-  expect(true, 'method8');
-
+    // void method1() {}
+    expect(false, 'method1');
+    // T method2() => null;
+    expect(true, 'method2');
+    // A<T> method3() => null;
+    expect(true, 'method3');
+    // void method4(T t) {}
+    expect(true, 'method4');
+    // void method5(A<T> t) {}
+    expect(true, 'method5');
+    // void method6(void foo(T t)) {}
+    expect(true, 'method6');
+    // void method7([T t]);
+    expect(true, 'method7');
+    // void method8({T t});
+    expect(true, 'method8');
+  }));
 }
diff --git a/tests/compiler/dart2js/types_of_captured_variables_test.dart b/tests/compiler/dart2js/types_of_captured_variables_test.dart
index 3376b65..9e802bd 100644
--- a/tests/compiler/dart2js/types_of_captured_variables_test.dart
+++ b/tests/compiler/dart2js/types_of_captured_variables_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'compiler_helper.dart';
 
 const String TEST1 = r"""
@@ -35,15 +36,18 @@
 
 main() {
   // Test that we know the type of captured, non-mutated variables.
-  String generated = compileAll(TEST1);
-  Expect.isTrue(generated.contains('+ 3'));
+  asyncTest(() => compileAll(TEST1).then((generated) {
+    Expect.isTrue(generated.contains('+ 3'));
+  }));
 
   // Test that we know the type of captured, mutated variables.
-  generated = compileAll(TEST2);
-  Expect.isTrue(generated.contains('+ 3'));
+  asyncTest(() => compileAll(TEST2).then((generated) {
+    Expect.isTrue(generated.contains('+ 3'));
+  }));
 
   // Test that we know when types of a captured, mutated variable
   // conflict.
-  generated = compileAll(TEST3);
-  Expect.isFalse(generated.contains('+ 3'));
+  asyncTest(() => compileAll(TEST3).then((generated) {
+    Expect.isFalse(generated.contains('+ 3'));
+  }));
 }
diff --git a/tests/compiler/dart2js/union_type_test.dart b/tests/compiler/dart2js/union_type_test.dart
new file mode 100644
index 0000000..2b48e04
--- /dev/null
+++ b/tests/compiler/dart2js/union_type_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2013, 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.
+
+import "package:expect/expect.dart";
+import "compiler_helper.dart";
+import "parser_helper.dart";
+
+import "../../../sdk/lib/_internal/compiler/implementation/types/types.dart";
+import "../../../sdk/lib/_internal/compiler/implementation/dart_types.dart";
+
+main() {
+  Compiler compiler = new MockCompiler();
+  compiler.intClass.ensureResolved(compiler);
+  compiler.stringClass.ensureResolved(compiler);
+
+  FlatTypeMask mask1 =
+      new FlatTypeMask.exact(new InterfaceType(compiler.intClass));
+  FlatTypeMask mask2 =
+      new FlatTypeMask.exact(new InterfaceType(compiler.stringClass));
+  UnionTypeMask union1 = mask1.nonNullable().union(mask2, compiler);
+  UnionTypeMask union2 = mask2.nonNullable().union(mask1, compiler);
+  Expect.equals(union1, union2);
+}
diff --git a/tests/compiler/dart2js/unneeded_part_js_test.dart b/tests/compiler/dart2js/unneeded_part_js_test.dart
index cebcd91..c8c0f20 100644
--- a/tests/compiler/dart2js/unneeded_part_js_test.dart
+++ b/tests/compiler/dart2js/unneeded_part_js_test.dart
@@ -5,6 +5,7 @@
 // Test that no parts are emitted when deferred loading isn't used.
 
 import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
 import 'memory_source_file_helper.dart';
 
 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
@@ -20,8 +21,7 @@
   Uri libraryRoot = script.resolve('../../../sdk/');
   Uri packageRoot = script.resolve('./packages/');
 
-  MemorySourceFileProvider.MEMORY_SOURCE_FILES = MEMORY_SOURCE_FILES;
-  var provider = new MemorySourceFileProvider();
+  var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);
   void diagnosticHandler(Uri uri, int begin, int end,
                          String message, Diagnostic kind) {
     if (kind == Diagnostic.VERBOSE_INFO) {
@@ -41,8 +41,9 @@
                                    libraryRoot,
                                    packageRoot,
                                    []);
-  compiler.run(Uri.parse('memory:main.dart'));
-  Expect.isFalse(compiler.compilationFailed);
+  asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
+    Expect.isFalse(compiler.compilationFailed);
+  }));
 }
 
 const Map MEMORY_SOURCE_FILES = const {
diff --git a/tests/compiler/dart2js/unparser_test.dart b/tests/compiler/dart2js/unparser_test.dart
index d470b3f..38e9bdb 100644
--- a/tests/compiler/dart2js/unparser_test.dart
+++ b/tests/compiler/dart2js/unparser_test.dart
@@ -341,6 +341,28 @@
        ]);
 }
 
+testSymbolLiterals() {
+  testUnparse("#+;");  
+  testUnparse("#-;");
+  testUnparse("#*;");
+  testUnparse("#/;");
+  testUnparse("#~/;");
+  testUnparse("#%;");
+  testUnparse("#<;");
+  testUnparse("#<=;");
+  testUnparse("#>;");
+  testUnparse("#>=;");
+  testUnparse("#==;");
+  testUnparse("#&;");
+  testUnparse("#|;");
+  testUnparse("#^;");
+  
+  testUnparse("#a;");
+  testUnparse("#a.b;");
+  testUnparse("#a.b.c;");
+  testUnparse("#aa.bb.cc.dd;");
+}
+
 main() {
   testSignedConstants();
   testGenericTypes();
@@ -362,4 +384,5 @@
   testClassDeclarations();
   testMixinApplications();
   testParameters();
+  testSymbolLiterals();
 }
diff --git a/tests/compiler/dart2js_extra/dart2js_extra.status b/tests/compiler/dart2js_extra/dart2js_extra.status
index 416799d..31e3827 100644
--- a/tests/compiler/dart2js_extra/dart2js_extra.status
+++ b/tests/compiler/dart2js_extra/dart2js_extra.status
@@ -40,9 +40,7 @@
 mirrors_test: Fail # http://dartbug.com/6490
 mirror_printer_test: Fail # http://dartbug.com/6490
 mirror_invalid_field_access_test: Fail # http://dartbug.com/6490
-mirror_invalid_field_access2_test: Fail # http://dartbug.com/6490
 mirror_invalid_field_access3_test: Fail # http://dartbug.com/6490
-mirror_invalid_field_access4_test: Fail # http://dartbug.com/6490
 deferred/deferred_class_test: Fail # http://dartbug.com/3940
 deferred/deferred_constant_test: Fail # http://dartbug.com/3940
 mirror_type_inference_field_test: Fail # http://dartbug.com/6490
diff --git a/tests/compiler/dart2js_extra/inference_nsm_mirrors_test.dart b/tests/compiler/dart2js_extra/inference_nsm_mirrors_test.dart
new file mode 100644
index 0000000..8875dc0
--- /dev/null
+++ b/tests/compiler/dart2js_extra/inference_nsm_mirrors_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for dart2js that did type inferencing on parameters
+// whose type may change at runtime due to an invocation through
+// [InstanceMirror.delegate].
+
+@MirrorsUsed(targets: 'A')
+import 'dart:mirrors';
+import 'package:expect/expect.dart';
+
+class A {
+  noSuchMethod(im) {
+    reflect(new B()).delegate(im);
+  }
+}
+
+class B {
+  foo(a) => a + 42;
+}
+
+main() {
+  Expect.equals(42, new B().foo(0));
+  Expect.throws(() => new A().foo('foo'), (e) => e is UnsupportedError);
+}
diff --git a/tests/compiler/dart2js_extra/inferrer_is_int_test.dart b/tests/compiler/dart2js_extra/inferrer_is_int_test.dart
new file mode 100644
index 0000000..6aecf39
--- /dev/null
+++ b/tests/compiler/dart2js_extra/inferrer_is_int_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2013, 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.
+
+// Test that dart2js's inferrer and code optimizers know a double
+// literal might become an int at runtime.
+
+import "package:expect/expect.dart";
+import '../../language/compiler_annotations.dart';
+
+@DontInline()
+callWithStringAndDouble(value) {
+  () => 42;
+  if (value is !int) throw new ArgumentError(value);
+  return 42;
+}
+
+@DontInline()
+callWithDouble(value) {
+  () => 42;
+  if (value is !int) throw new ArgumentError(value);
+  return 42;
+}
+
+main() {
+  Expect.throws(() => callWithStringAndDouble('foo'),
+                (e) => e is ArgumentError);
+  Expect.equals(42, callWithStringAndDouble(0.0));
+  Expect.equals(42, callWithDouble(0.0));
+}
diff --git a/tests/compiler/dart2js_extra/no_such_method_mirrors_test.dart b/tests/compiler/dart2js_extra/no_such_method_mirrors_test.dart
new file mode 100644
index 0000000..7719974
--- /dev/null
+++ b/tests/compiler/dart2js_extra/no_such_method_mirrors_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2013, 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.
+
+import 'dart:mirrors';
+import 'package:expect/expect.dart';
+
+class A {
+  noSuchMethod(im) {
+    reflect(new B()).delegate(im);
+  }
+}
+
+class B {}
+
+main() {
+  // Test with an intercepted selector.
+  Expect.throws(() => new A().startsWith(42), (e) => e is NoSuchMethodError);
+  // Test with a non-intercepted selector.
+  Expect.throws(() => new A().foobar(), (e) => e is NoSuchMethodError);
+}
diff --git a/tests/compiler/dart2js_extra/private_symbol_literal_test.dart b/tests/compiler/dart2js_extra/private_symbol_literal_test.dart
new file mode 100644
index 0000000..31a2783
--- /dev/null
+++ b/tests/compiler/dart2js_extra/private_symbol_literal_test.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2013, 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.
+
+// Test symbol literals with underscores.
+// These are currently unsupported by dart2js.
+
+library symbol_literal_test;
+
+main() {
+  print(#a);
+  print(#_a); /// 01: compile-time error
+
+  print(#a.b);
+  print(#_a.b); /// 02: compile-time error
+  print(#a._b); /// 03: compile-time error
+
+  print(#a.b.c);
+  print(#_a.b.c); /// 04: compile-time error
+  print(#a._b.c); /// 05: compile-time error
+  print(#a.b._c); /// 06: compile-time error
+}
diff --git a/tests/compiler/dart2js_foreign/dart2js_foreign.status b/tests/compiler/dart2js_foreign/dart2js_foreign.status
deleted file mode 100644
index 1807eab..0000000
--- a/tests/compiler/dart2js_foreign/dart2js_foreign.status
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright (c) 2011, 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.
-
-*: Skip
diff --git a/tests/compiler/dart2js_foreign/foreign_test.dart b/tests/compiler/dart2js_foreign/foreign_test.dart
deleted file mode 100644
index 1e7dddb..0000000
--- a/tests/compiler/dart2js_foreign/foreign_test.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2011, 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-foreign1(var a, var b) {
-  return JS("num", r"# + #", a, b);
-}
-
-var called = false;
-callOnce() {
-  Expect.isFalse(called);
-  called = true;
-  return 499;
-}
-
-foreign2() {
-  var t = callOnce();
-  return JS("num", r"# + #", t, t);
-}
-
-foreign11(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) {
-  return JS("num", r"# + # + # + # + # + # + # + # + # + # + #",
-      a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
-}
-
-void main() {
-  Expect.equals(9, foreign1(4, 5));
-  Expect.equals(998, foreign2());
-  Expect.equals('1234567891011',
-      foreign11('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'));
-}
diff --git a/tests/compiler/dart2js_foreign/native_call_arity1_test.dart b/tests/compiler/dart2js_foreign/native_call_arity1_test.dart
deleted file mode 100644
index 1476be5..0000000
--- a/tests/compiler/dart2js_foreign/native_call_arity1_test.dart
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test that native methods with unnamed* optional arguments are called with the
-// number of arguments in the call site.  This is necessary because native
-// methods can dispatch on the number of arguments.  Passing null or undefined
-// as the last argument is not the same as passing one fewer argument.
-//
-// * Named arguments are passed in the correct position, so require preceding
-// arguments to be passed.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  @native int foo(int x);
-}
-
-@Native("*B")
-class B {
-  @native int foo([x, y, z]);
-}
-
-// TODO(sra): Add a case where the parameters have default values.  Wait until
-// dart:html need non-null default values.
-
-@native A makeA() { return new A(); }
-@native B makeB() { return new B(); }
-
-@Native("""
-function A() {}
-A.prototype.foo = function () { return arguments.length; };
-
-function B() {}
-B.prototype.foo = function () { return arguments.length; };
-
-makeA = function(){return new A;};
-makeB = function(){return new B;};
-""")
-void setup();
-
-
-testDynamicContext() {
-  var things = [makeA(), makeB()];
-  var a = things[0];
-  var b = things[1];
-
-  Expect.throws(() => a.foo());
-  Expect.equals(1, a.foo(10));
-  Expect.throws(() => a.foo(10, 20));
-  Expect.throws(() => a.foo(10, 20, 30));
-
-  Expect.equals(0, b.foo());
-  Expect.equals(1, b.foo(10));
-  Expect.equals(2, b.foo(10, 20));
-  Expect.equals(3, b.foo(10, 20, 30));
-
-  Expect.equals(1, b.foo(x: 10));   // 1 = x
-  Expect.equals(2, b.foo(y: 20));   // 2 = x, y
-  Expect.equals(3, b.foo(z: 30));   // 3 = x, y, z
-  Expect.throws(() => b.foo(10, 20, 30, 40));
-}
-
-testStaticContext() {
-  A a = makeA();
-  B b = makeB();
-
-  Expect.throws(() => a.foo());
-  Expect.equals(1, a.foo(10));
-  Expect.throws(() => a.foo(10, 20));
-  Expect.throws(() => a.foo(10, 20, 30));
-
-  Expect.equals(0, b.foo());
-  Expect.equals(1, b.foo(10));
-  Expect.equals(2, b.foo(10, 20));
-  Expect.equals(3, b.foo(10, 20, 30));
-
-  Expect.equals(1, b.foo(x: 10));
-  Expect.equals(2, b.foo(y: 20));
-  Expect.equals(3, b.foo(z: 30));
-  Expect.throws(() => b.foo(10, 20, 30, 40));
-}
-
-main() {
-  setup();
-  testDynamicContext();
-  testStaticContext();
-}
diff --git a/tests/compiler/dart2js_foreign/native_call_arity2_test.dart b/tests/compiler/dart2js_foreign/native_call_arity2_test.dart
deleted file mode 100644
index acb0f71..0000000
--- a/tests/compiler/dart2js_foreign/native_call_arity2_test.dart
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// This is a similar test to NativeCallArity1FrogTest, but makes sure
-// that subclasses also get the right number of arguments.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  @native int foo([x, y]);
-}
-
-@Native("*B")
-class B extends A  {
-  @native int foo([x, y]);
-}
-
-@native A makeA() { return new A(); }
-@native B makeB() { return new B(); }
-
-@Native("""
-function inherits(child, parent) {
-  if (child.prototype.__proto__) {
-    child.prototype.__proto__ = parent.prototype;
-  } else {
-    function tmp() {};
-    tmp.prototype = parent.prototype;
-    child.prototype = new tmp();
-    child.prototype.constructor = child;
-  }
-}
-function A() {}
-A.prototype.foo = function () { return arguments.length; };
-
-function B() {}
-B.prototype.foo = function () { return arguments.length; };
-inherits(B, A);
-
-makeA = function(){return new A;};
-makeB = function(){return new B;};
-""")
-void setup();
-
-
-testDynamicContext() {
-  var things = [makeA(), makeB()];
-  var a = things[0];
-  var b = things[1];
-
-  Expect.equals(0, a.foo());
-  Expect.equals(1, a.foo(10));
-  Expect.equals(2, a.foo(10, 20));
-  Expect.throws(() => a.foo(10, 20, 30));
-
-  Expect.equals(1, a.foo(x: 10));   // 1 = x
-  Expect.equals(2, a.foo(y: 20));   // 2 = x, y
-  Expect.throws(() => a.foo(10, 20, 30));
-
-  Expect.equals(0, b.foo());
-  Expect.equals(1, b.foo(10));
-  Expect.equals(2, b.foo(10, 20));
-  Expect.throws(() => b.foo(10, 20, 30));
-
-  Expect.equals(1, b.foo(x: 10));   // 1 = x
-  Expect.equals(2, b.foo(y: 20));   // 2 = x, y
-  Expect.throws(() => b.foo(10, 20, 30));
-}
-
-testStaticContext() {
-  A a = makeA();
-  B b = makeB();
-
-  Expect.equals(0, a.foo());
-  Expect.equals(1, a.foo(10));
-  Expect.equals(2, a.foo(10, 20));
-  Expect.throws(() => a.foo(10, 20, 30));
-
-  Expect.equals(1, a.foo(x: 10));   // 1 = x
-  Expect.equals(2, a.foo(y: 20));   // 2 = x, y
-  Expect.throws(() => a.foo(10, 20, 30));
-
-  Expect.equals(0, b.foo());
-  Expect.equals(1, b.foo(10));
-  Expect.equals(2, b.foo(10, 20));
-  Expect.throws(() => b.foo(10, 20, 30));
-
-  Expect.equals(1, b.foo(x: 10));   // 1 = x
-  Expect.equals(2, b.foo(y: 20));   // 2 = x, y
-  Expect.throws(() => b.foo(10, 20, 30));
-}
-
-main() {
-  setup();
-  testDynamicContext();
-  testStaticContext();
-}
diff --git a/tests/compiler/dart2js_foreign/native_call_arity3_test.dart b/tests/compiler/dart2js_foreign/native_call_arity3_test.dart
deleted file mode 100644
index 172119c..0000000
--- a/tests/compiler/dart2js_foreign/native_call_arity3_test.dart
+++ /dev/null
@@ -1,86 +0,0 @@
-// 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.
-
-// Test similar to NativeCallArity1FrogTest, but with default values to
-// parameters set to null. These parameters should be treated as if they
-// do not have a default value for the native methods.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  @native int foo(int x);
-}
-
-@Native("*B")
-class B {
-  @native int foo([x = null, y, z = null]);
-}
-
-// TODO(sra): Add a case where the parameters have default values.  Wait until
-// dart:html need non-null default values.
-
-@native A makeA() { return new A(); }
-@native B makeB() { return new B(); }
-
-@Native("""
-function A() {}
-A.prototype.foo = function () { return arguments.length; };
-
-function B() {}
-B.prototype.foo = function () { return arguments.length; };
-
-makeA = function(){return new A;};
-makeB = function(){return new B;};
-""")
-void setup();
-
-
-testDynamicContext() {
-  var things = [makeA(), makeB()];
-  var a = things[0];
-  var b = things[1];
-
-  Expect.throws(() => a.foo());
-  Expect.equals(1, a.foo(10));
-  Expect.throws(() => a.foo(10, 20));
-  Expect.throws(() => a.foo(10, 20, 30));
-
-  Expect.equals(0, b.foo());
-  Expect.equals(1, b.foo(10));
-  Expect.equals(2, b.foo(10, 20));
-  Expect.equals(3, b.foo(10, 20, 30));
-
-  Expect.equals(1, b.foo(x: 10));   // 1 = x
-  Expect.equals(2, b.foo(y: 20));   // 2 = x, y
-  Expect.equals(3, b.foo(z: 30));   // 3 = x, y, z
-  Expect.throws(() => b.foo(10, 20, 30, 40));
-}
-
-testStaticContext() {
-  A a = makeA();
-  B b = makeB();
-
-  Expect.throws(() => a.foo());
-  Expect.equals(1, a.foo(10));
-  Expect.throws(() => a.foo(10, 20));
-  Expect.throws(() => a.foo(10, 20, 30));
-
-  Expect.equals(0, b.foo());
-  Expect.equals(1, b.foo(10));
-  Expect.equals(2, b.foo(10, 20));
-  Expect.equals(3, b.foo(10, 20, 30));
-
-  Expect.equals(1, b.foo(x: 10));
-  Expect.equals(2, b.foo(y: 20));
-  Expect.equals(3, b.foo(z: 30));
-  Expect.throws(() => b.foo(10, 20, 30, 40));
-}
-
-main() {
-  setup();
-  testDynamicContext();
-  testStaticContext();
-}
diff --git a/tests/compiler/dart2js_foreign/native_checked_arguments1_test.dart b/tests/compiler/dart2js_foreign/native_checked_arguments1_test.dart
deleted file mode 100644
index 29bbefe..0000000
--- a/tests/compiler/dart2js_foreign/native_checked_arguments1_test.dart
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test that type checks occur on native methods.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  @native int foo(int x);
-  @native int cmp(A other);
-}
-
-@Native("*B")
-class B {
-  @native String foo(String x);
-  @native int cmp(B other);
-}
-
-@native A makeA() { return new A(); }
-@native B makeB() { return new B(); }
-
-@Native("""
-function A() {}
-A.prototype.foo = function (x) { return x + 1; };
-A.prototype.cmp = function (x) { return 0; };
-
-function B() {}
-B.prototype.foo = function (x) { return x + 'ha!'; };
-B.prototype.cmp = function (x) { return 1; };
-
-makeA = function(){return new A;};
-makeB = function(){return new B;};
-""")
-void setup();
-
-expectThrows(action()) {
-  bool threw = false;
-  try {
-    action();
-  } catch (e) {
-    threw = true;
-  }
-  Expect.isTrue(threw);
-}
-
-checkedModeTest() {
-  var things = [makeA(), makeB()];
-  var a = things[0];
-  var b = things[1];
-
-  Expect.equals(124, a.foo(123));
-  expectThrows(() => a.foo('xxx'));
-
-  Expect.equals('helloha!', b.foo('hello'));
-  expectThrows(() => b.foo(123));
-
-  Expect.equals(0, a.cmp(a));
-  expectThrows(() => a.cmp(b));
-  expectThrows(() => a.cmp(5));
-
-  Expect.equals(1, b.cmp(b));
-  expectThrows(() => b.cmp(a));
-  expectThrows(() => b.cmp(5));
-
-  // Check that we throw the same errors when the locals are typed.
-  A aa = things[0];
-  B bb = things[1];
-
-  Expect.equals(124, aa.foo(123));
-  expectThrows(() => aa.foo('xxx'));
-
-  Expect.equals('helloha!', bb.foo('hello'));
-  expectThrows(() => bb.foo(123));
-
-  Expect.equals(0, aa.cmp(aa));
-  expectThrows(() => aa.cmp(bb));
-  expectThrows(() => aa.cmp(5));
-
-  Expect.equals(1, bb.cmp(bb));
-  expectThrows(() => bb.cmp(aa));
-  expectThrows(() => bb.cmp(5));
-}
-
-uncheckedModeTest() {
-  var things = [makeA(), makeB()];
-  var a = things[0];
-  var b = things[1];
-
-  Expect.equals(124, a.foo(123));
-  Expect.equals('xxx1', a.foo('xxx'));
-
-  Expect.equals('helloha!', b.foo('hello'));
-  Expect.equals('123ha!', b.foo(123));
-
-  Expect.equals(0, a.cmp(a));
-  Expect.equals(0, a.cmp(b));
-  Expect.equals(0, a.cmp(5));
-
-  Expect.equals(1, b.cmp(b));
-  Expect.equals(1, b.cmp(a));
-  Expect.equals(1, b.cmp(5));
-
-  // Check that we do not throw errors when the locals are typed.
-  A aa = things[0];
-  B bb = things[1];
-
-  Expect.equals(124, aa.foo(123));
-  Expect.equals('xxx1', aa.foo('xxx'));
-
-  Expect.equals('helloha!', bb.foo('hello'));
-  Expect.equals('123ha!', bb.foo(123));
-
-  Expect.equals(0, aa.cmp(aa));
-  Expect.equals(0, aa.cmp(bb));
-  Expect.equals(0, aa.cmp(5));
-
-  Expect.equals(1, bb.cmp(bb));
-  Expect.equals(1, bb.cmp(aa));
-  Expect.equals(1, bb.cmp(5));
-}
-
-bool isCheckedMode() {
-  var stuff = [1, 'string'];
-  var a = stuff[0];
-  // Checked-mode detection.
-  try {
-    String s = a;
-    return false;
-  } catch (e) {
-    // Ignore.
-  }
-  return true;
-}
-
-main() {
-  setup();
-
-  if (isCheckedMode()) {
-    checkedModeTest();
-  } else {
-    uncheckedModeTest();
-  }
-}
diff --git a/tests/compiler/dart2js_foreign/native_checked_fields_test.dart b/tests/compiler/dart2js_foreign/native_checked_fields_test.dart
deleted file mode 100644
index 91406f3..0000000
--- a/tests/compiler/dart2js_foreign/native_checked_fields_test.dart
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test that type checks occur on assignment to fields of native methods.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  int foo;
-}
-
-@Native("*B")
-class B {
-  String foo;
-}
-
-@native A makeA() { return new A(); }
-@native B makeB() { return new B(); }
-
-@Native("""
-function A() {}
-
-function B() {}
-
-makeA = function(){return new A;};
-makeB = function(){return new B;};
-""")
-void setup();
-
-expectThrows(action()) {
-  bool threw = false;
-  try {
-    action();
-  } catch (e) {
-    threw = true;
-  }
-  Expect.isTrue(threw);
-}
-
-checkedModeTest() {
-  var things = [makeA(), makeB()];
-  var a = things[0];
-  var b = things[1];
-
-  a.foo = 123;
-  expectThrows(() => a.foo = 'xxx');
-  Expect.equals(123, a.foo);
-
-  b.foo = 'hello';
-  expectThrows(() => b.foo = 123);
-  Expect.equals('hello', b.foo);
-
-  // Check that we throw the same errors when the locals are typed.
-  A aa = things[0];
-  B bb = things[1];
-
-  aa.foo = 124;
-  expectThrows(() => aa.foo = 'xxx');
-  Expect.equals(124, aa.foo);
-
-  bb.foo = 'hello';
-  expectThrows(() => bb.foo = 124);
-  Expect.equals('hello', bb.foo);
-}
-
-uncheckedModeTest() {
-  var things = [makeA(), makeB()];
-  var a = things[0];
-  var b = things[1];
-
-  a.foo = 123;
-  Expect.equals(123, a.foo);
-  a.foo = 'xxx';
-  Expect.equals('xxx', a.foo);
-
-  b.foo = 'hello';
-  Expect.equals('hello', b.foo);
-  b.foo = 123;
-  Expect.equals(b.foo, 123);
-
-  // Check that we do not throw errors when the locals are typed.
-  A aa = things[0];
-  B bb = things[1];
-
-  aa.foo = 124;
-  Expect.equals(124, aa.foo);
-  a.foo = 'yyy';
-  Expect.equals('yyy', a.foo);
-
-  b.foo = 'hello';
-  Expect.equals('hello', b.foo);
-  b.foo = 124;
-  Expect.equals(b.foo, 124);
-}
-
-bool isCheckedMode() {
-  var stuff = [1, 'string'];
-  var a = stuff[0];
-  // Checked-mode detection.
-  try {
-    String s = a;
-    return false;
-  } catch (e) {
-    // Ignore.
-  }
-  return true;
-}
-
-main() {
-  setup();
-
-  if (isCheckedMode()) {
-    checkedModeTest();
-  } else {
-    uncheckedModeTest();
-  }
-}
diff --git a/tests/compiler/dart2js_foreign/native_class_avoids_hidden_name_test.dart b/tests/compiler/dart2js_foreign/native_class_avoids_hidden_name_test.dart
deleted file mode 100644
index 7ff5cb1..0000000
--- a/tests/compiler/dart2js_foreign/native_class_avoids_hidden_name_test.dart
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test that hidden native class names are not used by generated code.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*B")
-class A {
-  get name => 'A';
-  static A create() => makeA();
-}
-
-@Native("*C")
-class B {
-  get name => 'B';
-  static B create() => makeB();
-}
-
-class C {  // Ordinary class with name clashing with native class.
-  get name => 'C';
-  static C create() => new C();
-}
-
-@native makeA();
-@native makeB();
-
-@Native("""
-// Poison hidden native names 'B' and 'C' to prove the compiler didn't place
-// anthing on the hidden native class.
-B = null;
-C = null;
-""")
-void setup1();
-
-@Native("""
-// This code is all inside 'setup' and so not accesible from the global scope.
-function B(){}
-function C(){}
-makeA = function(){return new B};  // A is "*B"
-makeB = function(){return new C};  // B is "*C"
-""")
-void setup2();
-
-int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
-
-main() {
-  setup1();
-  setup2();
-
-  var things = [A.create(), B.create(), C.create()];
-  var a = things[inscrutable(0)];
-  var b = things[inscrutable(1)];
-  var c = things[inscrutable(2)];
-
-  Expect.equals('A', a.name);
-  Expect.equals('B', b.name);
-  Expect.equals('C', c.name);
-}
diff --git a/tests/compiler/dart2js_foreign/native_class_inheritance1_test.dart b/tests/compiler/dart2js_foreign/native_class_inheritance1_test.dart
deleted file mode 100644
index b3d9632..0000000
--- a/tests/compiler/dart2js_foreign/native_class_inheritance1_test.dart
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test to see if resolving a hidden native class's method interferes with
-// subsequent resolving the subclass's method.  This might happen if the
-// superclass caches the method in the prototype, so shadowing the dispatcher
-// stored on Object.prototype.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-// Version 1: It might be possible to call foo directly.
-@Native("*A1")
-class A1 {
-  @native foo();
-}
-
-@Native("*B1")
-class B1 extends A1  {
-  @native foo();
-}
-
-@native makeA1();
-@native makeB1();
-
-
-// Version 2: foo needs some kind of trampoline.
-@Native("*A2")
-class A2 {
-  @native foo([a=99]);
-}
-
-@Native("*B2")
-class B2 extends A2  {
-  @native foo([z=1000]);
-}
-
-@native makeA2();
-@native makeB2();
-
-@Native("""
-// This code is all inside 'setup' and so not accesible from the global scope.
-function inherits(child, parent) {
-  if (child.prototype.__proto__) {
-    child.prototype.__proto__ = parent.prototype;
-  } else {
-    function tmp() {};
-    tmp.prototype = parent.prototype;
-    child.prototype = new tmp();
-    child.prototype.constructor = child;
-  }
-}
-function A1(){}
-function B1(){}
-inherits(B1, A1);
-A1.prototype.foo = function(){return 100;}
-B1.prototype.foo = function(){return 200;}
-
-makeA1 = function(){return new A1};
-makeB1 = function(){return new B1};
-
-function A2(){}
-function B2(){}
-inherits(B2, A2);
-A2.prototype.foo = function(a){return a + 10000;}
-B2.prototype.foo = function(z){return z + 20000;}
-
-makeA2 = function(){return new A2};
-makeB2 = function(){return new B2};
-""")
-void setup();
-
-
-main() {
-  setup();
-
-  var a1 = makeA1();
-  var b1 = makeB1();
-  Expect.equals(100, a1.foo());
-  Expect.equals(200, b1.foo());
-
-  var a2 = makeA2();
-  var b2 = makeB2();
-  Expect.equals(10000 + 99, a2.foo());
-  Expect.equals(20000 + 1000, b2.foo());
-
-  Expect.equals(10000 + 1, a2.foo(1));
-  Expect.equals(20000 + 2, b2.foo(2));
-
-  bool caught = false;
-  try {
-    a1.foo(20);
-  } catch (ex) {
-    caught = true;
-    Expect.isTrue(ex is NoSuchMethodError);
-  }
-  Expect.isTrue(caught, 'a1.foo(20) should throw');
-
-  caught = false;
-  try {
-    var x = 123;
-    x.foo(20);
-  } catch (ex) {
-    caught = true;
-    Expect.isTrue(ex is NoSuchMethodError);
-  }
-  Expect.isTrue(caught, "x.foo(20) should throw");
-}
diff --git a/tests/compiler/dart2js_foreign/native_class_inheritance2_test.dart b/tests/compiler/dart2js_foreign/native_class_inheritance2_test.dart
deleted file mode 100644
index da23d5f..0000000
--- a/tests/compiler/dart2js_foreign/native_class_inheritance2_test.dart
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test to see if resolving a hidden native class's method interferes with
-// subsequent resolving the subclass's method.  This might happen if the
-// superclass caches the method in the prototype, so shadowing the dispatcher
-// stored on Object.prototype.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  @native foo([a=100]);
-}
-
-@Native("*B")
-class B extends A  {
-}
-
-@Native("*C")
-class C extends B  {
-  @native foo([z=300]);
-}
-
-@Native("*D")
-class D extends C  {
-}
-
-@native makeA();
-@native makeB();
-@native makeC();
-@native makeD();
-
-@Native("""
-// This code is all inside 'setup' and so not accesible from the global scope.
-function inherits(child, parent) {
-  if (child.prototype.__proto__) {
-    child.prototype.__proto__ = parent.prototype;
-  } else {
-    function tmp() {};
-    tmp.prototype = parent.prototype;
-    child.prototype = new tmp();
-    child.prototype.constructor = child;
-  }
-}
-
-function A(){}
-function B(){}
-inherits(B, A);
-function C(){}
-inherits(C, B);
-function D(){}
-inherits(D, C);
-
-A.prototype.foo = function(a){return 'A.foo(' + a + ')';}
-C.prototype.foo = function(z){return 'C.foo(' + z + ')';}
-
-makeA = function(){return new A};
-makeB = function(){return new B};
-makeC = function(){return new C};
-makeD = function(){return new D};
-""")
-void setup();
-
-
-main() {
-  setup();
-
-  var a = makeA();
-  var b = makeB();
-  var c = makeC();
-  var d = makeD();
-
-  Expect.equals('A.foo(100)', b.foo());
-  Expect.equals('C.foo(300)', d.foo());
-  // If the above line fails with C.foo(100) then the dispatch to fill in the
-  // default got the wrong one, followed by a second dispatch that resolved to
-  // the correct native method.
-
-  Expect.equals('A.foo(1)', a.foo(1));
-  Expect.equals('A.foo(2)', b.foo(2));
-  Expect.equals('C.foo(3)', c.foo(3));
-  Expect.equals('C.foo(4)', d.foo(4));
-}
diff --git a/tests/compiler/dart2js_foreign/native_class_inheritance3_test.dart b/tests/compiler/dart2js_foreign/native_class_inheritance3_test.dart
deleted file mode 100644
index 73794c8..0000000
--- a/tests/compiler/dart2js_foreign/native_class_inheritance3_test.dart
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test to see if resolving a hidden native class's method to noSuchMethod
-// interferes with subsequent resolving of the method.  This might happen if the
-// noSuchMethod is cached on Object.prototype.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A1")
-class A1 {
-}
-
-@Native("*B1")
-class B1 extends A1  {
-}
-
-@native makeA1();
-@native makeB1();
-
-
-@Native("*A2")
-class A2 {
-  @native foo([a=99]);
-}
-
-@Native("*B2")
-class B2 extends A2  {
-}
-
-@native makeA2();
-@native makeB2();
-
-@native makeObject();
-
-@Native("""
-// This code is all inside 'setup' and so not accesible from the global scope.
-function inherits(child, parent) {
-  if (child.prototype.__proto__) {
-    child.prototype.__proto__ = parent.prototype;
-  } else {
-    function tmp() {};
-    tmp.prototype = parent.prototype;
-    child.prototype = new tmp();
-    child.prototype.constructor = child;
-  }
-}
-function A1(){}
-function B1(){}
-inherits(B1, A1);
-
-makeA1 = function(){return new A1};
-makeB1 = function(){return new B1};
-
-function A2(){}
-function B2(){}
-inherits(B2, A2);
-A2.prototype.foo = function(a){return 'A2.foo(' + a  + ')';}
-
-makeA2 = function(){return new A2};
-makeB2 = function(){return new B2};
-
-makeObject = function(){return new Object};
-""")
-void setup();
-
-
-main() {
-  setup();
-
-  var a1 = makeA1();
-  var b1 = makeB1();
-  var ob = makeObject();
-
-  // Does calling missing methods in one tree of inheritance forest affect other
-  // trees?
-  expectNoSuchMethod(() => b1.foo(), 'b1.foo()');
-  expectNoSuchMethod(() => a1.foo(), 'a1.foo()');
-  expectNoSuchMethod(() => ob.foo(), 'ob.foo()');
-
-  var a2 = makeA2();
-  var b2 = makeB2();
-
-  Expect.equals('A2.foo(99)', a2.foo());
-  Expect.equals('A2.foo(99)', b2.foo());
-  Expect.equals('A2.foo(1)', a2.foo(1));
-  Expect.equals('A2.foo(2)', b2.foo(2));
-
-
-  expectNoSuchMethod(() => b1.foo(3), 'b1.foo(3)');
-  expectNoSuchMethod(() => a1.foo(4), 'a1.foo(4)');
-}
-
-expectNoSuchMethod(action, note) {
-  bool caught = false;
-  try {
-    action();
-  } catch (ex) {
-    caught = true;
-    Expect.isTrue(ex is NoSuchMethodError, note);
-  }
-  Expect.isTrue(caught, note);
-}
diff --git a/tests/compiler/dart2js_foreign/native_class_inheritance4_test.dart b/tests/compiler/dart2js_foreign/native_class_inheritance4_test.dart
deleted file mode 100644
index f128515..0000000
--- a/tests/compiler/dart2js_foreign/native_class_inheritance4_test.dart
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Additional Dart code may be 'placed on' hidden native classes.  With
-// inheritance, the superclass method must not be reached by a call on the
-// subclass.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  var _field;
-
-  int get X => _field;
-  void set X(int x) { _field = x; }
-
-  int method(int z) => _field + z;
-}
-
-@Native("*B")
-class B extends A  {
-  var _field2;
-
-  int get X => _field2;
-  void set X(int x) { _field2 = x; }
-
-  int method(int z) => _field2 + z;
-}
-
-@native A makeA() { return new A(); }
-@native B makeB() { return new B(); }
-
-@Native(r"""
-function inherits(child, parent) {
-  if (child.prototype.__proto__) {
-    child.prototype.__proto__ = parent.prototype;
-  } else {
-    function tmp() {};
-    tmp.prototype = parent.prototype;
-    child.prototype = new tmp();
-    child.prototype.constructor = child;
-  }
-}
-
-function A(){}
-function B(){}
-inherits(B, A);
-makeA = function(){return new A;};
-makeB = function(){return new B;};
-""")
-void setup();
-
-testBasicA_dynamic() {
-  setup();  // Fresh constructors.
-
-  var a = [makeA()][0];
-
-  a.X = 100;
-  Expect.equals(100, a._field);
-  Expect.equals(100, a.X);
-  Expect.equals(150, a.method(50));
-}
-
-testBasicA_typed() {
-  setup();  // Fresh constructors.
-
-  A a = makeA();
-
-  a.X = 100;
-  Expect.equals(100, a._field);
-  Expect.equals(100, a.X);
-  Expect.equals(150, a.method(50));
-}
-
-testBasicB_dynamic() {
-  setup();  // Fresh constructors.
-
-  var b = [makeB()][0];
-
-  b._field = 1;
-  b.X = 123;
-  Expect.equals(1, b._field);
-  Expect.equals(123, b._field2);
-  Expect.equals(123, b.X);
-  Expect.equals(200, b.method(77));
-}
-
-testBasicB_typed() {
-  setup();  // Fresh constructors.
-
-  B b = makeB();
-
-  b._field = 1;
-  b.X = 123;
-  Expect.equals(1, b._field);
-  Expect.equals(123, b._field2);
-  Expect.equals(123, b.X);
-  Expect.equals(200, b.method(77));
-}
-
-testAB_dynamic() {
-  setup();  // Fresh constructors.
-
-  var things = [makeA(), makeB()];
-  var a = things[0];
-  var b = things[1];
-
-  a.X = 100;
-  Expect.equals(100, a._field);
-  Expect.equals(100, a.X);
-  Expect.equals(150, a.method(50));
-
-  b._field = 1;
-  b._field2 = 2;
-  b.X = 123;
-  Expect.equals(1, b._field);
-  Expect.equals(123, b._field2);
-  Expect.equals(123, b.X);
-  Expect.equals(200, b.method(77));
-}
-
-testAB_typed() {
-  setup();  // Fresh constructors.
-
-  A a = makeA();
-  B b = makeB();
-
-  a.X = 100;
-  Expect.equals(100, a._field);
-  Expect.equals(100, a.X);
-  Expect.equals(150, a.method(50));
-
-  b._field = 1;
-  b._field2 = 2;
-  b.X = 123;
-  Expect.equals(1, b._field);
-  Expect.equals(123, b._field2);
-  Expect.equals(123, b.X);
-  Expect.equals(200, b.method(77));
-}
-
-main() {
-  testBasicA_dynamic();
-  testBasicA_typed();
-  testBasicB_dynamic();
-  testBasicB_typed();
-  testAB_dynamic();
-  testAB_typed();
-}
diff --git a/tests/compiler/dart2js_foreign/native_class_is_check1_test.dart b/tests/compiler/dart2js_foreign/native_class_is_check1_test.dart
deleted file mode 100644
index 11879ec..0000000
--- a/tests/compiler/dart2js_foreign/native_class_is_check1_test.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test for correct simple is-checks on hidden native classes.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-abstract class I {
-  I read();
-  write(I x);
-}
-
-// Native implementation.
-
-@Native("*A")
-class A implements I  {
-  // The native class accepts only other native instances.
-  @native A read();
-  @native write(A x);
-}
-
-@native makeA();
-
-@Native("""
-// This code is all inside 'setup' and so not accesible from the global scope.
-function A(){}
-A.prototype.read = function() { return this._x; };
-A.prototype.write = function(x) { this._x = x; };
-makeA = function(){return new A};
-""")
-void setup();
-
-class B {}
-
-main() {
-  setup();
-
-  var a1 = makeA();
-  var ob = new Object();
-
-  Expect.isFalse(ob is I);
-  Expect.isFalse(ob is A);
-  Expect.isFalse(ob is B);
-
-  Expect.isTrue(a1 is I);
-  Expect.isTrue(a1 is A);
-  Expect.isTrue(a1 is !B);
-}
diff --git a/tests/compiler/dart2js_foreign/native_class_is_check3_test.dart b/tests/compiler/dart2js_foreign/native_class_is_check3_test.dart
deleted file mode 100644
index a311203..0000000
--- a/tests/compiler/dart2js_foreign/native_class_is_check3_test.dart
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test for correct simple is-checks on hidden native classes.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-abstract class J {
-}
-
-abstract class I extends J {
-  I read();
-  write(I x);
-}
-
-// Native implementation.
-
-@Native("*A")
-class A implements I  {
-  // The native class accepts only other native instances.
-  @native A read();
-  @native write(A x);
-}
-
-@Native("*B")
-class B extends A  {
-}
-
-@native makeA();
-@native makeB();
-
-@Native("""
-// This code is all inside 'setup' and so not accesible from the global scope.
-function inherits(child, parent) {
-  if (child.prototype.__proto__) {
-    child.prototype.__proto__ = parent.prototype;
-  } else {
-    function tmp() {};
-    tmp.prototype = parent.prototype;
-    child.prototype = new tmp();
-    child.prototype.constructor = child;
-  }
-}
-function A(){}
-function B(){}
-inherits(B, A);
-A.prototype.read = function() { return this._x; };
-A.prototype.write = function(x) { this._x = x; };
-makeA = function(){return new A};
-makeB = function(){return new B};
-""")
-void setup();
-
-class C {}
-
-main() {
-  setup();
-
-  var a1 = makeA();
-  var b1 = makeB();
-  var ob = new Object();
-
-  Expect.isFalse(ob is J);
-  Expect.isFalse(ob is I);
-  Expect.isFalse(ob is A);
-  Expect.isFalse(ob is B);
-  Expect.isFalse(ob is C);
-
-  // Use b1 first to prevent a1 is checks patching the A prototype.
-  Expect.isTrue(b1 is J);
-  Expect.isTrue(b1 is I);
-  Expect.isTrue(b1 is A);
-  Expect.isTrue(b1 is B);
-  Expect.isTrue(b1 is !C);
-
-  Expect.isTrue(a1 is J);
-  Expect.isTrue(a1 is I);
-  Expect.isTrue(a1 is A);
-  Expect.isTrue(a1 is !B);
-  Expect.isTrue(a1 is !C);
-}
diff --git a/tests/compiler/dart2js_foreign/native_class_with_dart_methods_test.dart b/tests/compiler/dart2js_foreign/native_class_with_dart_methods_test.dart
deleted file mode 100644
index 09ec690..0000000
--- a/tests/compiler/dart2js_foreign/native_class_with_dart_methods_test.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Additional Dart code may be 'placed on' hidden native classes.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-
-  var _field;
-
-  int get X => _field;
-  void set X(int x) { _field = x; }
-
-  int method(int z) => _field + z;
-}
-
-@native A makeA() { return new A(); }
-
-@Native("""
-function A() {}
-makeA = function(){return new A;};
-""")
-void setup();
-
-
-main() {
-  setup();
-
-  var a = makeA();
-
-  a.X = 100;
-  Expect.equals(100, a.X);
-  Expect.equals(150, a.method(50));
-}
diff --git a/tests/compiler/dart2js_foreign/native_closure_identity_test.dart b/tests/compiler/dart2js_foreign/native_closure_identity_test.dart
deleted file mode 100644
index cca3588..0000000
--- a/tests/compiler/dart2js_foreign/native_closure_identity_test.dart
+++ /dev/null
@@ -1,75 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-typedef void MyFunctionType();
-
-@Native("*A")
-class A {
-  @native setClosure(MyFunctionType f);
-  @native check(MyFunctionType f);
-  @native invoke();
-}
-
-@native makeA() { return new A(); }
-
-@Native("""
-function A() {}
-A.prototype.setClosure = function(f) { this.f = f; };
-A.prototype.check = function(f) { return this.f === f; };
-A.prototype.invoke = function() { return this.f(); };
-makeA = function(){return new A;};
-""")
-void setup();
-
-var staticClosure;
-staticMethod() => 42;
-
-class B {
-  var instanceClosure;
-  instanceMethod() => 43;
-}
-
-checkUntyped(a, closure) {
-  a.setClosure(closure);
-  Expect.isTrue(a.check(closure));
-  Expect.equals(closure(), a.invoke());
-}
-
-checkTyped(A a, MyFunctionType closure) {
-  a.setClosure(closure);
-  Expect.isTrue(a.check(closure));
-  Expect.equals(closure(), a.invoke());
-}
-
-main() {
-  setup();
-
-  staticClosure = () => 44;
-  B b = new B();
-  b.instanceClosure = () => 45;
-
-  closureStatement() => 46;
-  var closureExpression = () => 47;
-
-  checkUntyped(makeA(), staticClosure);
-  checkTyped(makeA(), staticClosure);
-
-  checkUntyped(makeA(), staticMethod);
-  checkTyped(makeA(), staticMethod);
-
-  checkUntyped(makeA(), b.instanceClosure);
-  checkTyped(makeA(), b.instanceClosure);
-
-  checkUntyped(makeA(), b.instanceMethod);
-  checkTyped(makeA(), b.instanceMethod);
-
-  checkUntyped(makeA(), closureStatement);
-  checkTyped(makeA(), closureStatement);
-
-  checkUntyped(makeA(), closureExpression);
-  checkTyped(makeA(), closureExpression);
-}
diff --git a/tests/compiler/dart2js_foreign/native_exceptions1_test.dart b/tests/compiler/dart2js_foreign/native_exceptions1_test.dart
deleted file mode 100644
index 25ca222..0000000
--- a/tests/compiler/dart2js_foreign/native_exceptions1_test.dart
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test that hidden native exception classes can be marked as existing.
-//
-// To infer which native hidden types exist, we need
-//   (1) return types of native methods and getters
-//   (2) argument types of callbacks
-//   (3) exceptions thrown by the operation.
-//
-// (1) and (2) can be achieved by having nicely typed native methods, but there
-// is no place in the Dart language to communicate (3).  So we use the following
-// fake body technique.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-// The exception type.
-@Native("*E")
-class E {
-  @native E._used();  // Bogus native constructor, called only from fake body.
-
-  final int code;
-}
-
-// Type with exception-throwing methods.
-@Native("*A")
-class A {
-  @native op(int x) {
-    // Fake body calls constructor to mark the exception class (E) as used.
-    throw new E._used();
-  }
-}
-
-// This class is here just so that a dynamic context is polymorphic.
-class B {
-  int get code => 666;
-  op(String x) => 123;
-}
-
-@native makeA();
-
-@Native("""
-// Ensure we are not relying on global names 'A' and 'E'.
-A = null;
-E = null;
-""")
-void setup1();
-
-@Native("""
-// This code is all inside 'setup2' and so not accesible from the global scope.
-function E(x){ this.code = x; }
-
-function A(){}
-A.prototype.op = function (x) {
-  if (x & 1) throw new E(100);
-  return  x / 2;
-};
-makeA = function(){return new A};
-""")
-void setup2();
-
-int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
-
-main() {
-  setup1();
-  setup2();
-
-  var things = [makeA(), new B()];
-  var a = things[inscrutable(0)];
-  var b = things[inscrutable(1)];
-
-  Expect.equals(25, a.op(50));
-  Expect.equals(123, b.op('hello'));
-  Expect.equals(666, b.code);
-
-  bool threw = false;
-  try {
-    var x = a.op(51);
-  } catch (e) {
-    threw = true;
-    Expect.equals(100, e.code);
-    Expect.isTrue(e is E);
-  }
-  Expect.isTrue(threw);
-
-  // Again, but with statically typed receivers.
-  A aa = a;
-  B bb = b;
-
-  Expect.equals(25, aa.op(50));
-  Expect.equals(123, bb.op('hello'));
-  Expect.equals(666, bb.code);
-
-  threw = false;
-  try {
-    var x = aa.op(51);
-  } on E catch (e) {
-    threw = true;
-    Expect.equals(100, e.code);
-    Expect.isTrue(e is E);
-  }
-  Expect.isTrue(threw);
-}
diff --git a/tests/compiler/dart2js_foreign/native_field_rename_1_test.dart b/tests/compiler/dart2js_foreign/native_field_rename_1_test.dart
deleted file mode 100644
index a7b7f51..0000000
--- a/tests/compiler/dart2js_foreign/native_field_rename_1_test.dart
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// A native method prevents other members from having that name, including
-// fields.  However, native fields keep their name.  The implication: a getter
-// for the field must be based on the field's name, not the field's jsname.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  int key;                    //  jsname is 'key'
-  int getKey() => key;
-}
-
-class B {
-  int key;                    //  jsname is not 'key'
-  B([this.key = 222]);
-  int getKey() => key;
-}
-
-@Native("*X")
-class X {
-  @Native('key') int native_key_method();
-  // This should cause B.key to be renamed, but not A.key.
-
-  @natve('key') int key();
-}
-
-@native A makeA();
-@native X makeX();
-
-
-@Native("""
-// This code is all inside 'setup' and so not accesible from the global scope.
-function A(){ this.key = 111; }
-A.prototype.getKey = function(){return this.key;};
-
-function X(){}
-X.prototype.key = function(){return 666;};
-
-makeA = function(){return new A};
-makeX = function(){return new X};
-""")
-void setup();
-
-testDynamic() {
-  var things = [makeA(), new B(), makeX()];
-  var a = things[0];
-  var b = things[1];
-  var x = things[2];
-
-  Expect.equals(111, a.key);
-  Expect.equals(222, b.key);
-  Expect.equals(111, a.getKey());
-  Expect.equals(222, b.getKey());
-
-
-  Expect.equals(666, x.native_key_method());
-  Expect.equals(666, x.key());
-  // The getter for the closurized member must also have the right name.
-  var fn = x.key;
-  Expect.equals(666, fn());
-}
-
-testTyped() {
-  A a = makeA();
-  B b = new B();
-  X x = makeX();
-
-  Expect.equals(666, x.native_key_method());
-  Expect.equals(111, a.key);
-  Expect.equals(222, b.key);
-  Expect.equals(111, a.getKey());
-  Expect.equals(222, b.getKey());
-}
-
-main() {
-  setup();
-
-  testTyped();
-  testDynamic();
-}
diff --git a/tests/compiler/dart2js_foreign/native_field_rename_2_test.dart b/tests/compiler/dart2js_foreign/native_field_rename_2_test.dart
deleted file mode 100644
index a920236..0000000
--- a/tests/compiler/dart2js_foreign/native_field_rename_2_test.dart
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// A native method prevents other members from having that name, including
-// fields.  However, native fields keep their name.  The implication: a getter
-// for the field must be based on the field's name, not the field's jsname.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-abstract class I {
-  int key;
-}
-
-@Native("*A")
-class A implements I  {
-  int key;                    //  jsname is 'key'
-  int getKey() => key;
-}
-
-class B implements I {
-  int key;                    //  jsname is not 'key'
-  B([this.key = 222]);
-  int getKey() => key;
-}
-
-@Native("*X")
-class X {
-  @Native('key') int native_key_method();
-  // This should cause B.key to be renamed, but not A.key.
-  @Native('key') int key();
-}
-
-@native A makeA();
-@native X makeX();
-
-
-@Native("""
-// This code is all inside 'setup' and so not accesible from the global scope.
-function A(){ this.key = 111; }
-A.prototype.getKey = function(){return this.key;};
-
-function X(){}
-X.prototype.key = function(){return 666;};
-
-makeA = function(){return new A};
-makeX = function(){return new X};
-""")
-void setup();
-
-testDynamic() {
-  var things = [makeA(), new B(), makeX()];
-  var a = things[0];
-  var b = things[1];
-  var x = things[2];
-
-  Expect.equals(111, a.key);
-  Expect.equals(222, b.key);
-  Expect.equals(111, a.getKey());
-  Expect.equals(222, b.getKey());
-
-  Expect.equals(666, x.native_key_method());
-  Expect.equals(666, x.key());
-  var fn = x.key;
-  Expect.equals(666, fn());
-}
-
-testPartial() {
-  var things = [makeA(), new B(), makeX()];
-  I a = things[0];
-  I b = things[1];
-
-  // All subtypes of I have a field 'key'. The compiler might be tempted to
-  // generate a direct property access, but that will fail since one of the
-  // fields is renamed.  A getter call is required here.
-  Expect.equals(111, a.key);
-  Expect.equals(222, b.key);
-}
-
-testTyped() {
-  A a = makeA();
-  B b = new B();
-  X x = makeX();
-
-  Expect.equals(666, x.native_key_method());
-  Expect.equals(111, a.key);
-  Expect.equals(222, b.key);
-  Expect.equals(111, a.getKey());
-  Expect.equals(222, b.getKey());
-}
-
-main() {
-  setup();
-
-  testTyped();
-  testPartial();
-  testDynamic();
-}
diff --git a/tests/compiler/dart2js_foreign/native_library_same_name_used_lib1.dart b/tests/compiler/dart2js_foreign/native_library_same_name_used_lib1.dart
deleted file mode 100644
index 35ecf2f..0000000
--- a/tests/compiler/dart2js_foreign/native_library_same_name_used_lib1.dart
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// 'I' is the name of an abstract class and the name of the native class.
-
-library native_library_same_name_used_lib1;
-
-import 'native_library_same_name_used_lib2.dart';
-
-abstract class I {
-  I read();
-  write(I x);
-}
-
-@native makeI() { new Impl(); }  // Hint Impl is created by makeI.
diff --git a/tests/compiler/dart2js_foreign/native_library_same_name_used_lib2.dart b/tests/compiler/dart2js_foreign/native_library_same_name_used_lib2.dart
deleted file mode 100644
index 431cffc..0000000
--- a/tests/compiler/dart2js_foreign/native_library_same_name_used_lib2.dart
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Native implementation.
-
-library lib2;
-import 'native_library_same_name_used_lib1.dart';  // To get abstract class I.
-import 'native_metadata.dart';
-
-// Native impl has same name as abstract class.
-@Native("*I")
-class Impl implements I  {
-  @native Impl read();
-  @native write(Impl x);
-}
diff --git a/tests/compiler/dart2js_foreign/native_library_same_name_used_test.dart b/tests/compiler/dart2js_foreign/native_library_same_name_used_test.dart
deleted file mode 100644
index a8af518..0000000
--- a/tests/compiler/dart2js_foreign/native_library_same_name_used_test.dart
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test for correct hidden native class when abstract class has same name.
-
-library main;
-import "package:expect/expect.dart";
-import 'native_library_same_name_used_lib1.dart';
-import 'native_metadata.dart';
-
-@Native("""
-  // This code is all inside 'setup' and so not accesible from the global scope.
-  function I(){}
-  I.prototype.read = function() { return this._x; };
-  I.prototype.write = function(x) { this._x = x; };
-  makeI = function(){return new I};
-""")
-void setup();
-
-// A pure Dart implementation of I.
-
-class ProxyI implements I {
-  ProxyI b;
-  ProxyI read() { return b; }
-  write(ProxyI x) { b = x; }
-}
-
-main() {
-  setup();
-
-  var a1 = makeI();
-  var a2 = makeI();
-  var b1 = new ProxyI();
-  var b2 = new ProxyI();
-  var ob = new Object();
-
-  Expect.isFalse(ob is I,      'ob is I');
-  Expect.isFalse(ob is ProxyI, 'ob is ProxyI');
-
-  Expect.isTrue(b1 is I,       'b1 is I');
-  Expect.isTrue(b1 is ProxyI,  'b1 is ProxyI');
-
-  Expect.isTrue(a1 is I,       'a1 is I');
-  Expect.isFalse(a1 is ProxyI, 'a1 is ProxyI');
-}
diff --git a/tests/compiler/dart2js_foreign/native_literal_class_test.dart b/tests/compiler/dart2js_foreign/native_literal_class_test.dart
deleted file mode 100644
index 9bb3ec2..0000000
--- a/tests/compiler/dart2js_foreign/native_literal_class_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("= {log: function() { return 42 } }")
-class A {
-  @native void log();
-}
-
-@Native("""
-  return A;
-""")
-getA();
-
-bar() {
-  new A();
-}
-
-main() {
-  var a = getA();
-  // Make a call to bar to make sure A gets generated.
-  if (a is int) bar();
-  Expect.equals(42, a.log());
-}
diff --git a/tests/compiler/dart2js_foreign/native_metadata.dart b/tests/compiler/dart2js_foreign/native_metadata.dart
deleted file mode 100644
index e3a513f..0000000
--- a/tests/compiler/dart2js_foreign/native_metadata.dart
+++ /dev/null
@@ -1,12 +0,0 @@
-// 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 native_metadata;
-
-class Native {
-  final String info;
-  const Native(this.info);
-}
-
-const Native native = const Native(null);
diff --git a/tests/compiler/dart2js_foreign/native_method_rename1_test.dart b/tests/compiler/dart2js_foreign/native_method_rename1_test.dart
deleted file mode 100644
index 9e229a8..0000000
--- a/tests/compiler/dart2js_foreign/native_method_rename1_test.dart
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test the feature where the native string declares the native method's name.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  @Native('fooA') int foo();
-  @Native('barA') int bar();
-  @Native('bazA') int baz();
-}
-
-@native A makeA();
-
-class B {
-  int bar([x]) => 800;
-  int baz() => 900;
-}
-
-@Native("""
-// This code is all inside 'setup' and so not accesible from the global scope.
-function A(){}
-A.prototype.fooA = function(){return 100;};
-A.prototype.barA = function(){return 200;};
-A.prototype.bazA = function(){return 300;};
-
-makeA = function(){return new A};
-""")
-void setup();
-
-
-testDynamic() {
-  setup();
-
-  var things = [makeA(), new B()];
-  var a = things[0];
-  var b = things[1];
-
-  Expect.equals(100, a.foo());
-  Expect.equals(200, a.bar());
-  Expect.equals(300, a.baz());
-  Expect.equals(800, b.bar());
-  Expect.equals(900, b.baz());
-}
-
-testTyped() {
-  A a = makeA();
-  B b = new B();
-
-  Expect.equals(100, a.foo());
-  Expect.equals(200, a.bar());
-  Expect.equals(300, a.baz());
-  Expect.equals(800, b.bar());
-  Expect.equals(900, b.baz());
-}
-
-main() {
-  setup();
-  testDynamic();
-  testTyped();
-}
-
-expectNoSuchMethod(action, note) {
-  bool caught = false;
-  try {
-    action();
-  } catch (ex) {
-    caught = true;
-    Expect.isTrue(ex is NoSuchMethodError, note);
-  }
-  Expect.isTrue(caught, note);
-}
diff --git a/tests/compiler/dart2js_foreign/native_method_rename2_test.dart b/tests/compiler/dart2js_foreign/native_method_rename2_test.dart
deleted file mode 100644
index 9258aa6..0000000
--- a/tests/compiler/dart2js_foreign/native_method_rename2_test.dart
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test the feature where the native string declares the native method's name.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  @Native('fooA')
-  int foo();
-}
-
-@Native("*B")
-class B extends A  {
-  @Native('fooB')
-  int foo();
-}
-
-@native makeA();
-@native makeB();
-
-@Native("""
-// This code is all inside 'setup' and so not accesible from the global scope.
-function inherits(child, parent) {
-  if (child.prototype.__proto__) {
-    child.prototype.__proto__ = parent.prototype;
-  } else {
-    function tmp() {};
-    tmp.prototype = parent.prototype;
-    child.prototype = new tmp();
-    child.prototype.constructor = child;
-  }
-}
-function A(){}
-A.prototype.fooA = function(){return 100;};
-function B(){}
-inherits(B, A);
-B.prototype.fooB = function(){return 200;};
-
-makeA = function(){return new A};
-makeB = function(){return new B};
-""")
-void setup();
-
-testDynamic() {
-  var things = [makeA(), makeB()];
-  var a = things[0];
-  var b = things[1];
-
-  Expect.equals(100, a.foo());
-  Expect.equals(200, b.foo());
-
-  expectNoSuchMethod((){ a.fooA(); }, 'fooA should be invisible on A');
-  expectNoSuchMethod((){ b.fooA(); }, 'fooA should be invisible on B');
-
-  expectNoSuchMethod((){ a.fooB(); }, 'fooB should be absent on A');
-  expectNoSuchMethod((){ b.fooB(); }, 'fooA should be invisible on B');
-}
-
-testTyped() {
-  A a = makeA();
-  B b = makeB();
-
-  Expect.equals(100, a.foo());
-  Expect.equals(200, b.foo());
-}
-
-main() {
-  setup();
-
-  testDynamic();
-  testTyped();
-}
-
-expectNoSuchMethod(action, note) {
-  bool caught = false;
-  try {
-    action();
-  } catch (ex) {
-    caught = true;
-    Expect.isTrue(ex is NoSuchMethodError, note);
-  }
-  Expect.isTrue(caught, note);
-}
diff --git a/tests/compiler/dart2js_foreign/native_method_rename3_test.dart b/tests/compiler/dart2js_foreign/native_method_rename3_test.dart
deleted file mode 100644
index e0f5c71..0000000
--- a/tests/compiler/dart2js_foreign/native_method_rename3_test.dart
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test the feature where the native string declares the native method's name.
-// #3. The name does not get
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  @Native('fooA')
-  int foo();
-}
-
-@Native("*B")
-class B extends A  {
-  @Native('fooB')
-  int foo();
-  int fooA() => 333;
-}
-
-class Decoy {
-  int fooA() => 666;
-  int fooB() => 999;
-}
-
-@native makeA();
-@native makeB();
-
-
-@Native("""
-// This code is all inside 'setup' and so not accesible from the global scope.
-function inherits(child, parent) {
-  if (child.prototype.__proto__) {
-    child.prototype.__proto__ = parent.prototype;
-  } else {
-    function tmp() {};
-    tmp.prototype = parent.prototype;
-    child.prototype = new tmp();
-    child.prototype.constructor = child;
-  }
-}
-function A(){}
-A.prototype.fooA = function(){return 100;};
-function B(){}
-inherits(B, A);
-B.prototype.fooB = function(){return 200;};
-
-makeA = function(){return new A};
-makeB = function(){return new B};
-""")
-void setup();
-
-testDynamic() {
-  var things = [makeA(), makeB(), new Decoy()];
-  var a = things[0];
-  var b = things[1];
-  var d = things[2];
-
-  Expect.equals(100, a.foo());
-  Expect.equals(200, b.foo());
-  Expect.equals(666, d.fooA());
-  Expect.equals(999, d.fooB());
-
-  expectNoSuchMethod((){ a.fooA(); }, 'fooA should be invisible on A');
-  Expect.equals(333, b.fooA());
-
-  expectNoSuchMethod((){ a.fooB(); }, 'fooB should be absent on A');
-  expectNoSuchMethod((){ b.fooB(); }, 'fooA should be invisible on B');
-}
-
-testTyped() {
-  A a = makeA();
-  B b = makeB();
-  Decoy d = new Decoy();
-
-  Expect.equals(100, a.foo());
-  Expect.equals(200, b.foo());
-  Expect.equals(666, d.fooA());
-  Expect.equals(999, d.fooB());
-}
-
-main() {
-  setup();
-
-  testDynamic();
-  testTyped();
-}
-
-expectNoSuchMethod(action, note) {
-  bool caught = false;
-  try {
-    action();
-  } on NoSuchMethodError catch (ex) {
-    caught = true;
-    Expect.isTrue(ex is NoSuchMethodError, note);
-  }
-  Expect.isTrue(caught, note);
-}
diff --git a/tests/compiler/dart2js_foreign/native_method_with_keyword_name_test.dart b/tests/compiler/dart2js_foreign/native_method_with_keyword_name_test.dart
deleted file mode 100644
index 3786647..0000000
--- a/tests/compiler/dart2js_foreign/native_method_with_keyword_name_test.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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.
-
-// Make sure we can have a native with a name that is a JavaScript keyword.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  @native int delete();
-}
-
-@native A makeA() { return new A(); }
-
-@Native("""
-function A() {}
-A.prototype.delete = function() { return 87; };
-
-makeA = function(){return new A;};
-""")
-void setup();
-
-
-main() {
-  setup();
-
-  var a = makeA();
-  Expect.equals(87, a.delete());
-  A aa = a;
-  Expect.equals(87, aa.delete());  
-}
diff --git a/tests/compiler/dart2js_foreign/native_missing_method1_test.dart b/tests/compiler/dart2js_foreign/native_missing_method1_test.dart
deleted file mode 100644
index d87878f..0000000
--- a/tests/compiler/dart2js_foreign/native_missing_method1_test.dart
+++ /dev/null
@@ -1,55 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-}
-
-@native makeA();
-
-@Native("""
-function A() {};
-A.prototype.foo = function() { return  42; }
-makeA = function() { return new A; }
-""")
-void setup();
-
-class B {
-  // We need to define a foo method so that Frog sees it. Because it's
-  // the only occurence of 'foo', Frog does not bother mangling the
-  // call sites. It thinks all calls will either go to this method, or
-  // throw a NoSuchMethodError.
-  foo() { return 42; }
-}
-
-typedContext() {
-  var things = [ makeA(), new B() ];
-  A a = things[0];
-  Expect.throws(() => a.foo(),
-                (e) => e is NoSuchMethodError);
-  Expect.throws(() => a.foo,
-                (e) => e is NoSuchMethodError);
-  Expect.throws(() => a.foo = 4,
-                (e) => e is NoSuchMethodError);
-}
-
-untypedContext() {
-  var things = [ makeA(), new B() ];
-  var a = things[0];
-  Expect.throws(() => a.foo(),
-                (e) => e is NoSuchMethodError);
-  Expect.throws(() => a.foo,
-                (e) => e is NoSuchMethodError);
-  Expect.throws(() => a.foo = 4,
-                (e) => e is NoSuchMethodError);
-}
-
-main() {
-  setup();
-  typedContext();
-  untypedContext();
-}
diff --git a/tests/compiler/dart2js_foreign/native_missing_method2_test.dart b/tests/compiler/dart2js_foreign/native_missing_method2_test.dart
deleted file mode 100644
index bd6bae4..0000000
--- a/tests/compiler/dart2js_foreign/native_missing_method2_test.dart
+++ /dev/null
@@ -1,57 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-}
-
-@native makeA();
-
-@Native("""
-function A() {};
-A.prototype.foo = function() { return  42; }
-makeA = function() { return new A; }
-""")
-void setup();
-
-class B {
-  foo() { return 42; }
-}
-
-class C {
-  // By having two 'foo' defined in the application, Frog will mangle
-  // all calls to 'foo', which makes this test pass.
-  foo(x) { return 43; }
-}
-
-typedContext() {
-  var things = [ makeA(), new B() ];
-  A a = things[0];
-  Expect.throws(() => a.foo(),
-                (e) => e is NoSuchMethodError);
-  Expect.throws(() => a.foo,
-                (e) => e is NoSuchMethodError);
-  Expect.throws(() => a.foo = 4,
-                (e) => e is NoSuchMethodError);
-}
-
-untypedContext() {
-  var things = [ makeA(), new B() ];
-  var a = things[0];
-  Expect.throws(() => a.foo(),
-                (e) => e is NoSuchMethodError);
-  Expect.throws(() => a.foo,
-                (e) => e is NoSuchMethodError);
-  Expect.throws(() => a.foo = 4,
-                (e) => e is NoSuchMethodError);
-}
-
-main() {
-  setup();
-  typedContext();
-  untypedContext();
-}
diff --git a/tests/compiler/dart2js_foreign/native_named_constructors2_test.dart b/tests/compiler/dart2js_foreign/native_named_constructors2_test.dart
deleted file mode 100644
index d00a779..0000000
--- a/tests/compiler/dart2js_foreign/native_named_constructors2_test.dart
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Hidden native class wwith named constructors and static methods.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-
-  factory A(int len) => _construct(len);
-
-  factory A.fromString(String s)  => _construct(s.length);
-
-  @Native(r'return makeA(a+b);')
-  factory A.nativeConstructor(int a, int b);
-
-  static A _construct(v) { return makeA(v); }
-
-  @Native('return this._x;')
-  foo();
-}
-
-@native makeA(v);
-
-@Native("""
-// This code is all inside 'setup' and so not accesible from the global scope.
-function A(arg) { this._x = arg; }
-makeA = function(arg) { return new A(arg); }
-""")
-void setup();
-
-main() {
-  setup();
-  var a1 = new A(100);
-  var a2 = new A.fromString('Hello');
-  var a3 = new A.nativeConstructor(100, 2);
-
-  Expect.equals(100, a1.foo());
-  Expect.equals(5, a2.foo());
-  Expect.equals(102, a3.foo());
-}
diff --git a/tests/compiler/dart2js_foreign/native_named_constructors3_test.dart b/tests/compiler/dart2js_foreign/native_named_constructors3_test.dart
deleted file mode 100644
index 0921f6e..0000000
--- a/tests/compiler/dart2js_foreign/native_named_constructors3_test.dart
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Hidden native class with factory constructors and NO static methods.
-// Regression test.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-
-  // No static methods in this class.
-
-  factory A(int len) => makeA(len);
-
-  factory A.fromString(String s)  => makeA(s.length);
-
-  @Native(r'return makeA(a+b);')
-  factory A.nativeConstructor(int a, int b);
-
-  @Native('return this._x;')
-  foo();
-}
-
-@native makeA(v);
-
-@Native("""
-// This code is all inside 'setup' and so not accesible from the global scope.
-function A(arg) { this._x = arg; }
-makeA = function(arg) { return new A(arg); }
-""")
-void setup();
-
-main() {
-  setup();
-  var a1 = new A(100);
-  var a2 = new A.fromString('Hello');
-  var a3 = new A.nativeConstructor(100, 2);
-
-  Expect.equals(100, a1.foo());
-  Expect.equals(5, a2.foo());
-  Expect.equals(102, a3.foo());
-}
diff --git a/tests/compiler/dart2js_foreign/native_no_such_method_exception2_test.dart b/tests/compiler/dart2js_foreign/native_no_such_method_exception2_test.dart
deleted file mode 100644
index 894a462..0000000
--- a/tests/compiler/dart2js_foreign/native_no_such_method_exception2_test.dart
+++ /dev/null
@@ -1,53 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-}
-
-@Native("*B")
-class B extends A  {
-  @native foo();
-}
-
-@native makeA();
-@native makeB();
-
-@Native("""
-function inherits(child, parent) {
-  if (child.prototype.__proto__) {
-    child.prototype.__proto__ = parent.prototype;
-  } else {
-    function tmp() {};
-    tmp.prototype = parent.prototype;
-    child.prototype = new tmp();
-    child.prototype.constructor = child;
-  }
-}
-  function A() {}
-  function B() {}
-  inherits(B, A);
-  makeA = function() { return new A; }
-  makeB = function() { return new B; }
-  B.prototype.foo = function() { return 42; }
-""")
-setup();
-
-main() {
-  setup();
-  var a = makeA();
-  var exception;
-  try {
-    a.foo();
-  } on NoSuchMethodError catch (e) {
-    exception = e;
-  }
-  Expect.isNotNull(exception);
-
-  var b = makeB();
-  Expect.equals(42, b.foo());
-}
diff --git a/tests/compiler/dart2js_foreign/native_no_such_method_exception3_test.dart b/tests/compiler/dart2js_foreign/native_no_such_method_exception3_test.dart
deleted file mode 100644
index 1c50a0a..0000000
--- a/tests/compiler/dart2js_foreign/native_no_such_method_exception3_test.dart
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  bar() => 42;
-}
-
-@Native("*B")
-class B {
-  foo() => 42;
-}
-
-class C {
-  static create() => new C();
-  noSuchMethod(x, y) => "$x:$y";
-}
-
-@native makeA();
-
-@Native("""
-  function A() {}
-  makeA = function() { return new A; }
-""")
-setup();
-
-main() {
-  setup();
-  var a = makeA();
-  a.bar();
-  var exception;
-  try {
-    a.foo();
-  } on NoSuchMethodError catch (e) {
-    exception = e;
-  }
-  Expect.isNotNull(exception);
-  var c = C.create();
-  Expect.equals("foo:[1, 2]", c.foo(1, 2));
-  Expect.equals("foo:[3, 4, 5]", c.foo(3, 4, 5));
-}
diff --git a/tests/compiler/dart2js_foreign/native_no_such_method_exception4_test.dart b/tests/compiler/dart2js_foreign/native_no_such_method_exception4_test.dart
deleted file mode 100644
index 182cbc6..0000000
--- a/tests/compiler/dart2js_foreign/native_no_such_method_exception4_test.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  bar() => 42;
-  noSuchMethod(x,y) => "native($x:$y)";
-}
-
-@Native("*B")
-class B {
-  baz() => 42;
-}
-
-@native makeA();
-
-@Native("""
-  function A() {}
-  makeA = function() { return new A; }
-""")
-setup();
-
-main() {
-  setup();
-  var a = makeA();
-  a.bar();
-  Expect.equals("native(foo:[1, 2])", a.foo(1, 2));
-  Expect.equals("native(baz:[3, 4, 5])", a.baz(3, 4, 5));
-}
diff --git a/tests/compiler/dart2js_foreign/native_no_such_method_exception5_test.dart b/tests/compiler/dart2js_foreign/native_no_such_method_exception5_test.dart
deleted file mode 100644
index 15c9cad..0000000
--- a/tests/compiler/dart2js_foreign/native_no_such_method_exception5_test.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  bar() => 42;
-  noSuchMethod(x,y) => "native($x:$y)";
-}
-
-@Native("*B")
-class B {
-  baz() => 42;
-}
-
-class C {
-  static create() => new C();
-  noSuchMethod(x, y) => "$x:$y";
-}
-
-@native makeA();
-
-@Native("""
-  function A() {}
-  makeA = function() { return new A; }
-""")
-setup();
-
-main() {
-  setup();
-  var a = makeA();
-  a.bar();
-  Expect.equals("native(foo:[1, 2])", a.foo(1, 2));
-  Expect.equals("native(baz:[3, 4, 5])", a.baz(3, 4, 5));
-  var c = C.create();
-  Expect.equals("foo:[6]", c.foo(6));
-}
diff --git a/tests/compiler/dart2js_foreign/native_no_such_method_exception_test.dart b/tests/compiler/dart2js_foreign/native_no_such_method_exception_test.dart
deleted file mode 100644
index 7459441..0000000
--- a/tests/compiler/dart2js_foreign/native_no_such_method_exception_test.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  bar() => 42;
-}
-
-@Native("*B")
-class B {
-  foo() => 42;
-}
-
-@native makeA();
-
-@Native("""
-  function A() {}
-  makeA = function() { return new A; }
-""")
-setup();
-
-main() {
-  setup();
-  var a = makeA();
-  a.bar();
-  var exception;
-  try {
-    a.foo();
-  } on NoSuchMethodError catch (e) {
-    exception = e;
-  }
-  Expect.isNotNull(exception);
-}
diff --git a/tests/compiler/dart2js_foreign/native_null_closure_test.dart b/tests/compiler/dart2js_foreign/native_null_closure_test.dart
deleted file mode 100644
index b6ac177..0000000
--- a/tests/compiler/dart2js_foreign/native_null_closure_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-typedef void MyFunctionType();
-
-@Native("*A")
-class A {
-  @native setClosure(MyFunctionType f);
-  @native check(MyFunctionType f);
-  @native invoke();
-}
-
-@native makeA() { return new A(); }
-
-@Native("""
-function A() {}
-A.prototype.setClosure = function(f) { this.f = f; };
-A.prototype.check = function(f) { return this.f === f; };
-A.prototype.invoke = function() { return this.f(); };
-makeA = function(){return new A;};
-""")
-void setup();
-
-
-main() {
-  setup();
-  A a = makeA();
-  a.setClosure(null);
-  Expect.isTrue(a.check(null));
-  bool caughtException = false;
-  try {
-    a.invoke();
-  } on Exception catch (e) {
-    caughtException = true;
-  }
-  Expect.isTrue(caughtException);
-}
diff --git a/tests/compiler/dart2js_foreign/native_null_test.dart b/tests/compiler/dart2js_foreign/native_null_test.dart
deleted file mode 100644
index 540d994..0000000
--- a/tests/compiler/dart2js_foreign/native_null_test.dart
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test that parameters in native methods are not mangled. This test is needed
-// until we change all libraries to using the JS foreign element.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  @Native("return null;")
-  returnNull();
-  @Native("return undefined;")
-  returnUndefined();
-  @Native("return '';")
-  returnEmptyString();
-  @Native("return 0;")
-  returnZero();
-}
-
-@native A makeA();
-
-@Native("""
-function A() {}
-makeA = function(){return new A;};
-""")
-void setup();
-
-
-main() {
-  setup();
-  A a = makeA();
-  Expect.equals(null, a.returnNull());
-  Expect.equals(null, a.returnUndefined());
-
-  Expect.equals('', a.returnEmptyString());
-  Expect.isTrue(a.returnEmptyString().isEmpty);
-  Expect.isTrue(a.returnEmptyString() is String);
-
-  Expect.isTrue(a.returnZero() is int);
-  Expect.equals(0, a.returnZero());
-}
diff --git a/tests/compiler/dart2js_foreign/native_parameter_names_test.dart b/tests/compiler/dart2js_foreign/native_parameter_names_test.dart
deleted file mode 100644
index 4bf7084..0000000
--- a/tests/compiler/dart2js_foreign/native_parameter_names_test.dart
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test that parameters in native methods are not mangled. This test is needed
-// until we change all libraries to using the JS foreign element.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-  @Native("return name;")
-  foo(name);
-  @Native("return undefined;")
-  bar(undefined);
-}
-
-@native A makeA();
-
-@Native("""
-function A() {}
-makeA = function(){return new A;};
-""")
-void setup();
-
-
-main() {
-  setup();
-  A a = makeA();
-  Expect.equals(42, a.foo(42));
-  Expect.equals(42, a.bar(42));
-}
diff --git a/tests/compiler/dart2js_foreign/native_property_test.dart b/tests/compiler/dart2js_foreign/native_property_test.dart
deleted file mode 100644
index e7abbda8..0000000
--- a/tests/compiler/dart2js_foreign/native_property_test.dart
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Properties on hidden native classes.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {
-
-  // Setters and getters should be similar to these methods:
-  @Native('return this._x;')
-  int getX();
-
-  @Native('this._x = value;')
-  void setX(int value);
-
-  @native
-  int get X;
-
-  @native
-  set X(int value);
-
-  @native
-  int get Y;
-
-  @native
-  set Y(int value);
-
-  @Native('return this._z;')
-  int get Z;
-
-  @Native('this._z = value;')
-  set Z(int value);
-}
-
-@native
-A makeA() { return new A(); }
-
-@Native("""
-function A() {}
-
-Object.defineProperty(A.prototype, "X", {
-  get: function () { return this._x; },
-  set: function (v) { this._x = v; }
-});
-
-makeA = function(){return new A;};
-""")
-void setup();
-
-
-main() {
-  setup();
-
-  var a = makeA();
-
-  a.setX(5);
-  Expect.equals(5, a.getX());
-
-  a.X = 10;
-  a.Y = 20;
-  a.Z = 30;
-
-  Expect.equals(10, a.X);
-  Expect.equals(20, a.Y);
-  Expect.equals(30, a.Z);
-}
diff --git a/tests/compiler/dart2js_foreign/native_to_string_test.dart b/tests/compiler/dart2js_foreign/native_to_string_test.dart
deleted file mode 100644
index 69bcc8b..0000000
--- a/tests/compiler/dart2js_foreign/native_to_string_test.dart
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*A")
-class A {}
-@native makeA();
-
-@Native("""
-function A() {}
-makeA = function(){return new A;};
-""")
-void setup();
-
-
-main() {
-  setup();
-  Expect.isTrue(makeA().toString() is String);
-}
diff --git a/tests/compiler/dart2js_foreign/native_use_native_name_in_table_test.dart b/tests/compiler/dart2js_foreign/native_use_native_name_in_table_test.dart
deleted file mode 100644
index cc1d668..0000000
--- a/tests/compiler/dart2js_foreign/native_use_native_name_in_table_test.dart
+++ /dev/null
@@ -1,57 +0,0 @@
-// 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.
-
-// Test that we put native names and not Dart names into the dynamic
-// dispatch table.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-@Native("*NativeA")
-class A {
-  @native foo();
-}
-
-@Native("*NativeB")
-class B extends A  {
-}
-
-@native A makeA() { return new A(); }
-@native B makeB() { return new B(); }
-
-@Native("""
-function inherits(child, parent) {
-  if (child.prototype.__proto__) {
-    child.prototype.__proto__ = parent.prototype;
-  } else {
-    function tmp() {}; 
-    tmp.prototype = parent.prototype;
-    child.prototype = new tmp();
-    child.prototype.constructor = child;
-  }
-}
-function NativeA() {}
-function NativeB() {}
-inherits(NativeB, NativeA);
-NativeA.prototype.foo = function() { return 42; };
-
-makeA = function(){return new NativeA;};
-makeB = function(){return new NativeB;};
-""")
-void setup();
-
-
-main() {
-  setup();
-
-  var a = makeA();
-  Expect.equals(42, a.foo());
-  A aa = a;
-  Expect.equals(42, aa.foo());  
-
-  var b = makeB();
-  Expect.equals(42, b.foo());
-  B bb = b;
-  Expect.equals(42, bb.foo());  
-}
diff --git a/tests/compiler/dart2js_foreign/native_window1_test.dart b/tests/compiler/dart2js_foreign/native_window1_test.dart
deleted file mode 100644
index 8694830..0000000
--- a/tests/compiler/dart2js_foreign/native_window1_test.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-abstract class Window {
-  final int document;
-}
-
-// Defining this global object makes Frog eager on optimizing
-// call sites where the receiver is typed 'Window'.
-@Native("@*DOMWindow")
-class _DOMWindowJs implements Window  {
-  final int document;
-}
-
-class Win implements Window {
-}
-
-main() {
-  // By typing this variable to 'Window', Frog will optimize calls on
-  // it.
-  Window win = new Win();
-  Expect.throws(() => win.document,
-                (e) => e is NoSuchMethodError);
-}
diff --git a/tests/compiler/dart2js_foreign/native_window2_test.dart b/tests/compiler/dart2js_foreign/native_window2_test.dart
deleted file mode 100644
index 0cb3a08..0000000
--- a/tests/compiler/dart2js_foreign/native_window2_test.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-abstract class Window {
-  final int document;
-}
-
-// Defining this global object makes Frog eager on optimizing
-// call sites where the receiver is typed 'Window'.
-@Native("@*DOMWindow")
-class _DOMWindowJs implements Window  {
-  final int document;
-}
-
-class Win implements Window {
-}
-
-main() {
-  // By not typing the variable, Frog does not try to optimize calls
-  // on it.
-  var win = new Win();
-  Expect.throws(() => win.document,
-                (e) => e is NoSuchMethodError);
-}
diff --git a/tests/compiler/dart2js_foreign/native_wrapping_function2_test.dart b/tests/compiler/dart2js_foreign/native_wrapping_function2_test.dart
deleted file mode 100644
index 90e8caa..0000000
--- a/tests/compiler/dart2js_foreign/native_wrapping_function2_test.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-typedef void Callback0();
-typedef void Callback1(arg1);
-typedef void Callback2(arg1, arg2);
-
-@Native("*A")
-class A {
-  @Native("return closure();")
-  foo0(Callback0 closure);
-
-  @Native("return closure(arg1);")
-  foo1(Callback1 closure, arg1);
-
-  @Native("return closure(arg1, arg2);")
-  foo2(Callback2 closure, arg1, arg2);
-
-  @Native("return closure == (void 0) ? 42 : closure();")
-  foo3([Callback0 closure]);
-}
-
-@native makeA();
-
-@Native("""
-function A() {}
-makeA = function(){return new A;};
-""")
-void setup();
-
-main() {
-  setup();
-  var a = makeA();
-  Expect.equals(42, a.foo0(() => 42));
-  Expect.equals(43, a.foo1((arg1) => arg1, 43));
-  Expect.equals(44, a.foo2((arg1, arg2) => arg1 + arg2, 21, 23));
-  Expect.equals(42, a.foo3());
-  Expect.equals(43, a.foo3(() => 43));
-
-  A aa = a;
-  Expect.equals(42, aa.foo0(() => 42));
-  Expect.equals(43, aa.foo1((arg1) => arg1, 43));
-  Expect.equals(44, aa.foo2((arg1, arg2) => arg1 + arg2, 21, 23));
-  Expect.equals(42, aa.foo3());
-  Expect.equals(43, aa.foo3(() => 43));
-}
diff --git a/tests/compiler/dart2js_foreign/native_wrapping_function3_test.dart b/tests/compiler/dart2js_foreign/native_wrapping_function3_test.dart
deleted file mode 100644
index 3b994d0..0000000
--- a/tests/compiler/dart2js_foreign/native_wrapping_function3_test.dart
+++ /dev/null
@@ -1,56 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-typedef void Callback0();
-typedef void Callback1(arg1);
-typedef void Callback2(arg1, arg2);
-
-@Native("*A")
-class A {
-  @native foo1(Callback1 closure, [arg1 = 0]);
-  @native foo2(Callback2 closure, [arg1 = 0, arg2 = 1]);
-}
-
-@native makeA();
-
-@Native("""
-function A() {}
-A.prototype.foo1 = function(closure, arg1) { return closure(arg1); };
-A.prototype.foo2 = function(closure, arg1, arg2) {
-  return closure(arg1, arg2);
-};
-makeA = function(){return new A;};
-""")
-void setup();
-
-
-main() {
-  setup();
-  var a = makeA();
-  Expect.equals(43, a.foo1((arg1) => arg1, 43));
-  Expect.equals(43, a.foo1((arg1) => arg1, arg1: 43));
-  Expect.equals(0, a.foo1((arg1) => arg1));
-
-  Expect.equals(44, a.foo2((arg1, arg2) => arg1 + arg2, 21, 23));
-  Expect.equals(22, a.foo2((arg1, arg2) => arg1 + arg2, 21));
-  Expect.equals(22, a.foo2((arg1, arg2) => arg1 + arg2, arg1: 21));
-  Expect.equals(21, a.foo2((arg1, arg2) => arg1 + arg2, arg2: 21));
-  Expect.equals(44, a.foo2((arg1, arg2) => arg1 + arg2, arg1: 21, arg2: 23));
-  Expect.equals(44, a.foo2((arg1, arg2) => arg1 - arg2, arg2: 22, arg1: 66));
-
-  A aa = a;
-  Expect.equals(43, aa.foo1((arg1) => arg1, 43));
-  Expect.equals(43, aa.foo1((arg1) => arg1, arg1: 43));
-  Expect.equals(0, aa.foo1((arg1) => arg1));
-
-  Expect.equals(44, aa.foo2((arg1, arg2) => arg1 + arg2, 21, 23));
-  Expect.equals(22, aa.foo2((arg1, arg2) => arg1 + arg2, 21));
-  Expect.equals(22, aa.foo2((arg1, arg2) => arg1 + arg2, arg1: 21));
-  Expect.equals(21, aa.foo2((arg1, arg2) => arg1 + arg2, arg2: 21));
-  Expect.equals(44, aa.foo2((arg1, arg2) => arg1 + arg2, arg1: 21, arg2: 23));
-  Expect.equals(44, aa.foo2((arg1, arg2) => arg1 - arg2, arg2: 22, arg1: 66));
-}
diff --git a/tests/compiler/dart2js_foreign/native_wrapping_function_test.dart b/tests/compiler/dart2js_foreign/native_wrapping_function_test.dart
deleted file mode 100644
index ec2057e..0000000
--- a/tests/compiler/dart2js_foreign/native_wrapping_function_test.dart
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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.
-
-import "package:expect/expect.dart";
-import 'native_metadata.dart';
-
-typedef void Callback0();
-typedef void Callback1(arg1);
-typedef void Callback2(arg1, arg2);
-
-@Native("*A")
-class A {
-  @native foo0(Callback0 closure);
-  @native foo1(Callback1 closure, arg1);
-  @native foo2(Callback2 closure, arg1, arg2);
-}
-
-@native makeA();
-
-@Native("""
-function A() {}
-A.prototype.foo0 = function(closure) { return closure(); };
-A.prototype.foo1 = function(closure, arg1) { return closure(arg1); };
-A.prototype.foo2 = function(closure, arg1, arg2) {
-  return closure(arg1, arg2);
-};
-makeA = function(){return new A;};
-""")
-void setup();
-
-
-main() {
-  setup();
-  var a = makeA();
-  Expect.equals(42, a.foo0(() => 42));
-  Expect.equals(43, a.foo1((arg1) => arg1, 43));
-  Expect.equals(44, a.foo2((arg1, arg2) => arg1 + arg2, 21, 23));
-
-  A aa = a;
-  Expect.equals(42, aa.foo0(() => 42));
-  Expect.equals(43, aa.foo1((arg1) => arg1, 43));
-  Expect.equals(44, aa.foo2((arg1, arg2) => arg1 + arg2, 21, 23));
-}
diff --git a/tests/compiler/dart2js_native/dart2js_native.status b/tests/compiler/dart2js_native/dart2js_native.status
index 0191a10..1daea78 100644
--- a/tests/compiler/dart2js_native/dart2js_native.status
+++ b/tests/compiler/dart2js_native/dart2js_native.status
@@ -9,6 +9,12 @@
 native_no_such_method_exception4_frog_test: Fail  # Issue 9631
 native_no_such_method_exception5_frog_test: Fail  # Issue 9631
 
+[ $compiler == dart2js && $unminified ]
+fake_thing_test: Fail # Issue 13010
+
+[ $compiler == dart2js && $minified ]
+fake_thing_test: Skip # Test relies on unminified names.
+
 [ $browser || $runtime == jsshell ]
 only_pass_on_d8_test: Fail, OK # This test should only pass on D8.
 
diff --git a/tests/compiler/dart2js_native/fake_thing_test.dart b/tests/compiler/dart2js_native/fake_thing_test.dart
new file mode 100644
index 0000000..aa3bb0f
--- /dev/null
+++ b/tests/compiler/dart2js_native/fake_thing_test.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2013, 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.
+
+import "package:expect/expect.dart";
+
+// Test that native objects cannot accidentally or maliciously be mistaken for
+// Dart objects.
+
+class Thing {
+}
+
+make1() native;
+make2() native;
+
+void setup() native r"""
+function A() {}
+A.prototype.$isThing = true;
+make1 = function(){return new A;};
+make2 = function(){return {$isThing: true}};
+""";
+
+var inscrutable;
+main() {
+  setup();
+  inscrutable = (x) => x;
+
+  var a = new Thing();
+  var b = make1();
+  var c = make2();
+  Expect.isTrue(inscrutable(a) is Thing);
+  Expect.isFalse(inscrutable(b) is Thing);
+  Expect.isFalse(inscrutable(c) is Thing);
+}
diff --git a/tests/corelib/map_test.dart b/tests/corelib/map_test.dart
index 4f48be4..c9ba29f 100644
--- a/tests/corelib/map_test.dart
+++ b/tests/corelib/map_test.dart
@@ -29,8 +29,25 @@
   testNumericKeys(new Map<num, String>());
   testNumericKeys(new HashMap());
   testNumericKeys(new HashMap<num, String>());
+  testNumericKeys(new HashMap(equals: identical));
+  testNumericKeys(new HashMap<num, String>(equals: identical));
   testNumericKeys(new LinkedHashMap());
   testNumericKeys(new LinkedHashMap<num, String>());
+
+  testNaNKeys(new Map());
+  testNaNKeys(new Map<num, String>());
+  testNaNKeys(new HashMap());
+  testNaNKeys(new HashMap<num, String>());
+  testNaNKeys(new LinkedHashMap());
+  testNaNKeys(new LinkedHashMap<num, String>());
+  // Identity maps fail the NaN-keys tests because the test assumes that
+  // NaN is not equal to NaN.
+
+  testIdentityMap(new HashMap(equals: identical));
+
+  testCustomMap(new HashMap(equals: myEquals, hashCode: myHashCode));
+
+  testIterationOrder(new LinkedHashMap());
 }
 
 
@@ -373,7 +390,10 @@
     Expect.equals(null, map[key]);
   }
   Expect.isTrue(map.isEmpty);
+}
 
+void testNaNKeys(Map map) {
+  Expect.isTrue(map.isEmpty);
   // Test NaN.
   var nan = double.NAN;
   Expect.isFalse(map.containsKey(nan));
@@ -407,3 +427,224 @@
   (length == 0 ? Expect.isTrue : Expect.isFalse)(map.isEmpty);
   (length != 0 ? Expect.isTrue : Expect.isFalse)(map.isNotEmpty);
 }
+
+
+testIdentityMap(Map map) {
+  Expect.isTrue(map.isEmpty);
+
+  var nan = double.NAN;
+  // TODO(11551): Remove guard when dart2js makes identical(NaN, NaN) true.
+  if (identical(nan, nan)) {
+    map[nan] = 42;
+    testLength(1, map);
+    Expect.isTrue(map.containsKey(nan));
+    Expect.equals(42, map[nan]);
+    map[nan] = 37;
+    testLength(1, map);
+    Expect.equals(37, map[nan]);
+    Expect.equals(37, map.remove(nan));
+    testLength(0, map);
+  }
+
+  Vampire v1 = const Vampire(1);
+  Vampire v2 = const Vampire(2);
+  Expect.isFalse(v1 == v1);
+  Expect.isFalse(v2 == v2);
+  Expect.isTrue(v2 == v1);  // Snob!
+
+  map[v1] = 1;
+  map[v2] = 2;
+  testLength(2, map);
+
+  Expect.isTrue(map.containsKey(v1));
+  Expect.isTrue(map.containsKey(v2));
+
+  Expect.equals(1, map[v1]);
+  Expect.equals(2, map[v2]);
+
+  Expect.equals(1, map.remove(v1));
+  testLength(1, map);
+  Expect.isFalse(map.containsKey(v1));
+  Expect.isTrue(map.containsKey(v2));
+
+  Expect.isNull(map.remove(v1));
+  Expect.equals(2, map.remove(v2));
+  testLength(0, map);
+
+  var eq01 = new Equalizer(0);
+  var eq02 = new Equalizer(0);
+  var eq11 = new Equalizer(1);
+  var eq12 = new Equalizer(1);
+  // Sanity.
+  Expect.equals(eq01, eq02);
+  Expect.equals(eq02, eq01);
+  Expect.equals(eq11, eq12);
+  Expect.equals(eq12, eq11);
+  Expect.notEquals(eq01, eq11);
+  Expect.notEquals(eq01, eq12);
+  Expect.notEquals(eq02, eq11);
+  Expect.notEquals(eq02, eq12);
+  Expect.notEquals(eq11, eq01);
+  Expect.notEquals(eq11, eq02);
+  Expect.notEquals(eq12, eq01);
+  Expect.notEquals(eq12, eq02);
+
+  map[eq01] = 0;
+  map[eq02] = 1;
+  map[eq11] = 2;
+  map[eq12] = 3;
+  testLength(4, map);
+
+  Expect.equals(0, map[eq01]);
+  Expect.equals(1, map[eq02]);
+  Expect.equals(2, map[eq11]);
+  Expect.equals(3, map[eq12]);
+
+  Expect.isTrue(map.containsKey(eq01));
+  Expect.isTrue(map.containsKey(eq02));
+  Expect.isTrue(map.containsKey(eq11));
+  Expect.isTrue(map.containsKey(eq12));
+
+  Expect.equals(1, map.remove(eq02));
+  Expect.equals(3, map.remove(eq12));
+  testLength(2, map);
+  Expect.isTrue(map.containsKey(eq01));
+  Expect.isFalse(map.containsKey(eq02));
+  Expect.isTrue(map.containsKey(eq11));
+  Expect.isFalse(map.containsKey(eq12));
+
+  Expect.equals(0, map[eq01]);
+  Expect.equals(null, map[eq02]);
+  Expect.equals(2, map[eq11]);
+  Expect.equals(null, map[eq12]);
+
+  Expect.equals(0, map.remove(eq01));
+  Expect.equals(2, map.remove(eq11));
+  testLength(0, map);
+
+  map[eq01] = 0;
+  map[eq02] = 1;
+  map[eq11] = 2;
+  map[eq12] = 3;
+  testLength(4, map);
+
+  // Transfer to equality-based map will collapse elements.
+  Map eqMap = new HashMap();
+  eqMap.addAll(map);
+  testLength(2, eqMap);
+  Expect.isTrue(eqMap.containsKey(eq01));
+  Expect.isTrue(eqMap.containsKey(eq02));
+  Expect.isTrue(eqMap.containsKey(eq11));
+  Expect.isTrue(eqMap.containsKey(eq12));
+}
+
+/** Class of objects that are equal if they hold the same id. */
+class Equalizer {
+  int id;
+  Equalizer(this.id);
+  int get hashCode => id;
+  bool operator==(Object other) =>
+      other is Equalizer && id == (other as Equalizer).id;
+}
+
+/**
+ * Objects that are not reflexive.
+ *
+ * They think they are better than their equals.
+ */
+class Vampire {
+  final int generation;
+  const Vampire(this.generation);
+
+  int get hashCode => generation;
+
+  // The double-fang operator falsely claims that a vampire is equal to
+  // any of its sire's generation.
+  bool operator==(Object other) =>
+      other is Vampire && generation - 1 == (other as Vampire).generation;
+}
+
+void testCustomMap(Map map) {
+  testLength(0, map);
+  var c11 = const Customer(1, 1);
+  var c12 = const Customer(1, 2);
+  var c21 = const Customer(2, 1);
+  var c22 = const Customer(2, 2);
+  // Sanity.
+  Expect.equals(c11, c12);
+  Expect.notEquals(c11, c21);
+  Expect.notEquals(c11, c22);
+  Expect.equals(c21, c22);
+  Expect.notEquals(c21, c11);
+  Expect.notEquals(c21, c12);
+
+  Expect.isTrue(myEquals(c11, c21));
+  Expect.isFalse(myEquals(c11, c12));
+  Expect.isFalse(myEquals(c11, c22));
+  Expect.isTrue(myEquals(c12, c22));
+  Expect.isFalse(myEquals(c12, c11));
+  Expect.isFalse(myEquals(c12, c21));
+
+  map[c11] = 42;
+  testLength(1, map);
+  Expect.isTrue(map.containsKey(c11));
+  Expect.isTrue(map.containsKey(c21));
+  Expect.isFalse(map.containsKey(c12));
+  Expect.isFalse(map.containsKey(c22));
+  Expect.equals(42, map[c11]);
+  Expect.equals(42, map[c21]);
+
+  map[c21] = 37;
+  testLength(1, map);
+  Expect.isTrue(map.containsKey(c11));
+  Expect.isTrue(map.containsKey(c21));
+  Expect.isFalse(map.containsKey(c12));
+  Expect.isFalse(map.containsKey(c22));
+  Expect.equals(37, map[c11]);
+  Expect.equals(37, map[c21]);
+
+  map[c22] = 42;
+  testLength(2, map);
+  Expect.isTrue(map.containsKey(c11));
+  Expect.isTrue(map.containsKey(c21));
+  Expect.isTrue(map.containsKey(c12));
+  Expect.isTrue(map.containsKey(c22));
+  Expect.equals(37, map[c11]);
+  Expect.equals(37, map[c21]);
+  Expect.equals(42, map[c12]);
+  Expect.equals(42, map[c22]);
+
+  Expect.equals(42, map.remove(c12));
+  testLength(1, map);
+  Expect.isTrue(map.containsKey(c11));
+  Expect.isTrue(map.containsKey(c21));
+  Expect.isFalse(map.containsKey(c12));
+  Expect.isFalse(map.containsKey(c22));
+  Expect.equals(37, map[c11]);
+  Expect.equals(37, map[c21]);
+
+  Expect.equals(37, map.remove(c11));
+  testLength(0, map);
+}
+
+class Customer {
+  final int id;
+  final int secondId;
+  const Customer(this.id, this.secondId);
+  int get hashCode => id;
+  bool operator==(Object other) {
+    if (other is! Customer) return false;
+    Customer otherCustomer = other;
+    return id == otherCustomer.id;
+  }
+}
+
+int myHashCode(Customer c) => c.secondId;
+bool myEquals(Customer a, Customer b) => a.secondId == b.secondId;
+
+testIterationOrder(Map map) {
+  var order = [0, 6, 4, 2, 7, 9, 7, 1, 2, 5, 3];
+  for (int i = 0; i < order.length; i++) map[order[i]] = i;
+  Expect.listEquals(map.keys.toList(), [0, 6, 4, 2, 7, 9, 1, 5, 3]);
+  Expect.listEquals(map.values.toList(), [0, 1, 2, 8, 6, 5, 7, 9, 10]);
+}
diff --git a/tests/html/cssstyledeclaration_test.dart b/tests/html/cssstyledeclaration_test.dart
index 964e9f9..0634b34 100644
--- a/tests/html/cssstyledeclaration_test.dart
+++ b/tests/html/cssstyledeclaration_test.dart
@@ -89,7 +89,7 @@
     new Timer(const Duration(milliseconds: 10), expectAsync0(() {
       element.style.textDecoration = 'underline';
       var style = element.getComputedStyle();
-      expect(style.textDecoration, equals('underline'));
+      expect(style.textDecoration, contains('underline'));
     }));
   });
 
diff --git a/tests/html/html.status b/tests/html/html.status
index 29d55f0..0c6ee7c 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -2,11 +2,6 @@
 # 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.
 
-cssstyledeclaration_test: Skip # Issue 12951
-indexeddb_3_test: Skip # Issue 12948
-indexeddb_4_test: Skip # Issue 12948
-indexeddb_5_test: Skip # Issue 12948
-
 async_window_test: Skip #TODO(gram): investigating
 event_test: Skip  # Issue 1996
 interactive_test: Skip # Must be run manually.
@@ -30,6 +25,7 @@
 xhr_test: Pass, Fail # Issue 12648
 custom/attribute_changed_callback_test: Fail # 12643
 custom/created_callback_test: Fail # Issue 12642
+xhr_test/json: Fail # Issue 13069
 
 [ $compiler == none && $runtime == drt && $system == windows ]
 worker_test/functional: Pass, Crash # Issue 9929.
@@ -40,8 +36,8 @@
 [ $compiler == dart2js && $runtime == ie10 ]
 async_test: Pass, Fail # timers test fails on ie10.
 indexeddb_2_test: Fail # Issue 12893
-indexeddb_3_test: Fail, Timeout # Issue 9437 + 12893
-indexeddb_4_test: Fail, Timeout # Issue 9437 + 12893
+indexeddb_3_test: Fail # Issue 12893
+indexeddb_4_test: Fail # Issue 12893
 indexeddb_5_test: Fail # Issue 12893
 
 [ $compiler == dart2js && ( $runtime == ie9 || $runtime == ie10 ) ]
@@ -94,8 +90,7 @@
 dromaeo_smoke_test: Skip #TODO(efortuna): investigating.
 element_test/click: Fail                # IE does not support firing this event.
 history_test/history: Pass, Fail # issue 8183
-indexeddb_1_test/functional: Fail, Timeout # Issue 9269 + 12893
-isolates_test: Skip
+indexeddb_1_test/functional: Fail # Issue 12893
 microtask_test: Fail, Pass # Appears to be flaky
 native_gc_test: Fail, Pass # BUG(7774): Untriaged.
 serialized_script_value_test: Fail
@@ -145,18 +140,20 @@
 touchevent_test/supported: Fail
 webgl_1_test/supported: Fail
 websql_test/supported: Fail
+xhr_test/json: Fail # IE10 returns string, not JSON object
 xhr_test/supported_HttpRequestProgressEvent: Fail
 xhr_test/supported_overrideMimeType: Fail
 xsltprocessor_test/supported: Fail
 
+
 [ $runtime == ie9 ]
+isolates_test: Timeout # Issue 13027
 blob_constructor_test: Fail
 document_test/document: Pass, Fail # BUG(9654) need per-instance patching
 dom_constructors_test: Fail
 dromaeo_smoke_test: Skip #TODO(efortuna): investigating.
 element_test/click: Fail                # IE does not support firing this event.
 form_element_test: Fail # Issue 4793.
-isolates_test: Skip         # BUG(4016)
 localstorage_test: Fail
 microtask_test: Pass, Fail # http://dartbug.com/8300
 postmessage_structured_test: Skip   # BUG(5685): times out.
@@ -167,6 +164,7 @@
 canvasrenderingcontext2d_test/drawImage_image_element: Pass, Fail # Issue: 11416
 input_element_test/attributes: Fail # IE returns null while others ''
 xhr_cross_origin_test: Skip # Issue 12920
+xhr_test/json: Fail # IE9 returns null because of unsupported type
 
 # IE9 Feature support statuses-
 # All changes should be accompanied by platform support annotation changes.
@@ -283,6 +281,7 @@
 shadow_dom_test/supported: Fail
 speechrecognition_test/supported: Fail
 touchevent_test/supported: Fail
+xhr_test/json: Fail # Safari doesn't support JSON response type
 
 [ $runtime == opera ]
 blob_constructor_test: Fail
@@ -363,7 +362,6 @@
 websql_test/supported: Fail
 xhr_test/supported_HttpRequestProgressEvent: Fail
 
-
 # 'html' tests import the HTML library, so they only make sense in
 # a browser environment.
 [ $runtime == vm ]
@@ -372,9 +370,6 @@
 [ $compiler == dart2js && ($runtime == drt || $runtime == ff) ]
 request_animation_frame_test: Skip # Async test hangs.
 
-[ $compiler == dart2js && ($runtime == drt || $runtime == chrome || $runtime == ff || $runtime == safari) ]
-isolates_test: Skip   # Timeout because leg does not support web workers.
-
 [ $compiler == dart2js && $csp && ($runtime == drt || $runtime == safari || $runtime == ff || $runtime == chrome || $runtime == chromeOnAndroid) ]
 # Note: these tests are all injecting scripts by design.  This is not allowed under CSP.
 event_customevent_test: Fail       # Test cannot run under CSP restrictions.
diff --git a/tests/html/indexeddb_4_test.dart b/tests/html/indexeddb_4_test.dart
index 06a4a0b..76e264e 100644
--- a/tests/html/indexeddb_4_test.dart
+++ b/tests/html/indexeddb_4_test.dart
@@ -81,14 +81,13 @@
   // Support is tested in indexeddb_1_test
   if (IdbFactory.supported) {
     var db;
-    test('prepare', () {
-      return setupDb().then((result) {
-          db = result;
-        });
+    setUp(() {
+      if (db == null) {
+        return setupDb().then((result) {
+            db = result;
+          });
+      }
     });
-
-    test('only1', () => testRange(db, new KeyRange.only(55), 55, 55));
-
     test('only1', () => testRange(db, new KeyRange.only(55), 55, 55));
     test('only2', () => testRange(db, new KeyRange.only(100), null, null));
     test('only3', () => testRange(db, new KeyRange.only(-1), null, null));
diff --git a/tests/html/shadowroot_test.dart b/tests/html/shadowroot_test.dart
index 56cf13b..04e0b5e 100644
--- a/tests/html/shadowroot_test.dart
+++ b/tests/html/shadowroot_test.dart
@@ -18,8 +18,10 @@
 
     // If it's supported, then it should work. Otherwise should fail.
     if (isSupported) {
-      var shadowRoot = new DivElement().createShadowRoot();
+      var div = new DivElement();
+      var shadowRoot = div.createShadowRoot();
       expect(shadowRoot, isShadowRoot);
+      expect(div.shadowRoot, shadowRoot);
     } else {
       expect(() => new DivElement().createShadowRoot(), throws);
     }
diff --git a/tests/html/xhr_test.dart b/tests/html/xhr_test.dart
index b5c538b..9894888 100644
--- a/tests/html/xhr_test.dart
+++ b/tests/html/xhr_test.dart
@@ -3,12 +3,12 @@
 // BSD-style license that can be found in the LICENSE file.
 
 library XHRTest;
-import '../../pkg/unittest/lib/unittest.dart';
-import '../../pkg/unittest/lib/html_individual_config.dart';
 import 'dart:async';
+import 'dart:convert';
 import 'dart:html';
-import "dart:convert";
 import 'dart:typed_data';
+import 'package:unittest/html_individual_config.dart';
+import 'package:unittest/unittest.dart';
 
 void fail(message) {
   guardAsync(() {
@@ -225,7 +225,6 @@
           expect(xhr.responseText, encodedData);
         });
     });
-
   });
 
   group('xhr_requestBlob', () {
@@ -241,4 +240,25 @@
       }
     });
   });
+
+  group('json', () {
+    test('xhr responseType json', () {
+      var url = '${window.location.protocol}//${window.location.host}/echo';
+      var data = {
+        'key': 'value',
+        'a': 'b',
+        'one': 2,
+      };
+
+      HttpRequest.request(url,
+          method: 'POST',
+          sendData: JSON.encode(data),
+          responseType: 'json').then(
+          expectAsync1((xhr) {
+            expect(xhr.status, equals(200));
+            var json = xhr.response;
+            expect(json, equals(data));
+          }));
+    });
+  });
 }
diff --git a/tests/isolate/isolate.status b/tests/isolate/isolate.status
index 1e076c7..d96a036 100644
--- a/tests/isolate/isolate.status
+++ b/tests/isolate/isolate.status
@@ -88,9 +88,5 @@
 [ $compiler == dart2js && ( $runtime == ff || $runtime == safari || $runtime == drt || $runtime == chrome ) ]
 isolate_stress_test: Pass, Slow # Issue 10697
 
-[ ($arch == mips || $arch == simmips) && $mode == debug ]
-mandel_isolate_test: Crash  # Issue 12823
-mandel_isolate_stream_test: Crash  # Issue 12823
-
 [ $compiler == none && ($runtime == drt || $runtime == dartium) ]
 isolate_stress_test: Skip # Issue 12537
diff --git a/tests/language/pseudo_kw_illegal_test.dart b/tests/language/built_in_identifier_illegal_test.dart
similarity index 90%
rename from tests/language/pseudo_kw_illegal_test.dart
rename to tests/language/built_in_identifier_illegal_test.dart
index 32d8041..ab7dc00 100644
--- a/tests/language/pseudo_kw_illegal_test.dart
+++ b/tests/language/built_in_identifier_illegal_test.dart
@@ -5,9 +5,10 @@
 
 // Pseudo keywords are not allowed to be used as class names.
 class abstract { }    /// 01: compile-time error
-class assert { }      /// 02: compile-time error
+class as { }          /// 19: compile-time error
 class dynamic { }     /// 04: compile-time error
 class export { }      /// 17: compile-time error
+class external { }    /// 20: compile-time error
 class factory { }     /// 05: compile-time error
 class get { }         /// 06: compile-time error
 class implements { }  /// 07: compile-time error
@@ -19,4 +20,5 @@
 class static { }      /// 15: compile-time error
 class typedef { }     /// 16: compile-time error
 
+
 main() { }
diff --git a/tests/language/pseudo_kw_test.dart b/tests/language/built_in_identifier_test.dart
similarity index 67%
rename from tests/language/pseudo_kw_test.dart
rename to tests/language/built_in_identifier_test.dart
index 0e55cc1..5116416 100644
--- a/tests/language/pseudo_kw_test.dart
+++ b/tests/language/built_in_identifier_test.dart
@@ -12,21 +12,20 @@
     // This is a list of built-in identifiers from the Dart spec.
     // It sanity checks that these pseudo-keywords are legal identifiers.
 
-    var abstract = 0;
+    var abstract = 0;  /// 01: ok
     var as = 0;
-    var call = 0;
     var dynamic = 0;
+    var export = 0;
+    var external = 0;  /// 01: ok
     var factory = 0;
     var get = 0;
     var implements = 0;
     var import = 0;
-    var interface = 0;
     var library = 0;
-    var negate = 0;
     var operator = 0;
+    var part = 0;
     var set = 0;
-    var source = 0;
-    var static = 0;
+    var static = 0;  /// 01: ok
     var typedef = 0;
 
     // "native" is a per-implementation extension that is not a part of the
@@ -39,7 +38,7 @@
     // attempt at complete coverage.
     {
       void factory(set) {
-        return 0;
+        return 0;  /// 01: ok
       }
     }
 
@@ -47,15 +46,17 @@
       break get;
     }
 
-    return static + library * operator;
+    return
+        static +  /// 01: ok
+        library * operator;
   }
 }
 
-typedef(x) => "typedef $x";
+typedef(x) => "typedef $x";  /// 01: ok
 
-static(abstract) {
-  return abstract == true;
-}
+static(abstract) {  /// 01: ok
+  return abstract == true;  /// 01: ok
+}  /// 01: ok
 
 class A {
   var typedef = 0;
@@ -64,14 +65,14 @@
   set(x) { typedef = x; }
   get() => typedef - 5;
 
-  static static() {
-    return 1;
-  }
+  static static() {  /// 01: ok
+    return 1;  /// 01: ok
+  }  /// 01: ok
   static check() {
     var o = new A();
     o.set(55);
     Expect.equals(50, o.get());
-    static();
+    static();  /// 01: ok
   }
 }
 
@@ -80,11 +81,11 @@
   get get => set;
   set get(get) => set = 2 * get.get;
 
-  static() {
-    var set = new B();
-    set.get = set;
-    Expect.equals(200, set.get);
-  }
+  static() {  /// 01: ok
+    var set = new B();  /// 01: ok
+    set.get = set;  /// 01: ok
+    Expect.equals(200, set.get);  /// 01: ok
+  }  /// 01: ok
   int operator() {
     return 1;
   }
@@ -101,13 +102,13 @@
 main() {
   PseudoKWTest.testMain();
   A.check();
-  new B().static();
+  new B().static();  /// 01: ok
   Expect.equals(1, new B().operator());
-  Expect.equals(1, A.static());
-  typedef("T");
-  Expect.equals("typedef T", typedef("T"));
-  static("true");
-  Expect.equals(false, static("true"));
+  Expect.equals(1, A.static());  /// 01: ok
+  typedef("T");  /// 01: ok
+  Expect.equals("typedef T", typedef("T"));  /// 01: ok
+  static("true");  /// 01: ok
+  Expect.equals(false, static("true"));  /// 01: ok
   Expect.equals(5, C.operator);
   Expect.equals(null, C.get);
   C.set = 0;
diff --git a/tests/language/const_factory_negative_test.dart b/tests/language/const_factory_negative_test.dart
deleted file mode 100644
index dd88a6c..0000000
--- a/tests/language/const_factory_negative_test.dart
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) 2011, 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.
-// For Dart VM: tests that a "const factory" with body produces an error.
-// For DartC: tests that a "const factory" is illegal.
-
-class ConstFactoryNegativeTest {
-  const factory ConstFactoryNegativeTest.one() {
-  }
-}
-
-main() {
-  const ConstFactoryNegativeTest.one();
-}
diff --git a/tests/language/const_factory_with_body_test.dart b/tests/language/const_factory_with_body_test.dart
new file mode 100644
index 0000000..e7830d6
--- /dev/null
+++ b/tests/language/const_factory_with_body_test.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2011, 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.
+//
+// Tests that a "const factory" with body produces a compile-time error.
+
+class ConstFactoryWithBody {
+  const factory ConstFactoryWithBody.one() { }  /// 01: compile-time error
+}
+
+main() {
+  const ConstFactoryWithBody.one();  /// 01: continued
+}
diff --git a/tests/language/constructor_initializer_test.dart b/tests/language/constructor_initializer_test.dart
index fd328b6..21c2ffa 100644
--- a/tests/language/constructor_initializer_test.dart
+++ b/tests/language/constructor_initializer_test.dart
@@ -11,7 +11,7 @@
     // is remembered in the constructor body.
     Expect.equals(x, _x + 1);
     Expect.equals(y, _y + 1);
-    Expect.isFalse(?y);
+    Expect.isFalse(?y);  /// 01: compile-time error
   }
 }
 
diff --git a/tests/language/constructor_return_test.dart b/tests/language/constructor_return_test.dart
index f46c9ec..a48507dc 100644
--- a/tests/language/constructor_return_test.dart
+++ b/tests/language/constructor_return_test.dart
@@ -18,8 +18,25 @@
   int foo(int y) => x + y;
 }
 
+class B {
+  B() => null;  /// 03: compile-time error
+}
+
+class C {
+  int value;
+  C() : value = 1 { return null; }  /// 04: compile-time error
+}
+
+class D {
+  int value;
+  D(): value = 1 => null;  /// 05: compile-time error
+}
+
 main() {
   Expect.equals((new A(1)).foo(10), 11);
   Expect.equals((new A.test1(1)).foo(10), 11);
   Expect.equals((new A.test2(1)).foo(10), 11);
+  new B();
+  new C();
+  new D();
 }
diff --git a/tests/language/constructor_return_with_arrow_negative_test.dart b/tests/language/constructor_return_with_arrow_negative_test.dart
deleted file mode 100644
index bd6f77f..0000000
--- a/tests/language/constructor_return_with_arrow_negative_test.dart
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright (c) 2011, 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.
-
-class A {
-  A() => null;
-}
-
-main() {
-  new A();
-}
diff --git a/tests/language/constructor_return_with_init_and_arrow_negative_test.dart b/tests/language/constructor_return_with_init_and_arrow_negative_test.dart
deleted file mode 100644
index 45d5f8a..0000000
--- a/tests/language/constructor_return_with_init_and_arrow_negative_test.dart
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) 2011, 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.
-
-class A {
-  int value;
-  A(): value = 1 => null;
-}
-
-main() {
-  new A();
-}
diff --git a/tests/language/constructor_return_with_init_negative_test.dart b/tests/language/constructor_return_with_init_negative_test.dart
deleted file mode 100644
index 6909c0f..0000000
--- a/tests/language/constructor_return_with_init_negative_test.dart
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) 2011, 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.
-
-class A {
-  int value;
-  A() : value = 1 { return null; }
-}
-
-main() {
-  new A();
-}
diff --git a/tests/language/import_show_lib.dart b/tests/language/import_show_lib.dart
new file mode 100644
index 0000000..a3d7325
--- /dev/null
+++ b/tests/language/import_show_lib.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2013, 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 import_show_lib;
+
+get theEnd => "http://www.endoftheinternet.com/";
diff --git a/tests/language/import_show_test.dart b/tests/language/import_show_test.dart
new file mode 100644
index 0000000..e2495b0
--- /dev/null
+++ b/tests/language/import_show_test.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2013, 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 import_show_test;
+
+import "package:expect/expect.dart";
+import "import_show_lib.dart" show theEnd;
+
+main() {
+  var foo = theEnd;
+  Expect.equals("http://www.endoftheinternet.com/", foo);
+}
\ No newline at end of file
diff --git a/tests/language/inferrer_this_access_test.dart b/tests/language/inferrer_this_access_test.dart
new file mode 100644
index 0000000..9aa782e
--- /dev/null
+++ b/tests/language/inferrer_this_access_test.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2013, 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.
+
+import "package:expect/expect.dart";
+
+class A {
+  var fisk;
+  A() {
+    // dart2js's inferrer used to not recognize the following call to
+    // be on [this].
+    fisk--;
+    fisk = 42;
+  }
+}
+
+class B {
+  var a;
+  B() {
+    hest = 54;
+    a = 42;
+  } 
+}
+
+class C extends B {
+  set hest(value) {
+    return a + 42;
+  }
+}
+
+main() {
+  Expect.throws(() => new A(), (e) => e is NoSuchMethodError);
+  Expect.throws(() => new C(), (e) => e is NoSuchMethodError);
+}
diff --git a/tests/language/instantiate_type_variable_negative_test.dart b/tests/language/instantiate_type_variable_test.dart
similarity index 83%
rename from tests/language/instantiate_type_variable_negative_test.dart
rename to tests/language/instantiate_type_variable_test.dart
index 1ced058..a798984 100644
--- a/tests/language/instantiate_type_variable_negative_test.dart
+++ b/tests/language/instantiate_type_variable_test.dart
@@ -6,7 +6,9 @@
 
 class Foo<T> {
   Foo() {}
-  T make() { return new T(); }
+  T make() {
+    return new T();  /// 01: compile-time error
+  }
 }
 
 main() {
diff --git a/tests/language/issue10561_test.dart b/tests/language/issue10561_test.dart
index d02e157..37a6cef 100644
--- a/tests/language/issue10561_test.dart
+++ b/tests/language/issue10561_test.dart
@@ -9,7 +9,7 @@
 
 import 'dart:collection';
 
-class Foo extends HashMap {
+class Foo extends LinkedHashMap {
 }
 
 main() {
diff --git a/tests/language/issue9949_test.dart b/tests/language/issue9949_test.dart
index cec8102..e161d5a 100644
--- a/tests/language/issue9949_test.dart
+++ b/tests/language/issue9949_test.dart
@@ -8,11 +8,11 @@
 import "package:expect/expect.dart";
 import 'dart:collection';
 
-class Crash extends HashMap<String,String> {
+class Crash extends LinkedHashMap<String,String> {
   Crash(): super();
 }
 
 void main() {
   Crash map = new Crash();
-  Expect.isTrue(map is HashMap);
+  Expect.isTrue(map is LinkedHashMap);
 }
diff --git a/tests/language/language.status b/tests/language/language.status
index 1470441..f1293db 100644
--- a/tests/language/language.status
+++ b/tests/language/language.status
@@ -12,9 +12,10 @@
 library_juxtaposition_test: Fail # Issue 6877
 switch_int_double_test/01: Fail # Issue 7307
 switch_int_double_test/02: Fail # Issue 7307
+symbol_literal_test: Fail # Issue 12171
 
 # These bugs refer currently ongoing language discussions.
-constructor_initializer_test: Fail # Issue 12633
+constructor_initializer_test/none: Fail # Issue 12633
 constructor5_test: Fail # Issue 6422
 constructor6_test: Fail # Issue 6422
 closure_in_initializer_test: Fail # Issue 6422
@@ -25,12 +26,14 @@
 duplicate_export_negative_test: Fail # Issue 6134
 on_catch_malformed_type_test: Fail # Issue 8601
 mixin_mixin_test: Fail # Issue 9683
+mixin_mixin2_test: Fail # Issue 9683
 mixin_issue10216_2_test: Fail # Issue 9683
 mixin_illegal_object_test/01: Crash # Issue 10952
 mixin_illegal_object_test/02: Crash # Issue 10952
 mixin_forwarding_constructor2_test: Fail # Issue 11888
 mixin_typedef_constructor_test: Fail # Issue 11888
 mixin_type_parameter2_test: Fail # Issue 11888
+built_in_identifier_illegal_test/19: Fail # Issue 13021
 
 [ $compiler == none && $unchecked ]
 # Only checked mode reports an error on type assignment
diff --git a/tests/language/language_analyzer.status b/tests/language/language_analyzer.status
index 0eea3a2..e360479 100644
--- a/tests/language/language_analyzer.status
+++ b/tests/language/language_analyzer.status
@@ -37,9 +37,6 @@
 list_literal_syntax_test/03: fail # Issue 12103
 malformed_test/none: fail # Issue 12696
 
-# TBF: 1is int; invalid character in number
-number_identifier_negative_test: fail
-
 # TBF: we should check conflicts not only for methods, but for accessors too
 override_field_test/02: fail
 override_field_test/03: fail
@@ -54,24 +51,21 @@
 private_member2_negative_test: fail
 private_member3_negative_test: fail
 
-# TBF
-pseudo_kw_test: fail
-
+built_in_identifier_test/none: Fail # Issue 13023
 
 # test issue 10683, It is a compile-time error if e refers to the name v or the name v=.
 block_scope_test: fail
 lazy_static3_test: fail
 
-# Test issue 11124, Uninitialized finals are warnings not errors
-field3a_negative_test: fail
-const_syntax_test/01: fail
-const_syntax_test/04: fail
-const_syntax_test/02: fail
-const_syntax_test/03: fail
-final_syntax_test/01: fail
-final_syntax_test/04: fail
-final_syntax_test/02: fail
-final_syntax_test/03: fail
+field3a_negative_test: Fail # Issue 11124
+const_syntax_test/01: Fail # Issue 11124
+const_syntax_test/04: Fail # Issue 11124
+const_syntax_test/02: Fail # Issue 11124
+const_syntax_test/03: Fail # Issue 11124
+final_syntax_test/01: Fail # Issue 11124
+final_syntax_test/04: Fail # Issue 11124
+final_syntax_test/02: Fail # Issue 11124
+final_syntax_test/03: Fail # Issue 11124
 
 # Test issue 11123, Only static fields can be declared as 'const'
 const_escape_frog_test: fail
@@ -132,8 +126,7 @@
 import_combinators_negative_test: fail
 interface_static_non_final_fields_negative_test: fail
 
-# test issue 11595, It is static warning to create instance (new) of the malformed type
-instantiate_type_variable_negative_test: fail
+instantiate_type_variable_test/01: fail # Issue 11595
 
 mixin_type_parameters_errors_test/01: fail # Issue 11598
 mixin_type_parameters_errors_test/02: fail # Issue 11598
@@ -166,12 +159,10 @@
 # test issue 12156, fails only at runtime
 static_call_wrong_argument_count_negative_test: fail
 
-# test issue 12157, uninitializer instance variable is warning, so not negative test
-static_final_field_negative_test: fail
-constructor9_test/01: fail # Issue 12157
+static_final_field2_test/02: Fail # Issue 13018
+constructor9_test/01: Fail # Issue 12157
 
-# test issue 12159, print(exception.message_); causes static warning, not an error
-throw7_negative_test: fail
+throw7_test/01: Fail # Issue 12159
 
 # test issue 12160, not annotated warnings for type variables from static member
 type_parameter_test/none: fail
@@ -190,9 +181,6 @@
 unresolved_in_factory_negative_test: fail # Issue 12163
 unresolved_top_level_var_negative_test: fail # Issue 12163
 
-# test issue 12181, uses argument definition test
-constructor_initializer_test: fail # Issue 12181
-
 # test issue 12191, ambiguous import is always warning now
 prefix3_negative_test: fail # Issue 12191
 library_ambiguous_test/00: fail # Issue 12191
@@ -204,8 +192,7 @@
 issue11724_test: fail # Issue 12381
 call_nonexistent_static_test/08: fail # Issue 12381
 
-# test issue 12397; it is static warning, not error to use variable before declaration (or hidden)
-scope_negative_test: fail # Issue 12397
+scope_variable_test/01: fail # Issue 12397
 
 # test issue 12539, rules for finals were loosened, contradiction in spec was fixed
 const_syntax_test/09: fail # Issue 12539
diff --git a/tests/language/language_analyzer2.status b/tests/language/language_analyzer2.status
index 1a19e14..b489212 100644
--- a/tests/language/language_analyzer2.status
+++ b/tests/language/language_analyzer2.status
@@ -37,9 +37,6 @@
 list_literal_syntax_test/03: fail # Issue 12103
 malformed_test/none: fail # Issue 12696
 
-# TBF: 1is int; invalid character in number
-number_identifier_negative_test: fail
-
 # TBF: we should check conflicts not only for methods, but for accessors too
 override_field_test/02: fail
 override_field_test/03: fail
@@ -54,24 +51,21 @@
 private_member2_negative_test: fail
 private_member3_negative_test: fail
 
-# TBF
-pseudo_kw_test: fail
-
+built_in_identifier_test/none: Fail # Issue 13023
 
 # test issue 10683, It is a compile-time error if e refers to the name v or the name v=.
 block_scope_test: fail
 lazy_static3_test: fail
 
-# Test issue 11124, Uninitialized finals are warnings not errors
-field3a_negative_test: fail
-const_syntax_test/01: fail
-const_syntax_test/04: fail
-const_syntax_test/02: fail
-const_syntax_test/03: fail
-final_syntax_test/01: fail
-final_syntax_test/04: fail
-final_syntax_test/02: fail
-final_syntax_test/03: fail
+field3a_negative_test: Fail # Issue 11124
+const_syntax_test/01: Fail # Issue 11124
+const_syntax_test/04: Fail # Issue 11124
+const_syntax_test/02: Fail # Issue 11124
+const_syntax_test/03: Fail # Issue 11124
+final_syntax_test/01: Fail # Issue 11124
+final_syntax_test/04: Fail # Issue 11124
+final_syntax_test/02: Fail # Issue 11124
+final_syntax_test/03: Fail # Issue 11124
 
 # Test issue 11123, Only static fields can be declared as 'const'
 const_escape_frog_test: fail
@@ -132,8 +126,7 @@
 import_combinators_negative_test: fail
 interface_static_non_final_fields_negative_test: fail
 
-# test issue 11595, It is static warning to create instance (new) of the malformed type
-instantiate_type_variable_negative_test: fail
+instantiate_type_variable_test/01: fail # Issue 11595
 
 mixin_type_parameters_errors_test/01: fail # Issue 11598
 mixin_type_parameters_errors_test/02: fail # Issue 11598
@@ -167,11 +160,10 @@
 static_call_wrong_argument_count_negative_test: fail
 
 # test issue 12157, uninitializer instance variable is warning, so not negative test
-static_final_field_negative_test: fail
-constructor9_test/01: fail # Issue 12157
+static_final_field2_test/02: Fail # Issue 13018
+constructor9_test/01: Fail # Issue 12157
 
-# test issue 12159, print(exception.message_); causes static warning, not an error
-throw7_negative_test: fail
+throw7_test/01: Fail # Issue 12159
 
 # test issue 12160, not annotated warnings for type variables from static member
 type_parameter_test/none: fail
@@ -190,9 +182,6 @@
 unresolved_in_factory_negative_test: fail # Issue 12163
 unresolved_top_level_var_negative_test: fail # Issue 12163
 
-# test issue 12181, uses argument definition test
-constructor_initializer_test: fail # Issue 12181
-
 # test issue 12191, ambiguous import is always warning now
 prefix3_negative_test: fail # Issue 12191
 library_ambiguous_test/00: fail # Issue 12191
@@ -204,8 +193,7 @@
 issue11724_test: fail # Issue 12381
 call_nonexistent_static_test/08: fail # Issue 12381
 
-# test issue 12397; it is static warning, not error to use variable before declaration (or hidden)
-scope_negative_test: fail # Issue 12397
+scope_variable_test/01: fail # Issue 12397
 
 # test issue 12539, rules for finals were loosened, contradiction in spec was fixed
 const_syntax_test/09: fail # Issue 12539
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index 7db88ec..c0c31c7 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -3,17 +3,12 @@
 # BSD-style license that can be found in the LICENSE file.
 
 [ $compiler == dart2js || $compiler == dart2dart ]
-compile_time_constant_c_test/none: Fail # Map literal with int key.
-constructor_initializer_test: Fail, OK # Depends on ?parameter check.
+compile_time_constant_c_test/none: Fail # Issue 11583
 null_test/03: Fail # Issue 12445.
-
 black_listed_test/none: Fail # Issue 12446.
-
-# Issues related to undeclared prefix resolution.
 malformed_test/none: Fail # Issue 12695
 malformed_test/05: Fail # Issue 12695
 malformed_test/06: Fail # Issue 12695
-
 full_stacktrace1_test: Pass, Fail # Issue 12698
 full_stacktrace2_test: Pass, Fail # Issue 12698
 full_stacktrace3_test: Pass, Fail # Issue 12698
@@ -44,15 +39,10 @@
 [ $compiler == dart2js && $unchecked ]
 factory_redirection_test/14: Fail # Issue 10959
 type_checks_in_factory_method_test: Fail # Issue 12746
-
 assertion_test: Fail # Issue 12748
-
 double_to_string_as_exponential2_test: Fail # Issue 12749
 double_to_string_as_fixed2_test: Fail # Issue 12749
 double_to_string_as_precision2_test: Fail # Issue 12749
-
-# Only checked mode reports an error on type assignment
-# problems in compile time constants.
 compile_time_constant_checked_test/02: Fail, OK
 compile_time_constant_checked2_test/01: Fail, OK
 compile_time_constant_checked2_test/02: Fail, OK
@@ -76,6 +66,7 @@
 [ $compiler == dart2js && $minified ]
 f_bounded_quantification4_test: Fail # Issue 12605.
 f_bounded_quantification5_test: Fail # Issue 12605.
+mixin_mixin2_test: Fail # Issue 12605.
 
 [ $compiler == dart2js ]
 function_type_alias6_test/00: Crash # Issue 9792
@@ -122,6 +113,7 @@
 metadata_test: Fail # Issue 5841
 infinity_test: Fail # Issue 4984
 positive_bit_operations_test: Fail # Issue 12795
+mixin_mixin2_test: Fail # Issue 13109.
 
 # Compilation errors.
 const_var_test: Fail # Issue 12793
@@ -136,7 +128,6 @@
 parameter_initializer6_negative_test: Fail # Issue 3502
 named_parameters_aggregated_test/01: Fail # Issue 12801
 named_parameters_aggregated_test/03: Fail # Issue 12812
-pseudo_kw_test: Fail # Unexpected token '('
 super_implicit_closure_test: Fail # Issue 12884
 mixin_type_parameters_errors_test/01: Fail # Issue 12885
 mixin_type_parameters_errors_test/02: Fail # Issue 12885
@@ -152,55 +143,35 @@
 instanceof4_test/01: Fail # Issue 12889
 list_literal4_test: Fail # Issue 12890
 map_literal4_test: Fail # Issue 12891
+built_in_identifier_test/01: Fail # Issue 13022
 
-#
-# The following tests are all negative tests that should be fixed.
-#
-const_constructor_syntax_test/04: Fail # Issue 12900
 const_syntax_test/01: Fail # Issue 12932
 const_syntax_test/02: Fail # Issue 12932
 const_syntax_test/03: Fail # Issue 12932
 const_syntax_test/04: Fail # Issue 12932
 constructor9_test/01: Fail # Issue 12934
-constructor_return_test/01: Fail # Issue 12937
-constructor_return_test/02: Fail # Issue 12937
-constructor_return_with_arrow_negative_test: Fail # Negative language test.
-constructor_return_with_init_and_arrow_negative_test: Fail # Negative language test.
-constructor_return_with_init_negative_test: Fail # Negative language test.
-duplicate_implements_test/01: Fail # Negative language test.
-duplicate_implements_test/02: Fail # Negative language test.
-duplicate_implements_test/03: Fail # Negative language test.
-duplicate_implements_test/04: Fail # Negative language test.
-instantiate_type_variable_negative_test: Pass  # For the wrong reason.
-list_literal1_negative_test: Fail # Negative language test.
-map_literal1_negative_test: Fail # Negative language test.
-number_identifier_negative_test: Fail # Negative language test.
-scope_negative_test: Fail # Negative language test.
-static_final_field_negative_test: Fail # Negative language test.
-throw7_negative_test: Fail # Negative language test.
+duplicate_implements_test/01: Fail # Issue 12991
+duplicate_implements_test/02: Fail # Issue 12991
+duplicate_implements_test/03: Fail # Issue 12991
+duplicate_implements_test/04: Fail # Issue 12991
+list_literal1_test/01: Fail # Issue 12993
+map_literal1_test/01: Fail # Issue 12993
+number_identifier_test/05: Fail # Issue 13070
+scope_variable_test/01: Fail # Issue 13016
+static_final_field2_test/02: Fail # Issue 13017
+throw7_test/01: Fail # Issue 13019
 
-numbers_test: Fail, OK # (unintended?) VM specific test.
+numbers_test: Fail, OK # Issue 1533
+canonical_const2_test: Fail, OK # Issue 1533
+bit_operations_test: Fail, OK # Issue 1533
+expect_test: Fail, OK # Issue 13080
 
-final_syntax_test/01: Fail # Missing error for uninitialized final field.
-final_syntax_test/02: Fail # Missing error for uninitialized final field.
-final_syntax_test/03: Fail # Missing error for uninitialized final field.
-final_syntax_test/04: Fail # Missing error for uninitialized final field.
+final_syntax_test/01: Fail # Issue 13020
+final_syntax_test/02: Fail # Issue 13020
+final_syntax_test/03: Fail # Issue 13020
+final_syntax_test/04: Fail # Issue 13020
 
-canonical_const2_test: Fail, OK # Dart2js only has doubles.
-
-bit_operations_test: Fail, OK # Tests bit operations outside the 32 bit range.
-# The following test will start to fail again once dart2js implements the
-# runtime semantics for numbers.
-# Should be: Fail, OK # Expects negative results of bit-operations.
-optimization_test: Fail, OK # Expects negative results of bit-operations.
-
-expect_test: Fail, OK # JavaScript canonicalizes all strings. This test assumes that string-concatenation returns a new string.
-
-# Partially implemented redirecting constructors makes this throw instead
-# of failing.
-const_factory_negative_test: Crash, Fail
-
-assign_top_method_test: Fail
+assign_top_method_test: Fail # Issue 13075
 null_test/none: Fail  # Issue 12482
 
 
@@ -216,7 +187,7 @@
 double_to_string_as_exponential3_test: Fail # Issue 12750
 double_to_string_as_fixed_test: Fail # Issue 12750
 double_to_string_as_precision3_test: Fail # Issue 12750
-expect_test: Fail
+expect_test: Fail # Issue 13080
 stack_overflow_test: Fail
 stack_overflow_stacktrace_test: Fail
 
@@ -239,15 +210,13 @@
 mixin_super_constructor_positionals_test: Fail # Issue 12631
 function_type_alias6_test/00: Fail # Issue 11986
 function_type_alias9_test/00: Crash # Issue 11986
+symbol_literal_test: Fail # Issue 12171
 
 built_in_identifier_prefix_test: Fail # Issue 6972
-constructor_initializer_test: Fail # VM issue
-factory3_test: Fail
+constructor_initializer_test/none: Fail # Issue 12633
+factory3_test: Fail # Issue 13077
 type_checks_in_factory_method_test: Fail # Issue 12747
 
-many_overridden_no_such_method_test: Fail, Pass, OK # Fails in minified mode, test depends on method names.
-overridden_no_such_method_test: Fail, Pass, OK # Fails in minified mode, test depends on method names.
-
 on_catch_malformed_type_test: Fail # Issue 8601
 
 mixin_type_parameters_errors_test/01: Fail # Issue 12886
@@ -256,6 +225,7 @@
 
 # Mixins fail on the VM.
 mixin_mixin_test: Fail # Issue 9683
+mixin_mixin2_test: Fail # Issue 9683
 mixin_issue10216_2_test: Fail # Issue 9683
 mixin_forwarding_constructor2_test: Fail # Issue 11888
 mixin_typedef_constructor_test: Fail # Issue 11888
@@ -264,12 +234,12 @@
 mixin_with_two_implicit_constructors_test: Fail # Issue 11889
 
 # Malformed types not handled as unresolved:
-import_core_prefix_test: Fail
-prefix16_test: Fail
-prefix22_test: Fail
+import_core_prefix_test: Fail # Issue 13081
+prefix16_test: Fail # Issue 13081
+prefix22_test: Fail # Issue 13081
 
 # Calling unresolved class constructor:
-call_nonexistent_constructor_test: Fail
+call_nonexistent_constructor_test: Fail # Issue 13082
 
 bad_override_test/01: Fail # Issue 11496
 bad_override_test/02: Fail # Issue 11496
@@ -297,7 +267,6 @@
 compile_time_constant_arguments_test/03: Fail # Issue 5519
 compile_time_constant_arguments_test/05: Fail # Issue 5519
 compile_time_constant_arguments_test/06: Fail # Issue 5519
-const_constructor_syntax_test/04: Fail # Issue 12901
 const_syntax_test/01: Fail # Issue 12933
 const_syntax_test/02: Fail # Issue 12933
 const_syntax_test/03: Fail # Issue 12933
@@ -308,13 +277,11 @@
 const_syntax_test/08: Fail # Issue 12933
 const_syntax_test/10: Fail # Issue 12933
 constructor9_test/01: Fail # Issue 12935
-constructor_return_test/01: Fail # Issue 12938
-constructor_return_test/02: Fail # Issue 12938
 constructor_named_arguments_test/01: Fail # Issue 5519
-final_syntax_test/01: Fail # Issue 5519
-final_syntax_test/02: Fail # Issue 5519
-final_syntax_test/03: Fail # Issue 5519
-final_syntax_test/04: Fail # Issue 5519
+final_syntax_test/01: Fail # Issue 13020
+final_syntax_test/02: Fail # Issue 13020
+final_syntax_test/03: Fail # Issue 13020
+final_syntax_test/04: Fail # Issue 13020
 getter_no_setter_test/01: Fail # Issue 5519
 named_parameters_aggregated_test/01: Fail # Issue 12802
 named_parameters_aggregated_test/03: Fail # Issue 12813
@@ -325,10 +292,6 @@
 metadata_test: Fail # Issue 12762
 const_var_test: Pass, Fail # Issue 12794
 map_literal3_test: Fail # Issue 12794
-# Common problems with dart2js.  In illegal family, invalid
-# declarations are simply not parsed.  In pseudo kw dart2js
-# chokes on things like typedef(x) => "typedef $x" and alike.
-pseudo_kw_test: Fail
 external_test/11: Fail # Issue 12888
 external_test/12: Fail # Issue 12888
 external_test/13: Fail # Issue 12888
@@ -337,18 +300,19 @@
 external_test/23: Fail # Issue 12888
 external_test/30: Fail # Issue 12888
 external_test/31: Fail # Issue 12888
+built_in_identifier_test/01: Fail # Issue 13022
 lazy_static3_test: Fail # Issue 12593
-# dart2js frontend doesn't even analyse problematic classes.
-duplicate_implements_test/01: Fail
-duplicate_implements_test/02: Fail
-duplicate_implements_test/03: Fail
-duplicate_implements_test/04: Fail
+duplicate_implements_test/01: Fail # Issue 12992
+duplicate_implements_test/02: Fail # Issue 12992
+duplicate_implements_test/03: Fail # Issue 12992
+duplicate_implements_test/04: Fail # Issue 12992
+list_literal1_test/01: Fail # Issue 12993
+map_literal1_test/01: Fail # Issue 12993
 method_override4_test: Fail # Issue 12810
 method_override5_test: Fail # Issue 12810
-static_final_field_negative_test: Fail
-# Bug in dart2js parser: it happily parses 1is int; variable declaration.
-number_identifier_negative_test: Fail
-# Common with language_dart2js.
+static_final_field2_test/02: Fail # Issue 13017
+throw7_test/01: Fail # Issue 13019
+scope_variable_test/01: Fail # Issue 13016
 factory_redirection_test/01: Fail # Issue 12753
 factory_redirection_test/02: Crash # Issue 12753
 factory_redirection_test/03: Crash # Issue 12753
@@ -367,8 +331,6 @@
 closure_in_initializer_test: Fail
 super_first_constructor_test: Fail
 # Minified mode failures.
-# TODO(antonm): proper support in test framework.
-no_such_method_test: Pass, Fail, OK # Hard codes the name of invoked method ("foo").
 
 new_expression_type_args_test/00: Fail # Wrongly reports compile-time error.
 new_expression_type_args_test/01: Fail # Wrongly reports compile-time error.
@@ -395,6 +357,9 @@
 super_getter_setter_test: Fail # Issue 11065.
 f_bounded_quantification4_test: Fail # Issue 12605.
 f_bounded_quantification5_test: Fail # Issue 12605.
+many_overridden_no_such_method_test: Fail # Issue 13078
+overridden_no_such_method_test: Fail # Issue 13078
+no_such_method_test: Fail # Issue 13078
 
 # TODO(tball): Assign proper bug numbers.
 class_literal_test: Fail
diff --git a/tests/language/list_literal1_negative_test.dart b/tests/language/list_literal1_test.dart
similarity index 72%
rename from tests/language/list_literal1_negative_test.dart
rename to tests/language/list_literal1_test.dart
index 4e3c843..e029a79 100644
--- a/tests/language/list_literal1_negative_test.dart
+++ b/tests/language/list_literal1_test.dart
@@ -6,13 +6,7 @@
 // When type checks are enabled, a type mismatch in a list literal is a compile-time error
 
 main() {
-  try {
-    var m = const <String>[0, 1];  // 0 is not a String.
-  } on TypeError catch (error) {
-    // not a catchable error
-  }
+  var m = const
+      <String>  /// 01: compile-time error
+      [0, 1];
 }
-
-
-
-
diff --git a/tests/language/map_literal1_negative_test.dart b/tests/language/map_literal1_test.dart
similarity index 71%
rename from tests/language/map_literal1_negative_test.dart
rename to tests/language/map_literal1_test.dart
index 43da66a..af75129 100644
--- a/tests/language/map_literal1_negative_test.dart
+++ b/tests/language/map_literal1_test.dart
@@ -6,11 +6,9 @@
 // When type checks are enabled, a type mismatch in a map literal is a compile-time error
 
 main() {
-  try {
-    var m = const <String, String>{"a": 0};  // 0 is not a String.
-  } on TypeError catch (error) {
-    // not a catchable error
-  }
+  var m = const
+      <String, String>  /// 01: compile-time error
+      {"a": 0};
 }
 
 
diff --git a/tests/language/mixin_mixin2_test.dart b/tests/language/mixin_mixin2_test.dart
new file mode 100644
index 0000000..e6f8160
--- /dev/null
+++ b/tests/language/mixin_mixin2_test.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2013, 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.
+
+import "package:expect/expect.dart";
+
+class M<T> {
+  t() { return T; }
+}
+
+typedef A<U> = Object with M<U>;
+
+typedef B<V> = Object with A<V>;
+
+typedef C<U> = Object with M<List<U>>;
+
+typedef D<V> = Object with C<Set<V>>;
+
+class E extends A<num> { }
+
+class F extends B<String> { }
+
+class G<T> extends C<T> { }
+
+class H<T> extends D<Map<String, T>> { }
+
+main() {
+  Expect.equals("num", new E().t().toString());
+  Expect.equals("String", new F().t().toString());
+  Expect.equals("List<bool>", new G<bool>().t().toString());
+  Expect.equals("List<Set<Map<String, int>>>", new H<int>().t().toString());
+}
diff --git a/tests/language/no_such_method_subtype_test.dart b/tests/language/no_such_method_subtype_test.dart
new file mode 100644
index 0000000..a843c91
--- /dev/null
+++ b/tests/language/no_such_method_subtype_test.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2013, 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.
+
+import "package:expect/expect.dart";
+
+class A {
+  foo() => 42;
+}
+
+class B implements A {
+  noSuchMethod(im) => 84;
+}
+
+main() {
+  var a = [new A(), new B()];
+  var b = a[1];
+  if (b is A) {
+    // `b.foo()` will create a typed selector whose receiver type is a
+    // subtype of `A`. Because not all subtypes of `A` implement
+    // `foo`, dart2js must generate a `noSuchMethod` stub for `foo` in
+    // the top Object class.
+    Expect.equals(84, b.foo());
+    return;
+  }
+  Expect.fail('Should not be here');
+}
diff --git a/tests/language/number_identifier_negative_test.dart b/tests/language/number_identifier_negative_test.dart
deleted file mode 100644
index 587267b..0000000
--- a/tests/language/number_identifier_negative_test.dart
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) 2011, 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.
-
-class NumberIdentifierNegativeTest {
-
-  static void testMain() {
-    1is int;  // Number literals must not be followed by an identifier or keyword.
-  }
-
-}
-main() {
-  NumberIdentifierNegativeTest.testMain();
-}
diff --git a/tests/language/number_identifier_test.dart b/tests/language/number_identifier_test.dart
new file mode 100644
index 0000000..9ef17d8
--- /dev/null
+++ b/tests/language/number_identifier_test.dart
@@ -0,0 +1,36 @@
+// Copyright (c) 2011, 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.
+
+import "package:expect/expect.dart";
+
+main() {
+  // Integer literals.
+  Expect.isTrue(2is int);
+  Expect.equals(2, 2as int);
+  Expect.isTrue(-2is int);
+  Expect.equals(-2, -2as int);
+  Expect.isTrue(0x10is int);
+  Expect.isTrue(-0x10is int);
+  // "a" will be part of hex literal, the following "s" is an error.
+  0x10as int;  /// 01: compile-time error
+  0x;          /// 04: compile-time error
+
+  // Double literals.
+  Expect.isTrue(2.0is double);
+  Expect.equals(2.0, 2.0as double);
+  Expect.isTrue(-2.0is double);
+  Expect.equals(-2.0, -2.0as double);
+  Expect.isTrue(.2is double);
+  Expect.equals(0.2, .2as double);
+  Expect.isTrue(1e2is double);
+  Expect.equals(1e2, 1e2as double);
+  Expect.isTrue(1e-2is double);
+  Expect.equals(1e-2, 1e-2as double);
+  Expect.isTrue(1e+2is double);
+  Expect.equals(1e+2, 1e+2as double);
+  Expect.throws(() => 1.e+2,                       /// 05: ok
+                (e) => e is NoSuchMethodError);    /// 05: continued
+  1e;  /// 02: compile-time error
+  1x;  /// 03: compile-time error
+}
diff --git a/tests/language/prefix24_lib1.dart b/tests/language/prefix24_lib1.dart
new file mode 100644
index 0000000..481b739
--- /dev/null
+++ b/tests/language/prefix24_lib1.dart
@@ -0,0 +1,12 @@
+
+// Copyright (c) 2013, 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 prefix24_lib1;
+
+import "prefix24_lib2.dart" as X;
+
+// lib1_foo() returns value of bar() in library prefix24_lib2.
+lib1_foo() => X.bar();
+
diff --git a/tests/language/prefix24_lib2.dart b/tests/language/prefix24_lib2.dart
new file mode 100644
index 0000000..d4dd592
--- /dev/null
+++ b/tests/language/prefix24_lib2.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2013, 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 prefix24_lib2;
+
+bar() => "prefix24_lib2_bar";
diff --git a/tests/language/prefix24_lib3.dart b/tests/language/prefix24_lib3.dart
new file mode 100644
index 0000000..4490f9b
--- /dev/null
+++ b/tests/language/prefix24_lib3.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2013, 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 prefix24_lib3;
+
+class X {
+  static bar() => "static method bar of class X";
+}
diff --git a/tests/language/prefix24_test.dart b/tests/language/prefix24_test.dart
new file mode 100644
index 0000000..0f36fe7
--- /dev/null
+++ b/tests/language/prefix24_test.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2013, 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 prefix24_test;
+
+import "package:expect/expect.dart";
+
+// Import a library that contains library prefix X.
+import "prefix24_lib1.dart";
+
+// Import a library that declares class X.
+import "prefix24_lib3.dart";
+
+// Check that the library prefix X that is used in library prefix24_lib1
+// remains private to that library and does not collide with class X
+// defined in (and imported from) prefix24_lib3;
+
+main() {
+  Expect.equals("static method bar of class X", X.bar());
+  Expect.equals("prefix24_lib2_bar", lib1_foo());
+}
\ No newline at end of file
diff --git a/tests/language/scope_negative_test.dart b/tests/language/scope_negative_test.dart
deleted file mode 100644
index 5278880..0000000
--- a/tests/language/scope_negative_test.dart
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2011, 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.
-// Dart test program for testing the prohibited use of a variable before it has
-// been declared, which is not trivial to detect in the context of a variable
-// declaration shadowing another one.
-
-class ScopeNegativeTest {
-  static testMain() {
-    var a = 1;
-    {
-      var b = 2;
-      var c = a;  // Use of 'a' prior to its shadow declaration below.
-      var d = b + c;
-      var a = 5;  // Shadow declaration of 'a'.
-      return d + a;
-    }
-  }
-}
-
-
-main() {
-  ScopeNegativeTest.testMain();
-}
diff --git a/tests/language/scope_variable_test.dart b/tests/language/scope_variable_test.dart
index d3bca7c..58ae910 100644
--- a/tests/language/scope_variable_test.dart
+++ b/tests/language/scope_variable_test.dart
@@ -4,38 +4,44 @@
 
 import "package:expect/expect.dart";
 
-class ScopeVariableTest {
-
-  static void testSimpleScope() {
-    {
-      var a = "Test";
-      int b = 1;
-    }
-    {
-      var c;
-      int d;
-      Expect.equals(true, c == null);
-      Expect.equals(true, d == null);
-    }
-  }
-
-  static void testShadowingScope() {
+void testSimpleScope() {
+  {
     var a = "Test";
-    {
-      var a;
-      Expect.equals(true, a == null);
-      a = "a";
-      Expect.equals(true, a == "a");
-    }
-    Expect.equals(true, a == "Test");
+    int b = 1;
   }
+  {
+    var c;
+    int d;
+    Expect.isNull(c);
+    Expect.isNull(d);
+  }
+}
 
-  static void testMain() {
-    testSimpleScope();
-    testShadowingScope();
+void testShadowingScope() {
+  var a = "Test";
+  {
+    var a;
+    Expect.isNull(a);
+    a = "a";
+    Expect.equals(a, "a");
+  }
+  Expect.equals(a, "Test");
+}
+
+int testShadowingAfterUse() {
+  var a = 1;
+  {
+    var b = 2;
+    var c = a;  // Use of 'a' prior to its shadow declaration below.
+    var d = b + c;
+    // Shadow declaration of 'a'.
+    var a = 5;  /// 01: compile-time error
+    return d + a;
   }
 }
 
 main() {
-  ScopeVariableTest.testMain();
+  testSimpleScope();
+  testShadowingScope();
+  testShadowingAfterUse();
 }
diff --git a/tests/language/static_final_field2_test.dart b/tests/language/static_final_field2_test.dart
index 4e4c188..c80588a 100644
--- a/tests/language/static_final_field2_test.dart
+++ b/tests/language/static_final_field2_test.dart
@@ -7,6 +7,15 @@
   static const x = 1;
 }
 
+class B {
+  const B() : n = 5;
+  final n;
+  static const a;  /// 02: compile-time error
+  static const b = 3 + 5;
+  static const c;  /// 02: continued
+}
+
 main() {
   A.x = 2;  /// 01: static type warning, runtime error
+  new B();
 }
diff --git a/tests/language/static_final_field_negative_test.dart b/tests/language/static_final_field_negative_test.dart
deleted file mode 100644
index 957874a..0000000
--- a/tests/language/static_final_field_negative_test.dart
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2011, 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.
-// Dart test program for testing static const fields.
-// This test should fail because fields a and c are static const fields
-// and they are missing initializers.
-
-class A {
-  const A() : n = 5;
-  final n;
-  static const a;
-  static const b = 3 + 5;
-  static const c;
-}
-
-class StaticFinalFieldNegativeTest {
-  static testMain() {
-    var a = new A();
-  }
-}
-
-main() {
-  StaticFinalFieldNegativeTest.testMain();
-}
diff --git a/tests/language/symbol_literal_test.dart b/tests/language/symbol_literal_test.dart
new file mode 100644
index 0000000..052773d
--- /dev/null
+++ b/tests/language/symbol_literal_test.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2013, 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.
+
+// Test symbol literals.
+
+library symbol_literal_test;
+
+import 'package:expect/expect.dart';
+
+foo(a, b) => Expect.isTrue(identical(a, b));
+
+var check = foo; // Indirection used to avoid inlining.
+
+main() {
+  check(const Symbol("a"), #a);
+  check(const Symbol("a"), #
+                            a);
+  check(const Symbol("ab"), #ab);
+  check(const Symbol("ab"), #
+                             ab);
+  check(const Symbol("a.b"), #a.b);
+  check(const Symbol("a.b"), #
+                              a
+                               .
+                                b);
+  check(const Symbol("=="), #==);
+  check(const Symbol("=="), # ==);
+  check(const Symbol("a.toString"), #a.toString);
+
+  // Tries to call the symbol literal #a.toString
+  Expect.throws(() => #a.toString(), (e) => e is NoSuchMethodError); /// 01: static type warning
+}
diff --git a/tests/language/throw7_negative_test.dart b/tests/language/throw7_negative_test.dart
deleted file mode 100644
index 7ab33b6..0000000
--- a/tests/language/throw7_negative_test.dart
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2011, 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.
-// Dart test program for testing throw statement
-
-class MyException1 {
-  const MyException1([String message = "1"]) : message_ = message;
-  final String message_;
-}
-
-class Helper {
-  Helper() : i = 0 { }
-
-  int f1() {
-    int j = 0;
-    try {
-      j = i;
-    } catch (exception) {
-      i = i + 100;
-      print(exception.message_);
-    }
-    // Since there is a generic 'catch all' statement preceding this
-    // we expect to get a dead code error/warning over here.
-    on MyException1 catch (exception) {
-      i = i + 100;
-      print(exception.message_);
-    }
-    finally {
-      i = i + 1000;
-    }
-    return i;
-  }
-
-  int i;
-}
-
-class Throw7NegativeTest {
-  static testMain() {
-    new Helper().f1();
-  }
-}
-
-main() {
-  Throw7NegativeTest.testMain();
-}
diff --git a/tests/language/throw7_test.dart b/tests/language/throw7_test.dart
new file mode 100644
index 0000000..daa5655
--- /dev/null
+++ b/tests/language/throw7_test.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2011, 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.
+// Dart test program for testing throw statement
+
+main() {
+  int i = 0;
+  try {
+    i = 1;
+  } catch (exception) {
+    i = 2;
+  }
+  // Since there is a generic 'catch all' statement preceding this
+  // we expect to get a dead code error/warning over here.
+  on Exception catch (exception) { i = 3; }  /// 01: compile-time error
+}
diff --git a/tests/language/vm/if_conversion_vm_test.dart b/tests/language/vm/if_conversion_vm_test.dart
index 1c76181..0837030 100644
--- a/tests/language/vm/if_conversion_vm_test.dart
+++ b/tests/language/vm/if_conversion_vm_test.dart
@@ -40,6 +40,8 @@
 f17(b) => b ? 0 : 11;
 f18(b) => b ? 2 : 0;
 
+f19(i) => i == 0 ? 0 : 0;
+
 main() {
   for (var i = 0; i < 20; i++) {
     f1(i);
@@ -62,6 +64,7 @@
     bigPower(i);
     f17(true);
     f18(true);
+    f19(i);
   }
 
   Expect.equals(0, f1(0));
@@ -111,4 +114,7 @@
 
   Expect.equals(0, f18(false));
   Expect.equals(2, f18(true));
+
+  Expect.equals(0, f19(0));
+  Expect.equals(0, f19(1));
 }
diff --git a/tests/language/optimization_test.dart b/tests/language/vm/optimization_test.dart
similarity index 100%
rename from tests/language/optimization_test.dart
rename to tests/language/vm/optimization_test.dart
diff --git a/tests/lib/analyzer/analyze_library.status b/tests/lib/analyzer/analyze_library.status
index 227e5c6..20a7804 100644
--- a/tests/lib/analyzer/analyze_library.status
+++ b/tests/lib/analyzer/analyze_library.status
@@ -3,7 +3,6 @@
 # BSD-style license that can be found in the LICENSE file.
 
 [ $compiler == dart2analyzer ]
-lib/async/async: fail
 lib/core/core: fail
 lib/typed_data/typed_data: fail
 lib/io/io: fail
diff --git a/tests/lib/async/catch_errors15_test.dart b/tests/lib/async/catch_errors15_test.dart
index e76a070..7e1219d 100644
--- a/tests/lib/async/catch_errors15_test.dart
+++ b/tests/lib/async/catch_errors15_test.dart
@@ -36,6 +36,8 @@
                          "after inner",
                          "main exit",
                          "i catch error",
+                         // We guarantee the order of one stream but not any
+                         // global order.
                          "o inner throw",
                          "i future error",
                          "i future error2",
diff --git a/tests/lib/convert/html_escape_test.dart b/tests/lib/convert/html_escape_test.dart
new file mode 100644
index 0000000..691547b
--- /dev/null
+++ b/tests/lib/convert/html_escape_test.dart
@@ -0,0 +1,85 @@
+// Copyright (c) 2013, 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.
+
+import "package:expect/expect.dart";
+import 'dart:async';
+import 'dart:convert';
+
+const _NOOP = 'Nothing_to_escape';
+
+const _TEST_INPUT = '<A <test> of \u00A0 "double" & \'single\' values>';
+
+const _OUTPUT_UNKNOWN = '&lt;A &lt;test&gt; of &nbsp; &quot;double&quot; &amp; '
+  '&apos;single&apos; values&gt;';
+
+const _OUTPUT_ATTRIBUTE = "<A <test> of &nbsp; &quot;double&quot; &amp; "
+  "\'single\' values>";
+
+const _OUTPUT_ELEMENT = '&lt;A &lt;test&gt; of &nbsp; "double" &amp; '
+  '\'single\' values&gt;';
+
+void _testMode(HtmlEscape escape, String input, String expected) {
+  _testConvert(escape, input, expected);
+  _testTransform(escape, input, expected);
+  _testChunked(escape, input, expected);
+}
+
+void _testChunked(HtmlEscape escape, String input, String expected) {
+  var buffer = new StringBuffer();
+
+  var rootSink = new StringConversionSink.fromStringSink(buffer);
+  var sink = escape.startChunkedConversion(rootSink);
+
+  sink.addSlice("1" + input + "2", 1, input.length + 1, false);
+  sink.close();
+
+  Expect.equals(expected, buffer.toString());
+}
+
+void _testConvert(HtmlEscape escape, String input, String expected) {
+  var output = escape.convert(input);
+  Expect.equals(expected, output);
+}
+
+void _testTransform(HtmlEscape escape, String input, String expected) {
+  var controller = new StreamController(sync: true);
+
+  var stream = controller.stream
+      .transform(escape);
+
+  var done = false;
+  int count = 0;
+
+  void stringData(value) {
+    Expect.equals(expected, value);
+    count++;
+  }
+
+  void streamClosed() {
+    done = true;
+  }
+
+  stream.listen(
+      stringData,
+      onDone: streamClosed);
+
+
+  for(var i = 0; i < _COUNT; i++) {
+    controller.add(input);
+  }
+  controller.close();
+  Expect.isTrue(done);
+  Expect.equals(_COUNT, count);
+}
+
+const _COUNT = 3;
+
+void main() {
+  _testMode(HTML_ESCAPE, _TEST_INPUT, _OUTPUT_UNKNOWN);
+  _testMode(const HtmlEscape(), _TEST_INPUT, _OUTPUT_UNKNOWN);
+  _testMode(const HtmlEscape(HtmlEscapeMode.UNKNOWN), _TEST_INPUT, _OUTPUT_UNKNOWN);
+  _testMode(const HtmlEscape(HtmlEscapeMode.ATTRIBUTE), _TEST_INPUT, _OUTPUT_ATTRIBUTE);
+  _testMode(const HtmlEscape(HtmlEscapeMode.ELEMENT), _TEST_INPUT, _OUTPUT_ELEMENT);
+  _testMode(HTML_ESCAPE, _NOOP, _NOOP);
+}
diff --git a/tests/lib/convert/line_splitter_test.dart b/tests/lib/convert/line_splitter_test.dart
index 60a7c29..2d8f5e0 100644
--- a/tests/lib/convert/line_splitter_test.dart
+++ b/tests/lib/convert/line_splitter_test.dart
@@ -83,8 +83,8 @@
 void testReadLine1() {
   var controller = new StreamController(sync: true);
   var stream = controller.stream
-      .transform(new Utf8Decoder())
-      .transform(new LineSplitter());
+      .transform(UTF8.decoder)
+      .transform(const LineSplitter());
 
   var stage = 0;
   var done = false;
@@ -114,8 +114,8 @@
   var controller = new StreamController(sync: true);
 
   var stream = controller.stream
-    .transform(new Utf8Decoder())
-    .transform(new LineSplitter());
+    .transform(UTF8.decoder)
+    .transform(const LineSplitter());
 
   var expectedLines = ['Line1', 'Line2','Line3', 'Line4',
                        '', '', '', '', '', '',
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index c93b83e..aecf6a9 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -10,23 +10,25 @@
 math/double_pow_test: Fail
 math/low_test: Fail
 math/random_test: Fail
-mirrors/invoke_test: Fail # Issue 11954
 mirrors/class_mirror_type_variables_test: Fail # Issue 12087
-mirrors/invoke_private_test: Fail # Issue 12164
-mirrors/equality_test: Fail # Issue 12333, 12919
+mirrors/equality_test: Fail # Issue 12333
+mirrors/fake_function_test: Fail # Issue 11612
 mirrors/function_type_mirror_test: Fail # Issue 12166
 mirrors/generics_test: Fail # Issue 12333
 mirrors/hierarchy_invariants_test: Fail # Issue 11863
-mirrors/fake_function_test: Fail # Issue 11612
+mirrors/invoke_test: Fail # Issue 11954
+mirrors/invoke_named_test: Fail # Issue 10471, 12863
+mirrors/invoke_private_test: Fail # Issue 12164
+mirrors/library_uri_io_test: Skip # Not intended for dart2js as it uses dart:io.
 mirrors/method_mirror_name_test: Fail # Issue 6335
 mirrors/method_mirror_properties_test: Fail # Issue 11861
 mirrors/method_mirror_returntype_test : Fail # Issue 11928
 mirrors/method_mirror_source_test : Fail # Issue 6490
 mirrors/mirrors_test: Fail # TODO(ahe): I'm working on fixing this.
-mirrors/mixin_test: Fail # Issue 12464
+mirrors/mixin_test/none: Fail # Issue 12464
 mirrors/null_test : Fail # Issue 12129
 mirrors/parameter_test: Fail # Issue 6490
-mirrors/library_uri_io_test: Skip # Not intended for dart2js as it uses dart:io.
+mirrors/parameter_metadata_test: Fail # Issue 10905
 mirrors/reflected_type_test: Fail # Issue 12607
 mirrors/typedef_metadata_test: Fail # Issue 12785
 mirrors/unnamed_library_test: Fail # Issue 10580
@@ -34,6 +36,8 @@
 async/run_async4_test: Pass, Fail # no global exception handler in isolates. http://dartbug.com/9012
 async/run_async6_test: Fail # global error handling is not supported. http://dartbug.com/5958
 async/stream_controller_async_test: Fail, Pass # http://dartbug.com/11953
+mirrors/typedef_test/none: Fail # http://dartbug.com/6490
+mirrors/typedef_test/02: Fail, OK # Incorrect VM behavior.
 
 [ $runtime == safari ]
 mirrors/return_type_test: Pass, Timeout # Issue 12858
@@ -77,12 +81,14 @@
 
 [ $compiler == dart2dart ]
 mirrors/*: Skip # http://dartbug.com/11511
-library_metadata2_test/01: Skip # http://dartbug.com/11511
 async/run_async6_test: Fail             # Issue 10957 - may be related to issue 10910
 
 [ $compiler == dart2dart && $minified ]
 json/json_test: Fail                            # Issue 10961
 
+[ $compiler == dart2js && $minified ]
+mirrors/typedef_test/01: Fail # http://dartbug.com/6490
+
 [ $runtime == ff ]
 # FF setTimeout can fire early: https://bugzilla.mozilla.org/show_bug.cgi?id=291386
 async/multiple_timer_test: Pass, Fail
@@ -116,8 +122,9 @@
 
 [ $runtime == vm || ($compiler == none && $runtime == drt) ]
 async/run_async3_test: Fail # _enqueueImmediate runs after Timer. http://dartbug.com/9001.
-mirrors/mixin_dart2js_test: Skip # TODO(ahe): This test is slightly broken. http://dartbug.com/12464
 mirrors/hierarchy_test: Fail # TODO(ahe): This test is slightly broken. http://dartbug.com/12464
+mirrors/mixin_test/01: Fail, OK # TODO(ahe): Slight broken test to ensure test coverage on dart2js.
+mirrors/typedef_test/01: Fail, OK # Incorrect dart2js behavior.
 
 [ $compiler == none && $runtime == drt ]
 async/timer_isolate_test: Skip # See Issue 4997
@@ -144,8 +151,7 @@
 
 [ $compiler == dartanalyzer ]
 mirrors/library_metadata2_test/01: Fail # http://dartbug.com/12950
-library_metadata2_test/01: Fail # http://dartbug.com/12950
+mirrors/typedef_test/none: Fail # Issue 13093
 
 [ $compiler == dart2analyzer ]
 mirrors/library_metadata2_test/01: Fail # http://dartbug.com/12950
-library_metadata2_test/01: Fail # http://dartbug.com/12950
diff --git a/tests/lib/mirrors/equality_dart2js_test.dart b/tests/lib/mirrors/equality_dart2js_test.dart
new file mode 100644
index 0000000..15c036d
--- /dev/null
+++ b/tests/lib/mirrors/equality_dart2js_test.dart
@@ -0,0 +1,112 @@
+// Copyright (c) 2013, 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 test.class_equality_test;
+
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+class A<T> {}
+class B extends A<int> {}
+
+class BadEqualityHash {
+  int count = 0;
+  bool operator ==(other) => true;
+  int get hashCode => count++;
+}
+
+checkEquality(List<Map> equivalenceClasses) {
+  for (var equivalenceClass in equivalenceClasses) {
+    equivalenceClass.forEach((name, member) {
+      equivalenceClass.forEach((otherName, otherMember) {
+        // Reflexivity, symmetry and transitivity.
+        Expect.equals(member, 
+                      otherMember,
+                      "$name == $otherName");
+        Expect.equals(member.hashCode,
+                      otherMember.hashCode,
+                      "$name.hashCode == $otherName.hashCode");
+      });
+      for (var otherEquivalenceClass in equivalenceClasses) {
+        if (otherEquivalenceClass == equivalenceClass) continue;
+        otherEquivalenceClass.forEach((otherName, otherMember) {
+          Expect.notEquals(member,
+                           otherMember,
+                           "$name != $otherName");  // Exclusion.
+          // Hash codes may or may not be equal.
+        });
+      }
+    });
+  }
+}
+
+void subroutine() {
+}
+
+main() {
+  LibraryMirror thisLibrary =
+      currentMirrorSystem()
+      .findLibrary(const Symbol('test.class_equality_test'))
+      .single;
+
+  var o1 = new Object();
+  var o2 = new Object();
+
+  var badEqualityHash1 = new BadEqualityHash();
+  var badEqualityHash2 = new BadEqualityHash();
+
+  checkEquality([
+    {'reflect(o1)' : reflect(o1),
+     'reflect(o1), again' : reflect(o1)},
+
+    {'reflect(o2)' : reflect(o2),
+     'reflect(o2), again' : reflect(o2)},
+
+    {'reflect(badEqualityHash1)' : reflect(badEqualityHash1),
+     'reflect(badEqualityHash1), again' : reflect(badEqualityHash1)},
+
+    {'reflect(badEqualityHash2)' : reflect(badEqualityHash2),
+     'reflect(badEqualityHash2), again' : reflect(badEqualityHash2)},
+
+    {'reflect(true)' : reflect(true),
+     'reflect(true), again' : reflect(true)},
+
+    {'reflect(false)' : reflect(false),
+     'reflect(false), again' : reflect(false)},
+
+    {'reflect(null)' : reflect(null),
+     'reflect(null), again' : reflect(null)},
+
+    {'reflect(3.5+4.5)' : reflect(3.5+4.5),
+     'reflect(6.5+1.5)' : reflect(6.5+1.5)},
+
+    {'reflect(3+4)' : reflect(3+4),
+     'reflect(6+1)' : reflect(6+1)},
+
+    {'reflect("foo")' : reflect("foo"),
+     'reflect("foo"), again' : reflect("foo")},
+
+    {'currentMirrorSystem().voidType' : currentMirrorSystem().voidType},
+
+    {'currentMirrorSystem().dynamicType' : currentMirrorSystem().dynamicType,
+     'thisLibrary.functions[#main].returnType' :
+          thisLibrary.functions[const Symbol('main')].returnType},
+
+    {'reflectClass(A)' : reflectClass(A),
+     'thisLibrary.classes[#A]' : thisLibrary.classes[const Symbol('A')],
+     'reflect(new A<int>()).type.originalDeclaration' :
+          reflect(new A<int>()).type.originalDeclaration},
+
+    {'reflectClass(B)' : reflectClass(B),
+     'thisLibrary.classes[#B]' : thisLibrary.classes[const Symbol('B')],
+     'reflect(new B()).type' : reflect(new B()).type},
+
+    {'thisLibrary' : thisLibrary,
+     'reflectClass(A).owner' : reflectClass(A).owner,
+     'reflectClass(B).owner' : reflectClass(B).owner,
+     'reflect(new A()).type.owner' : reflect(new A()).type.owner,
+     'reflect(new A()).type.owner' : reflect(new A()).type.owner},
+  ]);
+}
diff --git a/tests/lib/mirrors/equality_test.dart b/tests/lib/mirrors/equality_test.dart
index 2399032..1a08b59 100644
--- a/tests/lib/mirrors/equality_test.dart
+++ b/tests/lib/mirrors/equality_test.dart
@@ -11,6 +11,12 @@
 class A<T> {}
 class B extends A<int> {}
 
+class BadEqualityHash {
+  int count = 0;
+  bool operator ==(other) => true;
+  int get hashCode => count++;
+}
+
 checkEquality(List<Map> equivalenceClasses) {
   for (var equivalenceClass in equivalenceClasses) {
     equivalenceClass.forEach((name, member) {
@@ -45,8 +51,11 @@
       .findLibrary(const Symbol('test.class_equality_test'))
       .single;
 
-  Object o1 = new Object();
-  Object o2 = new Object();
+  var o1 = new Object();
+  var o2 = new Object();
+
+  var badEqualityHash1 = new BadEqualityHash();
+  var badEqualityHash2 = new BadEqualityHash();
 
   checkEquality([
     {'reflect(o1)' : reflect(o1),
@@ -55,9 +64,30 @@
     {'reflect(o2)' : reflect(o2),
      'reflect(o2), again' : reflect(o2)},
 
+    {'reflect(badEqualityHash1)' : reflect(badEqualityHash1),
+     'reflect(badEqualityHash1), again' : reflect(badEqualityHash1)},
+
+    {'reflect(badEqualityHash2)' : reflect(badEqualityHash2),
+     'reflect(badEqualityHash2), again' : reflect(badEqualityHash2)},
+
+    {'reflect(true)' : reflect(true),
+     'reflect(true), again' : reflect(true)},
+
+    {'reflect(false)' : reflect(false),
+     'reflect(false), again' : reflect(false)},
+
+    {'reflect(null)' : reflect(null),
+     'reflect(null), again' : reflect(null)},
+
+    {'reflect(3.5+4.5)' : reflect(3.5+4.5),
+     'reflect(6.5+1.5)' : reflect(6.5+1.5)},
+
     {'reflect(3+4)' : reflect(3+4),
      'reflect(6+1)' : reflect(6+1)},
 
+    {'reflect("foo")' : reflect("foo"),
+     'reflect("foo"), again' : reflect("foo")},
+
     {'currentMirrorSystem().voidType' : currentMirrorSystem().voidType,
      'thisLibrary.functions[#subroutine].returnType' :
           thisLibrary.functions[const Symbol('subroutine')].returnType},
diff --git a/tests/lib/mirrors/hierarchy_test.dart b/tests/lib/mirrors/hierarchy_test.dart
index 44ad0f2..16937a6 100644
--- a/tests/lib/mirrors/hierarchy_test.dart
+++ b/tests/lib/mirrors/hierarchy_test.dart
@@ -45,10 +45,9 @@
 > dart.core.Object
 ''', stringifyHierarchy(reflect(new Bar()..foo()..bar()..qux())));
 
-  // TODO(ahe): Using wrong mixin syntax, see http://dartbug.com/12464.
   Expect.stringEquals('''
 > hierarchy_test.Baz
-> hierarchy_test.FooMixin(hierarchy_test.Qux)
+> hierarchy_test.Qux with hierarchy_test.FooMixin
   + hierarchy_test.FooMixin
 > hierarchy_test.Qux
 > dart.core.Object
diff --git a/tests/lib/mirrors/inference_and_no_such_method_test.dart b/tests/lib/mirrors/inference_and_no_such_method_test.dart
new file mode 100644
index 0000000..4f57eed
--- /dev/null
+++ b/tests/lib/mirrors/inference_and_no_such_method_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for dart2js that did type inferencing on parameters
+// whose type may change at runtime due to an invocation through
+// [InstanceMirror.delegate].
+
+import 'dart:mirrors';
+import 'package:expect/expect.dart';
+
+class A {
+  noSuchMethod(im) {
+    reflect(new B()).delegate(im);
+  }
+}
+
+class B {
+  foo(a) => a + 42;
+}
+
+main() {
+  Expect.equals(42, new B().foo(0));
+  Expect.throws(() => new A().foo('foo'),
+                (e) => e is ArgumentError || e is TypeError);
+}
diff --git a/tests/lib/mirrors/invoke_named_test.dart b/tests/lib/mirrors/invoke_named_test.dart
new file mode 100644
index 0000000..2405ba8
--- /dev/null
+++ b/tests/lib/mirrors/invoke_named_test.dart
@@ -0,0 +1,584 @@
+// Copyright (c) 2013, 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 test.invoke_named_test;
+
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+import 'invoke_test.dart';
+
+class C {
+  a(a, {b:'B', c}) => "$a-$b-$c";
+  b({a:'A', b, c}) => "$a-$b-$c";
+  c(a, [b, c='C']) => "$a-$b-$c";
+  d([a, b='B', c='C']) => "$a-$b-$c";
+  e(a, b, c) => "$a-$b-$c";
+}
+
+class D {
+  static a(a, {b:'B', c}) => "$a-$b-$c";
+  static b({a:'A', b, c}) => "$a-$b-$c";
+  static c(a, [b, c='C']) => "$a-$b-$c";
+  static d([a, b='B', c='C']) => "$a-$b-$c";
+  static e(a, b, c) => "$a-$b-$c";
+}
+
+class E {
+  var field;
+  E(a, {b:'B', c}) : this.field = "$a-$b-$c";
+  E.b({a:'A', b, c}) : this.field = "$a-$b-$c";
+  E.c(a, [b, c='C']) : this.field = "$a-$b-$c";
+  E.d([a, b='B', c='C']) : this.field = "$a-$b-$c";
+  E.e(a, b, c) : this.field = "$a-$b-$c";
+}
+
+a(a, {b:'B', c}) => "$a-$b-$c";
+b({a:'A', b, c}) => "$a-$b-$c";
+c(a, [b, c='C']) => "$a-$b-$c";
+d([a, b='B', c='C']) => "$a-$b-$c";
+e(a, b, c) => "$a-$b-$c";
+
+testSyncInvoke(ObjectMirror om) {
+  InstanceMirror result;
+
+  result = om.invoke(const Symbol('a'), ['X']);
+  Expect.equals('X-B-null', result.reflectee);
+  result = om.invoke(const Symbol('a'), ['X'], {const Symbol('b') : 'Y'});
+  Expect.equals('X-Y-null', result.reflectee);
+  result = om.invoke(const Symbol('a'), ['X'], {const Symbol('c') : 'Z', const Symbol('b') : 'Y'});
+  Expect.equals('X-Y-Z', result.reflectee);
+  Expect.throws(() => om.invoke(const Symbol('a'), []),
+                isNoSuchMethodError,
+                'Insufficient positional arguments');
+  Expect.throws(() => om.invoke(const Symbol('a'), ['X', 'Y']),
+                isNoSuchMethodError,
+                'Extra positional arguments');
+  Expect.throws(() => om.invoke(const Symbol('a'), ['X'], {const Symbol('undef') : 'Y'}),
+                isNoSuchMethodError,
+                'Unmatched named argument');
+ 
+  result = om.invoke(const Symbol('b'), []);
+  Expect.equals('A-null-null', result.reflectee);
+  result = om.invoke(const Symbol('b'), [], {const Symbol('a') : 'X'});
+  Expect.equals('X-null-null', result.reflectee);
+  result = om.invoke(const Symbol('b'), [], {const Symbol('b') :'Y', const Symbol('c') :'Z', const Symbol('a') :'X'});
+  Expect.equals('X-Y-Z', result.reflectee);
+  Expect.throws(() => om.invoke(const Symbol('b'), ['X']),
+                isNoSuchMethodError,
+                'Extra positional arguments');
+  Expect.throws(() => om.invoke(const Symbol('b'), ['X'], {const Symbol('undef'): 'Y'}),
+                isNoSuchMethodError,
+                'Unmatched named argument');
+
+  result = om.invoke(const Symbol('c'), ['X']);
+  Expect.equals('X-null-C', result.reflectee);
+  result = om.invoke(const Symbol('c'), ['X', 'Y']);
+  Expect.equals('X-Y-C', result.reflectee);
+  result = om.invoke(const Symbol('c'), ['X', 'Y', 'Z']);
+  Expect.equals('X-Y-Z', result.reflectee);
+  Expect.throws(() => om.invoke(const Symbol('c'), []),
+                isNoSuchMethodError,
+                'Insufficient positional arguments');
+  Expect.throws(() => om.invoke(const Symbol('c'), ['X', 'Y', 'Z', 'W']),
+                isNoSuchMethodError,
+                'Extra positional arguments');
+  Expect.throws(() => om.invoke(const Symbol('c'), ['X'], {const Symbol('undef'): 'Y'}),
+                isNoSuchMethodError,
+                'Unmatched named argument');
+
+  result = om.invoke(const Symbol('d'), []);
+  Expect.equals('null-B-C', result.reflectee);
+  result = om.invoke(const Symbol('d'), ['X']);
+  Expect.equals('X-B-C', result.reflectee);
+  result = om.invoke(const Symbol('d'), ['X', 'Y']);
+  Expect.equals('X-Y-C', result.reflectee);
+  result = om.invoke(const Symbol('d'), ['X', 'Y', 'Z']);
+  Expect.equals('X-Y-Z', result.reflectee);
+  Expect.throws(() => om.invoke(const Symbol('d'), ['X', 'Y', 'Z', 'W']),
+                isNoSuchMethodError,
+                'Extra positional arguments');
+  Expect.throws(() => om.invoke(const Symbol('d'), ['X'], {const Symbol('undef'): 'Y'}),
+                isNoSuchMethodError,
+                'Unmatched named argument');
+
+  result = om.invoke(const Symbol('e'), ['X', 'Y', 'Z']);
+  Expect.equals('X-Y-Z', result.reflectee);
+  Expect.throws(() => om.invoke(const Symbol('e'), ['X']),
+                isNoSuchMethodError,
+                'Insufficient positional arguments');
+  Expect.throws(() => om.invoke(const Symbol('e'), ['X', 'Y', 'Z', 'W']),
+                isNoSuchMethodError,
+                'Extra positional arguments');
+  Expect.throws(() => om.invoke(const Symbol('e'), ['X'], {const Symbol('undef'): 'Y'}),
+                isNoSuchMethodError,
+                'Unmatched named argument');
+}
+
+testAsyncInvoke(ObjectMirror om) {
+  Future<InstanceMirror> future;
+
+  future = om.invokeAsync(const Symbol('a'), ['X']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-B-null', result.reflectee);
+  });
+  future = om.invokeAsync(const Symbol('a'), ['X'], {const Symbol('b') : 'Y'});
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-null', result.reflectee);
+  });
+  future = om.invokeAsync(const Symbol('a'), ['X'], {const Symbol('c') : 'Z', const Symbol('b') : 'Y'});
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-Z', result.reflectee);
+  });
+  future = om.invokeAsync(const Symbol('a'), []);
+  expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
+  future = om.invokeAsync(const Symbol('a'), ['X', 'Y']);
+  expectError(future, isNoSuchMethodError, 'Extra positional arguments');
+  future = om.invokeAsync(const Symbol('a'), ['X'], {const Symbol('undef') : 'Y'});
+  expectError(future, isNoSuchMethodError, 'Unmatched named argument');
+ 
+ 
+  future = om.invokeAsync(const Symbol('b'), []);
+  expectValueThen(future, (result) {
+    Expect.equals('A-null-null', result.reflectee);
+  });
+  future = om.invokeAsync(const Symbol('b'), [], {const Symbol('a') : 'X'});
+  expectValueThen(future, (result) {
+    Expect.equals('X-null-null', result.reflectee);
+  });
+  future = om.invokeAsync(const Symbol('b'), [], {const Symbol('b') :'Y', const Symbol('c') :'Z', const Symbol('a') :'X'});
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-Z', result.reflectee);
+  });
+  future = om.invokeAsync(const Symbol('b'), ['X']);
+  expectError(future, isNoSuchMethodError, 'Extra positional arguments');
+  future = om.invokeAsync(const Symbol('b'), ['X'], {const Symbol('undef'): 'Y'});
+  expectError(future, isNoSuchMethodError, 'Unmatched named argument');
+
+
+  future = om.invokeAsync(const Symbol('c'), ['X']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-null-C', result.reflectee);
+  });
+  future = om.invokeAsync(const Symbol('c'), ['X', 'Y']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-C', result.reflectee);
+  });
+  future = om.invokeAsync(const Symbol('c'), ['X', 'Y', 'Z']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-Z', result.reflectee);
+  });
+  future = om.invokeAsync(const Symbol('c'), []);
+  expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
+  future = om.invokeAsync(const Symbol('c'), ['X', 'Y', 'Z', 'W']);
+  expectError(future, isNoSuchMethodError, 'Extra positional arguments');
+  future = om.invokeAsync(const Symbol('c'), ['X'], {const Symbol('undef'): 'Y'});
+  expectError(future, isNoSuchMethodError, 'Unmatched named argument');
+
+
+  future = om.invokeAsync(const Symbol('d'), []);
+  expectValueThen(future, (result) {
+    Expect.equals('null-B-C', result.reflectee);
+  });
+  future = om.invokeAsync(const Symbol('d'), ['X']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-B-C', result.reflectee);
+  });
+  future = om.invokeAsync(const Symbol('d'), ['X', 'Y']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-C', result.reflectee);
+  });
+  future = om.invokeAsync(const Symbol('d'), ['X', 'Y', 'Z']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-Z', result.reflectee);
+  });
+  future = om.invokeAsync(const Symbol('d'), ['X', 'Y', 'Z', 'W']);
+  expectError(future, isNoSuchMethodError, 'Extra positional arguments');
+  future = om.invokeAsync(const Symbol('d'), ['X'], {const Symbol('undef'): 'Y'});
+  expectError(future, isNoSuchMethodError, 'Unmatched named argument');
+
+
+  future = om.invokeAsync(const Symbol('e'), ['X', 'Y', 'Z']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-Z', result.reflectee);
+  });
+  future = om.invokeAsync(const Symbol('e'), ['X']);
+  expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
+  future = om.invokeAsync(const Symbol('e'), ['X', 'Y', 'Z', 'W']);
+  expectError(future, isNoSuchMethodError, 'Extra positional arguments');
+  future = om.invokeAsync(const Symbol('e'), ['X'], {const Symbol('undef'): 'Y'});
+  expectError(future, isNoSuchMethodError, 'Unmatched named argument');
+}
+
+testSyncNewInstance() {
+  ClassMirror cm = reflectClass(E);
+  InstanceMirror result;
+
+  result = cm.newInstance(const Symbol(''), ['X']);
+  Expect.equals('X-B-null', result.reflectee.field);
+  result = cm.newInstance(const Symbol(''), ['X'], {const Symbol('b') : 'Y'});
+  Expect.equals('X-Y-null', result.reflectee.field);
+  result = cm.newInstance(const Symbol(''), ['X'], {const Symbol('c') : 'Z', const Symbol('b') : 'Y'});
+  Expect.equals('X-Y-Z', result.reflectee.field);
+  Expect.throws(() => cm.newInstance(const Symbol(''), []),
+                isNoSuchMethodError,
+                'Insufficient positional arguments');
+  Expect.throws(() => cm.newInstance(const Symbol(''), ['X', 'Y']),
+                isNoSuchMethodError,
+                'Extra positional arguments');
+  Expect.throws(() => cm.newInstance(const Symbol(''), ['X'], {const Symbol('undef') : 'Y'}),
+                isNoSuchMethodError,
+                'Unmatched named argument');
+ 
+  result = cm.newInstance(const Symbol('b'), []);
+  Expect.equals('A-null-null', result.reflectee.field);
+  result = cm.newInstance(const Symbol('b'), [], {const Symbol('a') : 'X'});
+  Expect.equals('X-null-null', result.reflectee.field);
+  result = cm.newInstance(const Symbol('b'), [], {const Symbol('b') :'Y', const Symbol('c') :'Z', const Symbol('a') :'X'});
+  Expect.equals('X-Y-Z', result.reflectee.field);
+  Expect.throws(() => cm.newInstance(const Symbol('b'), ['X']),
+                isNoSuchMethodError,
+                'Extra positional arguments');
+  Expect.throws(() => cm.newInstance(const Symbol('b'), ['X'], {const Symbol('undef'): 'Y'}),
+                isNoSuchMethodError,
+                'Unmatched named argument');
+
+  result = cm.newInstance(const Symbol('c'), ['X']);
+  Expect.equals('X-null-C', result.reflectee.field);
+  result = cm.newInstance(const Symbol('c'), ['X', 'Y']);
+  Expect.equals('X-Y-C', result.reflectee.field);
+  result = cm.newInstance(const Symbol('c'), ['X', 'Y', 'Z']);
+  Expect.equals('X-Y-Z', result.reflectee.field);
+  Expect.throws(() => cm.newInstance(const Symbol('c'), []),
+                isNoSuchMethodError,
+                'Insufficient positional arguments');
+  Expect.throws(() => cm.newInstance(const Symbol('c'), ['X', 'Y', 'Z', 'W']),
+                isNoSuchMethodError,
+                'Extra positional arguments');
+  Expect.throws(() => cm.newInstance(const Symbol('c'), ['X'], {const Symbol('undef'): 'Y'}),
+                isNoSuchMethodError,
+                'Unmatched named argument');
+
+  result = cm.newInstance(const Symbol('d'), []);
+  Expect.equals('null-B-C', result.reflectee.field);
+  result = cm.newInstance(const Symbol('d'), ['X']);
+  Expect.equals('X-B-C', result.reflectee.field);
+  result = cm.newInstance(const Symbol('d'), ['X', 'Y']);
+  Expect.equals('X-Y-C', result.reflectee.field);
+  result = cm.newInstance(const Symbol('d'), ['X', 'Y', 'Z']);
+  Expect.equals('X-Y-Z', result.reflectee.field);
+  Expect.throws(() => cm.newInstance(const Symbol('d'), ['X', 'Y', 'Z', 'W']),
+                isNoSuchMethodError,
+                'Extra positional arguments');
+  Expect.throws(() => cm.newInstance(const Symbol('d'), ['X'], {const Symbol('undef'): 'Y'}),
+                isNoSuchMethodError,
+                'Unmatched named argument');
+
+  result = cm.newInstance(const Symbol('e'), ['X', 'Y', 'Z']);
+  Expect.equals('X-Y-Z', result.reflectee.field);
+  Expect.throws(() => cm.newInstance(const Symbol('e'), ['X']),
+                isNoSuchMethodError,
+                'Insufficient positional arguments');
+  Expect.throws(() => cm.newInstance(const Symbol('e'), ['X', 'Y', 'Z', 'W']),
+                isNoSuchMethodError,
+                'Extra positional arguments');
+  Expect.throws(() => cm.newInstance(const Symbol('e'), ['X'], {const Symbol('undef'): 'Y'}),
+                isNoSuchMethodError,
+                'Unmatched named argument');
+}
+
+testAsyncNewInstance() {
+  ClassMirror cm = reflectClass(E);
+  Future<InstanceMirror> future;
+
+  future = cm.newInstanceAsync(const Symbol(''), ['X']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-B-null', result.reflectee.field);
+  });
+  future = cm.newInstanceAsync(const Symbol(''), ['X'], {const Symbol('b') : 'Y'});
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-null', result.reflectee.field);
+  });
+  future = cm.newInstanceAsync(const Symbol(''), ['X'], {const Symbol('c') : 'Z', const Symbol('b') : 'Y'});
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-Z', result.reflectee.field);
+  });
+  future = cm.newInstanceAsync(const Symbol(''), []);
+  expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
+  future = cm.newInstanceAsync(const Symbol(''), ['X', 'Y']);
+  expectError(future, isNoSuchMethodError, 'Extra positional arguments');
+  future = cm.newInstanceAsync(const Symbol(''), ['X'], {const Symbol('undef') : 'Y'});
+  expectError(future, isNoSuchMethodError, 'Unmatched named argument');
+ 
+ 
+  future = cm.newInstanceAsync(const Symbol('b'), []);
+  expectValueThen(future, (result) {
+    Expect.equals('A-null-null', result.reflectee.field);
+  });
+  future = cm.newInstanceAsync(const Symbol('b'), [], {const Symbol('a') : 'X'});
+  expectValueThen(future, (result) {
+    Expect.equals('X-null-null', result.reflectee.field);
+  });
+  future = cm.newInstanceAsync(const Symbol('b'), [], {const Symbol('b') :'Y', const Symbol('c') :'Z', const Symbol('a') :'X'});
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-Z', result.reflectee.field);
+  });
+  future = cm.newInstanceAsync(const Symbol('b'), ['X']);
+  expectError(future, isNoSuchMethodError, 'Extra positional arguments');
+  future = cm.newInstanceAsync(const Symbol('b'), ['X'], {const Symbol('undef'): 'Y'});
+  expectError(future, isNoSuchMethodError, 'Unmatched named argument');
+
+
+  future = cm.newInstanceAsync(const Symbol('c'), ['X']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-null-C', result.reflectee.field);
+  });
+  future = cm.newInstanceAsync(const Symbol('c'), ['X', 'Y']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-C', result.reflectee.field);
+  });
+  future = cm.newInstanceAsync(const Symbol('c'), ['X', 'Y', 'Z']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-Z', result.reflectee.field);
+  });
+  future = cm.newInstanceAsync(const Symbol('c'), []);
+  expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
+  future = cm.newInstanceAsync(const Symbol('c'), ['X', 'Y', 'Z', 'W']);
+  expectError(future, isNoSuchMethodError, 'Extra positional arguments');
+  future = cm.newInstanceAsync(const Symbol('c'), ['X'], {const Symbol('undef'): 'Y'});
+  expectError(future, isNoSuchMethodError, 'Unmatched named argument');
+
+
+  future = cm.newInstanceAsync(const Symbol('d'), []);
+  expectValueThen(future, (result) {
+    Expect.equals('null-B-C', result.reflectee.field);
+  });
+  future = cm.newInstanceAsync(const Symbol('d'), ['X']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-B-C', result.reflectee.field);
+  });
+  future = cm.newInstanceAsync(const Symbol('d'), ['X', 'Y']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-C', result.reflectee.field);
+  });
+  future = cm.newInstanceAsync(const Symbol('d'), ['X', 'Y', 'Z']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-Z', result.reflectee.field);
+  });
+  future = cm.newInstanceAsync(const Symbol('d'), ['X', 'Y', 'Z', 'W']);
+  expectError(future, isNoSuchMethodError, 'Extra positional arguments');
+  future = cm.newInstanceAsync(const Symbol('d'), ['X'], {const Symbol('undef'): 'Y'});
+  expectError(future, isNoSuchMethodError, 'Unmatched named argument');
+
+
+  future = cm.newInstanceAsync(const Symbol('e'), ['X', 'Y', 'Z']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-Z', result.reflectee.field);
+  });
+  future = cm.newInstanceAsync(const Symbol('e'), ['X']);
+  expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
+  future = cm.newInstanceAsync(const Symbol('e'), ['X', 'Y', 'Z', 'W']);
+  expectError(future, isNoSuchMethodError, 'Extra positional arguments');
+  future = cm.newInstanceAsync(const Symbol('e'), ['X'], {const Symbol('undef'): 'Y'});
+  expectError(future, isNoSuchMethodError, 'Unmatched named argument');
+}
+
+testSyncApply() {
+  ClosureMirror cm;
+  InstanceMirror result;
+
+  cm = reflect(a);
+  result = cm.apply(['X']);
+  Expect.equals('X-B-null', result.reflectee);
+  result = cm.apply(['X'], {const Symbol('b') : 'Y'});
+  Expect.equals('X-Y-null', result.reflectee);
+  result = cm.apply(['X'], {const Symbol('c') : 'Z', const Symbol('b') : 'Y'});
+  Expect.equals('X-Y-Z', result.reflectee);
+  Expect.throws(() => cm.apply([]),
+                isNoSuchMethodError,
+                'Insufficient positional arguments');
+  Expect.throws(() => cm.apply(['X', 'Y']),
+                isNoSuchMethodError,
+                'Extra positional arguments');
+  Expect.throws(() => cm.apply(['X'], {const Symbol('undef') : 'Y'}),
+                isNoSuchMethodError,
+                'Unmatched named argument');
+ 
+  cm = reflect(b);
+  result = cm.apply([]);
+  Expect.equals('A-null-null', result.reflectee);
+  result = cm.apply([], {const Symbol('a') : 'X'});
+  Expect.equals('X-null-null', result.reflectee);
+  result = cm.apply([], {const Symbol('b') :'Y', const Symbol('c') :'Z', const Symbol('a') :'X'});
+  Expect.equals('X-Y-Z', result.reflectee);
+  Expect.throws(() => cm.apply(['X']),
+                isNoSuchMethodError,
+                'Extra positional arguments');
+  Expect.throws(() => cm.apply(['X'], {const Symbol('undef'): 'Y'}),
+                isNoSuchMethodError,
+                'Unmatched named argument');
+
+  cm = reflect(c);
+  result = cm.apply(['X']);
+  Expect.equals('X-null-C', result.reflectee);
+  result = cm.apply(['X', 'Y']);
+  Expect.equals('X-Y-C', result.reflectee);
+  result = cm.apply(['X', 'Y', 'Z']);
+  Expect.equals('X-Y-Z', result.reflectee);
+  Expect.throws(() => cm.apply([]),
+                isNoSuchMethodError,
+                'Insufficient positional arguments');
+  Expect.throws(() => cm.apply(['X', 'Y', 'Z', 'W']),
+                isNoSuchMethodError,
+                'Extra positional arguments');
+  Expect.throws(() => cm.apply(['X'], {const Symbol('undef'): 'Y'}),
+                isNoSuchMethodError,
+                'Unmatched named argument');
+
+  cm = reflect(d);
+  result = cm.apply([]);
+  Expect.equals('null-B-C', result.reflectee);
+  result = cm.apply(['X']);
+  Expect.equals('X-B-C', result.reflectee);
+  result = cm.apply(['X', 'Y']);
+  Expect.equals('X-Y-C', result.reflectee);
+  result = cm.apply(['X', 'Y', 'Z']);
+  Expect.equals('X-Y-Z', result.reflectee);
+  Expect.throws(() => cm.apply(['X', 'Y', 'Z', 'W']),
+                isNoSuchMethodError,
+                'Extra positional arguments');
+  Expect.throws(() => cm.apply(['X'], {const Symbol('undef'): 'Y'}),
+                isNoSuchMethodError,
+                'Unmatched named argument');
+
+  cm = reflect(e);
+  result = cm.apply(['X', 'Y', 'Z']);
+  Expect.equals('X-Y-Z', result.reflectee);
+  Expect.throws(() => cm.apply(['X']),
+                isNoSuchMethodError,
+                'Insufficient positional arguments');
+  Expect.throws(() => cm.apply(['X', 'Y', 'Z', 'W']),
+                isNoSuchMethodError,
+                'Extra positional arguments');
+  Expect.throws(() => cm.apply(['X'], {const Symbol('undef'): 'Y'}),
+                isNoSuchMethodError,
+                'Unmatched named argument');
+}
+
+testAsyncApply() {
+  ClosureMirror cm;
+  Future<InstanceMirror> future;
+
+  cm = reflect(a);
+  future = cm.applyAsync(['X']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-B-null', result.reflectee);
+  });
+  future = cm.applyAsync(['X'], {const Symbol('b') : 'Y'});
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-null', result.reflectee);
+  });
+  future = cm.applyAsync(['X'], {const Symbol('c') : 'Z', const Symbol('b') : 'Y'});
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-Z', result.reflectee);
+  });
+  future = cm.applyAsync([]);
+  expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
+  future = cm.applyAsync(['X', 'Y']);
+  expectError(future, isNoSuchMethodError, 'Extra positional arguments');
+  future = cm.applyAsync(['X'], {const Symbol('undef') : 'Y'});
+  expectError(future, isNoSuchMethodError, 'Unmatched named argument');
+ 
+
+  cm = reflect(b);
+  future = cm.applyAsync([]);
+  expectValueThen(future, (result) {
+    Expect.equals('A-null-null', result.reflectee);
+  });
+  future = cm.applyAsync([], {const Symbol('a') : 'X'});
+  expectValueThen(future, (result) {
+    Expect.equals('X-null-null', result.reflectee);
+  });
+  future = cm.applyAsync([], {const Symbol('b') :'Y', const Symbol('c') :'Z', const Symbol('a') :'X'});
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-Z', result.reflectee);
+  });
+  future = cm.applyAsync(['X']);
+  expectError(future, isNoSuchMethodError, 'Extra positional arguments');
+  future = cm.applyAsync(['X'], {const Symbol('undef'): 'Y'});
+  expectError(future, isNoSuchMethodError, 'Unmatched named argument');
+
+
+  cm = reflect(c);
+  future = cm.applyAsync(['X']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-null-C', result.reflectee);
+  });
+  future = cm.applyAsync(['X', 'Y']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-C', result.reflectee);
+  });
+  future = cm.applyAsync(['X', 'Y', 'Z']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-Z', result.reflectee);
+  });
+  future = cm.applyAsync([]);
+  expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
+  future = cm.applyAsync(['X', 'Y', 'Z', 'W']);
+  expectError(future, isNoSuchMethodError, 'Extra positional arguments');
+  future = cm.applyAsync(['X'], {const Symbol('undef'): 'Y'});
+  expectError(future, isNoSuchMethodError, 'Unmatched named argument');
+
+
+  cm = reflect(d);
+  future = cm.applyAsync([]);
+  expectValueThen(future, (result) {
+    Expect.equals('null-B-C', result.reflectee);
+  });
+  future = cm.applyAsync(['X']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-B-C', result.reflectee);
+  });
+  future = cm.applyAsync(['X', 'Y']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-C', result.reflectee);
+  });
+  future = cm.applyAsync(['X', 'Y', 'Z']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-Z', result.reflectee);
+  });
+  future = cm.applyAsync(['X', 'Y', 'Z', 'W']);
+  expectError(future, isNoSuchMethodError, 'Extra positional arguments');
+  future = cm.applyAsync(['X'], {const Symbol('undef'): 'Y'});
+  expectError(future, isNoSuchMethodError, 'Unmatched named argument');
+
+
+  cm = reflect(e);
+  future = cm.applyAsync(['X', 'Y', 'Z']);
+  expectValueThen(future, (result) {
+    Expect.equals('X-Y-Z', result.reflectee);
+  });
+  future = cm.applyAsync(['X']);
+  expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
+  future = cm.applyAsync(['X', 'Y', 'Z', 'W']);
+  expectError(future, isNoSuchMethodError, 'Extra positional arguments');
+  future = cm.applyAsync(['X'], {const Symbol('undef'): 'Y'});
+  expectError(future, isNoSuchMethodError, 'Unmatched named argument');
+}
+
+main() {
+  testSyncInvoke(reflect(new C()));       // InstanceMirror
+  testSyncInvoke(reflectClass(D));        // ClassMirror
+  testSyncInvoke(reflectClass(D).owner);  // LibraryMirror
+
+  testAsyncInvoke(reflect(new C()));       // InstanceMirror
+  testAsyncInvoke(reflectClass(D));        // ClassMirror
+  testAsyncInvoke(reflectClass(D).owner);  // LibraryMirror
+
+  testSyncNewInstance();
+  testAsyncNewInstance();
+  
+  testSyncApply();
+  testAsyncApply();
+}
diff --git a/tests/lib/mirrors/mixin_dart2js_test.dart b/tests/lib/mirrors/mixin_dart2js_test.dart
deleted file mode 100644
index eb70034..0000000
--- a/tests/lib/mirrors/mixin_dart2js_test.dart
+++ /dev/null
@@ -1,306 +0,0 @@
-// Copyright (c) 2013, 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.
-
-// TODO(ahe): This test is sligthly broken but provides temporary test coverage
-// for dart2js. See http://dartbug.com/12464.
-
-library test.mixin_test;
-
-@MirrorsUsed(targets: 'test.mixin_test, test.model, Object', override: '*')
-import 'dart:mirrors';
-
-import 'package:expect/expect.dart';
-
-import 'model.dart';
-import 'stringify.dart';
-
-class Mixin {
-  int i;
-  m() {}
-}
-
-class Mixin2 {
-  int i2;
-  m2() {}
-}
-
-typedef MixinApplication = C with Mixin;
-typedef MixinApplicationA = C with Mixin, Mixin2;
-
-typedef UnusedMixinApplication = C with Mixin;
-
-class Subclass extends C with Mixin {
-  f() {}
-}
-
-class Subclass2 extends MixinApplication {
-  g() {}
-}
-
-class SubclassA extends C with Mixin, Mixin2 {
-  fa() {}
-}
-
-class Subclass2A extends MixinApplicationA {
-  ga() {}
-}
-
-checkClass(Type type, List<String> expectedSuperclasses) {
-  int i = 0;
-  for (var cls = reflectClass(type); cls != null; cls = cls.superclass) {
-    expect(expectedSuperclasses[i++], cls);
-  }
-  Expect.equals(i, expectedSuperclasses.length, '$type');
-}
-
-expectSame(ClassMirror a, ClassMirror b) {
-  Expect.equals(a, b);
-  expect(stringify(a), b);
-  expect(stringify(b), a);
-}
-
-testMixin() {
-  checkClass(Mixin, [
-      'Class(s(Mixin) in s(test.mixin_test), top-level)',
-      'Class(s(Object) in s(dart.core), top-level)',
-  ]);
-
-  expect(
-      '{i: Variable(s(i) in s(Mixin)),'
-      ' m: Method(s(m) in s(Mixin))}',
-      reflectClass(Mixin).members);
-
-  expect('{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
-         reflectClass(Mixin).constructors);
-}
-
-testMixin2() {
-  checkClass(Mixin2, [
-      'Class(s(Mixin2) in s(test.mixin_test), top-level)',
-      'Class(s(Object) in s(dart.core), top-level)',
-  ]);
-
-  expect(
-      '{i2: Variable(s(i2) in s(Mixin2)),'
-      ' m2: Method(s(m2) in s(Mixin2))}',
-      reflectClass(Mixin2).members);
-
-  expect('{Mixin2: Method(s(Mixin2) in s(Mixin2), constructor)}',
-         reflectClass(Mixin2).constructors);
-}
-
-testMixinApplication() {
-  checkClass(MixinApplication, [
-      'Class(s(MixinApplication) in s(test.mixin_test), top-level)',
-      'Class(s(C) in s(test.model), top-level)',
-      'Class(s(B) in s(test.model), top-level)',
-      'Class(s(A) in s(test.model), top-level)',
-      'Class(s(Object) in s(dart.core), top-level)',
-  ]);
-
-  expect(
-      '{i: Variable(s(i) in s(MixinApplication)),'
-      ' m: Method(s(m) in s(MixinApplication))}',
-      reflectClass(MixinApplication).members);
-
-  expect('{MixinApplication: Method(s(MixinApplication) in s(MixinApplication),'
-         ' constructor)}',
-         reflectClass(MixinApplication).constructors);
-
-  expectSame(reflectClass(C), reflectClass(MixinApplication).superclass);
-}
-
-testMixinApplicationA() {
-  checkClass(MixinApplicationA, [
-      'Class(s(MixinApplicationA) in s(test.mixin_test), top-level)',
-      'Class(s(test.mixin_test.Mixin(test.model.C)), top-level)',
-      'Class(s(C) in s(test.model), top-level)',
-      'Class(s(B) in s(test.model), top-level)',
-      'Class(s(A) in s(test.model), top-level)',
-      'Class(s(Object) in s(dart.core), top-level)',
-  ]);
-
-  expect(
-      // TODO(ahe): The owner should be the mixin.
-      '{i2: Variable(s(i2) in s(MixinApplicationA)),'
-      ' m2: Method(s(m2) in s(MixinApplicationA))}',
-      reflectClass(MixinApplicationA).members);
-
-  expect(
-      '{MixinApplicationA: Method(s(MixinApplicationA) in s(MixinApplicationA),'
-      ' constructor)}',
-      reflectClass(MixinApplicationA).constructors);
-
-  expect(
-      '{i: Variable(s(i) in s(Mixin)),'
-      ' m: Method(s(m) in s(Mixin))}',
-      reflectClass(MixinApplicationA).superclass.members);
-
-  expect(
-      // TODO(ahe): The owner should be the mixin application.
-      '{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
-      reflectClass(MixinApplicationA).superclass.constructors);
-
-  expectSame(
-      reflectClass(C),
-      reflectClass(MixinApplicationA).superclass.superclass);
-}
-
-testUnusedMixinApplication() {
-  checkClass(UnusedMixinApplication, [
-      'Class(s(UnusedMixinApplication) in s(test.mixin_test), top-level)',
-      'Class(s(C) in s(test.model), top-level)',
-      'Class(s(B) in s(test.model), top-level)',
-      'Class(s(A) in s(test.model), top-level)',
-      'Class(s(Object) in s(dart.core), top-level)',
-  ]);
-
-  expect(
-      '{i: Variable(s(i) in s(UnusedMixinApplication)),'
-      ' m: Method(s(m) in s(UnusedMixinApplication))}',
-      reflectClass(UnusedMixinApplication).members);
-
-  expect(
-      '{UnusedMixinApplication: Method(s(UnusedMixinApplication)'
-      ' in s(UnusedMixinApplication), constructor)}',
-      reflectClass(UnusedMixinApplication).constructors);
-
-  expectSame(reflectClass(C), reflectClass(UnusedMixinApplication).superclass);
-}
-
-testSubclass() {
-  checkClass(Subclass, [
-      'Class(s(Subclass) in s(test.mixin_test), top-level)',
-      'Class(s(test.mixin_test.Mixin(test.model.C)), top-level)',
-      'Class(s(C) in s(test.model), top-level)',
-      'Class(s(B) in s(test.model), top-level)',
-      'Class(s(A) in s(test.model), top-level)',
-      'Class(s(Object) in s(dart.core), top-level)',
-  ]);
-
-  expect(
-      '{f: Method(s(f) in s(Subclass))}',
-      reflectClass(Subclass).members);
-
-  expect(
-      '{Subclass: Method(s(Subclass) in s(Subclass), constructor)}',
-      reflectClass(Subclass).constructors);
-
-  expect(
-      '{i: Variable(s(i) in s(Mixin)),'
-      ' m: Method(s(m) in s(Mixin))}',
-      reflectClass(Subclass).superclass.members);
-
-  expect(
-       // TODO(ahe): The owner should be the mixin application.
-      '{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
-      reflectClass(Subclass).superclass.constructors);
-
-  expectSame(
-      reflectClass(C),
-      reflectClass(Subclass).superclass.superclass);
-}
-
-testSubclass2() {
-  checkClass(Subclass2, [
-      'Class(s(Subclass2) in s(test.mixin_test), top-level)',
-      'Class(s(MixinApplication) in s(test.mixin_test), top-level)',
-      'Class(s(C) in s(test.model), top-level)',
-      'Class(s(B) in s(test.model), top-level)',
-      'Class(s(A) in s(test.model), top-level)',
-      'Class(s(Object) in s(dart.core), top-level)',
-  ]);
-
-  expect(
-      '{g: Method(s(g) in s(Subclass2))}',
-      reflectClass(Subclass2).members);
-
-  expect(
-      '{Subclass2: Method(s(Subclass2) in s(Subclass2), constructor)}',
-      reflectClass(Subclass2).constructors);
-
-  expectSame(
-      reflectClass(MixinApplication),
-      reflectClass(Subclass2).superclass);
-}
-
-testSubclassA() {
-  checkClass(SubclassA, [
-      'Class(s(SubclassA) in s(test.mixin_test), top-level)',
-      'Class(s(test.mixin_test.Mixin2(test.mixin_test.Mixin(test.model.C))),'
-      ' top-level)',
-      'Class(s(test.mixin_test.Mixin(test.model.C)), top-level)',
-      'Class(s(C) in s(test.model), top-level)',
-      'Class(s(B) in s(test.model), top-level)',
-      'Class(s(A) in s(test.model), top-level)',
-      'Class(s(Object) in s(dart.core), top-level)',
-  ]);
-
-  expect(
-      '{fa: Method(s(fa) in s(SubclassA))}',
-      reflectClass(SubclassA).members);
-
-  expect(
-      '{SubclassA: Method(s(SubclassA) in s(SubclassA), constructor)}',
-      reflectClass(SubclassA).constructors);
-
-  expect(
-      '{i2: Variable(s(i2) in s(Mixin2)),'
-      ' m2: Method(s(m2) in s(Mixin2))}',
-      reflectClass(SubclassA).superclass.members);
-
-  expect(
-       // TODO(ahe): The owner should be the mixin application.
-      '{Mixin2: Method(s(Mixin2) in s(Mixin2), constructor)}',
-      reflectClass(SubclassA).superclass.constructors);
-
-  expect(
-      '{i: Variable(s(i) in s(Mixin)),'
-      ' m: Method(s(m) in s(Mixin))}',
-      reflectClass(SubclassA).superclass.superclass.members);
-
-  expect(
-       // TODO(ahe): The owner should be the mixin application.
-      '{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
-      reflectClass(SubclassA).superclass.superclass.constructors);
-
-  expectSame(
-      reflectClass(C),
-      reflectClass(SubclassA).superclass.superclass.superclass);
-}
-
-testSubclass2A() {
-  checkClass(Subclass2A, [
-      'Class(s(Subclass2A) in s(test.mixin_test), top-level)',
-      'Class(s(MixinApplicationA) in s(test.mixin_test), top-level)',
-      'Class(s(test.mixin_test.Mixin(test.model.C)), top-level)',
-      'Class(s(C) in s(test.model), top-level)',
-      'Class(s(B) in s(test.model), top-level)',
-      'Class(s(A) in s(test.model), top-level)',
-      'Class(s(Object) in s(dart.core), top-level)',
-  ]);
-
-  expect(
-      '{ga: Method(s(ga) in s(Subclass2A))}',
-      reflectClass(Subclass2A).members);
-
-  expect(
-      '{Subclass2A: Method(s(Subclass2A) in s(Subclass2A), constructor)}',
-      reflectClass(Subclass2A).constructors);
-
-  expectSame(reflectClass(MixinApplicationA),
-             reflectClass(Subclass2A).superclass);
-}
-
-main() {
-  testMixin();
-  testMixin2();
-  testMixinApplication();
-  testMixinApplicationA();
-  testUnusedMixinApplication();
-  testSubclass();
-  testSubclass2();
-  testSubclassA();
-  testSubclass2A();
-}
diff --git a/tests/lib/mirrors/mixin_members_test.dart b/tests/lib/mirrors/mixin_members_test.dart
index eca7166..470f647 100644
--- a/tests/lib/mirrors/mixin_members_test.dart
+++ b/tests/lib/mirrors/mixin_members_test.dart
@@ -4,8 +4,6 @@
 
 library mixin_members_test;
 
-// TODO(ahe): Don't add mirrors used, the test doesn't work without it.
-@MirrorsUsed(targets: 'mixin_members_test', override: '*')
 import "dart:mirrors";
 
 import "package:expect/expect.dart";
diff --git a/tests/lib/mirrors/mixin_test.dart b/tests/lib/mirrors/mixin_test.dart
index 4ccb457..4a21544 100644
--- a/tests/lib/mirrors/mixin_test.dart
+++ b/tests/lib/mirrors/mixin_test.dart
@@ -2,9 +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.
 
+// This test uses the multi-test "ok" feature to create two positive tests from
+// one file. One of these tests fail on dart2js, but pass on the VM, or vice
+// versa.
+// TODO(ahe): When both implementations agree, remove the multi-test parts.
+
 library test.mixin_test;
 
-@MirrorsUsed(targets: 'test.mixin_test, test.model, Object', override: '*')
 import 'dart:mirrors';
 
 import 'package:expect/expect.dart';
@@ -62,13 +66,14 @@
       'Class(s(Mixin) in s(test.mixin_test), top-level)',
       'Class(s(Object) in s(dart.core), top-level)',
   ]);
+
   expect(
       '{i: Variable(s(i) in s(Mixin)),'
       ' m: Method(s(m) in s(Mixin))}',
       reflectClass(Mixin).members);
-  expect(
-      '{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
-      reflectClass(Mixin).constructors);
+
+  expect('{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
+         reflectClass(Mixin).constructors);
 }
 
 testMixin2() {
@@ -76,13 +81,14 @@
       'Class(s(Mixin2) in s(test.mixin_test), top-level)',
       'Class(s(Object) in s(dart.core), top-level)',
   ]);
+
   expect(
       '{i2: Variable(s(i2) in s(Mixin2)),'
       ' m2: Method(s(m2) in s(Mixin2))}',
       reflectClass(Mixin2).members);
-  expect(
-      '{Mixin2: Method(s(Mixin2) in s(Mixin2), constructor)}',
-      reflectClass(Mixin2).constructors);
+
+  expect('{Mixin2: Method(s(Mixin2) in s(Mixin2), constructor)}',
+         reflectClass(Mixin2).constructors);
 }
 
 testMixinApplication() {
@@ -94,33 +100,40 @@
       'Class(s(Object) in s(dart.core), top-level)',
   ]);
 
+  String owner = 'Mixin';
+  owner = 'MixinApplication'; /// 01: ok
   expect(
-      '{i: Variable(s(i) in s(Mixin)),'
-      ' m: Method(s(m) in s(Mixin))}',
+      '{i: Variable(s(i) in s($owner)),'
+      ' m: Method(s(m) in s($owner))}',
       reflectClass(MixinApplication).members);
-  expect(
-      '{MixinApplication: Method(s(MixinApplication) in s(MixinApplication),'
-      ' constructor)}',
-      reflectClass(MixinApplication).constructors);
+
+  expect('{MixinApplication: Method(s(MixinApplication) in s(MixinApplication),'
+         ' constructor)}',
+         reflectClass(MixinApplication).constructors);
 
   expectSame(reflectClass(C), reflectClass(MixinApplication).superclass);
 }
 
 testMixinApplicationA() {
+  // TODO(ahe): I don't think an anonymous mixin has an owner.
+  String owner = ' in s(test.mixin_test)';
+  owner = ''; /// 01: ok
   checkClass(MixinApplicationA, [
       'Class(s(MixinApplicationA) in s(test.mixin_test), top-level)',
-      'Class(s(test.model.C with test.mixin_test.Mixin) in s(test.mixin_test),'
-      ' top-level)',
+      'Class(s(test.model.C with test.mixin_test.Mixin)$owner, top-level)',
       'Class(s(C) in s(test.model), top-level)',
       'Class(s(B) in s(test.model), top-level)',
       'Class(s(A) in s(test.model), top-level)',
       'Class(s(Object) in s(dart.core), top-level)',
   ]);
 
+  owner = 'Mixin2';
+  owner = 'MixinApplicationA'; /// 01: ok
   expect(
-      '{i2: Variable(s(i2) in s(Mixin2)),'
-      ' m2: Method(s(m2) in s(Mixin2))}',
+      '{i2: Variable(s(i2) in s($owner)),'
+      ' m2: Method(s(m2) in s($owner))}',
       reflectClass(MixinApplicationA).members);
+
   expect(
       '{MixinApplicationA: Method(s(MixinApplicationA) in s(MixinApplicationA),'
       ' constructor)}',
@@ -130,10 +143,13 @@
       '{i: Variable(s(i) in s(Mixin)),'
       ' m: Method(s(m) in s(Mixin))}',
       reflectClass(MixinApplicationA).superclass.members);
+
+  String name = 'test.model.C with test.mixin_test.Mixin';
+  name = 'Mixin'; /// 01: ok
   expect(
-      '{test.model.C with test.mixin_test.Mixin:'
-      ' Method(s(test.model.C with test.mixin_test.Mixin)'
-      ' in s(test.model.C with test.mixin_test.Mixin), constructor)}',
+      '{$name:'
+      ' Method(s($name)'
+      ' in s($name), constructor)}',
       reflectClass(MixinApplicationA).superclass.constructors);
 
   expectSame(
@@ -150,10 +166,13 @@
       'Class(s(Object) in s(dart.core), top-level)',
   ]);
 
+  String owner = 'Mixin';
+  owner = 'UnusedMixinApplication'; /// 01: ok
   expect(
-      '{i: Variable(s(i) in s(Mixin)),'
-      ' m: Method(s(m) in s(Mixin))}',
+      '{i: Variable(s(i) in s($owner)),'
+      ' m: Method(s(m) in s($owner))}',
       reflectClass(UnusedMixinApplication).members);
+
   expect(
       '{UnusedMixinApplication: Method(s(UnusedMixinApplication)'
       ' in s(UnusedMixinApplication), constructor)}',
@@ -163,10 +182,11 @@
 }
 
 testSubclass() {
+  String owner = ' in s(test.mixin_test)';
+  owner = ''; /// 01: ok
   checkClass(Subclass, [
       'Class(s(Subclass) in s(test.mixin_test), top-level)',
-      'Class(s(test.model.C with test.mixin_test.Mixin) in s(test.mixin_test),'
-      ' top-level)',
+      'Class(s(test.model.C with test.mixin_test.Mixin)$owner, top-level)',
       'Class(s(C) in s(test.model), top-level)',
       'Class(s(B) in s(test.model), top-level)',
       'Class(s(A) in s(test.model), top-level)',
@@ -176,6 +196,7 @@
   expect(
       '{f: Method(s(f) in s(Subclass))}',
       reflectClass(Subclass).members);
+
   expect(
       '{Subclass: Method(s(Subclass) in s(Subclass), constructor)}',
       reflectClass(Subclass).constructors);
@@ -184,10 +205,13 @@
       '{i: Variable(s(i) in s(Mixin)),'
       ' m: Method(s(m) in s(Mixin))}',
       reflectClass(Subclass).superclass.members);
+
+  String name = 'test.model.C with test.mixin_test.Mixin';
+  name = 'Mixin'; /// 01: ok
   expect(
-      '{test.model.C with test.mixin_test.Mixin:'
-      ' Method(s(test.model.C with test.mixin_test.Mixin)'
-      ' in s(test.model.C with test.mixin_test.Mixin), constructor)}',
+      '{$name:'
+      ' Method(s($name)'
+      ' in s($name), constructor)}',
       reflectClass(Subclass).superclass.constructors);
 
   expectSame(
@@ -208,6 +232,7 @@
   expect(
       '{g: Method(s(g) in s(Subclass2))}',
       reflectClass(Subclass2).members);
+
   expect(
       '{Subclass2: Method(s(Subclass2) in s(Subclass2), constructor)}',
       reflectClass(Subclass2).constructors);
@@ -218,12 +243,14 @@
 }
 
 testSubclassA() {
+  // TODO(ahe): I don't think an anonymous mixin has an owner.
+  String owner = ' in s(test.mixin_test)';
+  owner = ''; /// 01: ok
   checkClass(SubclassA, [
       'Class(s(SubclassA) in s(test.mixin_test), top-level)',
       'Class(s(test.model.C with test.mixin_test.Mixin, test.mixin_test.Mixin2)'
-      ' in s(test.mixin_test), top-level)',
-      'Class(s(test.model.C with test.mixin_test.Mixin) in s(test.mixin_test),'
-      ' top-level)',
+      '$owner, top-level)',
+      'Class(s(test.model.C with test.mixin_test.Mixin)$owner, top-level)',
       'Class(s(C) in s(test.model), top-level)',
       'Class(s(B) in s(test.model), top-level)',
       'Class(s(A) in s(test.model), top-level)',
@@ -233,6 +260,7 @@
   expect(
       '{fa: Method(s(fa) in s(SubclassA))}',
       reflectClass(SubclassA).members);
+
   expect(
       '{SubclassA: Method(s(SubclassA) in s(SubclassA), constructor)}',
       reflectClass(SubclassA).constructors);
@@ -241,21 +269,25 @@
       '{i2: Variable(s(i2) in s(Mixin2)),'
       ' m2: Method(s(m2) in s(Mixin2))}',
       reflectClass(SubclassA).superclass.members);
+
+  String name =
+      'test.model.C with test.mixin_test.Mixin, test.mixin_test.Mixin2';
+  name = 'Mixin2'; /// 01: ok
   expect(
-      '{test.model.C with test.mixin_test.Mixin, test.mixin_test.Mixin2:'
-      ' Method(s(test.model.C with test.mixin_test.Mixin,'
-      ' test.mixin_test.Mixin2) in s(test.model.C with test.mixin_test.Mixin,'
-      ' test.mixin_test.Mixin2), constructor)}',
+      '{$name: Method(s($name) in s($name), constructor)}',
       reflectClass(SubclassA).superclass.constructors);
 
   expect(
       '{i: Variable(s(i) in s(Mixin)),'
       ' m: Method(s(m) in s(Mixin))}',
       reflectClass(SubclassA).superclass.superclass.members);
+
+  name = 'test.model.C with test.mixin_test.Mixin';
+  name = 'Mixin'; /// 01: ok
   expect(
-      '{test.model.C with test.mixin_test.Mixin:'
-      ' Method(s(test.model.C with test.mixin_test.Mixin)'
-      ' in s(test.model.C with test.mixin_test.Mixin), constructor)}',
+      '{$name:'
+      ' Method(s($name)'
+      ' in s($name), constructor)}',
       reflectClass(SubclassA).superclass.superclass.constructors);
 
   expectSame(
@@ -264,10 +296,13 @@
 }
 
 testSubclass2A() {
+  // TODO(ahe): I don't think an anonymous mixin has an owner.
+  String owner = ' in s(test.mixin_test)';
+  owner = ''; /// 01: ok
   checkClass(Subclass2A, [
       'Class(s(Subclass2A) in s(test.mixin_test), top-level)',
       'Class(s(MixinApplicationA) in s(test.mixin_test), top-level)',
-      'Class(s(test.model.C with test.mixin_test.Mixin) in s(test.mixin_test),'
+      'Class(s(test.model.C with test.mixin_test.Mixin)$owner,'
       ' top-level)',
       'Class(s(C) in s(test.model), top-level)',
       'Class(s(B) in s(test.model), top-level)',
@@ -278,6 +313,7 @@
   expect(
       '{ga: Method(s(ga) in s(Subclass2A))}',
       reflectClass(Subclass2A).members);
+
   expect(
       '{Subclass2A: Method(s(Subclass2A) in s(Subclass2A), constructor)}',
       reflectClass(Subclass2A).constructors);
diff --git a/tests/lib/mirrors/parameter_metadata_test.dart b/tests/lib/mirrors/parameter_metadata_test.dart
new file mode 100644
index 0000000..987e059
--- /dev/null
+++ b/tests/lib/mirrors/parameter_metadata_test.dart
@@ -0,0 +1,55 @@
+// Copyright (c) 2013, 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 test.parameter_metadata_test;
+
+import 'dart:mirrors';
+
+import 'metadata_test.dart';
+
+const m1 = 'm1';
+const m2 = const Symbol('m2');
+const m3 = const CustomAnnotation(3);
+
+class CustomAnnotation {
+  final value;
+  const CustomAnnotation(this.value);
+  toString() => 'CustomAnnotation($value)';
+}
+
+class B {
+  B.foo(int x);
+  factory B.bar(@m3 @m2 int z, x){}
+
+  baz(@m1 final int x, @m2 int y, @m3 final int z);
+  qux(int x, [@m3 @m2 @m1 int y= 3 + 1]);
+  quux(int x, {String str: "foo"});
+  corge({@m1 int x: 3 * 17, @m2 String str: "bar"});
+
+  set x(@m2 final value);
+}
+
+main() {
+  ClassMirror cm = reflectClass(B);
+
+  checkMetadata(cm.constructors[const Symbol('B.foo')].parameters[0], []);
+
+  checkMetadata(cm.constructors[const Symbol('B.bar')].parameters[0], [m3, m2]);
+  checkMetadata(cm.constructors[const Symbol('B.bar')].parameters[1], []);
+
+  checkMetadata(cm.members[const Symbol('baz')].parameters[0], [m1]);
+  checkMetadata(cm.members[const Symbol('baz')].parameters[1], [m2]);
+  checkMetadata(cm.members[const Symbol('baz')].parameters[2], [m3]);
+
+  checkMetadata(cm.members[const Symbol('qux')].parameters[0], []);
+  checkMetadata(cm.members[const Symbol('qux')].parameters[1], [m3, m2, m1]);
+
+  checkMetadata(cm.members[const Symbol('quux')].parameters[0], []);
+  checkMetadata(cm.members[const Symbol('quux')].parameters[1], []);
+
+  checkMetadata(cm.members[const Symbol('corge')].parameters[0], [m1]);
+  checkMetadata(cm.members[const Symbol('corge')].parameters[1], [m2]);
+
+  checkMetadata(cm.members[const Symbol('x=')].parameters[0], [m2]);
+}
diff --git a/tests/lib/mirrors/typedef_test.dart b/tests/lib/mirrors/typedef_test.dart
new file mode 100644
index 0000000..3a5919a
--- /dev/null
+++ b/tests/lib/mirrors/typedef_test.dart
@@ -0,0 +1,157 @@
+// Copyright (c) 2013, 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.
+
+// This test is a multi-test with three positive tests. "01" pass on dart2js,
+// "02" pass on the VM, and "none" is the correct behavior.
+// The goal is to remove all "01" and "02" lines.
+
+library test.typedef_test;
+
+@MirrorsUsed(targets: 'test.typedef_test')
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+typedef Func();
+typedef void Void();
+typedef String Foo(int x);
+typedef String Bar(int x, [num y]);
+typedef String Baz(int x, {num y});
+typedef String Foo2(int x, num y);
+typedef String Bar2(int x, [num y, num z]);
+typedef String Baz2(int x, {num y, num z});
+
+check(t) {
+  var sb = new StringBuffer();
+  writeln(o) {
+    sb.write(o);
+    sb.write('\n');
+  }
+  writeln(t);
+  t = t.referent;
+  writeln(t);
+  writeln(t.returnType);
+  writeln(t.parameters);
+  for (var p in t.parameters) {
+    writeln(p.simpleName);
+    writeln(p.type);
+  }
+
+  return sb.toString();
+}
+
+// Return "$args -> $ret".
+ft(args, ret) {
+  return '$args -> $ret'
+      // TODO(ahe): dart2js doesn't fully qualify type names.
+      .replaceAll('dart.core.', '') /// 01: ok
+      ;
+}
+
+void main() {
+  String x = 'x';
+  String y = 'y';
+  String z = 'z';
+  x = 'argument0'; /// 01: ok
+  y = 'argument1'; /// 01: ok
+  z = 'argument2'; /// 01: ok
+
+  Expect.stringEquals(
+      """
+TypedefMirror on 'Func'
+FunctionTypeMirror on '${ft('()', 'dynamic')}'
+TypeMirror on 'dynamic'
+[]
+""",
+      check(reflectClass(Func)));
+  Expect.stringEquals(
+      """
+TypedefMirror on 'Void'
+FunctionTypeMirror on '${ft('()', 'void')}'
+TypeMirror on 'void'
+[]
+""",
+      check(reflectClass(Void)));
+  Expect.stringEquals(
+      """
+TypedefMirror on 'Foo'
+FunctionTypeMirror on '${ft('(dart.core.int)', 'dart.core.String')}'
+ClassMirror on 'String'
+[ParameterMirror on '$x']
+Symbol(\"$x\")
+ClassMirror on 'int'
+""",
+      check(reflectClass(Foo)));
+  String type = ft('(dart.core.int, dart.core.num)', 'dart.core.String');
+  Expect.stringEquals(
+      """
+TypedefMirror on 'Foo2'
+FunctionTypeMirror on '$type'
+ClassMirror on 'String'
+[ParameterMirror on '$x', ParameterMirror on '$y']
+Symbol(\"$x\")
+ClassMirror on 'int'
+Symbol(\"$y\")
+ClassMirror on 'num'
+""",
+      check(reflectClass(Foo2)));
+  type = ft('(dart.core.int, [dart.core.num])', 'dart.core.String');
+  Expect.stringEquals(
+      """
+TypedefMirror on 'Bar'
+FunctionTypeMirror on '$type'
+ClassMirror on 'String'
+[ParameterMirror on '$x', ParameterMirror on '$y']
+Symbol(\"$x\")
+ClassMirror on 'int'
+Symbol(\"$y\")
+ClassMirror on 'num'
+""",
+      check(reflectClass(Bar)));
+  type = ft('(dart.core.int, [dart.core.num, dart.core.num])',
+            'dart.core.String');
+  Expect.stringEquals(
+      """
+TypedefMirror on 'Bar2'
+FunctionTypeMirror on '$type'
+ClassMirror on 'String'
+[ParameterMirror on '$x', ParameterMirror on '$y', ParameterMirror on '$z']
+Symbol(\"$x\")
+ClassMirror on 'int'
+Symbol(\"$y\")
+ClassMirror on 'num'
+Symbol(\"$z\")
+ClassMirror on 'num'
+""",
+      check(reflectClass(Bar2)));
+  type = ft('(dart.core.int, {y: dart.core.num})', 'dart.core.String');
+  Expect.stringEquals(
+      """
+TypedefMirror on 'Baz'
+FunctionTypeMirror on '$type'
+ClassMirror on 'String'
+[ParameterMirror on '$x', ParameterMirror on 'y']
+Symbol(\"$x\")
+ClassMirror on 'int'
+Symbol(\"y\")
+ClassMirror on 'num'
+""",
+      check(reflectClass(Baz)));
+  type = ft('(dart.core.int, {y: dart.core.num, z: dart.core.num})',
+            'dart.core.String');
+  Expect.stringEquals(
+      """
+TypedefMirror on 'Baz2'
+FunctionTypeMirror on '$type'
+ClassMirror on 'String'
+[ParameterMirror on '$x', ParameterMirror on 'y', ParameterMirror on 'z']
+Symbol(\"$x\")
+ClassMirror on 'int'
+Symbol(\"y\")
+ClassMirror on 'num'
+Symbol(\"z\")
+ClassMirror on 'num'
+""",
+      check(reflectClass(Baz2)));
+}
diff --git a/tests/standalone/io/async_catch_errors_test.dart b/tests/standalone/io/async_catch_errors_test.dart
index 7107bf2..d129c05 100644
--- a/tests/standalone/io/async_catch_errors_test.dart
+++ b/tests/standalone/io/async_catch_errors_test.dart
@@ -2,11 +2,12 @@
 // 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 "package:expect/expect.dart";
 import 'dart:async';
-import 'dart:isolate';
 import 'dart:io';
 
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
 var events = [];
 
 Future testSocketException() {
@@ -38,11 +39,11 @@
 main() {
   // We keep a ReceivePort open until all tests are done. This way the VM will
   // hang if the callbacks are not invoked and the test will time out.
-  var timeOutPort = new ReceivePort();
+  asyncStart();
   testSocketException()
     .then((_) => testFileException())
     .then((_) {
-      timeOutPort.close();
+      asyncEnd();
       Expect.listEquals(["SocketException", "FileException"],
                         events);
     });
diff --git a/tests/standalone/io/delete_symlink_test.dart b/tests/standalone/io/delete_symlink_test.dart
index ad10a48..b5ca0b5 100644
--- a/tests/standalone/io/delete_symlink_test.dart
+++ b/tests/standalone/io/delete_symlink_test.dart
@@ -2,9 +2,10 @@
 // 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 "package:expect/expect.dart";
 import 'dart:io';
-import 'dart:isolate';
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 void main() {
   // temp/
@@ -33,7 +34,7 @@
     args = ["/c", "mklink", "/j", "${d.path}\\b\\a_link", "${d.path}\\a"];
   }
 
-  var keepAlive = new ReceivePort();
+  asyncStart();
 
   Process.run(cmd, args).then((_) {
     // Delete the directory containing the junction.
@@ -46,6 +47,6 @@
     d.deleteSync(recursive: true);
 
     // Terminate now that we are done with everything.
-    keepAlive.close();
+    asyncEnd();
   });
 }
diff --git a/tests/standalone/io/directory_chdir_test.dart b/tests/standalone/io/directory_chdir_test.dart
index 0805e3a..e1c9a1d 100644
--- a/tests/standalone/io/directory_chdir_test.dart
+++ b/tests/standalone/io/directory_chdir_test.dart
@@ -6,12 +6,12 @@
 
 
 import "dart:io";
-import "dart:isolate";
 
+import "package:async_helper/async_helper.dart";
 import "package:expect/expect.dart";
 
 testChangeDirectory() {
-  var port = new ReceivePort();
+  asyncStart();
   new Directory("").createTemp().then((temp) {
     var initialCurrent = Directory.current;
     Directory.current = temp;
@@ -28,7 +28,7 @@
     Expect.isTrue(new File("222/333").existsSync());
     Directory.current = initialCurrent;
     temp.deleteSync(recursive: true);
-    port.close();
+    asyncEnd();
   });
 }
 
diff --git a/tests/standalone/io/directory_create_race_test.dart b/tests/standalone/io/directory_create_race_test.dart
index e743a76..b1f7046 100644
--- a/tests/standalone/io/directory_create_race_test.dart
+++ b/tests/standalone/io/directory_create_race_test.dart
@@ -7,13 +7,14 @@
 // issue https://code.google.com/p/dart/issues/detail?id=7679 in revisions
 // without the fix for this issue.
 
-import "package:expect/expect.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 void testCreateRecursiveRace() {
-  var keepAlive = new ReceivePort();
+  asyncStart();
   var temp = new Directory('').createTempSync();
   var d = new Directory('${temp.path}/a/b/c/d/e');
   Future.wait([
@@ -33,7 +34,7 @@
     Expect.isTrue(new Directory('${temp.path}/a/b/c/d').existsSync());
     Expect.isTrue(new Directory('${temp.path}/a/b/c/d/e').existsSync());
     temp.delete(recursive: true).then((_) {
-      keepAlive.close();
+      asyncEnd();
     });
   });
 }
diff --git a/tests/standalone/io/directory_error_test.dart b/tests/standalone/io/directory_error_test.dart
index 9026513..4cda21f 100644
--- a/tests/standalone/io/directory_error_test.dart
+++ b/tests/standalone/io/directory_error_test.dart
@@ -4,10 +4,11 @@
 //
 // Dart test program for testing error handling in directory I/O.
 
-import "package:expect/expect.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 Directory tempDir() {
   return new Directory('').createTempSync();
@@ -199,14 +200,13 @@
   var temp = new Directory('').createTempSync();
 
   // Wait for the test to finish and delete the temporary directory.
-  ReceivePort p = new ReceivePort();
-  p.receive((x,y) {
-    p.close();
-    temp.deleteSync(recursive: true);
-  });
+  asyncStart();
 
   // Run the test.
-  test(temp, () => p.toSendPort().send(null));
+  test(temp, () {
+    temp.deleteSync(recursive: true);
+    asyncEnd();
+  });
 }
 
 
diff --git a/tests/standalone/io/directory_fuzz_test.dart b/tests/standalone/io/directory_fuzz_test.dart
index fb66b94..761bdef 100644
--- a/tests/standalone/io/directory_fuzz_test.dart
+++ b/tests/standalone/io/directory_fuzz_test.dart
@@ -7,7 +7,8 @@
 
 import 'dart:async';
 import 'dart:io';
-import 'dart:isolate';
+
+import "package:async_helper/async_helper.dart";
 import "package:expect/expect.dart";
 
 import 'fuzz_support.dart';
@@ -37,7 +38,7 @@
 }
 
 fuzzAsyncMethods() {
-  var port = new ReceivePort();
+  asyncStart();
   var futures = [];
   typeMapping.forEach((k, v) {
     if (v is! String) {
@@ -67,7 +68,7 @@
       }));
     });
   });
-  Future.wait(futures).then((ignore) => port.close());
+  Future.wait(futures).then((_) => asyncEnd());
 }
 
 main() {
diff --git a/tests/standalone/io/directory_invalid_arguments_test.dart b/tests/standalone/io/directory_invalid_arguments_test.dart
index 1b35aa0..e3e6bb6 100644
--- a/tests/standalone/io/directory_invalid_arguments_test.dart
+++ b/tests/standalone/io/directory_invalid_arguments_test.dart
@@ -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.
 
-import "package:expect/expect.dart";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 void testFailingList(Directory d, var recursive) {
-  var port = new ReceivePort();
+  asyncStart();
   int errors = 0;
   d.list(recursive: recursive).listen(
     () => Expect.fail("Unexpected listing result"),
@@ -15,8 +16,8 @@
       errors += 1;
     },
     onDone: () {
-      port.close();
       Expect.equals(1, errors);
+      asyncEnd();
     });
   Expect.equals(0, errors);
 }
diff --git a/tests/standalone/io/directory_list_nonexistent_test.dart b/tests/standalone/io/directory_list_nonexistent_test.dart
index b514924..387f682 100644
--- a/tests/standalone/io/directory_list_nonexistent_test.dart
+++ b/tests/standalone/io/directory_list_nonexistent_test.dart
@@ -7,24 +7,25 @@
 // TODO(7157): Merge this test into directory_test.dart testListNonExistent()
 // when it no longer crashes on Windows, when issue 7157 is resolved.
 
-import "package:expect/expect.dart";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 void testListNonExistent() {
-  var keepAlive = new ReceivePort();
+  asyncStart();
   new Directory("").createTemp().then((d) {
     d.delete().then((ignore) {
       Expect.throws(() => d.listSync(), (e) => e is DirectoryException);
       Expect.throws(() => d.listSync(recursive: true),
                     (e) => e is DirectoryException);
-      keepAlive.close();
+      asyncEnd();
     });
   });
 }
 
 void testListTooLongName() {
-  var keepAlive = new ReceivePort();
+  asyncStart();
   new Directory("").createTemp().then((d) {
     var subDirName = 'subdir';
     var subDir = new Directory("${d.path}/$subDirName");
@@ -42,7 +43,7 @@
       Expect.throws(() => long.listSync(recursive: true),
                     (e) => e is DirectoryException);
       d.deleteSync(recursive: true);
-      keepAlive.close();
+      asyncEnd();
     });
   });
 }
diff --git a/tests/standalone/io/directory_list_pause_test.dart b/tests/standalone/io/directory_list_pause_test.dart
index 081b406..5c5bf78 100644
--- a/tests/standalone/io/directory_list_pause_test.dart
+++ b/tests/standalone/io/directory_list_pause_test.dart
@@ -2,14 +2,15 @@
 // 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 "package:expect/expect.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 
 void testPauseList() {
-  var keepAlive = new ReceivePort();
+  asyncStart();
   // TOTAL should be bigger the our directory listing buffer.
   const int TOTAL = 128;
   new Directory("").createTemp().then((d) {
@@ -37,7 +38,7 @@
     }, onDone: () {
       Expect.notEquals(TOTAL, count);
       Expect.isTrue(count > 0);
-      d.delete(recursive: true).then((ignore) => keepAlive.close());
+      d.delete(recursive: true).then((ignore) => asyncEnd());
     });
   });
 }
diff --git a/tests/standalone/io/directory_non_ascii_test.dart b/tests/standalone/io/directory_non_ascii_test.dart
index 9fe3ef0..e4aede6 100644
--- a/tests/standalone/io/directory_non_ascii_test.dart
+++ b/tests/standalone/io/directory_non_ascii_test.dart
@@ -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.
 
-import "package:expect/expect.dart";
 import 'dart:io';
-import 'dart:isolate';
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 main() {
-  var port = new ReceivePort();
+  asyncStart();
 
   // On MacOS you get the decomposed utf8 form of file and directory
   // names from the system. Therefore, we have to check for both here.
@@ -28,7 +29,7 @@
               tempDir.delete(recursive: true).then((_) {
                 Expect.isFalse(temp.existsSync());
                 Expect.isFalse(nonAsciiDir.existsSync());
-                port.close();
+                asyncEnd();
               });
             });
           });
diff --git a/tests/standalone/io/directory_test.dart b/tests/standalone/io/directory_test.dart
index 33c6662..aaedf1c 100644
--- a/tests/standalone/io/directory_test.dart
+++ b/tests/standalone/io/directory_test.dart
@@ -4,10 +4,11 @@
 //
 // Directory listing test.
 
-import "package:expect/expect.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 class DirectoryTest {
   static void testListing() {
@@ -51,7 +52,7 @@
     testSyncListing(false);
     Expect.equals(f.fullPathSync(), fLong.fullPathSync());
 
-    var listingDonePort = new ReceivePort();
+    asyncStart();
     directory.list(recursive: true).listen(
         (FileSystemEntity entity) {
           if (entity is File) {
@@ -75,7 +76,7 @@
             f.exists().then((exists) => Expect.isFalse(exists));
             directory.exists().then((exists) => Expect.isFalse(exists));
             subDirectory.exists().then((exists) => Expect.isFalse(exists));
-            listingDonePort.close();
+            asyncEnd();
           });
         });
 
@@ -122,7 +123,7 @@
   static void testListTooLongName() {
     new Directory("").createTemp().then((d) {
       var errors = 0;
-      var port = new ReceivePort();
+      asyncStart();
       setupListHandlers(Stream<FileSystemEntity> stream) {
         stream.listen(
           (_) => Expect.fail("Listing of non-existing directory should fail"),
@@ -130,7 +131,7 @@
             Expect.isTrue(error is DirectoryException);
             if (++errors == 2) {
               d.delete(recursive: true).then((_) {
-                port.close();
+                asyncEnd();
               });
             }
           });
@@ -171,7 +172,7 @@
   }
 
   static void testDeleteTooLongName() {
-    var port = new ReceivePort();
+    asyncStart();
     new Directory("").createTemp().then((d) {
       var subDirName = 'subdir';
       var subDir = new Directory("${d.path}/$subDirName");
@@ -188,7 +189,7 @@
           onError(error) {
             Expect.isTrue(error is DirectoryException);
             if (++errors == 2) {
-              d.delete(recursive: true).then((ignore) => port.close());
+              d.delete(recursive: true).then((_) => asyncEnd());
             }
             return true;
           }
@@ -354,7 +355,7 @@
   }
 
   static void testCreateTemp([String template = ""]) {
-    var port = new ReceivePort();
+    asyncStart();
     Directory dir = new Directory(template);
     Future.wait([dir.createTemp(), dir.createTemp()])
       .then((tempDirs) {
@@ -364,7 +365,7 @@
           t.deleteSync();
           Expect.isFalse(t.existsSync());
         }
-        port.close();
+        asyncEnd();
       });
   }
 
@@ -500,9 +501,9 @@
   var location = illegalTempDirectoryLocation();
   if (location == null) return;
 
-  var port = new ReceivePort();
+  asyncStart();
   var future = new Directory(location).createTemp();
-  future.catchError((e) => port.close());
+  future.catchError((_) => asyncEnd());
 }
 
 
@@ -522,7 +523,7 @@
 
 testCreateExisting() {
   // Test that creating an existing directory succeeds.
-  var port = new ReceivePort();
+  asyncStart();
   var d = new Directory('');
   d.createTemp().then((temp) {
     var subDir = new Directory('${temp.path}/flaf');
@@ -535,7 +536,7 @@
             subDir.exists().then((dirExists) {
               Expect.isTrue(dirExists);
               temp.delete(recursive: true).then((_) {
-                port.close();
+                asyncEnd();
               });
             });
           });
@@ -562,7 +563,7 @@
 
 testCreateDirExistingFile() {
   // Test that creating an existing directory succeeds.
-  var port = new ReceivePort();
+  asyncStart();
   var d = new Directory('');
   d.createTemp().then((temp) {
     var path = '${temp.path}/flaf';
@@ -574,7 +575,7 @@
         .catchError((error) {
           Expect.isTrue(error is DirectoryException);
           temp.delete(recursive: true).then((_) {
-            port.close();
+            asyncEnd();
           });
         });
     });
@@ -594,7 +595,7 @@
 
 
 testCreateRecursive() {
-  var port = new ReceivePort();
+  asyncStart();
   new Directory('').createTemp().then((temp) {
     var d = new Directory('${temp.path}/a/b/c');
     d.create(recursive: true).then((_) {
@@ -602,7 +603,7 @@
       Expect.isTrue(new Directory('${temp.path}/a/b').existsSync());
       Expect.isTrue(new Directory('${temp.path}/a/b/c').existsSync());
       temp.deleteSync(recursive: true);
-      port.close();
+      asyncEnd();
     });
   });
 }
diff --git a/tests/standalone/io/file_error_test.dart b/tests/standalone/io/file_error_test.dart
index 6ebb5b9..d8dc8aa 100644
--- a/tests/standalone/io/file_error_test.dart
+++ b/tests/standalone/io/file_error_test.dart
@@ -4,10 +4,11 @@
 //
 // Dart test program for testing error handling in file I/O.
 
-import "package:expect/expect.dart";
 import "dart:convert";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 Directory tempDir() {
   return new Directory('').createTempSync();
@@ -40,12 +41,8 @@
 
 
 void testOpenNonExistent() {
+  asyncStart();
   Directory temp = tempDir();
-  ReceivePort p = new ReceivePort();
-  p.receive((x, y) {
-    p.close();
-    temp.deleteSync(recursive: true);
-  });
   var file = new File("${temp.path}/nonExistentFile");
 
   // Non-existing file should throw exception.
@@ -56,18 +53,15 @@
   openFuture.then((raf) => Expect.fail("Unreachable code"))
             .catchError((error) {
               checkOpenNonExistentFileException(error);
-              p.toSendPort().send(null);
+              temp.deleteSync(recursive: true);
+              asyncEnd();
             });
 }
 
 
 void testDeleteNonExistent() {
+  asyncStart();
   Directory temp = tempDir();
-  ReceivePort p = new ReceivePort();
-  p.receive((x, y) {
-    p.close();
-    temp.deleteSync(recursive: true);
-  });
   var file = new File("${temp.path}/nonExistentFile");
 
   // Non-existing file should throw exception.
@@ -78,18 +72,15 @@
   delete.then((ignore) => Expect.fail("Unreachable code"))
         .catchError((error) {
           checkDeleteNonExistentFileException(error);
-          p.toSendPort().send(null);
+          temp.deleteSync(recursive: true);
+          asyncEnd();
         });
 }
 
 
 void testLengthNonExistent() {
+  asyncStart();
   Directory temp = tempDir();
-  ReceivePort p = new ReceivePort();
-  p.receive((x, y) {
-    p.close();
-    temp.deleteSync(recursive: true);
-  });
   var file = new File("${temp.path}/nonExistentFile");
 
   // Non-existing file should throw exception.
@@ -100,7 +91,8 @@
   lenFuture.then((len) => Expect.fail("Unreachable code"))
            .catchError((error) {
              checkLengthNonExistentFileException(error);
-             p.toSendPort().send(null);
+             temp.deleteSync(recursive: true);
+             asyncEnd();
            });
 }
 
@@ -121,12 +113,8 @@
 }
 
 void testCreateInNonExistentDirectory() {
+  asyncStart();
   Directory temp = tempDir();
-  ReceivePort p = new ReceivePort();
-  p.receive((x, y) {
-    p.close();
-    temp.deleteSync(recursive: true);
-  });
   var file = new File("${temp.path}/nonExistentDirectory/newFile");
 
   // Create in non-existent directory should throw exception.
@@ -137,7 +125,8 @@
   create.then((ignore) => Expect.fail("Unreachable code"))
   .catchError((error) {
     checkCreateInNonExistentDirectoryException(error);
-    p.toSendPort().send(null);
+    temp.deleteSync(recursive: true);
+    asyncEnd();
   });
 }
 
@@ -152,12 +141,8 @@
 }
 
 void testFullPathOnNonExistentDirectory() {
+  asyncStart();
   Directory temp = tempDir();
-  ReceivePort p = new ReceivePort();
-  p.receive((x, y) {
-    p.close();
-    temp.deleteSync(recursive: true);
-  });
   var file = new File("${temp.path}/nonExistentDirectory");
 
   // Full path non-existent directory should throw exception.
@@ -168,17 +153,14 @@
   fullPathFuture.then((path) => Expect.fail("Unreachable code $path"))
   .catchError((error) {
     checkFullPathOnNonExistentDirectoryException(error);
-    p.toSendPort().send(null);
+    temp.deleteSync(recursive: true);
+    asyncEnd();
   });
 }
 
 void testReadAsBytesNonExistent() {
+  asyncStart();
   Directory temp = tempDir();
-  ReceivePort p = new ReceivePort();
-  p.receive((x, y) {
-    p.close();
-    temp.deleteSync(recursive: true);
-  });
   var file = new File("${temp.path}/nonExistentFile3");
 
   // Non-existing file should throw exception.
@@ -189,17 +171,14 @@
   readAsBytesFuture.then((data) => Expect.fail("Unreachable code"))
   .catchError((error) {
     checkOpenNonExistentFileException(error);
-    p.toSendPort().send(null);
+    temp.deleteSync(recursive: true);
+    asyncEnd();
   });
 }
 
 void testReadAsTextNonExistent() {
+  asyncStart();
   Directory temp = tempDir();
-  ReceivePort p = new ReceivePort();
-  p.receive((x, y) {
-    p.close();
-    temp.deleteSync(recursive: true);
-  });
   var file = new File("${temp.path}/nonExistentFile4");
 
   // Non-existing file should throw exception.
@@ -210,17 +189,14 @@
   readAsStringFuture.then((data) => Expect.fail("Unreachable code"))
   .catchError((error) {
     checkOpenNonExistentFileException(error);
-    p.toSendPort().send(null);
+    temp.deleteSync(recursive: true);
+    asyncEnd();
   });
 }
 
 testReadAsLinesNonExistent() {
+  asyncStart();
   Directory temp = tempDir();
-  ReceivePort p = new ReceivePort();
-  p.receive((x, y) {
-    p.close();
-    temp.deleteSync(recursive: true);
-  });
   var file = new File("${temp.path}/nonExistentFile5");
 
   // Non-existing file should throw exception.
@@ -231,7 +207,8 @@
   readAsLinesFuture.then((data) => Expect.fail("Unreachable code"))
   .catchError((error) {
     checkOpenNonExistentFileException(error);
-    p.toSendPort().send(null);
+    temp.deleteSync(recursive: true);
+    asyncEnd();
   });
 }
 
@@ -247,21 +224,19 @@
 // when the temporary directory should be deleted. Pass the file and
 // the port to the callback argument.
 createTestFile(callback) {
+  asyncStart();
   Directory temp = tempDir();
-  ReceivePort p = new ReceivePort();
-  p.receive((x, y) {
-    p.close();
-    temp.deleteSync(recursive: true);
-  });
-
   var file = new File("${temp.path}/test_file");
   file.createSync();
-  callback(file, p.toSendPort());
+  callback(file, () {
+    temp.deleteSync(recursive: true);
+    asyncEnd();
+  });
 }
 
 
 testWriteByteToReadOnlyFile() {
-  createTestFile((file, port) {
+  createTestFile((file, done) {
     var openedFile = file.openSync(mode: FileMode.READ);
 
     // Writing to read only file should throw an exception.
@@ -271,13 +246,13 @@
     var writeByteFuture = openedFile.writeByte(0);
     writeByteFuture.catchError((error) {
       checkWriteReadOnlyFileException(error);
-      openedFile.close().then((ignore) => port.send(null));
+      openedFile.close().then((_) => done());
     });
   });
 }
 
 testWriteFromToReadOnlyFile() {
-  createTestFile((file, port) {
+  createTestFile((file, done) {
     var openedFile = file.openSync(mode: FileMode.READ);
 
     List data = [0, 1, 2, 3];
@@ -288,13 +263,13 @@
     var writeFromFuture = openedFile.writeFrom(data, 0, data.length);
     writeFromFuture.catchError((error) {
       checkWriteReadOnlyFileException(error);
-      openedFile.close().then((ignore) => port.send(null));
+      openedFile.close().then((_) => done());
     });
   });
 }
 
 testTruncateReadOnlyFile() {
-  createTestFile((file, port) {
+  createTestFile((file, done) {
     var openedFile = file.openSync(mode: FileMode.WRITE);
     openedFile.writeByteSync(0);
     openedFile.closeSync();
@@ -308,7 +283,7 @@
     truncateFuture.then((ignore) => Expect.fail("Unreachable code"))
     .catchError((error) {
       checkWriteReadOnlyFileException(error);
-      openedFile.close().then((ignore) => port.send(null));
+      openedFile.close().then((_) => done());
     });
   });
 }
@@ -321,7 +296,7 @@
 }
 
 testOperateOnClosedFile() {
-  createTestFile((file, port) {
+  createTestFile((file, done) {
     var openedFile = file.openSync(mode: FileMode.READ);
     openedFile.closeSync();
 
@@ -352,7 +327,7 @@
     _errorHandler(error) {
       checkFileClosedException(error);
       if (--errorCount == 0) {
-        port.send(null);
+        done();
       }
     }
 
@@ -400,47 +375,47 @@
 }
 
 testRepeatedlyCloseFile() {
-  createTestFile((file, port) {
+  createTestFile((file, done) {
     var openedFile = file.openSync();
     openedFile.close().then((ignore) {
       var closeFuture = openedFile.close();
       closeFuture.then((ignore) => null)
       .catchError((error) {
         Expect.isTrue(error is FileException);
-        port.send(null);
+        done();
       });
     });
   });
 }
 
 testRepeatedlyCloseFileSync() {
-  createTestFile((file, port) {
+  createTestFile((file, done) {
     var openedFile = file.openSync();
     openedFile.closeSync();
     Expect.throws(openedFile.closeSync,
                   (e) => e is FileException);
-    port.send(null);
+    done();
   });
 }
 
 testReadSyncBigInt() {
-  createTestFile((file, port) {
+  createTestFile((file, done) {
     var bigint = 100000000000000000000000000000000000000000;
     var openedFile = file.openSync();
     Expect.throws(() => openedFile.readSync(bigint),
                   (e) => e is FileException);
     openedFile.closeSync();
-    port.send(null);
+    done();
   });
 }
 
 testReadSyncClosedFile() {
-  createTestFile((file, port) {
+  createTestFile((file, done) {
     var openedFile = file.openSync();
     openedFile.closeSync();
     Expect.throws(() => openedFile.readSync(1),
                   (e) => e is FileException);
-    port.send(null);
+    done();
   });
 }
 
diff --git a/tests/standalone/io/file_fuzz_test.dart b/tests/standalone/io/file_fuzz_test.dart
index f90030e..b34797b 100644
--- a/tests/standalone/io/file_fuzz_test.dart
+++ b/tests/standalone/io/file_fuzz_test.dart
@@ -7,10 +7,11 @@
 
 import 'dart:async';
 import 'dart:io';
-import 'dart:isolate';
 
 import 'fuzz_support.dart';
 
+import "package:async_helper/async_helper.dart";
+
 fuzzSyncMethods() {
   typeMapping.forEach((k, v) {
     doItSync(() {
@@ -36,7 +37,7 @@
 }
 
 fuzzAsyncMethods() {
-  var port = new ReceivePort();
+  asyncStart();
   var futures = [];
   typeMapping.forEach((k, v) {
     doItSync(() {
@@ -58,7 +59,7 @@
       });
     });
   });
-  Future.wait(futures).then((ignore) => port.close());
+  Future.wait(futures).then((_) => asyncEnd());
 }
 
 
diff --git a/tests/standalone/io/file_input_stream_test.dart b/tests/standalone/io/file_input_stream_test.dart
index 824cfce..b48864b 100644
--- a/tests/standalone/io/file_input_stream_test.dart
+++ b/tests/standalone/io/file_input_stream_test.dart
@@ -5,8 +5,8 @@
 
 import "dart:convert";
 import "dart:io";
-import "dart:isolate";
 
+import "package:async_helper/async_helper.dart";
 import "package:expect/expect.dart";
 
 // Helper method to be able to run the test from the runtime
@@ -36,7 +36,7 @@
 
 
 void testOpenStreamAsync() {
-  var keepAlive = new ReceivePort();
+  asyncStart();
   String fileName = getFilename("tests/standalone/io/readuntil_test.dat");
   // File contains "Hello Dart\nwassup!\n"
   var expected = "Hello Dart\nwassup!\n".codeUnits;
@@ -45,7 +45,7 @@
       (d) => byteCount += d.length,
       onDone: () {
         Expect.equals(expected.length, byteCount);
-        keepAlive.close();
+        asyncEnd();
       });
 }
 
@@ -66,7 +66,7 @@
 
 
 void testInputStreamTruncate() {
-  var keepAlive = new ReceivePort();
+  asyncStart();
   var temp = new Directory('').createTempSync();
   var file = new File('${temp.path}/input_stream_truncate.txt');
   var originalLength = writeLongFileSync(file);
@@ -91,7 +91,7 @@
       },
       onDone: () {
         Expect.isTrue(streamedBytes > 0 && streamedBytes <= originalLength);
-        temp.delete(recursive: true).then((_) => keepAlive.close());
+        temp.delete(recursive: true).then((_) => asyncEnd());
       },
       onError: (e) {
         Expect.fail("Unexpected error");
@@ -99,7 +99,7 @@
 }
 
 void testInputStreamDelete() {
-  var keepAlive = new ReceivePort();
+  asyncStart();
   var temp = new Directory('').createTempSync();
   var file = new File('${temp.path}/input_stream_delete.txt');
   var originalLength = writeLongFileSync(file);
@@ -130,7 +130,7 @@
       },
       onDone: () {
         Expect.equals(originalLength, streamedBytes);
-        temp.delete(recursive: true).then((_) => keepAlive.close());
+        temp.delete(recursive: true).then((_) => asyncEnd());
       },
       onError: (e) {
         Expect.fail("Unexpected error");
@@ -139,7 +139,7 @@
 
 
 void testInputStreamAppend() {
-  var keepAlive = new ReceivePort();
+  asyncStart();
   var temp = new Directory('').createTempSync();
   var file = new File('${temp.path}/input_stream_append.txt');
   var originalLength = writeLongFileSync(file);
@@ -163,7 +163,7 @@
       },
       onDone: () {
         Expect.equals(2 * originalLength, streamedBytes);
-        temp.delete(recursive: true).then((_) => keepAlive.close());
+        temp.delete(recursive: true).then((_) => asyncEnd());
       },
       onError: (e) {
         Expect.fail("Unexpected error");
@@ -173,7 +173,7 @@
 
 void testInputStreamOffset() {
   void test(int start, int end, int expectedBytes) {
-    var keepAlive = new ReceivePort();
+    asyncStart();
     var temp = new Directory('').createTempSync();
     var file = new File('${temp.path}/input_stream_offset.txt');
     var originalLength = writeLongFileSync(file);
@@ -185,7 +185,7 @@
         },
         onDone: () {
           Expect.equals(expectedBytes, streamedBytes);
-          temp.delete(recursive: true).then((_) => keepAlive.close());
+          temp.delete(recursive: true).then((_) => asyncEnd());
         },
         onError: (e) {
           Expect.fail("Unexpected error");
@@ -204,7 +204,7 @@
 
 void testInputStreamBadOffset() {
   void test(int start, int end) {
-    var keepAlive = new ReceivePort();
+    asyncStart();
     var temp = new Directory('').createTempSync();
     var file = new File('${temp.path}/input_stream_bad_offset.txt');
     var originalLength = writeLongFileSync(file);
@@ -217,7 +217,7 @@
           temp.delete(recursive: true);
         },
         onError: (e) {
-          keepAlive.close();
+          asyncEnd();
         });
   }
   test(-1, null);
diff --git a/tests/standalone/io/file_invalid_arguments_test.dart b/tests/standalone/io/file_invalid_arguments_test.dart
index 846e882..d66c458 100644
--- a/tests/standalone/io/file_invalid_arguments_test.dart
+++ b/tests/standalone/io/file_invalid_arguments_test.dart
@@ -3,9 +3,10 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "dart:async";
-import "package:expect/expect.dart";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 void testReadInvalidArgs(arg) {
   String filename = getFilename("tests/vm/data/fixed_length_file");
@@ -78,7 +79,7 @@
   Expect.throws(() => ((x) => FileSystemEntity.isFileSync(x))(52));
   Expect.throws(() => ((x) => FileSystemEntity.isDirectorySync(x))(52));
 
-  ReceivePort keepAlive = new ReceivePort();
+  asyncStart();
   futureThrows(((x) => FileSystemEntity.type(x))([1,2,3]))
   .then((_) => futureThrows(((x, y) =>
        FileSystemEntity.type(x, followLinks: y))(".", "why not?")))
@@ -89,7 +90,7 @@
   .then((_) => futureThrows(((x) => FileSystemEntity.isLink(x))(52)))
   .then((_) => futureThrows(((x) => FileSystemEntity.isFile(x))(52)))
   .then((_) => futureThrows(((x) => FileSystemEntity.isDirectory(x))(52)))
-  .then((_) => keepAlive.close());
+  .then((_) => asyncEnd());
 }
 
 String getFilename(String path) {
diff --git a/tests/standalone/io/file_non_ascii_test.dart b/tests/standalone/io/file_non_ascii_test.dart
index 3aa0a3a..a64beee 100644
--- a/tests/standalone/io/file_non_ascii_test.dart
+++ b/tests/standalone/io/file_non_ascii_test.dart
@@ -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.
 
-import "package:expect/expect.dart";
 import 'dart:io';
-import 'dart:isolate';
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 main() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
 
   // On MacOS you get the decomposed utf8 form of file and directory
   // names from the system. Therefore, we have to check for both here.
@@ -37,7 +38,7 @@
                         Expect.isTrue(path.endsWith('${precomposed}.txt') ||
                                       path.endsWith('${decomposed}.txt'));
                         tempDir.delete(recursive: true).then((_) {
-                        port.close();
+                        asyncEnd();
                       });
                     });
                   });
@@ -49,7 +50,6 @@
       });
     });
   }).catchError((e) {
-    port.close();
     Expect.fail("File not found");
   });
 }
diff --git a/tests/standalone/io/file_output_stream_test.dart b/tests/standalone/io/file_output_stream_test.dart
index f71c962..0981023 100644
--- a/tests/standalone/io/file_output_stream_test.dart
+++ b/tests/standalone/io/file_output_stream_test.dart
@@ -3,20 +3,15 @@
 // BSD-style license that can be found in the LICENSE file.
 // Testing file input stream, VM-only, standalone test.
 
-import "package:expect/expect.dart";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 void testOpenOutputStreamSync() {
   Directory tempDirectory = new Directory('').createTempSync();
 
-  // Create a port for waiting on the final result of this test.
-  ReceivePort done = new ReceivePort();
-  done.receive((message, replyTo) {
-    tempDirectory.deleteSync();
-    done.close();
-  });
-
+  asyncStart();
   String fileName = "${tempDirectory.path}/test";
   File file = new File(fileName);
   file.createSync();
@@ -27,7 +22,8 @@
   x.done.then((_) {
     Expect.listEquals(file.readAsBytesSync(), data);
     file.deleteSync();
-    done.toSendPort().send("done");
+    tempDirectory.deleteSync();
+    asyncEnd();
   });
 }
 
diff --git a/tests/standalone/io/file_stat_test.dart b/tests/standalone/io/file_stat_test.dart
index 7b3e331..afd1b67 100644
--- a/tests/standalone/io/file_stat_test.dart
+++ b/tests/standalone/io/file_stat_test.dart
@@ -4,11 +4,12 @@
 //
 // Dart test program for testing dart:io FileSystemEntity.Stat().
 
-import "package:expect/expect.dart";
-import "package:path/path.dart";
 import 'dart:async';
 import 'dart:io';
-import 'dart:isolate';
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+import "package:path/path.dart";
 
 void testStat() {
   Directory directory = new Directory("").createTempSync();
@@ -119,7 +120,7 @@
 
 
 void main() {
-  ReceivePort keepAlive = new ReceivePort();
+  asyncStart();
   testStat();
-  testStatAsync().then((_) => keepAlive.close());
+  testStatAsync().then((_) => asyncEnd());
 }
diff --git a/tests/standalone/io/file_system_async_links_test.dart b/tests/standalone/io/file_system_async_links_test.dart
index 25f07a9..f958bfa 100644
--- a/tests/standalone/io/file_system_async_links_test.dart
+++ b/tests/standalone/io/file_system_async_links_test.dart
@@ -3,10 +3,10 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "dart:async";
-import "package:expect/expect.dart";
 import "dart:io";
-import "dart:isolate";
 
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 class FutureExpect {
   static Future isTrue(Future<bool> result) =>
@@ -224,7 +224,7 @@
 main() {
   // Links on Windows are tested by windows_file_system_[async_]links_test.
   if (Platform.operatingSystem != 'windows') {
-    ReceivePort keepAlive = new ReceivePort();
+    asyncStart();
     testFileExistsCreate()
     .then((_) => testFileDelete())
     .then((_) => testFileWriteRead())
@@ -232,6 +232,6 @@
     .then((_) => testDirectoryDelete())
     .then((_) => testDirectoryListing())
     .then((_) => testDirectoryListingBrokenLink())
-    .then((_) => keepAlive.close());
+    .then((_) => asyncEnd());
   }
 }
diff --git a/tests/standalone/io/file_system_links_test.dart b/tests/standalone/io/file_system_links_test.dart
index afe8996..c1ea068 100644
--- a/tests/standalone/io/file_system_links_test.dart
+++ b/tests/standalone/io/file_system_links_test.dart
@@ -2,10 +2,10 @@
 // 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 "package:expect/expect.dart";
 import "dart:io";
-import "dart:isolate";
 
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 createLink(String dst, String link, void callback()) {
   new Link(link).create(dst).then((_) => callback());
@@ -153,7 +153,7 @@
 
 
 testDirectoryListing() {
-  var keepAlive = new ReceivePort();
+  asyncStart();
   var temp = new Directory('').createTempSync();
   var temp2 = new Directory('').createTempSync();
   var y = '${temp.path}${Platform.pathSeparator}y';
@@ -193,14 +193,14 @@
           Expect.isTrue(dirs[0].endsWith(y));
           temp.deleteSync(recursive: true);
           temp2.deleteSync(recursive: true);
-          keepAlive.close();
+          asyncEnd();
         });
   });
 }
 
 
 testDirectoryListingBrokenLink() {
-  var keepAlive = new ReceivePort();
+  asyncStart();
   var temp = new Directory('').createTempSync();
   var x = '${temp.path}${Platform.pathSeparator}x';
   var link = '${temp.path}${Platform.pathSeparator}link';
@@ -232,7 +232,7 @@
           Expect.equals(0, dirs.length);
           Expect.equals(0, errors.length);
           temp.deleteSync(recursive: true);
-          keepAlive.close();
+          asyncEnd();
         });
   });
 }
diff --git a/tests/standalone/io/file_system_watcher_test.dart b/tests/standalone/io/file_system_watcher_test.dart
new file mode 100644
index 0000000..fef2d6e
--- /dev/null
+++ b/tests/standalone/io/file_system_watcher_test.dart
@@ -0,0 +1,254 @@
+// Copyright (c) 2013, 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.
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+
+void testWatchCreateFile() {
+  var dir = new Directory('').createTempSync();
+  var file = new File(dir.path + '/file');
+
+  var watcher = dir.watch();
+
+  asyncStart();
+  var sub;
+  sub = watcher.listen((event) {
+    if (event is FileSystemCreateEvent &&
+        event.path.endsWith('file')) {
+      asyncEnd();
+      sub.cancel();
+      dir.deleteSync(recursive: true);
+    }
+  }, onError: (e) {
+    dir.deleteSync(recursive: true);
+    throw e;
+  });
+
+  runAsync(file.createSync);
+}
+
+
+void testWatchModifyFile() {
+  var dir = new Directory('').createTempSync();
+  var file = new File(dir.path + '/file');
+  file.createSync();
+
+  var watcher = dir.watch();
+
+  asyncStart();
+  var sub;
+  sub = watcher.listen((event) {
+    if (event is FileSystemModifyEvent) {
+      Expect.isTrue(event.path.endsWith('file'));
+      sub.cancel();
+      asyncEnd();
+      dir.deleteSync(recursive: true);
+    }
+  }, onError: (e) {
+    dir.deleteSync(recursive: true);
+    throw e;
+  });
+
+  runAsync(() => file.writeAsStringSync('a'));
+}
+
+
+void testWatchMoveFile() {
+  var dir = new Directory('').createTempSync();
+  var file = new File(dir.path + '/file');
+  file.createSync();
+
+  var watcher = dir.watch();
+
+  asyncStart();
+  var sub;
+  sub = watcher.listen((event) {
+    if (event is FileSystemMoveEvent) {
+      Expect.isTrue(event.path.endsWith('file'));
+      if (event.destination != null) {
+        Expect.isTrue(event.destination.endsWith('file2'));
+      }
+      sub.cancel();
+      asyncEnd();
+      dir.deleteSync(recursive: true);
+    }
+  }, onError: (e) {
+    dir.deleteSync(recursive: true);
+    throw e;
+  });
+
+  runAsync(() => file.renameSync(dir.path + '/file2'));
+}
+
+
+void testWatchDeleteFile() {
+  var dir = new Directory('').createTempSync();
+  var file = new File(dir.path + '/file');
+  file.createSync();
+
+  var watcher = dir.watch();
+
+  asyncStart();
+  var sub;
+  sub = watcher.listen((event) {
+    if (event is FileSystemDeleteEvent) {
+      Expect.isTrue(event.path.endsWith('file'));
+      sub.cancel();
+      asyncEnd();
+      dir.deleteSync(recursive: true);
+    }
+  }, onError: (e) {
+    dir.deleteSync(recursive: true);
+    throw e;
+  });
+
+  runAsync(file.deleteSync);
+}
+
+
+void testWatchOnlyModifyFile() {
+  var dir = new Directory('').createTempSync();
+  var file = new File(dir.path + '/file');
+
+  var watcher = dir.watch(events: FileSystemEvent.MODIFY);
+
+  asyncStart();
+  var sub;
+  sub = watcher.listen((event) {
+    Expect.isTrue(event is FileSystemModifyEvent);
+    Expect.isTrue(event.path.endsWith('file'));
+    sub.cancel();
+    asyncEnd();
+    dir.deleteSync(recursive: true);
+  }, onError: (e) {
+    dir.deleteSync(recursive: true);
+    throw e;
+  });
+
+  runAsync(() {
+    file.createSync();
+    file.writeAsStringSync('a');
+  });
+}
+
+
+void testMultipleEvents() {
+  var dir = new Directory('').createTempSync();
+  var file = new File(dir.path + '/file');
+  var file2 = new File(dir.path + '/file2');
+
+  var watcher = dir.watch();
+
+  asyncStart();
+  int state = 0;
+  var sub;
+  sub = watcher.listen((event) {
+    int newState = 0;
+    switch (event.type) {
+      case FileSystemEvent.CREATE:
+        newState = 1;
+        break;
+
+      case FileSystemEvent.MODIFY:
+        newState = 2;
+        break;
+
+      case FileSystemEvent.MOVE:
+        newState = 3;
+        break;
+
+      case FileSystemEvent.DELETE:
+        newState = 4;
+        sub.cancel();
+        asyncEnd();
+        dir.deleteSync();
+        break;
+    }
+    if (!Platform.isMacOS) {
+      if (newState < state) throw "Bad state";
+    }
+    state = newState;
+  });
+
+  runAsync(() {
+    file.createSync();
+    file.writeAsStringSync('a');
+    file.renameSync(file2.path);
+    file2.deleteSync();
+  });
+}
+
+
+void testWatchRecursive() {
+  var dir = new Directory('').createTempSync();
+  if (Platform.isLinux) {
+    Expect.throws(() => dir.watch(recursive: true));
+    return;
+  }
+  var dir2 = new Directory(dir.path + '/dir');
+  dir2.createSync();
+  var file = new File(dir.path + '/dir/file');
+
+  var watcher = dir.watch(recursive: true);
+
+  asyncStart();
+  var sub;
+  sub = watcher.listen((event) {
+    if (event.path.endsWith('file')) {
+      sub.cancel();
+      asyncEnd();
+      dir.deleteSync(recursive: true);
+    }
+  }, onError: (e) {
+    dir.deleteSync(recursive: true);
+    throw e;
+  });
+
+  runAsync(file.createSync());
+}
+
+
+void testWatchNonRecursive() {
+  var dir = new Directory('').createTempSync();
+  var dir2 = new Directory(dir.path + '/dir');
+  dir2.createSync();
+  var file = new File(dir.path + '/dir/file');
+
+  var watcher = dir.watch(recursive: false);
+
+  asyncStart();
+  var sub;
+  sub = watcher.listen((event) {
+    if (event.path.endsWith('file')) {
+      throw "File change event not expected";
+    }
+  }, onError: (e) {
+    dir.deleteSync(recursive: true);
+    throw e;
+  });
+
+  runAsync(file.createSync);
+
+  new Timer(const Duration(milliseconds: 300), () {
+    sub.cancel();
+    asyncEnd();
+    dir.deleteSync(recursive: true);
+  });
+}
+
+
+void main() {
+  if (!FileSystemEntity.isWatchSupported) return;
+  testWatchCreateFile();
+  testWatchModifyFile();
+  testWatchMoveFile();
+  testWatchDeleteFile();
+  testWatchOnlyModifyFile();
+  testMultipleEvents();
+  testWatchNonRecursive();
+}
diff --git a/tests/standalone/io/file_test.dart b/tests/standalone/io/file_test.dart
index 28001ed..2123b89 100644
--- a/tests/standalone/io/file_test.dart
+++ b/tests/standalone/io/file_test.dart
@@ -4,13 +4,14 @@
 //
 // Dart test program for testing file I/O.
 
-import "package:expect/expect.dart";
-import "package:path/path.dart";
 import 'dart:async';
 import 'dart:convert';
 import 'dart:collection';
 import 'dart:io';
-import 'dart:isolate';
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+import "package:path/path.dart";
 
 class MyListOfOneElement
     extends Object with ListMixin<int> implements List<int> {
@@ -31,14 +32,16 @@
 class FileTest {
   static Directory tempDirectory;
   static int numLiveAsyncTests = 0;
-  static ReceivePort port;
 
-  static void asyncTestStarted() { ++numLiveAsyncTests; }
+  static void asyncTestStarted() {
+    asyncStart();
+    ++numLiveAsyncTests;
+  }
   static void asyncTestDone(String name) {
+    asyncEnd();
     --numLiveAsyncTests;
     if (numLiveAsyncTests == 0) {
       deleteTempDirectory();
-      port.close();
     }
   }
 
@@ -213,7 +216,7 @@
   }
 
   static void testRead() {
-    ReceivePort port = new ReceivePort();
+    asyncStart();
     // Read a file and check part of it's contents.
     String filename = getFilename("bin/file_test.cc");
     File file = new File(filename);
@@ -233,7 +236,7 @@
           Expect.equals(114, buffer[7]);  // represents 'r' in the file.
           Expect.equals(105, buffer[8]);  // represents 'i' in the file.
           Expect.equals(103, buffer[9]);  // represents 'g' in the file.
-          file.close().then((ignore) => port.close());
+          file.close().then((ignore) => asyncEnd());
         });
       });
     });
@@ -276,6 +279,7 @@
 
   // Test for file read and write functionality.
   static void testReadWrite() {
+    asyncTestStarted();
     // Read a file.
     String inFilename = getFilename("tests/vm/data/fixed_length_file");
     final File file = new File(inFilename);
@@ -327,7 +331,6 @@
         });
       });
     });
-    asyncTestStarted();
   }
 
   static void testWriteAppend() {
@@ -355,6 +358,7 @@
   }
 
   static void testOutputStreamWriteAppend() {
+    asyncTestStarted();
     String content = "foobar";
     String filename = tempDirectory.path + "/outstream_write_append";
     File file = new File(filename);
@@ -382,11 +386,11 @@
         });
       });
     });
-    asyncTestStarted();
   }
 
   // Test for file read and write functionality.
   static void testOutputStreamWriteString() {
+    asyncTestStarted();
     String content = "foobar";
     String filename = tempDirectory.path + "/outstream_write_string";
     File file = new File(filename);
@@ -410,7 +414,6 @@
         asyncTestDone("testOutputStreamWriteString");
       });
     });
-    asyncTestStarted();
   }
 
 
@@ -559,15 +562,6 @@
 
   static void testDirectory() {
     asyncTestStarted();
-
-    // Port to verify that the test completes.
-    var port = new ReceivePort();
-    port.receive((message, replyTo) {
-      port.close();
-      Expect.equals(1, message);
-      asyncTestDone("testDirectory");
-    });
-
     var tempDir = tempDirectory.path;
     var file = new File("${tempDir}/testDirectory");
       file.create().then((ignore) {
@@ -575,9 +569,7 @@
           d.exists().then((xexists) {
           Expect.isTrue(xexists);
           Expect.isTrue(d.path.endsWith(tempDir));
-          file.delete().then((ignore) {
-                port.toSendPort().send(1);
-          });
+          file.delete().then((ignore) => asyncTestDone("testDirectory"));
         });
       });
   }
@@ -604,13 +596,13 @@
 
   // Test for file length functionality.
   static void testLength() {
-    var port = new ReceivePort();
+    asyncTestStarted();
     String filename = getFilename("tests/vm/data/fixed_length_file");
     File file = new File(filename);
     RandomAccessFile openedFile = file.openSync();
     openedFile.length().then((length) {
       Expect.equals(42, length);
-      openedFile.close().then((ignore) => port.close());
+      openedFile.close().then((ignore) => asyncTestDone("testLength"));
     });
     file.length().then((length) {
       Expect.equals(42, length);
@@ -628,7 +620,7 @@
 
   // Test for file position functionality.
   static void testPosition() {
-    var port = new ReceivePort();
+    asyncTestStarted();
     String filename = getFilename("tests/vm/data/fixed_length_file");
     RandomAccessFile input = (new File(filename)).openSync();
     input.position().then((position) {
@@ -643,7 +635,7 @@
               input.setPosition(8).then((ignore) {
                 input.position().then((position) {
                   Expect.equals(8, position);
-                  input.close().then((ignore) => port.close());
+                  input.close().then((ignore) => asyncTestDone("testPosition"));
                 });
               });
             });
@@ -668,6 +660,7 @@
   }
 
   static void testTruncate() {
+    asyncTestStarted();
     File file = new File(tempDirectory.path + "/out_truncate");
     List buffer = const [65, 65, 65, 65, 65, 65, 65, 65, 65, 65];
     file.open(mode: WRITE).then((RandomAccessFile openedFile) {
@@ -690,7 +683,6 @@
         });
       });
     });
-    asyncTestStarted();
   }
 
   static void testTruncateSync() {
@@ -939,29 +931,23 @@
   }
 
   static void testReadAsBytes() {
-    var port = new ReceivePort();
-    port.receive((result, replyTo) {
-      port.close();
-      Expect.equals(42, result);
-    });
+    asyncTestStarted();
     var name = getFilename("tests/vm/data/fixed_length_file");
     var f = new File(name);
     f.readAsBytes().then((bytes) {
       Expect.isTrue(new String.fromCharCodes(bytes).endsWith("42 bytes."));
-      port.toSendPort().send(bytes.length);
+      Expect.equals(42, bytes.length);
+      asyncTestDone("testReadAsBytes");
     });
   }
 
   static void testReadAsBytesEmptyFile() {
-    var port = new ReceivePort();
-    port.receive((result, replyTo) {
-      port.close();
-      Expect.equals(0, result);
-    });
+    asyncTestStarted();
     var name = getFilename("tests/vm/data/empty_file");
     var f = new File(name);
     f.readAsBytes().then((bytes) {
-      port.toSendPort().send(bytes.length);
+      Expect.equals(0, bytes.length);
+      asyncTestDone("testReadAsBytesEmptyFile");
     });
   }
 
@@ -979,11 +965,7 @@
   }
 
   static void testReadAsText() {
-    var port = new ReceivePort();
-    port.receive((result, replyTo) {
-      port.close();
-      Expect.equals(1, result);
-    });
+    asyncTestStarted();
     var name = getFilename("tests/vm/data/fixed_length_file");
     var f = new File(name);
     f.readAsString(encoding: UTF8).then((text) {
@@ -1003,7 +985,7 @@
           readAsStringFuture.then((text) {
             Expect.fail("Non-ascii char should cause error");
           }).catchError((e) {
-            port.toSendPort().send(1);
+            asyncTestDone("testReadAsText");
           });
         });
       });
@@ -1011,15 +993,12 @@
   }
 
   static void testReadAsTextEmptyFile() {
-    var port = new ReceivePort();
-    port.receive((result, replyTo) {
-      port.close();
-      Expect.equals(0, result);
-    });
+    asyncTestStarted();
     var name = getFilename("tests/vm/data/empty_file");
     var f = new File(name);
     f.readAsString(encoding: UTF8).then((text) {
-      port.toSendPort().send(text.length);
+      Expect.equals(0, text.length);
+      asyncTestDone("testReadAsTextEmptyFile");
       return true;
     });
   }
@@ -1058,18 +1037,15 @@
   }
 
   static void testReadAsLines() {
-    var port = new ReceivePort();
-    port.receive((result, replyTo) {
-      port.close();
-      Expect.equals(42, result);
-    });
+    asyncTestStarted();
     var name = getFilename("tests/vm/data/fixed_length_file");
     var f = new File(name);
     f.readAsLines(encoding: UTF8).then((lines) {
       Expect.equals(1, lines.length);
       var line = lines[0];
       Expect.isTrue(line.endsWith("42 bytes."));
-      port.toSendPort().send(line.length);
+      Expect.equals(42, line.length);
+      asyncTestDone("testReadAsLines");
     });
   }
 
@@ -1087,11 +1063,7 @@
 
 
   static void testReadAsErrors() {
-    var port = new ReceivePort();
-    port.receive((message, _) {
-      port.close();
-      Expect.equals(1, message);
-    });
+    asyncTestStarted();
     var f = new File('.');
     Expect.throws(f.readAsBytesSync, (e) => e is FileException);
     Expect.throws(f.readAsStringSync, (e) => e is FileException);
@@ -1105,18 +1077,18 @@
         var readAsLinesFuture = f.readAsLines(encoding: UTF8);
         readAsLinesFuture.then((lines) => Expect.fail("no lines expected"))
         .catchError((e) {
-          port.toSendPort().send(1);
+          asyncTestDone("testReadAsLines");
         });
       });
     });
   }
 
   static void testLastModified() {
-    var port = new ReceivePort();
+    asyncTestStarted();
     new File(Platform.executable).lastModified().then((modified) {
       Expect.isTrue(modified is DateTime);
       Expect.isTrue(modified.isBefore(new DateTime.now()));
-      port.close();
+      asyncTestDone("testLastModified");
     });
   }
 
@@ -1129,6 +1101,7 @@
   // Test that opens the same file for writing then for appending to test
   // that the file is not truncated when opened for appending.
   static void testAppend() {
+    asyncTestStarted();
     var file = new File('${tempDirectory.path}/out_append');
     file.open(mode: WRITE).then((openedFile) {
       openedFile.writeString("asdf").then((ignore) {
@@ -1154,7 +1127,6 @@
         });
       });
     });
-    asyncTestStarted();
   }
 
   static void testAppendSync() {
@@ -1173,6 +1145,7 @@
   }
 
   static void testWriteStringUtf8() {
+    asyncTestStarted();
     var file = new File('${tempDirectory.path}/out_write_string');
     var string = new String.fromCharCodes([0x192]);
     file.open(mode: WRITE).then((openedFile) {
@@ -1204,7 +1177,6 @@
         });
       });
     });
-    asyncTestStarted();
   }
 
   static void testWriteStringUtf8Sync() {
@@ -1228,6 +1200,7 @@
   // Test that opens the same file for writing then for appending to test
   // that the file is not truncated when opened for appending.
   static void testRename() {
+    asyncTestStarted();
     var file = new File('${tempDirectory.path}/rename_name');
     file.create().then((file) {
       file.rename("${tempDirectory.path}/rename_newname").then((newfile) {
@@ -1260,7 +1233,6 @@
         });
       });
     });
-    asyncTestStarted();
   }
 
   static void testRenameSync() {
@@ -1288,32 +1260,25 @@
 
   // Main test entrypoint.
   static testMain() {
-    port = new ReceivePort();
+    asyncStart();
+
     testRead();
     testReadSync();
     testReadStream();
-    testLength();
     testLengthSync();
-    testPosition();
     testPositionSync();
     testOpenDirectoryAsFile();
     testOpenDirectoryAsFileSync();
     testOpenFile();
-    testReadAsBytes();
-    testReadAsBytesEmptyFile();
     testReadAsBytesSync();
     testReadAsBytesSyncEmptyFile();
-    testReadAsText();
-    testReadAsTextEmptyFile();
     testReadAsTextSync();
     testReadAsTextSyncEmptyFile();
-    testReadAsLines();
     testReadAsLinesSync();
-    testReadAsErrors();
-    testLastModified();
     testLastModifiedSync();
 
     createTempDirectory(() {
+      testLength();
       testReadWrite();
       testReadWriteSync();
       testReadWriteNoArgsSync();
@@ -1321,6 +1286,13 @@
       testReadEmptyFileSync();
       testReadEmptyFile();
       testReadWriteStreamLargeFile();
+      testReadAsBytes();
+      testReadAsBytesEmptyFile();
+      testReadAsText();
+      testReadAsTextEmptyFile();
+      testReadAsLines();
+      testReadAsErrors();
+      testPosition();
       testTruncate();
       testTruncateSync();
       testCloseException();
@@ -1338,6 +1310,8 @@
       testWriteStringUtf8Sync();
       testRename();
       testRenameSync();
+      testLastModified();
+      asyncEnd();
     });
   }
 }
diff --git a/tests/standalone/io/file_typed_data_test.dart b/tests/standalone/io/file_typed_data_test.dart
index 90e89b6..0dee529 100644
--- a/tests/standalone/io/file_typed_data_test.dart
+++ b/tests/standalone/io/file_typed_data_test.dart
@@ -4,14 +4,15 @@
 //
 // Dart test program for testing file I/O.
 
-import "package:expect/expect.dart";
 import 'dart:async';
 import 'dart:io';
-import 'dart:isolate';
 import 'dart:typed_data';
 
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
 void testWriteInt8ListAndView() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   const int LIST_LENGTH = 8;
   const int OFFSET_IN_BYTES_FOR_VIEW = 2 * Int8List.BYTES_PER_ELEMENT;
   const int VIEW_LENGTH = 4;
@@ -36,14 +37,14 @@
       var content = file.readAsBytesSync();
       Expect.listEquals(expected, content);
       temp.deleteSync(recursive: true);
-      port.close();
+      asyncEnd();
     });
   });
 }
 
 
 void testWriteUint8ListAndView() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   const int LIST_LENGTH = 8;
   const int OFFSET_IN_BYTES_FOR_VIEW = 2 * Uint8List.BYTES_PER_ELEMENT;
   const int VIEW_LENGTH = 4;
@@ -68,14 +69,14 @@
       var content = file.readAsBytesSync();
       Expect.listEquals(expected, content);
       temp.deleteSync(recursive: true);
-      port.close();
+      asyncEnd();
     });
   });
 }
 
 
 void testWriteUint8ClampedListAndView() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   const int LIST_LENGTH = 8;
   const int OFFSET_IN_BYTES_FOR_VIEW = 2 * Uint8ClampedList.BYTES_PER_ELEMENT;
   const int VIEW_LENGTH = 4;
@@ -100,14 +101,14 @@
       var content = file.readAsBytesSync();
       Expect.listEquals(expected, content);
       temp.deleteSync(recursive: true);
-      port.close();
+      asyncEnd();
     });
   });
 }
 
 
 void testWriteInt16ListAndView() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   const int LIST_LENGTH = 8;
   const int LIST_LENGTH_IN_BYTES = LIST_LENGTH * Int16List.BYTES_PER_ELEMENT;
   const int OFFSET_IN_BYTES_FOR_VIEW = 2 * Int16List.BYTES_PER_ELEMENT;
@@ -144,14 +145,14 @@
       }
       Expect.listEquals(expected, new Int16List.view(typed_data_content));
       temp.deleteSync(recursive: true);
-      port.close();
+      asyncEnd();
     });
   });
 }
 
 
 void testWriteUint16ListAndView() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   const int LIST_LENGTH = 8;
   const int LIST_LENGTH_IN_BYTES = LIST_LENGTH * Uint16List.BYTES_PER_ELEMENT;
   const int OFFSET_IN_BYTES_FOR_VIEW = 2 * Uint16List.BYTES_PER_ELEMENT;
@@ -188,14 +189,14 @@
       }
       Expect.listEquals(expected, new Uint16List.view(typed_data_content));
       temp.deleteSync(recursive: true);
-      port.close();
+      asyncEnd();
     });
   });
 }
 
 
 void testWriteInt32ListAndView() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   const int LIST_LENGTH = 8;
   const int LIST_LENGTH_IN_BYTES = LIST_LENGTH * Int32List.BYTES_PER_ELEMENT;
   const int OFFSET_IN_BYTES_FOR_VIEW = 2 * Int32List.BYTES_PER_ELEMENT;
@@ -232,14 +233,14 @@
       }
       Expect.listEquals(expected, new Int32List.view(typed_data_content));
       temp.deleteSync(recursive: true);
-      port.close();
+      asyncEnd();
     });
   });
 }
 
 
 void testWriteUint32ListAndView() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   const int LIST_LENGTH = 8;
   const int LIST_LENGTH_IN_BYTES = LIST_LENGTH * Int32List.BYTES_PER_ELEMENT;
   const int OFFSET_IN_BYTES_FOR_VIEW = 2 * Int32List.BYTES_PER_ELEMENT;
@@ -276,14 +277,14 @@
       }
       Expect.listEquals(expected, new Uint32List.view(typed_data_content));
       temp.deleteSync(recursive: true);
-      port.close();
+      asyncEnd();
     });
   });
 }
 
 
 void testWriteInt64ListAndView() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   const int LIST_LENGTH = 8;
   const int LIST_LENGTH_IN_BYTES = LIST_LENGTH * Int64List.BYTES_PER_ELEMENT;
   const int OFFSET_IN_BYTES_FOR_VIEW = 2 * Int64List.BYTES_PER_ELEMENT;
@@ -320,14 +321,14 @@
       }
       Expect.listEquals(expected, new Int64List.view(typed_data_content));
       temp.deleteSync(recursive: true);
-      port.close();
+      asyncEnd();
     });
   });
 }
 
 
 void testWriteUint64ListAndView() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   const int LIST_LENGTH = 8;
   const int LIST_LENGTH_IN_BYTES = LIST_LENGTH * Uint64List.BYTES_PER_ELEMENT;
   const int OFFSET_IN_BYTES_FOR_VIEW = 2 * Uint64List.BYTES_PER_ELEMENT;
@@ -364,7 +365,7 @@
       }
       Expect.listEquals(expected, new Uint64List.view(typed_data_content));
       temp.deleteSync(recursive: true);
-      port.close();
+      asyncEnd();
     });
   });
 }
diff --git a/tests/standalone/io/file_write_as_test.dart b/tests/standalone/io/file_write_as_test.dart
index 3178bfe..1d40d96 100644
--- a/tests/standalone/io/file_write_as_test.dart
+++ b/tests/standalone/io/file_write_as_test.dart
@@ -2,10 +2,11 @@
 // 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 "package:expect/expect.dart";
 import 'dart:async';
 import 'dart:io';
-import 'dart:isolate';
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 testWriteAsBytesSync(dir) {
   var f = new File('${dir.path}/bytes_sync.txt');
@@ -68,7 +69,7 @@
 }
 
 main() {
-  var port = new ReceivePort();
+  asyncStart();
   var tempDir = new Directory('').createTempSync();
   testWriteAsBytesSync(tempDir);
   testWriteAsStringSync(tempDir);
@@ -76,6 +77,6 @@
     return testWriteAsString(tempDir);
   }).then((_) {
     tempDir.deleteSync(recursive: true);
-    port.close();
+    asyncEnd();
   });
 }
diff --git a/tests/standalone/io/http_client_connect_test.dart b/tests/standalone/io/http_client_connect_test.dart
index c4c4798..7f7ecff 100644
--- a/tests/standalone/io/http_client_connect_test.dart
+++ b/tests/standalone/io/http_client_connect_test.dart
@@ -7,10 +7,11 @@
 // VMOptions=--short_socket_write
 // VMOptions=--short_socket_read --short_socket_write
 
-import "package:expect/expect.dart";
 import 'dart:async';
 import 'dart:io';
-import 'dart:isolate';
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 void testGetEmptyRequest() {
   HttpServer.bind("127.0.0.1", 0).then((server) {
@@ -53,34 +54,35 @@
 }
 
 void testGetInvalidHost() {
-  var port = new ReceivePort();
+  asyncStart();
   var client = new HttpClient();
   client.get("__SOMETHING_INVALID__", 8888, "/")
     .catchError((error) {
-      port.close();
       client.close();
+      asyncEnd();
     });
 }
 
 void testGetServerClose() {
+  asyncStart();
   HttpServer.bind("127.0.0.1", 0).then((server) {
     server.listen((request) {
       server.close();
     });
 
-    var port = new ReceivePort();
     var client = new HttpClient();
     client.get("127.0.0.1", server.port, "/")
       .then((request) => request.close())
       .then((response) {
         Expect.fail("Request not expected");
       })
-        .catchError((error) => port.close(),
+        .catchError((error) => asyncEnd(),
                     test: (error) => error is HttpException);
   });
 }
 
 void testGetDataServerClose() {
+  asyncStart();
   var completer = new Completer();
   HttpServer.bind("127.0.0.1", 0).then((server) {
     server.listen((request) {
@@ -90,7 +92,6 @@
       completer.future.then((_) => server.close());
     });
 
-    var port = new ReceivePort();
     var client = new HttpClient();
     client.get("127.0.0.1", server.port, "/")
       .then((request) => request.close())
@@ -102,8 +103,8 @@
           (data) {},
           onError: (error) => errors++,
           onDone: () {
-            port.close();
             Expect.equals(1, errors);
+            asyncEnd();
           });
       });
   });
diff --git a/tests/standalone/io/http_client_exception_test.dart b/tests/standalone/io/http_client_exception_test.dart
index 9028b6d..e557e8d 100644
--- a/tests/standalone/io/http_client_exception_test.dart
+++ b/tests/standalone/io/http_client_exception_test.dart
@@ -3,9 +3,10 @@
 // BSD-style license that can be found in the LICENSE file.
 //
 
-import "package:expect/expect.dart";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 void testInvalidUrl() {
   HttpClient client = new HttpClient();
@@ -14,13 +15,13 @@
 }
 
 void testBadHostName() {
+  asyncStart();
   HttpClient client = new HttpClient();
-  ReceivePort port = new ReceivePort();
   client.get("some.bad.host.name.7654321", 0, "/")
     .then((request) {
       Expect.fail("Should not open a request on bad hostname");
     }).catchError((error) {
-      port.close();  // We expect onError to be called, due to bad host name.
+      asyncEnd();  // We expect onError to be called, due to bad host name.
     }, test: (error) => error is! String);
 }
 
diff --git a/tests/standalone/io/http_client_request_test.dart b/tests/standalone/io/http_client_request_test.dart
index 35d565b..5b6dc30 100644
--- a/tests/standalone/io/http_client_request_test.dart
+++ b/tests/standalone/io/http_client_request_test.dart
@@ -2,12 +2,14 @@
 // 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 "package:expect/expect.dart";
+import "dart:async";
 import "dart:io";
-import "dart:isolate";
 import "dart:typed_data";
 
-void testClientRequest(void handler(request)) {
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void testClientRequest(Future handler(request)) {
   HttpServer.bind("127.0.0.1", 0).then((server) {
     server.listen((request) {
       request.listen((_) {}, onDone: () {
@@ -45,61 +47,61 @@
 }
 
 void testBadResponseAdd() {
+  asyncStart();
   testClientRequest((request) {
-    var port = new ReceivePort();
     request.contentLength = 0;
     request.add([0]);
     request.close();
     request.done.catchError((error) {
-      port.close();
+      asyncEnd();
     }, test: (e) => e is HttpException);
     return request.done;
   });
 
+  asyncStart();
   testClientRequest((request) {
-    var port = new ReceivePort();
     request.contentLength = 5;
     request.add([0, 0, 0]);
     request.add([0, 0, 0]);
     request.close();
     request.done.catchError((error) {
-      port.close();
+      asyncEnd();
     }, test: (e) => e is HttpException);
     return request.done;
   });
 
+  asyncStart();
   testClientRequest((request) {
-    var port = new ReceivePort();
     request.contentLength = 0;
     request.add(new Uint8List(64 * 1024));
     request.add(new Uint8List(64 * 1024));
     request.add(new Uint8List(64 * 1024));
     request.close();
     request.done.catchError((error) {
-      port.close();
+      asyncEnd();
     }, test: (e) => e is HttpException);
     return request.done;
   });
 }
 
 void testBadResponseClose() {
+  asyncStart();
   testClientRequest((request) {
-    var port = new ReceivePort();
     request.contentLength = 5;
     request.close();
     request.done.catchError((error) {
-      port.close();
+      asyncEnd();
     }, test: (e) => e is HttpException);
     return request.done;
   });
 
+  asyncStart();
   testClientRequest((request) {
-    var port = new ReceivePort();
     request.contentLength = 5;
     request.add([0]);
     request.close();
     request.done.catchError((error) {
-      port.close();
+      asyncEnd();
     }, test: (e) => e is HttpException);
     return request.done;
   });
diff --git a/tests/standalone/io/http_reuse_server_port_test.dart b/tests/standalone/io/http_reuse_server_port_test.dart
index 4da6802..4829eb7 100644
--- a/tests/standalone/io/http_reuse_server_port_test.dart
+++ b/tests/standalone/io/http_reuse_server_port_test.dart
@@ -7,10 +7,11 @@
 // VMOptions=--short_socket_write
 // VMOptions=--short_socket_read --short_socket_write
 
-import "package:expect/expect.dart";
 import 'dart:async';
 import 'dart:io';
-import 'dart:isolate';
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 Future<int> runServer(int port, int connections, bool clean) {
   var completer = new Completer();
@@ -43,26 +44,26 @@
 
 
 void testReusePort() {
-  var keepAlive = new ReceivePort();
+  asyncStart();
   runServer(0, 10, true).then((int port) {
     // Stress test the port reusing it 10 times.
     Future.forEach(new List(10), (_) {
       return runServer(port, 10, true);
     }).then((_) {
-      keepAlive.close();
+      asyncEnd();
     });
   });
 }
 
 
 void testUncleanReusePort() {
-  var keepAlive = new ReceivePort();
+  asyncStart();
   runServer(0, 10, false).then((int port) {
     // Stress test the port reusing it 10 times.
     Future.forEach(new List(10), (_) {
       return runServer(port, 10, false);
     }).then((_) {
-      keepAlive.close();
+      asyncEnd();
     });
   });
 }
diff --git a/tests/standalone/io/http_server_close_response_after_error_client.dart b/tests/standalone/io/http_server_close_response_after_error_client.dart
new file mode 100644
index 0000000..990d34a
--- /dev/null
+++ b/tests/standalone/io/http_server_close_response_after_error_client.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2013, 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.

+

+import 'dart:async';

+import 'dart:io';

+

+void main() {

+  int port = int.parse(new Options().arguments.first);

+  var client = new HttpClient();

+  const MAX = 64;

+  int count = 0;

+  void run() {

+    if (count++ == MAX) exit(0);

+    Socket.connect('127.0.0.1', port).then((socket) {

+      socket.write("POST / HTTP/1.1\r\n");

+      socket.write("Content-Length: 10\r\n");

+      socket.write("\r\n");

+      socket.write("LALALA");

+      socket.destroy();

+      socket.listen(null, onDone: run);

+    });

+  }

+  for (int i = 0; i < 4; i++) run();

+}

+

diff --git a/tests/standalone/io/http_server_close_response_after_error_test.dart b/tests/standalone/io/http_server_close_response_after_error_test.dart
new file mode 100644
index 0000000..c3501f7
--- /dev/null
+++ b/tests/standalone/io/http_server_close_response_after_error_test.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2013, 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.

+//

+// VMOptions=

+// VMOptions=--short_socket_read

+// VMOptions=--short_socket_write

+// VMOptions=--short_socket_read --short_socket_write

+

+import 'dart:async';

+import 'dart:io';

+

+const CLIENT_SCRIPT = "http_server_close_response_after_error_client.dart";

+

+void main() {

+  HttpServer.bind("127.0.0.1", 0)

+      .then((server) {

+        server.listen(

+            (request) {

+              request.listen(

+                  null,

+                  onError: (e) {},

+                  onDone: () {

+                    request.response.close();

+                  });

+            });

+        var path = new Uri.file(Platform.script);

+        Process.run(Platform.executable,

+                    [path.resolve(CLIENT_SCRIPT).toString(),

+                     server.port.toString()])

+            .then((result) {

+              if (result.exitCode != 0) throw "Bad exit code";

+              server.close();

+            });

+      });

+}

+

diff --git a/tests/standalone/io/http_server_test.dart b/tests/standalone/io/http_server_test.dart
index afdd819..b470b4d 100644
--- a/tests/standalone/io/http_server_test.dart
+++ b/tests/standalone/io/http_server_test.dart
@@ -2,20 +2,19 @@
 // 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 "package:expect/expect.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 void testListenOn() {
   ServerSocket socket;
   HttpServer server;
 
   void test(void onDone()) {
-
     Expect.equals(socket.port, server.port);
 
-    ReceivePort clientPort = new ReceivePort();
     HttpClient client = new HttpClient();
     client.get("127.0.0.1", socket.port, "/")
       .then((request) {
@@ -26,7 +25,6 @@
           (_) {},
           onDone: () {
             client.close();
-            clientPort.close();
             onDone();
           });
       })
@@ -39,17 +37,14 @@
   }
 
   // Test two connection after each other.
+  asyncStart();
   ServerSocket.bind("127.0.0.1", 0).then((s) {
     socket = s;
     server = new HttpServer.listenOn(socket);
-    ReceivePort serverPort = new ReceivePort();
     server.listen((HttpRequest request) {
       request.listen(
         (_) {},
-        onDone: () {
-          request.response.close();
-          serverPort.close();
-        });
+        onDone: () => request.response.close());
     });
 
     test(() {
@@ -57,6 +52,7 @@
         server.close();
         Expect.throws(() => server.port);
         socket.close();
+        asyncEnd();
       });
     });
   });
diff --git a/tests/standalone/io/https_client_certificate_test.dart b/tests/standalone/io/https_client_certificate_test.dart
index e27e742..7000169 100644
--- a/tests/standalone/io/https_client_certificate_test.dart
+++ b/tests/standalone/io/https_client_certificate_test.dart
@@ -2,17 +2,18 @@
 // 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 "package:expect/expect.dart";
-import "package:path/path.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+import "package:path/path.dart";
 
 const HOST_NAME = "localhost";
 
 
 Function test() {
-  var keepAlive = new ReceivePort();
+  asyncStart();
   HttpServer.bindSecure(HOST_NAME,
                         0,
                         backlog: 5,
@@ -39,7 +40,7 @@
           Expect.equals(received, "Hello");
           client.close();
           server.close();
-          keepAlive.close();
+          asyncEnd();
         });
   });
 }
diff --git a/tests/standalone/io/https_client_exception_test.dart b/tests/standalone/io/https_client_exception_test.dart
index 6994e05..1f9cbad 100644
--- a/tests/standalone/io/https_client_exception_test.dart
+++ b/tests/standalone/io/https_client_exception_test.dart
@@ -2,19 +2,20 @@
 // 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 "package:expect/expect.dart";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 void testBadHostName() {
+  asyncStart();
   HttpClient client = new HttpClient();
-  ReceivePort port = new ReceivePort();
   client.getUrl(Uri.parse("https://some.bad.host.name.7654321/"))
       .then((HttpClientRequest request) {
         Expect.fail("Should not open a request on bad hostname");
       })
       .catchError((error) {
-        port.close();  // Should throw an error on bad hostname.
+        asyncEnd();  // Should throw an error on bad hostname.
       });
 }
 
diff --git a/tests/standalone/io/link_async_test.dart b/tests/standalone/io/link_async_test.dart
index d910749..d468a31 100644
--- a/tests/standalone/io/link_async_test.dart
+++ b/tests/standalone/io/link_async_test.dart
@@ -2,11 +2,12 @@
 // 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 "package:expect/expect.dart";
-import "package:path/path.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+import "package:path/path.dart";
 
 // Test the dart:io Link class.
 
@@ -271,9 +272,9 @@
 }
 
 main() {
-  ReceivePort keepAlive = new ReceivePort();
+  asyncStart();
   testCreate()
     .then((_) => testCreateLoopingLink())
     .then((_) => testRename())
-    .then((_) => keepAlive.close());
+    .then((_) => asyncEnd());
 }
diff --git a/tests/standalone/io/platform_test.dart b/tests/standalone/io/platform_test.dart
index 1fdad2b..6c009e8 100644
--- a/tests/standalone/io/platform_test.dart
+++ b/tests/standalone/io/platform_test.dart
@@ -2,11 +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.
 
-import "package:expect/expect.dart";
 import "dart:async";
 import "dart:io";
 import "dart:isolate";
 
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
 test() {
   Expect.isTrue(Platform.numberOfProcessors > 0);
   var os = Platform.operatingSystem;
@@ -60,7 +62,7 @@
 }
 
 testIsolate() {
-  var port = new ReceivePort();
+  asyncStart();
   var sendPort = spawnFunction(f);
   Future.wait([sendPort.call("Platform.executable"),
                sendPort.call("Platform.script"),
@@ -77,7 +79,7 @@
     Expect.isTrue(uri.path.endsWith('tests/standalone/io/platform_test.dart'));
     Expect.equals(Platform.packageRoot, results[2]);
     Expect.listEquals(Platform.executableArguments, results[3]);
-    sendPort.call("close").then((_) => port.close());
+    sendPort.call("close").then((_) => asyncEnd());
   });
 }
 
diff --git a/tests/standalone/io/process_environment_test.dart b/tests/standalone/io/process_environment_test.dart
index cb60471..c36ef8c 100644
--- a/tests/standalone/io/process_environment_test.dart
+++ b/tests/standalone/io/process_environment_test.dart
@@ -2,9 +2,11 @@
 // 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 "package:expect/expect.dart";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
 import "process_test_util.dart";
 
 runEnvironmentProcess(Map environment, name, includeParent, callback) {
@@ -24,7 +26,7 @@
 }
 
 testEnvironment() {
-  var donePort = new ReceivePort();
+  asyncStart();
   Map env = Platform.environment;
   Expect.isFalse(env.isEmpty);
   // Check that some value in the environment stays the same when passed
@@ -42,7 +44,7 @@
       copy[name] = 'value';
       runEnvironmentProcess(copy, name, true, (output) {
         Expect.isTrue(output.startsWith('value'));
-        donePort.close();
+        asyncEnd();
       });
     });
     // Only check one value to not spin up too many processes testing the
@@ -52,13 +54,13 @@
 }
 
 testNoIncludeEnvironment() {
-  var donePort = new ReceivePort();
+  asyncStart();
   var env = Platform.environment;
   Expect.isTrue(env.containsKey('PATH'));
   env.remove('PATH');
   runEnvironmentProcess(env, "PATH", false, (output) {
-    donePort.close();
     Expect.isTrue(output.startsWith("null"));
+    asyncEnd();
   });
 }
 
diff --git a/tests/standalone/io/process_non_ascii_test.dart b/tests/standalone/io/process_non_ascii_test.dart
index f590cff..82964e0 100644
--- a/tests/standalone/io/process_non_ascii_test.dart
+++ b/tests/standalone/io/process_non_ascii_test.dart
@@ -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.
 
-import "package:expect/expect.dart";
 import 'dart:io';
-import 'dart:isolate';
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 main() {
-  var port = new ReceivePort();
+  asyncStart();
   var executable = new File(Platform.executable).fullPathSync();
   var tempDir = new Directory('').createTempSync();
   var nonAsciiDir = new Directory('${tempDir.path}/æøå');
@@ -30,6 +31,6 @@
       .then((result) {
         Expect.equals(0, result.exitCode);
         tempDir.deleteSync(recursive: true);
-        port.close();
+        asyncEnd();
       });
 }
diff --git a/tests/standalone/io/process_pid_test.dart b/tests/standalone/io/process_pid_test.dart
index 0016058..b29c7f5 100644
--- a/tests/standalone/io/process_pid_test.dart
+++ b/tests/standalone/io/process_pid_test.dart
@@ -4,13 +4,14 @@
 //
 // Process test program to test process communication.
 
-import "package:expect/expect.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 main() {
-  var port = new ReceivePort();
+  asyncStart();
   Expect.isTrue(pid > 0);
   var futures = [];
   futures.add(Process.start(Platform.executable,['--version']));
@@ -21,7 +22,7 @@
     Expect.equals(0, results[1].exitCode);
     results[0].exitCode.then((exitCode) {
       Expect.equals(0, exitCode);
-      port.close();
+      asyncEnd();
     });
   });
 }
diff --git a/tests/standalone/io/raw_secure_server_closing_test.dart b/tests/standalone/io/raw_secure_server_closing_test.dart
index 1157a48..f2f0377 100644
--- a/tests/standalone/io/raw_secure_server_closing_test.dart
+++ b/tests/standalone/io/raw_secure_server_closing_test.dart
@@ -7,23 +7,24 @@
 // VMOptions=--short_socket_write
 // VMOptions=--short_socket_read --short_socket_write
 
-import "package:expect/expect.dart";
-import "package:path/path.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+import "package:path/path.dart";
 
 const HOST_NAME = "localhost";
 const CERTIFICATE = "localhost_cert";
 
 void testCloseOneEnd(String toClose) {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   Completer serverDone = new Completer();
   Completer serverEndDone = new Completer();
   Completer clientEndDone = new Completer();
   Future.wait([serverDone.future, serverEndDone.future, clientEndDone.future])
       .then((_) {
-        port.close();
+        asyncEnd();
       });
   RawSecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE).then((server) {
     server.listen((serverConnection) {
@@ -54,7 +55,7 @@
 }
 
 void testCloseBothEnds() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   RawSecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE).then((server) {
     var clientEndFuture = RawSecureSocket.connect(HOST_NAME, server.port);
     server.listen((serverEnd) {
@@ -62,7 +63,7 @@
         clientEnd.close();
         serverEnd.close();
         server.close();
-        port.close();
+        asyncEnd();
       });
     });
   });
@@ -73,7 +74,7 @@
   var acceptCount = 0;
   var resumed = false;
 
-  ReceivePort port = new ReceivePort();
+  asyncStart();
 
   RawSecureServerSocket.bind(HOST_NAME,
                              0,
@@ -86,7 +87,7 @@
       connection.shutdown(SocketDirection.SEND);
       if (++acceptCount == 2 * socketCount) {
         server.close();
-        port.close();
+        asyncEnd();
       }
     });
 
@@ -114,7 +115,7 @@
 
 testCloseServer() {
   const int socketCount = 3;
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   List ends = [];
 
   RawSecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE).then((server) {
@@ -125,7 +126,7 @@
         end.close();
       }
       server.close();
-      port.close();
+      asyncEnd();
     }
 
     server.listen((connection) {
diff --git a/tests/standalone/io/raw_secure_server_socket_test.dart b/tests/standalone/io/raw_secure_server_socket_test.dart
index 16babde..4226b80 100644
--- a/tests/standalone/io/raw_secure_server_socket_test.dart
+++ b/tests/standalone/io/raw_secure_server_socket_test.dart
@@ -7,65 +7,66 @@
 // VMOptions=--short_socket_write
 // VMOptions=--short_socket_read --short_socket_write
 
-import "package:expect/expect.dart";
-import "package:path/path.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+import "package:path/path.dart";
 
 const HOST_NAME = "localhost";
 const CERTIFICATE = "localhost_cert";
 
 void testSimpleBind() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   RawSecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE).then((s) {
     Expect.isTrue(s.port > 0);
     s.close();
-    port.close();
+    asyncEnd();
   });
 }
 
 void testInvalidBind() {
   int count = 0;
-  ReceivePort port = new ReceivePort();
-  port.receive((_, __) { count++; if (count == 3) port.close(); });
 
   // Bind to a unknown DNS name.
+  asyncStart();
   RawSecureServerSocket.bind("ko.faar.__hest__", 0, CERTIFICATE).then((_) {
     Expect.fail("Failure expected");
   }).catchError((error) {
     Expect.isTrue(error is SocketException);
-    port.toSendPort().send(1);
+    asyncEnd();
   });
 
   // Bind to an unavaliable IP-address.
+  asyncStart();
   RawSecureServerSocket.bind("8.8.8.8", 0, CERTIFICATE).then((_) {
     Expect.fail("Failure expected");
   }).catchError((error) {
     Expect.isTrue(error is SocketException);
-    port.toSendPort().send(1);
+    asyncEnd();
   });
 
   // Bind to a port already in use.
+  asyncStart();
   RawSecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE).then((s) {
     RawSecureServerSocket.bind(HOST_NAME,
                                s.port,
                                CERTIFICATE).then((t) {
-      Expect.fail("Multiple listens on same port");
       s.close();
       t.close();
-      port.toSendPort().send(1);
+      Expect.fail("Multiple listens on same port");
     })
     .catchError((error) {
       Expect.isTrue(error is SocketException);
       s.close();
-      port.toSendPort().send(1);
+      asyncEnd();
     });
   });
 }
 
 void testSimpleConnect(String certificate) {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   RawSecureServerSocket.bind(HOST_NAME, 0, certificate).then((server) {
     var clientEndFuture = RawSecureSocket.connect(HOST_NAME, server.port);
     server.listen((serverEnd) {
@@ -73,14 +74,14 @@
         clientEnd.shutdown(SocketDirection.SEND);
         serverEnd.shutdown(SocketDirection.SEND);
         server.close();
-        port.close();
+        asyncEnd();
       });
     });
   });
 }
 
 void testSimpleConnectFail(String certificate, bool cancelOnError) {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   RawSecureServerSocket.bind(HOST_NAME, 0, certificate).then((server) {
     var clientEndFuture = RawSecureSocket.connect(HOST_NAME, server.port)
       .then((clientEnd) {
@@ -97,7 +98,7 @@
       Expect.isTrue(error is CertificateException);
       clientEndFuture.then((_) {
         if (!cancelOnError) server.close();
-        port.close();
+        asyncEnd();
       });
     },
     cancelOnError: cancelOnError);
@@ -105,7 +106,7 @@
 }
 
 void testServerListenAfterConnect() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   RawSecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE).then((server) {
     Expect.isTrue(server.port > 0);
     var clientEndFuture = RawSecureSocket.connect(HOST_NAME, server.port);
@@ -115,7 +116,7 @@
           clientEnd.shutdown(SocketDirection.SEND);
           serverEnd.shutdown(SocketDirection.SEND);
           server.close();
-          port.close();
+          asyncEnd();
         });
       });
     });
@@ -164,7 +165,7 @@
     Expect.fail("Invalid arguments to testSimpleReadWrite");
   }
 
-  ReceivePort port = new ReceivePort();
+  asyncStart();
 
   const messageSize = 1000;
   const handshakeMessageSize = 100;
@@ -459,7 +460,7 @@
 
     connectClient(server.port).then(runClient).then((socket) {
       socket.close();
-      port.close();
+      asyncEnd();
     });
   }
 
diff --git a/tests/standalone/io/raw_server_socket_cancel_test.dart b/tests/standalone/io/raw_server_socket_cancel_test.dart
index 3279527..a10d179 100644
--- a/tests/standalone/io/raw_server_socket_cancel_test.dart
+++ b/tests/standalone/io/raw_server_socket_cancel_test.dart
@@ -7,10 +7,11 @@
 // VMOptions=--short_socket_write
 // VMOptions=--short_socket_read --short_socket_write
 
-import "package:expect/expect.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 void testCancelResubscribeServerSocket(int socketCount, int backlog) {
   var acceptCount = 0;
@@ -18,14 +19,14 @@
   var errorCount = 0;
   var earlyErrorCount = 0;
 
-  ReceivePort port = new ReceivePort();
+  asyncStart();
 
   RawServerSocket.bind("127.0.0.1", 0, backlog: backlog).then((server) {
     Expect.isTrue(server.port > 0);
 
     void checkDone() {
       if (doneCount + errorCount + earlyErrorCount == socketCount) {
-        port.close();
+        asyncEnd();
         // Be sure to close as subscription.cancel may not be called, if
         // backlog prevents acceptCount to grow to socketCount / 2.
         server.close();
diff --git a/tests/standalone/io/raw_socket_test.dart b/tests/standalone/io/raw_socket_test.dart
index a61bccf..53a5e02 100644
--- a/tests/standalone/io/raw_socket_test.dart
+++ b/tests/standalone/io/raw_socket_test.dart
@@ -7,10 +7,11 @@
 // VMOptions=--short_socket_write
 // VMOptions=--short_socket_read --short_socket_write
 
-import "package:expect/expect.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 void testArguments() {
   Expect.throws(() => RawServerSocket.bind("127.0.0.1", 65536));
@@ -19,68 +20,66 @@
 }
 
 void testSimpleBind() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((s) {
     Expect.isTrue(s.port > 0);
-    port.close();
+    asyncEnd();
   });
 }
 
 void testInvalidBind() {
-  int count = 0;
-  ReceivePort port = new ReceivePort();
-  port.receive((_, __) { count++; if (count == 3) port.close(); });
-
   // Bind to a unknown DNS name.
+  asyncStart();
   RawServerSocket.bind("ko.faar.__hest__", 0)
       .then((_) { Expect.fail("Failure expected"); } )
       .catchError((error) {
         Expect.isTrue(error is SocketException);
-        port.toSendPort().send(1);
+        asyncEnd();
       });
 
   // Bind to an unavaliable IP-address.
+  asyncStart();
   RawServerSocket.bind("8.8.8.8", 0)
       .then((_) { Expect.fail("Failure expected"); } )
       .catchError((error) {
         Expect.isTrue(error is SocketException);
-        port.toSendPort().send(1);
+        asyncEnd();
       });
 
   // Bind to a port already in use.
+  asyncStart();
   RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0)
       .then((s) {
           RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, s.port)
             .then((t) {
               Expect.fail("Multiple listens on same port");
-              port.toSendPort().send(1);
             })
             .catchError((error) {
               Expect.isTrue(error is SocketException);
-              port.toSendPort().send(1);
+              asyncEnd();
             });
       });
 }
 
 void testSimpleConnect() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
     server.listen((_) { });
     RawSocket.connect("127.0.0.1", server.port).then((_) {
       server.close();
-      port.close();
+      asyncEnd();
     });
   });
 }
 
 void testCloseOneEnd(String toClose) {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   Completer serverDone = new Completer();
   Completer serverEndDone = new Completer();
   Completer clientEndDone = new Completer();
   Future.wait([serverDone.future, serverEndDone.future, clientEndDone.future])
       .then((_) {
-        port.close();
+        asyncEnd();
       });
   RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
     server.listen((serverConnection) {
@@ -111,13 +110,13 @@
 }
 
 void testServerListenAfterConnect() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
     Expect.isTrue(server.port > 0);
     RawSocket.connect("127.0.0.1", server.port).then((_) {
       server.listen((_) {
         server.close();
-        port.close();
+        asyncEnd();
       });
     });
   });
@@ -128,7 +127,7 @@
   // writes and the server echos. When the server has finished its
   // echo it half-closes. When the client gets the close event is
   // closes fully.
-  ReceivePort port = new ReceivePort();
+  asyncStart();
 
   const messageSize = 1000;
   int serverReadCount = 0;
@@ -245,7 +244,7 @@
       },
       onDone: () {
         Expect.isTrue(closedEventReceived);
-        port.close();
+        asyncEnd();
       });
     });
   });
@@ -256,15 +255,14 @@
   var acceptCount = 0;
   var resumed = false;
 
-  ReceivePort port = new ReceivePort();
-
+  asyncStart();
   RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
     Expect.isTrue(server.port > 0);
     var subscription = server.listen((_) {
       Expect.isTrue(resumed);
       if (++acceptCount == socketCount) {
         server.close();
-        port.close();
+        asyncEnd();
       }
     });
 
@@ -297,8 +295,7 @@
   var writeSubscription;
   var readSubscription;
 
-  ReceivePort port = new ReceivePort();
-
+  asyncStart();
   RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
     Expect.isTrue(server.port > 0);
     server.listen((client) {
@@ -351,7 +348,7 @@
             if (bytesRead == messageSize) {
               if (++pauseResumeCount == loopCount) {
                 socket.close();
-                port.close();
+                asyncEnd();
               } else {
                 readSubscription.pause();
               }
@@ -380,6 +377,7 @@
 }
 
 main() {
+  asyncStart();
   testArguments();
   testSimpleBind();
   testCloseOneEnd("client");
@@ -391,4 +389,5 @@
   testSimpleReadWrite(dropReads: true);
   testPauseServerSocket();
   testPauseSocket();
+  asyncEnd();
 }
diff --git a/tests/standalone/io/raw_socket_typed_data_test.dart b/tests/standalone/io/raw_socket_typed_data_test.dart
index e843aba..11b6b3e 100644
--- a/tests/standalone/io/raw_socket_typed_data_test.dart
+++ b/tests/standalone/io/raw_socket_typed_data_test.dart
@@ -7,13 +7,15 @@
 // VMOptions=--short_socket_write
 // VMOptions=--short_socket_read --short_socket_write
 
-import "package:expect/expect.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
 import "dart:typed_data";
 
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
 testOutOfRange() {
+  asyncStart();
   RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
     server.listen((client) {
       client.writeEventsEnabled = false;
@@ -78,7 +80,7 @@
           default: throw "Unexpected event $event";
         }
       },
-      onDone: () => port.close());
+      onDone: asyncEnd);
     });
   });
 }
@@ -88,7 +90,7 @@
   // writes and the server echos. When the server has finished its
   // echo it half-closes. When the client gets the close event is
   // closes fully.
-  ReceivePort port = new ReceivePort();
+  asyncStart();
 
   // The test data to send is 5 times 256 bytes and 4 times 128
   // bytes. This is all the legal byte values from the integer typed
@@ -205,7 +207,7 @@
           default: throw "Unexpected event $event";
         }
       },
-      onDone: () => port.close());
+      onDone: asyncEnd);
     });
   });
 }
diff --git a/tests/standalone/io/regress_10026_test.dart b/tests/standalone/io/regress_10026_test.dart
index 1b7644c..568a91c 100644
--- a/tests/standalone/io/regress_10026_test.dart
+++ b/tests/standalone/io/regress_10026_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 "package:expect/expect.dart";
 import 'dart:async';
 import 'dart:convert';
 import 'dart:io';
-import 'dart:isolate';
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 void testZLibInflate_regress10026() {
   test(data, expect) {
-    var port = new ReceivePort();
+    asyncStart();
     var controller = new StreamController(sync: true);
     controller.stream
         .transform(ZLIB.decoder)
@@ -21,7 +22,7 @@
         })
         .then((out) {
           Expect.equals(out.toString(), expect);
-          port.close();
+          asyncEnd();
         });
     controller.add(data);
     controller.close();
diff --git a/tests/standalone/io/regress_7191_test.dart b/tests/standalone/io/regress_7191_test.dart
index 781f734..1595abe9 100644
--- a/tests/standalone/io/regress_7191_test.dart
+++ b/tests/standalone/io/regress_7191_test.dart
@@ -10,11 +10,13 @@
 // closed which will make this test hang.
 
 import 'dart:io';
-import 'dart:isolate';
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 import 'package:path/path.dart';
 
 main() {
-  var port = new ReceivePort();
+  asyncStart();
   var executable = Platform.executable;
   var script = join(dirname(Platform.script), 'regress_7191_script.dart');
   Process.start(executable, [script]).then((process) {
@@ -23,7 +25,7 @@
                            onDone: () { process.stdin.add([0]); });
     process.stderr.listen((_) { });
     process.exitCode.then((exitCode) {
-      port.close();
+      asyncEnd();
       if (exitCode != 0) throw "Bad exit code";
     });
   });
diff --git a/tests/standalone/io/secure_builtin_roots_test.dart b/tests/standalone/io/secure_builtin_roots_test.dart
index be0a467..f7b5cbb 100644
--- a/tests/standalone/io/secure_builtin_roots_test.dart
+++ b/tests/standalone/io/secure_builtin_roots_test.dart
@@ -2,11 +2,12 @@
 // 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 "dart:io";
+import "dart:async";
+
+import "package:async_helper/async_helper.dart";
 import "package:expect/expect.dart";
 import "package:path/path.dart";
-import "dart:io";
-import "dart:isolate";
-import "dart:async";
 
 void main() {
   var args = new Options().arguments;
@@ -80,10 +81,10 @@
     });
   }
 
-  ReceivePort keepAlive = new ReceivePort();
+  asyncStart();
   Future.wait([runChild(['--child']),
                runChild(['--child', '--database']),
                runChild(['--child', '--builtin-roots']),
                runChild(['--child', '--builtin-roots', '--database'])])
-      .then((_) => keepAlive.close());
+      .then((_) => asyncEnd());
   }
diff --git a/tests/standalone/io/secure_server_client_certificate_test.dart b/tests/standalone/io/secure_server_client_certificate_test.dart
index 395aa58..b2e3850 100644
--- a/tests/standalone/io/secure_server_client_certificate_test.dart
+++ b/tests/standalone/io/secure_server_client_certificate_test.dart
@@ -2,17 +2,18 @@
 // 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 "package:expect/expect.dart";
-import "package:path/path.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+import "package:path/path.dart";
 
 const HOST_NAME = "localhost";
 const CERTIFICATE = "localhost_cert";
 
 void testClientCertificate() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   SecureServerSocket.bind(HOST_NAME,
                           0,
                           CERTIFICATE,
@@ -33,14 +34,14 @@
         clientEnd.close();
         serverEnd.close();
         server.close();
-        port.close();
+        asyncEnd();
       });
     });
   });
 }
 
 void testRequiredClientCertificate() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   SecureServerSocket.bind(HOST_NAME,
                           0,
                           CERTIFICATE,
@@ -61,14 +62,14 @@
         clientEnd.close();
         serverEnd.close();
         server.close();
-        port.close();
+        asyncEnd();
       });
     });
   });
 }
 
 void testNoClientCertificate() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   SecureServerSocket.bind(HOST_NAME,
                           0,
                           CERTIFICATE,
@@ -82,14 +83,14 @@
         clientEnd.close();
         serverEnd.close();
         server.close();
-        port.close();
+        asyncEnd();
       });
     });
   });
 }
 
 void testNoRequiredClientCertificate() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   bool clientError = false;
   SecureServerSocket.bind(HOST_NAME,
                           0,
@@ -104,7 +105,7 @@
       clientDone.then((_) {
         Expect.isTrue(clientError);
         server.close();
-        port.close();
+        asyncEnd();
       });
     });
   });
diff --git a/tests/standalone/io/secure_server_closing_test.dart b/tests/standalone/io/secure_server_closing_test.dart
index da28650..5d344dd 100644
--- a/tests/standalone/io/secure_server_closing_test.dart
+++ b/tests/standalone/io/secure_server_closing_test.dart
@@ -7,23 +7,24 @@
 // VMOptions=--short_socket_write
 // VMOptions=--short_socket_read --short_socket_write
 
-import "package:expect/expect.dart";
-import "package:path/path.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+import "package:path/path.dart";
 
 const HOST_NAME = "localhost";
 const CERTIFICATE = "localhost_cert";
 
 void testCloseOneEnd(String toClose) {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   Completer serverDone = new Completer();
   Completer serverEndDone = new Completer();
   Completer clientEndDone = new Completer();
   Future.wait([serverDone.future, serverEndDone.future, clientEndDone.future])
       .then((_) {
-        port.close();
+        asyncEnd();
       });
   SecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE).then((server) {
     server.listen((serverConnection) {
@@ -60,7 +61,7 @@
 }
 
 void testCloseBothEnds() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   SecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE).then((server) {
     var clientEndFuture = SecureSocket.connect(HOST_NAME, server.port);
     server.listen((serverEnd) {
@@ -68,7 +69,7 @@
         clientEnd.destroy();
         serverEnd.destroy();
         server.close();
-        port.close();
+        asyncEnd();
       });
     });
   });
@@ -79,7 +80,7 @@
   var acceptCount = 0;
   var resumed = false;
 
-  ReceivePort port = new ReceivePort();
+  asyncStart();
 
   SecureServerSocket.bind(HOST_NAME,
                           0,
@@ -92,7 +93,7 @@
       connection.close();
       if (++acceptCount == 2 * socketCount) {
         server.close();
-        port.close();
+        asyncEnd();
       }
     });
 
@@ -122,7 +123,7 @@
 testCloseServer() {
   const int socketCount = 3;
   var endCount = 0;
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   List ends = [];
 
   SecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE).then((server) {
@@ -133,7 +134,7 @@
         end.destroy();
       }
       server.close();
-      port.close();
+      asyncEnd();
     }
 
     server.listen((connection) {
diff --git a/tests/standalone/io/secure_server_socket_test.dart b/tests/standalone/io/secure_server_socket_test.dart
index fe838aa..4727dbe 100644
--- a/tests/standalone/io/secure_server_socket_test.dart
+++ b/tests/standalone/io/secure_server_socket_test.dart
@@ -7,62 +7,63 @@
 // VMOptions=--short_socket_write
 // VMOptions=--short_socket_read --short_socket_write
 
-import "package:expect/expect.dart";
-import "package:path/path.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+import "package:path/path.dart";
 
 const HOST_NAME = "localhost";
 const CERTIFICATE = "localhost_cert";
 
 void testSimpleBind() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   SecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE).then((s) {
     Expect.isTrue(s.port > 0);
     s.close();
-    port.close();
+    asyncEnd();
   });
 }
 
 void testInvalidBind() {
   int count = 0;
-  ReceivePort port = new ReceivePort();
-  port.receive((_, __) { count++; if (count == 3) port.close(); });
 
   // Bind to a unknown DNS name.
+  asyncStart();
   SecureServerSocket.bind("ko.faar.__hest__", 0, CERTIFICATE).then((_) {
     Expect.fail("Failure expected");
   }).catchError((error) {
     Expect.isTrue(error is SocketException);
-    port.toSendPort().send(1);
+    asyncEnd();
   });
 
   // Bind to an unavaliable IP-address.
+  asyncStart();
   SecureServerSocket.bind("8.8.8.8", 0, CERTIFICATE).then((_) {
     Expect.fail("Failure expected");
   }).catchError((error) {
     Expect.isTrue(error is SocketException);
-    port.toSendPort().send(1);
+    asyncEnd();
   });
 
   // Bind to a port already in use.
+  asyncStart();
   SecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE).then((s) {
     SecureServerSocket.bind(HOST_NAME,
                             s.port,
                             CERTIFICATE).then((t) {
       Expect.fail("Multiple listens on same port");
-      port.toSendPort().send(1);
     }).catchError((error) {
       Expect.isTrue(error is SocketException);
       s.close();
-      port.toSendPort().send(1);
+      asyncEnd();
     });
   });
 }
 
 void testSimpleConnect(String certificate) {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   SecureServerSocket.bind(HOST_NAME, 0, certificate).then((server) {
     var clientEndFuture = SecureSocket.connect(HOST_NAME, server.port);
     server.listen((serverEnd) {
@@ -70,14 +71,14 @@
         clientEnd.close();
         serverEnd.close();
         server.close();
-        port.close();
+        asyncEnd();
       });
     });
   });
 }
 
 void testSimpleConnectFail(String certificate, bool cancelOnError) {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   SecureServerSocket.bind(HOST_NAME, 0, certificate).then((server) {
     var clientEndFuture = SecureSocket.connect(HOST_NAME, server.port)
       .then((clientEnd) {
@@ -94,7 +95,7 @@
       Expect.isTrue(error is CertificateException);
       clientEndFuture.then((_) {
         if (!cancelOnError) server.close();
-        port.close();
+        asyncEnd();
       });
     },
     cancelOnError: cancelOnError);
@@ -102,7 +103,7 @@
 }
 
 void testServerListenAfterConnect() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   SecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE).then((server) {
     Expect.isTrue(server.port > 0);
     var clientEndFuture = SecureSocket.connect(HOST_NAME, server.port);
@@ -112,7 +113,7 @@
           clientEnd.close();
           serverEnd.close();
           server.close();
-          port.close();
+          asyncEnd();
         });
       });
     });
@@ -124,7 +125,7 @@
   // writes and the server echos. When the server has finished its
   // echo it half-closes. When the client gets the close event is
   // closes fully.
-  ReceivePort port = new ReceivePort();
+  asyncStart();
 
   const messageSize = 1000;
 
@@ -181,13 +182,14 @@
         onDone: () {
           verifyTestData(dataReceived);
           socket.close();
-          port.close();
+          asyncEnd();
         });
     });
   });
 }
 
 main() {
+  asyncStart();
   String certificateDatabase = join(dirname(Platform.script), 'pkcert');
   SecureSocket.initialize(database: certificateDatabase,
                           password: 'dartdart',
@@ -202,4 +204,5 @@
   testSimpleConnectFail("CN=notARealDistinguishedName", true);
   testServerListenAfterConnect();
   testSimpleReadWrite();
+  asyncEnd();
 }
diff --git a/tests/standalone/io/secure_socket_bad_data_test.dart b/tests/standalone/io/secure_socket_bad_data_test.dart
index abb397f..0b6f813 100644
--- a/tests/standalone/io/secure_socket_bad_data_test.dart
+++ b/tests/standalone/io/secure_socket_bad_data_test.dart
@@ -7,11 +7,12 @@
 // VMOptions=--short_socket_write
 // VMOptions=--short_socket_read --short_socket_write
 
-import "package:expect/expect.dart";
-import "package:path/path.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+import "package:path/path.dart";
 
 const HOST_NAME = "localhost";
 const CERTIFICATE = "localhost_cert";
@@ -161,7 +162,7 @@
   SecureSocket.initialize(database: certificateDatabase,
                           password: 'dartdart',
                           useBuiltinRoots: false);
-  var keepAlive = new ReceivePort();
+  asyncStart();
   Future.wait([test(false), test(true)])
-  .then((_) => keepAlive.close());
+      .then((_) => asyncEnd());
 }
diff --git a/tests/standalone/io/socket_close_test.dart b/tests/standalone/io/socket_close_test.dart
index d89c798..39905e3 100644
--- a/tests/standalone/io/socket_close_test.dart
+++ b/tests/standalone/io/socket_close_test.dart
@@ -9,18 +9,20 @@
 //
 // Test socket close events.
 
-import "package:expect/expect.dart";
 import 'dart:async';
 import 'dart:io';
 import 'dart:isolate';
 
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
 const SERVERSHUTDOWN = -1;
 const ITERATIONS = 10;
 
 
 class SocketClose {
 
-  SocketClose.start(this._mode, this._donePort)
+  SocketClose.start(this._mode, this._done)
       : _receivePort = new ReceivePort(),
         _sendPort = null,
         _readBytes = 0,
@@ -150,7 +152,7 @@
   void shutdown() {
     _sendPort.send(SERVERSHUTDOWN, _receivePort.toSendPort());
     _receivePort.receive((message, ignore) {
-      _donePort.send(null);
+      _done();
       _receivePort.close();
     });
 
@@ -191,7 +193,7 @@
   int _errorEvents;
   int _iterations;
   int _mode;
-  SendPort _donePort;
+  Function _done;
 }
 
 
@@ -376,12 +378,8 @@
   // 5: Client sends. Server responds and half closes.
   // 6: Client sends and half-closes. Server responds and half closes.
   var tests = 7;
-  var port = new ReceivePort();
-  var completed = 0;
-  port.receive((message, ignore) {
-    if (++completed == tests) port.close();
-  });
   for (var i = 0; i < tests; i++) {
-    new SocketClose.start(i, port.toSendPort());
+    asyncStart();
+    new SocketClose.start(i, asyncEnd);
   }
 }
diff --git a/tests/standalone/io/socket_exception_test.dart b/tests/standalone/io/socket_exception_test.dart
index caa771a..2966e85 100644
--- a/tests/standalone/io/socket_exception_test.dart
+++ b/tests/standalone/io/socket_exception_test.dart
@@ -4,11 +4,12 @@
 //
 // Tests socket exceptions.
 
-import "package:expect/expect.dart";
 import "dart:async";
-import "dart:isolate";
 import "dart:io";
 
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
 class SocketExceptionTest {
 
   static void serverSocketExceptionTest() {
@@ -36,24 +37,24 @@
   }
 
   static void serverSocketCloseListenTest() {
-    var port = new ReceivePort();
+    asyncStart();
     ServerSocket.bind("127.0.0.1", 0).then((server) {
       Socket.connect("127.0.0.1", server.port).then((socket) {
         server.close();
         server.listen(
           (incoming) => Expect.fail("Unexpected socket"),
-          onDone: port.close);
+          onDone: asyncEnd);
       });
     });
   }
 
   static void serverSocketListenCloseTest() {
-    var port = new ReceivePort();
+    asyncStart();
     ServerSocket.bind("127.0.0.1", 0).then((server) {
       Socket.connect("127.0.0.1", server.port).then((socket) {
         server.listen(
           (incoming) => server.close(),
-          onDone: port.close);
+          onDone: asyncEnd);
       });
     });
   }
@@ -178,14 +179,14 @@
         client.add(new List.filled(SIZE, 0));
         // Destroy other socket now.
         completer.complete(null);
-        var port = new ReceivePort();
+        asyncStart();
         client.done.then(
             (_) {
               Expect.fail("Expected error");
             },
             onError: (error) {
               Expect.isTrue(error is SocketException);
-              port.close();
+              asyncEnd();
             });
       });
     });
@@ -212,13 +213,10 @@
   }
 
   static void unknownHostTest() {
-    // Port to verify that the test completes.
-    var port = new ReceivePort();
-    port.receive((message, replyTo) => null);
-
+    asyncStart();
     Socket.connect("hede.hule.hest", 1234)
         .then((socket) => Expect.fail("Connection completed"))
-        .catchError((e) => port.close(), test: (e) => e is SocketException);
+        .catchError((e) => asyncEnd(), test: (e) => e is SocketException);
 
   }
 
@@ -237,6 +235,8 @@
 }
 
 main() {
+  asyncStart();
   SocketExceptionTest.testMain();
+  asyncEnd();
 }
 
diff --git a/tests/standalone/io/socket_invalid_arguments_test.dart b/tests/standalone/io/socket_invalid_arguments_test.dart
index 24025ae..e928caf 100644
--- a/tests/standalone/io/socket_invalid_arguments_test.dart
+++ b/tests/standalone/io/socket_invalid_arguments_test.dart
@@ -2,9 +2,10 @@
 // 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 "package:expect/expect.dart";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 class NotAnInteger {
   operator==(other) => other == 1;
@@ -18,13 +19,17 @@
 }
 
 testSocketCreation(host, port) {
+  asyncStart();
   Socket.connect(host, port)
       .then((socket) => Expect.fail("Shouldn't get connected"))
-      .catchError((e) => null, test: (e) => e is SocketException)
-      .catchError((e) => null, test: (e) => e is ArgumentError);
+      .catchError((e) {
+        Expect.isTrue(e is ArgumentError || e is SocketException);
+        asyncEnd();
+      });
 }
 
 testAdd(buffer) {
+  asyncStart();
   ServerSocket.bind("127.0.0.1", 0).then((server) {
     server.listen((socket) => socket.destroy());
     Socket.connect("127.0.0.1", server.port).then((socket) {
@@ -39,6 +44,7 @@
             Expect.equals(1, errors);
             socket.destroy();
             server.close();
+            asyncEnd();
           });
       socket.add(buffer);
     });
@@ -46,13 +52,14 @@
 }
 
 testServerSocketCreation(address, port, backlog) {
+  asyncStart();
   var server;
-  var port = new ReceivePort();
   try {
     ServerSocket.bind(address, port, backlog: backlog)
-        .then((_) { Expect.fail("ServerSocket bound"); });
+        .then((_) { Expect.fail("ServerSocket bound"); })
+        .catchError((e) => asyncEnd());
   } catch (e) {
-    port.close();
+    asyncEnd();
   }
 }
 
diff --git a/tests/standalone/io/socket_ipv6_test.dart b/tests/standalone/io/socket_ipv6_test.dart
index d483b8e..bded728 100644
--- a/tests/standalone/io/socket_ipv6_test.dart
+++ b/tests/standalone/io/socket_ipv6_test.dart
@@ -3,17 +3,20 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'dart:io';
-import 'dart:isolate';
+
+import "package:async_helper/async_helper.dart";
 
 const ANY = InternetAddressType.ANY;
 
 void testIPv6toIPv6() {
+  asyncStart();
   InternetAddress.lookup("::0", type: ANY).then((serverAddr) {
     InternetAddress.lookup("::1", type: ANY).then((clientAddr) {
         ServerSocket.bind(serverAddr.first, 0).then((server) {
         server.listen((socket) {
           socket.destroy();
           server.close();
+          asyncEnd();
         });
         Socket.connect(clientAddr.first, server.port).then((socket) {
           socket.destroy();
@@ -24,11 +27,13 @@
 }
 
 void testIPv4toIPv6() {
+  asyncStart();
   InternetAddress.lookup("::0", type: ANY).then((serverAddr) {
       ServerSocket.bind(serverAddr.first, 0).then((server) {
       server.listen((socket) {
         socket.destroy();
         server.close();
+        asyncEnd();
       });
       Socket.connect("127.0.0.1", server.port).then((socket) {
         socket.destroy();
@@ -38,6 +43,7 @@
 }
 
 void testIPv6toIPv4() {
+  asyncStart();
   InternetAddress.lookup("::1", type: ANY).then((clientAddr) {
       ServerSocket.bind("127.0.0.1", 0).then((server) {
       server.listen((socket) {
@@ -45,16 +51,19 @@
       });
       Socket.connect(clientAddr.first, server.port).catchError((e) {
         server.close();
+        asyncEnd();
       });
     });
   });
 }
 
 void testIPv4toIPv4() {
+  asyncStart();
   ServerSocket.bind("127.0.0.1", 0).then((server) {
     server.listen((socket) {
       socket.destroy();
       server.close();
+      asyncEnd();
     });
     Socket.connect("127.0.0.1", server.port).then((socket) {
       socket.destroy();
@@ -63,7 +72,7 @@
 }
 
 void testIPv6Lookup() {
-  var port = new ReceivePort();
+  asyncStart();
   InternetAddress.lookup("::0", type: ANY).then((list) {
     if (list.length < 0) throw "no address";
     for (var entry in list) {
@@ -71,12 +80,12 @@
         throw "Wrong IP type";
       }
     }
-    port.close();
+    asyncEnd();
   });
 }
 
 void testIPv4Lookup() {
-  var port = new ReceivePort();
+  asyncStart();
   InternetAddress.lookup("127.0.0.1").then((list) {
     if (list.length < 0) throw "no addresse";
     for (var entry in list) {
@@ -84,11 +93,12 @@
         throw "Wrong IP type";
       }
     }
-    port.close();
+    asyncEnd();
   });
 }
 
 void testIPv4toIPv6_IPV6Only() {
+  asyncStart();
   InternetAddress.lookup("::0", type: ANY)
       .then((serverAddr) {
         ServerSocket.bind(serverAddr.first, 0, v6Only: true)
@@ -98,6 +108,7 @@
               });
               Socket.connect("127.0.0.1", server.port).catchError((error) {
                 server.close();
+                asyncEnd();
               });
             });
       });
diff --git a/tests/standalone/io/socket_test.dart b/tests/standalone/io/socket_test.dart
index 4220980..beec587 100644
--- a/tests/standalone/io/socket_test.dart
+++ b/tests/standalone/io/socket_test.dart
@@ -7,10 +7,11 @@
 // VMOptions=--short_socket_write
 // VMOptions=--short_socket_read --short_socket_write
 
-import "package:expect/expect.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 void testArguments() {
   Expect.throws(() => ServerSocket.bind("127.0.0.1", 65536));
@@ -19,69 +20,67 @@
 }
 
 void testSimpleBind() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((s) {
     Expect.isTrue(s.port > 0);
-    port.close();
+    asyncEnd();
   });
 }
 
 void testInvalidBind() {
-  int count = 0;
-  ReceivePort port = new ReceivePort();
-  port.receive((_, __) { count++; if (count == 3) port.close(); });
-
   // Bind to a unknown DNS name.
+  asyncStart();
   ServerSocket.bind("ko.faar.__hest__", 0)
       .then((_) { Expect.fail("Failure expected"); } )
       .catchError((error) {
         Expect.isTrue(error is SocketException);
-        port.toSendPort().send(1);
+        asyncEnd();
       });
 
   // Bind to an unavaliable IP-address.
+  asyncStart();
   ServerSocket.bind("8.8.8.8", 0)
       .then((_) { Expect.fail("Failure expected"); } )
       .catchError((error) {
         Expect.isTrue(error is SocketException);
-        port.toSendPort().send(1);
+        asyncEnd();
       });
 
   // Bind to a port already in use.
+  asyncStart();
   ServerSocket.bind("127.0.0.1", 0)
       .then((s) {
         ServerSocket.bind("127.0.0.1", s.port)
             .then((t) {
               Expect.fail("Multiple listens on same port");
-              port.toSendPort().send(1);
             })
             .catchError((error) {
               Expect.isTrue(error is SocketException);
               s.close();
-              port.toSendPort().send(1);
+              asyncEnd();
             });
       });
 }
 
 void testConnectNoDestroy() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
     server.listen((_) { });
     Socket.connect("127.0.0.1", server.port).then((_) {
       server.close();
-      port.close();
+      asyncEnd();
     });
   });
 }
 
 void testConnectImmediateDestroy() {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
     server.listen((_) { });
     Socket.connect("127.0.0.1", server.port).then((socket) {
       socket.destroy();
       server.close();
-      port.close();
+      asyncEnd();
     });
   });
 }
@@ -89,7 +88,7 @@
 void testConnectConsumerClose() {
   // Connect socket then immediate close the consumer without
   // listening on the stream.
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
     server.listen((_) { });
     Socket.connect("127.0.0.1", server.port).then((socket) {
@@ -97,7 +96,7 @@
       socket.done.then((_) {
         socket.destroy();
         server.close();
-        port.close();
+        asyncEnd();
       });
     });
   });
@@ -106,7 +105,7 @@
 void testConnectConsumerWriteClose() {
   // Connect socket write some data immediate close the consumer
   // without listening on the stream.
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
     server.listen((_) { });
     Socket.connect("127.0.0.1", server.port).then((socket) {
@@ -115,7 +114,7 @@
       socket.done.then((_) {
         socket.destroy();
         server.close();
-        port.close();
+        asyncEnd();
       });
     });
   });
@@ -124,7 +123,7 @@
 void testConnectStreamClose() {
   // Connect socket and listen on the stream. The server closes
   // immediately so only a done event is received.
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
     server.listen((client) {
                     client.close();
@@ -138,7 +137,7 @@
                         onDoneCalled = true;
                         socket.close();
                         server.close();
-                        port.close();
+                        asyncEnd();
                       });
     });
   });
@@ -148,7 +147,7 @@
   // Connect socket and listen on the stream. The server sends data
   // and then closes so both data and a done event is received.
   List<int> sendData = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
     server.listen(
         (client) {
@@ -171,7 +170,7 @@
                         socket.add([0]);
                         socket.close();
                         server.close();
-                        port.close();
+                        asyncEnd();
                       });
     });
   });
@@ -179,7 +178,7 @@
 
 void testConnectStreamDataCloseCancel(bool useDestroy) {
   List<int> sendData = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
-  ReceivePort port = new ReceivePort();
+  asyncStart();
   ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
     server.listen(
         (client) {
@@ -204,7 +203,7 @@
               subscription.cancel();
               socket.close();
               server.close();
-              port.close();
+              asyncEnd();
             },
             onDone: () { Expect.fail("Unexpected pipe completion"); });
     });
@@ -212,6 +211,7 @@
 }
 
 main() {
+  asyncStart();
   testArguments();
   testSimpleBind();
   testInvalidBind();
@@ -224,4 +224,5 @@
   testConnectStreamDataClose(false);
   testConnectStreamDataCloseCancel(true);
   testConnectStreamDataCloseCancel(false);
+  asyncEnd();
 }
diff --git a/tests/standalone/io/socket_upgrade_to_secure_test.dart b/tests/standalone/io/socket_upgrade_to_secure_test.dart
index ba2bed0..efbc143 100644
--- a/tests/standalone/io/socket_upgrade_to_secure_test.dart
+++ b/tests/standalone/io/socket_upgrade_to_secure_test.dart
@@ -7,11 +7,12 @@
 // VMOptions=--short_socket_write
 // VMOptions=--short_socket_read --short_socket_write
 
-import "package:expect/expect.dart";
-import "package:path/path.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+import "package:path/path.dart";
 
 const HOST_NAME = "localhost";
 const CERTIFICATE = "localhost_cert";
@@ -40,7 +41,7 @@
 void test(bool hostnameInConnect,
           bool handshakeBeforeSecure,
           [bool postponeSecure = false]) {
-  ReceivePort port = new ReceivePort();
+  asyncStart();
 
   const messageSize = 1000;
   const handshakeMessageSize = 100;
@@ -204,7 +205,7 @@
     });
 
     connectClient(server.port).then(runClient).then((socket) {
-      port.close();
+      asyncEnd();
     });
   }
 
diff --git a/tests/standalone/io/stream_pipe_test.dart b/tests/standalone/io/stream_pipe_test.dart
index 75f7981..5f0b801 100644
--- a/tests/standalone/io/stream_pipe_test.dart
+++ b/tests/standalone/io/stream_pipe_test.dart
@@ -6,11 +6,11 @@
 // VMOptions=--short_socket_read
 // VMOptions=--short_socket_write
 // VMOptions=--short_socket_read --short_socket_write
-library ServerTest;
 
-import "package:expect/expect.dart";
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 // Helper method to be able to run the test from the runtime
 // directory, or the top directory.
@@ -61,8 +61,7 @@
 testFileToFilePipe1() {
   // Force test to timeout if one of the handlers is
   // not called.
-  ReceivePort donePort = new ReceivePort();
-  donePort.receive((message, ignore) { donePort.close(); });
+  asyncStart();
 
   String srcFileName =
       getDataFilename("tests/standalone/io/readline_test1.dat");
@@ -77,7 +76,7 @@
     new File(dstFileName).deleteSync();
     tempDir.deleteSync();
     Expect.isTrue(result);
-    donePort.toSendPort().send(null);
+    asyncEnd();
   });
 }
 
@@ -87,8 +86,7 @@
 testFileToFilePipe2() {
   // Force test to timeout if one of the handlers is
   // not called.
-  ReceivePort donePort = new ReceivePort();
-  donePort.receive((message, ignore) { donePort.close(); });
+  asyncStart();
 
   String srcFileName =
       getDataFilename("tests/standalone/io/readline_test1.dat");
@@ -120,7 +118,7 @@
       dst.closeSync();
       dstFile.deleteSync();
       tempDir.deleteSync();
-      donePort.toSendPort().send(null);
+      asyncEnd();
     });
   });
 }
@@ -130,8 +128,7 @@
 testFileToFilePipe3() {
   // Force test to timeout if one of the handlers is
   // not called.
-  ReceivePort donePort = new ReceivePort();
-  donePort.receive((message, ignore) { donePort.close(); });
+  asyncStart();
 
   String srcFileName =
       getDataFilename("tests/standalone/io/readline_test1.dat");
@@ -164,7 +161,7 @@
         dst.closeSync();
         dstFile.deleteSync();
         tempDir.deleteSync();
-        donePort.toSendPort().send(null);
+        asyncEnd();
       });
     });
   });
diff --git a/tests/standalone/io/web_socket_protocol_processor_test.dart b/tests/standalone/io/web_socket_protocol_processor_test.dart
index 4354ab0..17f57f99 100644
--- a/tests/standalone/io/web_socket_protocol_processor_test.dart
+++ b/tests/standalone/io/web_socket_protocol_processor_test.dart
@@ -2,7 +2,6 @@
 // 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 "package:expect/expect.dart";
 import "dart:convert";
 import "dart:math";
 import "dart:async";
@@ -10,6 +9,9 @@
 import "dart:typed_data";
 import "dart:isolate";
 
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
 part '../../../sdk/lib/io/common.dart';
 part "../../../sdk/lib/io/http.dart";
 part "../../../sdk/lib/io/bytes_builder.dart";
@@ -232,9 +234,9 @@
 void testUnmaskedMessage() {
   var transformer = new _WebSocketProtocolTransformer(true);
   var controller = new StreamController(sync: true);
-  var port = new ReceivePort();
+  asyncStart();
   controller.stream.transform(transformer).listen((_) {}, onError: (e) {
-    port.close();
+    asyncEnd();
   });
   var message = new Uint8List(10);
   List<int> frame = createFrame(
diff --git a/tests/standalone/io/web_socket_test.dart b/tests/standalone/io/web_socket_test.dart
index d129354..31d7a2f 100644
--- a/tests/standalone/io/web_socket_test.dart
+++ b/tests/standalone/io/web_socket_test.dart
@@ -7,13 +7,14 @@
 // VMOptions=--short_socket_write
 // VMOptions=--short_socket_read --short_socket_write
 
-import "package:expect/expect.dart";
-import "package:path/path.dart";
 import "dart:async";
 import "dart:io";
-import "dart:isolate";
 import "dart:typed_data";
 
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+import "package:path/path.dart";
+
 const String CERT_NAME = 'localhost_cert';
 const String HOST_NAME = 'localhost';
 
@@ -48,7 +49,9 @@
               Expect.equals(closeStatus == null
                             ? WebSocketStatus.NO_STATUS_RECEIVED
                             : closeStatus, webSocket.closeCode);
-              Expect.equals(closeReason == null ? "" : closeReason, webSocket.closeReason);
+              Expect.equals(
+                  closeReason == null ? ""
+                                      : closeReason, webSocket.closeReason);
             });
         });
 
@@ -248,11 +251,11 @@
 
   void testUsePOST() {
     createServer().then((server) {
-      var errorPort = new ReceivePort();
+      asyncStart();
       server.transform(new WebSocketTransformer()).listen((webSocket) {
         Expect.fail("No connection expected");
       }, onError: (e) {
-        errorPort.close();
+        asyncEnd();
       });
 
       HttpClient client = new HttpClient();
diff --git a/tests/standalone/io/windows_file_system_async_links_test.dart b/tests/standalone/io/windows_file_system_async_links_test.dart
index 5560776..44fb229 100644
--- a/tests/standalone/io/windows_file_system_async_links_test.dart
+++ b/tests/standalone/io/windows_file_system_async_links_test.dart
@@ -3,9 +3,10 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "dart:async";
-import 'package:expect/expect.dart';
 import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 
 class FutureExpect {
@@ -99,7 +100,7 @@
 main() {
   // Links on other platforms are tested by file_system_[async_]links_test.
   if (Platform.operatingSystem == 'windows') {
-    ReceivePort keepAlive = new ReceivePort();
-    testJunctionTypeDelete().then((_) => keepAlive.close());
+    asyncStart();
+    testJunctionTypeDelete().then((_) => asyncEnd());
   }
 }
diff --git a/tests/standalone/io/zlib_test.dart b/tests/standalone/io/zlib_test.dart
index a7bf2f7..5b0fc49 100644
--- a/tests/standalone/io/zlib_test.dart
+++ b/tests/standalone/io/zlib_test.dart
@@ -2,14 +2,15 @@
 // 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 "package:expect/expect.dart";
 import 'dart:async';
 import 'dart:io';
-import 'dart:isolate';
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
 
 void testZLibDeflate() {
   test(int level, List<int> expected) {
-    var port = new ReceivePort();
+    asyncStart();
     var data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
     var controller = new StreamController(sync: true);
     controller.stream.transform(new ZLibEncoder(gzip: false, level: level))
@@ -19,7 +20,7 @@
         })
         .then((data) {
           Expect.listEquals(expected, data);
-          port.close();
+          asyncEnd();
         });
     controller.add(data);
     controller.close();
@@ -30,7 +31,7 @@
 
 
 void testZLibDeflateEmpty() {
-  var port = new ReceivePort();
+  asyncStart();
   var controller = new StreamController(sync: true);
   controller.stream.transform(new ZLibEncoder(gzip: false, level: 6))
       .fold([], (buffer, data) {
@@ -39,14 +40,14 @@
       })
       .then((data) {
         Expect.listEquals([120, 156, 3, 0, 0, 0, 0, 1], data);
-        port.close();
+        asyncEnd();
       });
   controller.close();
 }
 
 
 void testZLibDeflateGZip() {
-  var port = new ReceivePort();
+  asyncStart();
   var data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
   var controller = new StreamController(sync: true);
   controller.stream.transform(new ZLibEncoder(gzip: true))
@@ -60,7 +61,7 @@
                            70, 215, 108, 69, 10, 0, 0, 0],
                           // Skip header, as it can change.
                           data.sublist(10));
-        port.close();
+        asyncEnd();
       });
   controller.add(data);
   controller.close();
@@ -68,11 +69,10 @@
 
 void testZLibDeflateInvalidLevel() {
   test2(gzip, level) {
-    var port = new ReceivePort();
     try {
       new ZLibEncoder(gzip: gzip, level: level).startChunkedConversion(null);
+      Expect.fail("No exception thrown");
     } catch (e) {
-      port.close();
     }
   }
   test(level) {
@@ -90,7 +90,7 @@
 
 void testZLibInflate() {
   test2(bool gzip, int level) {
-    var port = new ReceivePort();
+    asyncStart();
     var data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
     var controller = new StreamController(sync: true);
     controller.stream
@@ -102,7 +102,7 @@
         })
         .then((inflated) {
           Expect.listEquals(data, inflated);
-          port.close();
+          asyncEnd();
         });
     controller.add(data);
     controller.close();
@@ -133,10 +133,12 @@
 }
 
 void main() {
+  asyncStart();
   testZLibDeflate();
   testZLibDeflateEmpty();
   testZLibDeflateGZip();
   testZLibDeflateInvalidLevel();
   testZLibInflate();
   testZLibInflateSync();
+  asyncEnd();
 }
diff --git a/tests/standalone/standalone.status b/tests/standalone/standalone.status
index 7251e17..77e8f0e 100644
--- a/tests/standalone/standalone.status
+++ b/tests/standalone/standalone.status
@@ -18,6 +18,7 @@
 [ $runtime == vm ]
 package/package_isolate_test: Fail # http://dartbug.com/7520.
 
+
 [ $runtime == vm && $checked ]
 # These tests have type errors on purpose.
 io/process_invalid_arguments_test: Fail, OK
@@ -157,6 +158,9 @@
 oom_error_stacktrace_test: Skip # Fails on Linux
 io/test_runner_test: Pass, Fail # Issue 12413
 
+[ $arch == simmips ]
+io/test_runner_test: Pass, Fail # Issue 12413
+
 [ $arch == simmips || $arch == mips ]
 io/file_fuzz_test: Pass, Timeout
 io/web_socket_test: Pass, Slow
diff --git a/tests/utils/dummy_compiler_test.dart b/tests/utils/dummy_compiler_test.dart
index 5c7c1da..be63346 100644
--- a/tests/utils/dummy_compiler_test.dart
+++ b/tests/utils/dummy_compiler_test.dart
@@ -8,6 +8,7 @@
 library dummy_compiler;
 
 import 'dart:async';
+import "package:async_helper/async_helper.dart";
 
 import '../../sdk/lib/_internal/compiler/compiler.dart';
 
@@ -102,6 +103,7 @@
 }
 
 main() {
+  asyncStart();
   Future<String> result =
       compile(new Uri(scheme: 'main'),
               new Uri(scheme: 'lib', path: '/'),
@@ -113,5 +115,5 @@
     }
   }, onError: (e) {
       throw 'Compilation failed';
-  });
+  }).whenComplete(() => asyncEnd());
 }
diff --git a/tests/utils/recursive_import_test.dart b/tests/utils/recursive_import_test.dart
index b0a042d..0bb8769 100644
--- a/tests/utils/recursive_import_test.dart
+++ b/tests/utils/recursive_import_test.dart
@@ -5,6 +5,7 @@
 // Test of "recursive" imports using the dart2js compiler API.
 
 import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
 import 'dart:async';
 import '../../sdk/lib/_internal/compiler/compiler.dart';
 
@@ -90,7 +91,7 @@
         source = "library lib${uri.path.replaceAll('/', '.')};";
       }
     } else {
-     throw "unexpected URI $uri";
+     return new Future.error("unexpected URI $uri");
     }
     return new Future.value(source);
   }
@@ -111,6 +112,7 @@
     }
   }
 
+  asyncStart();
   Future<String> result =
       compile(new Uri(scheme: 'main'),
               new Uri(scheme: 'lib', path: '/'),
@@ -125,5 +127,5 @@
     Expect.equals(1, errorCount);
   }, onError: (e) {
       throw 'Compilation failed';
-  });
+  }).whenComplete(() => asyncEnd());
 }
diff --git a/tests/utils/utils.status b/tests/utils/utils.status
index 34e6ff0..b1c695f 100644
--- a/tests/utils/utils.status
+++ b/tests/utils/utils.status
@@ -19,3 +19,9 @@
 
 [ $system == macos || $system == windows ]
 *_layout_test: Skip
+
+[ $compiler == dartanalyzer ]
+dart2js_test: Fail # Issue 13012
+
+[ $compiler == dart2analyzer ]
+dart2js_test: Fail # Issue 13012
diff --git a/tools/VERSION b/tools/VERSION
index cc8eb02..77964b9 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -1,4 +1,4 @@
 MAJOR 0
 MINOR 7
-BUILD 1
+BUILD 2
 PATCH 0
diff --git a/tools/bots/compiler.py b/tools/bots/compiler.py
index 4cc6ac6..2b11178 100644
--- a/tools/bots/compiler.py
+++ b/tools/bots/compiler.py
@@ -254,7 +254,7 @@
     TestStep("dart2js", mode, system, 'dart2js', runtime, [], flags, arch)
 
     # TODO(kasperl): Consider running peg and css tests too.
-    extras = ['dart2js_extra', 'dart2js_native', 'dart2js_foreign']
+    extras = ['dart2js_extra', 'dart2js_native']
     extras_flags = flags
     if (system == 'linux'
         and runtime == 'd8'
diff --git a/tools/bots/cross-vm.py b/tools/bots/cross-vm.py
index ea992a5..53a5d27 100644
--- a/tools/bots/cross-vm.py
+++ b/tools/bots/cross-vm.py
@@ -5,7 +5,6 @@
 
 import os
 import re
-import shutil
 import sys
 
 import bot
@@ -34,17 +33,9 @@
 
 def cross_compiling_builder(arch, mode):
   build_py = os.path.join('tools', 'build.py')
-  test_py = os.path.join('tools', 'test.py')
-  test_args = [sys.executable, test_py, '--progress=line', '--report',
-               '--time', '--compiler=none', '--runtime=vm', '--write-debug-log']
 
   tarball = tarball_name(arch, mode)
-  (recording, recording_out) = record_names('tests', arch, mode)
-  (checked_recording, checked_recording_out) = record_names(
-      'checked_tests', arch, mode)
-
-  temporary_files = [tarball, recording, recording_out, checked_recording,
-                     checked_recording_out]
+  temporary_files = [tarball]
   bot.Clobber()
   try:
     num_run = int(os.environ['BUILDBOT_ANNOTATED_STEPS_RUN'])
@@ -68,31 +59,10 @@
         run([GSUTIL, 'cp', tarball, uri])
         run([GSUTIL, 'setacl', 'public-read', uri])
 
-      with bot.BuildStep('prepare tests'):
-        uri = "%s/%s" % (GCS_BUCKET, recording)
-        run(test_args + ['--mode=' + mode, '--arch=' + arch,
-                         '--record_to_file=' + recording])
-        run([GSUTIL, 'cp', recording, uri])
-        run([GSUTIL, 'setacl', 'public-read', uri])
-
-      with bot.BuildStep('prepare checked_tests'):
-        uri = "%s/%s" % (GCS_BUCKET, checked_recording)
-        run(test_args + ['--mode=' + mode, '--arch=' + arch, '--checked',
-                         '--record_to_file=' + checked_recording])
-        run([GSUTIL, 'cp', checked_recording, uri])
-        run([GSUTIL, 'setacl', 'public-read', uri])
     elif num_run == 2:
       with bot.BuildStep('tests'):
-        uri = "%s/%s" % (GCS_BUCKET, recording_out)
-        run([GSUTIL, 'cp', uri, recording_out])
-        run(test_args + ['--mode=' + mode, '--arch=' + arch,
-                         '--replay_from_file=' + recording_out])
-
-      with bot.BuildStep('checked_tests'):
-        uri = "%s/%s" % (GCS_BUCKET, checked_recording_out)
-        run([GSUTIL, 'cp', uri, checked_recording_out])
-        run(test_args + ['--mode=' + mode, '--arch=' + arch, '--checked',
-                         '--replay_from_file=' + checked_recording_out])
+        print "Please see the target device for results."
+        print "We no longer record/replay tests."
     else:
       raise Exception("Invalid annotated steps run")
   finally:
@@ -101,15 +71,13 @@
         os.remove(path)
 
 def target_builder(arch, mode):
-  execute_testcases_py = os.path.join('tools', 'execute_recorded_testcases.py')
+  test_py = os.path.join('tools', 'test.py')
+  test_args = [sys.executable, test_py, '--progress=line', '--report',
+               '--time', '--compiler=none', '--runtime=vm', '--write-debug-log',
+               '--mode=' + mode, '--arch=' + arch]
 
   tarball = tarball_name(arch, mode)
-  (recording, recording_out) = record_names('tests', arch, mode)
-  (checked_recording, checked_recording_out) = record_names(
-      'checked_tests', arch, mode)
-
-  temporary_files = [tarball, recording, recording_out, checked_recording,
-                     checked_recording_out]
+  temporary_files = [tarball]
   bot.Clobber()
   try:
     with bot.BuildStep('Fetch build tarball'):
@@ -119,21 +87,10 @@
       run(['tar', '-xjf', tarball])
 
     with bot.BuildStep('execute tests'):
-      uri = "%s/%s" % (GCS_BUCKET, recording)
-      uri_out = "%s/%s" % (GCS_BUCKET, recording_out)
-      run([GSUTIL, 'cp', uri, recording])
-      run(['python', execute_testcases_py, recording, recording_out])
-      run([GSUTIL, 'cp', recording_out, uri_out])
-      run([GSUTIL, 'setacl', 'public-read', uri_out])
+      run(test_args)
 
     with bot.BuildStep('execute checked_tests'):
-      uri = "%s/%s" % (GCS_BUCKET, checked_recording)
-      uri_out = "%s/%s" % (GCS_BUCKET, checked_recording_out)
-      run([GSUTIL, 'cp', uri, checked_recording])
-      run(['python', execute_testcases_py, checked_recording,
-           checked_recording_out])
-      run([GSUTIL, 'cp', checked_recording_out, uri_out])
-      run([GSUTIL, 'setacl', 'public-read', uri_out])
+      run(test_args + ['--checked'])
   finally:
     for path in temporary_files:
       if os.path.exists(path):
diff --git a/tools/dom/docs/docs.json b/tools/dom/docs/docs.json
index b2df0d0..ba4c2b3 100644
--- a/tools/dom/docs/docs.json
+++ b/tools/dom/docs/docs.json
@@ -479,6 +479,21 @@
       }
     }
   },
+  "dart.dom.web_audio": {
+    "ScriptProcessorNode": {
+      "members": {
+        "onaudioprocess": [
+          "/**",
+          "   * Get a Stream that fires events when AudioProcessingEvents occur.",
+          "   * This particular stream is special in that it only allows one listener to a",
+          "   * given stream. Converting the returned Stream [asBroadcast] will likely ruin",
+          "   * the soft-real-time properties which which these events are fired and can",
+          "   * be processed.",
+          "   */"
+        ]
+      }
+    }
+  },
   "dart.dom.web_sql": {
     "Database": {
       "members": {
diff --git a/tools/dom/dom.json b/tools/dom/dom.json
index 3bafc1d..8e3c217 100644
--- a/tools/dom/dom.json
+++ b/tools/dom/dom.json
@@ -1841,6 +1841,9 @@
         "comment": "https://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#widl-Document-onpointerlockerror",
         "support_level": "experimental"
       },
+      "onwheel": {
+        "support_level": "untriaged"
+      },
       "preferredStylesheetSet": {
         "comment": "http://dev.w3.org/csswg/cssom/#widl-Document-preferredStyleSheetSet"
       },
@@ -2062,8 +2065,12 @@
       },
       "firstElementChild": {},
       "focus": {},
-      "getAttribute": {},
-      "getAttributeNS": {},
+      "getAttribute": {
+        "support_level": "deprecated"
+      },
+      "getAttributeNS": {
+        "support_level": "deprecated"
+      },
       "getAttributeNode": {
         "comment": "http://dom.spec.whatwg.org/#dom-element-getattributenode",
         "dart_action": "suppress",
@@ -2224,6 +2231,9 @@
         "comment": "https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html",
         "support_level": "experimental"
       },
+      "onwheel": {
+        "support_level": "untriaged"
+      },
       "outerHTML": {
         "comment": "http://www.whatwg.org/specs/web-apps/2007-10-26/multipage/section-elements.html#htmlelement",
         "dart_action": "stable",
@@ -2259,8 +2269,12 @@
       "scrollLeft": {},
       "scrollTop": {},
       "scrollWidth": {},
-      "setAttribute": {},
-      "setAttributeNS": {},
+      "setAttribute": {
+        "support_level": "deprecated"
+      },
+      "setAttributeNS": {
+        "support_level": "deprecated"
+      },
       "setAttributeNode": {
         "comment": "http://dom.spec.whatwg.org/#dom-element-setattributenode",
         "dart_action": "suppress",
@@ -5970,7 +5984,9 @@
       "addEventListener": {},
       "appendChild": {},
       "baseURI": {},
-      "childNodes": {},
+      "childNodes": {
+        "support_level": "deprecated"
+      },
       "cloneNode": {},
       "compareDocumentPosition": {},
       "contains": {},
@@ -7692,6 +7708,9 @@
       "onselectstart": {},
       "onsubmit": {},
       "onunload": {},
+      "onwheel": {
+        "support_level": "untriaged"
+      },
       "parentNode": {},
       "previousSibling": {},
       "removeEventListener": {
@@ -10212,7 +10231,10 @@
       "_setEventListener": {
         "support_level": "nonstandard"
       },
-      "bufferSize": {}
+      "bufferSize": {},
+      "onaudioprocess": {
+        "support_level": "untriaged"
+      }
     },
     "support_level": "experimental"
   },
@@ -10348,6 +10370,9 @@
     "members": {
       "name": {
         "support_level": "untriaged"
+      },
+      "onconnect": {
+        "support_level": "untriaged"
       }
     },
     "support_level": "untriaged"
@@ -12237,6 +12262,9 @@
       "onwebkittransitionend": {
         "support_level": "deprecated"
       },
+      "onwheel": {
+        "support_level": "untriaged"
+      },
       "open": {},
       "openDatabase": {
         "comment": "http://www.w3.org/TR/webdatabase/",
@@ -12725,6 +12753,9 @@
       "onprogress": {
         "support_level": "untriaged"
       },
+      "ontimeout": {
+        "support_level": "untriaged"
+      },
       "removeEventListener": {
         "support_level": "untriaged"
       }
diff --git a/tools/dom/idl/dart/dart.idl b/tools/dom/idl/dart/dart.idl
index a38ee94..ca2ccd0 100644
--- a/tools/dom/idl/dart/dart.idl
+++ b/tools/dom/idl/dart/dart.idl
@@ -183,9 +183,9 @@
 };
 [Supplemental]
 interface IDBIndex {
-    [CallWith=ScriptExecutionContext, RaisesException] IDBRequest openCursor([Default=Undefined] optional any key, [Default=NullString] optional DOMString direction);
+    [CallWith=ScriptExecutionContext, RaisesException] IDBRequest openCursor([Default=Undefined] optional any key, [ForceOptional] optional DOMString direction);
 
-    [CallWith=ScriptExecutionContext, RaisesException] IDBRequest openKeyCursor([Default=Undefined] optional any key, [Default=NullString] optional DOMString direction);
+    [CallWith=ScriptExecutionContext, RaisesException] IDBRequest openKeyCursor([Default=Undefined] optional any key, [ForceOptional] optional DOMString direction);
 
     [CallWith=ScriptExecutionContext, RaisesException] IDBRequest count([Default=Undefined] optional any key);
 };
diff --git a/tools/dom/scripts/dartgenerator.py b/tools/dom/scripts/dartgenerator.py
index cde0484..6171700 100755
--- a/tools/dom/scripts/dartgenerator.py
+++ b/tools/dom/scripts/dartgenerator.py
@@ -86,7 +86,8 @@
               self._IsCompoundType(database, type_name)):
             continue
           # Ignore constructor warnings.
-          if not (interface.id in ['Window', 'WorkerContext'] and
+          if not (interface.id in ['Window', 'WorkerContext',
+              'WorkerGlobalScope'] and
               type_name.endswith('Constructor')):
             _logger.warn('removing %s in %s which has unidentified type %s' %
                        (node_name, interface.id, type_name))
diff --git a/tools/dom/scripts/dartmetadata.py b/tools/dom/scripts/dartmetadata.py
index 8b6063c..3f6f017 100644
--- a/tools/dom/scripts/dartmetadata.py
+++ b/tools/dom/scripts/dartmetadata.py
@@ -202,13 +202,18 @@
       "@Returns('int|String|Null')",
     ],
 
-    'MessageEvent.ports': ["@Creates('JSExtendableArray')"],
-
     'MessageEvent.data': [
       "@annotation_Creates_SerializedScriptValue",
       "@annotation_Returns_SerializedScriptValue",
     ],
 
+    'MessageEvent.ports': ["@Creates('JSExtendableArray')"],
+
+    'MessageEvent.source': [
+      "@Creates('Null')",
+      "@Returns('EventTarget|=Object')",
+    ],
+
     'Metadata.modificationTime': [
       "@Creates('Null')", # JS date object.
     ],
@@ -502,10 +507,10 @@
   'WebGLRenderingContext': _webgl_annotations,
   'WebSocket': _all_but_ie9_annotations,
   'Worker': _all_but_ie9_annotations,
-  'XMLHttpRequest.onloadend': _all_but_ie9_annotations,
-  'XMLHttpRequest.onprogress': _all_but_ie9_annotations,
   'XMLHttpRequest.overrideMimeType': _no_ie_annotations,
   'XMLHttpRequest.response': _all_but_ie9_annotations,
+  'XMLHttpRequestEventTarget.onloadend': _all_but_ie9_annotations,
+  'XMLHttpRequestEventTarget.onprogress': _all_but_ie9_annotations,
   'XMLHttpRequestProgressEvent': _webkit_experimental_annotations,
   'XSLTProcessor': [
     "@SupportedBrowser(SupportedBrowser.CHROME)",
diff --git a/tools/dom/scripts/generator.py b/tools/dom/scripts/generator.py
index 06f4df6..1de4ede 100644
--- a/tools/dom/scripts/generator.py
+++ b/tools/dom/scripts/generator.py
@@ -18,7 +18,6 @@
     'DOMStringMap',
     'ChildNode',
     'EventListener',
-    'EventHandler',
     'MediaQueryListListener',
     'MutationCallback',
     'NavigatorID',
@@ -137,10 +136,10 @@
 
     'WebGLLoseContext': 'WebGLLoseContext,WebGLExtensionLoseContext',
 
-    'WebKitCSSKeyframeRule':
+    'CSSKeyframeRule':
         'CSSKeyframeRule,MozCSSKeyframeRule,WebKitCSSKeyframeRule',
 
-    'WebKitCSSKeyframesRule':
+    'CSSKeyframesRule':
         'CSSKeyframesRule,MozCSSKeyframesRule,WebKitCSSKeyframesRule',
 
     'WheelEvent': 'WheelEvent,MouseWheelEvent,MouseScrollEvent',
@@ -589,6 +588,10 @@
 
     # Should be either a DOMString, an Array of DOMStrings or null.
     'IDBAny get IDBObjectStore.keyPath': None,
+
+    '* get XMLHttpRequest.response':
+      Conversion('_convertNativeToDart_XHR_Response',
+                 'dynamic', 'dynamic'),
 }, dart2jsOnly=True)
 
 def FindConversion(idl_type, direction, interface, member):
@@ -1063,10 +1066,6 @@
     'PluginArray': TypeData(clazz='Interface', item_type='Plugin'),
     'DOMStringList': TypeData(clazz='Interface', item_type='DOMString',
         dart_type='List<String>', custom_to_native=True),
-    'EntryArray': TypeData(clazz='Interface', item_type='Entry',
-        suppress_interface=True),
-    'EntryArraySync': TypeData(clazz='Interface', item_type='EntrySync',
-        suppress_interface=True),
     'FileList': TypeData(clazz='Interface', item_type='File',
         dart_type='List<File>'),
     'Future': TypeData(clazz='Interface', dart_type='Future'),
diff --git a/tools/dom/scripts/htmleventgenerator.py b/tools/dom/scripts/htmleventgenerator.py
index 89602e0..715d114 100644
--- a/tools/dom/scripts/htmleventgenerator.py
+++ b/tools/dom/scripts/htmleventgenerator.py
@@ -113,6 +113,7 @@
   '*.transitionend': ('transitionEnd', 'TransitionEvent'),
   '*.webkitfullscreenchange': ('fullscreenChange', 'Event'),
   '*.webkitfullscreenerror': ('fullscreenError', 'Event'),
+  '*.wheel': ('wheel', 'WheelEvent'),
   'AbstractWorker.error': ('error', 'ErrorEvent'),
   'AudioContext.complete': ('complete', 'Event'),
   'ApplicationCache.cached': ('cached', 'Event'),
@@ -176,6 +177,8 @@
   'Notification.close': ('close', 'Event'),
   'Notification.display': ('display', 'Event'),
   'Notification.show': ('show', 'Event'),
+  'Performance.webkitresourcetimingbufferfull':
+      ('resourceTimingBufferFull', 'Event'),
   'RTCDTMFSender.tonechange': ('toneChange', 'RtcDtmfToneChangeEvent'),
   'RTCDataChannel.close': ('close', 'Event'),
   'RTCDataChannel.open': ('open', 'Event'),
@@ -186,6 +189,8 @@
   'RTCPeerConnection.negotiationneeded': ('negotiationNeeded', 'Event'),
   'RTCPeerConnection.removestream': ('removeStream', 'MediaStreamEvent'),
   'RTCPeerConnection.signalingstatechange': ('signalingStateChange', 'Event'),
+  'ScriptProcessorNode.audioprocess': ('audioProcess', 'AudioProcessingEvent'),
+  'SharedWorkerGlobalScope.connect': ('connect', 'Event'),
   'SpeechRecognition.audioend': ('audioEnd', 'Event'),
   'SpeechRecognition.audiostart': ('audioStart', 'Event'),
   'SpeechRecognition.end': ('end', 'Event'),
@@ -215,12 +220,14 @@
   'Window.pagehide': ('pageHide', 'Event'),
   'Window.pageshow': ('pageShow', 'Event'),
   'Window.progress': ('progress', 'Event'),
+  'Window.webkittransitionend': ('webkitTransitionEnd', 'TransitionEvent'),
   'XMLHttpRequestEventTarget.abort': ('abort', 'ProgressEvent'),
   'XMLHttpRequestEventTarget.error': ('error', 'ProgressEvent'),
   'XMLHttpRequestEventTarget.load': ('load', 'ProgressEvent'),
   'XMLHttpRequestEventTarget.loadend': ('loadEnd', 'ProgressEvent'),
   'XMLHttpRequestEventTarget.loadstart': ('loadStart', 'ProgressEvent'),
   'XMLHttpRequestEventTarget.progress': ('progress', 'ProgressEvent'),
+  'XMLHttpRequestEventTarget.timeout': ('timeout', 'ProgressEvent'),
   'XMLHttpRequest.readystatechange': ('readyStateChange', 'ProgressEvent'),
 })
 
diff --git a/tools/dom/scripts/htmlrenamer.py b/tools/dom/scripts/htmlrenamer.py
index c989f5e..4a21a49 100644
--- a/tools/dom/scripts/htmlrenamer.py
+++ b/tools/dom/scripts/htmlrenamer.py
@@ -115,6 +115,7 @@
   'SVGTRefElement',
   'SVGVKernElement',
   'SharedWorker', # Workers
+  'SubtleCrypto',
   'WebKitMediaSource',
   'WebKitSourceBuffer',
   'WebKitSourceBufferList',
@@ -211,13 +212,9 @@
   'Element.children',
   'Element.childElementCount',
   'Element.firstElementChild',
-  'Element.getAttribute',
-  'Element.getAttributeNS',
   'Element.getElementsByTagName',
   'Element.scrollIntoView',
   'Element.scrollIntoViewIfNeeded',
-  'Element.setAttribute',
-  'Element.setAttributeNS',
   'Element.removeAttribute',
   'Element.removeAttributeNS',
   'Element.hasAttribute',
@@ -276,7 +273,6 @@
   'MutationEvent.initMutationEvent',
   'MutationObserver.observe',
   'Node.attributes',
-  'Node.childNodes',
   'Node.localName',
   'Node.namespaceURI',
   'Node.removeChild',
@@ -330,7 +326,7 @@
 # Members from the standard dom that exist in the dart:html library with
 # identical functionality but with cleaner names.
 renamed_html_members = monitored.Dict('htmlrenamer.renamed_html_members', {
-    'WebKitCSSKeyframesRule.insertRule': 'appendRule',
+    'CSSKeyframesRule.insertRule': 'appendRule',
     'DirectoryEntry.getDirectory': '_getDirectory',
     'DirectoryEntry.getFile': '_getFile',
     'Document.createCDATASection': 'createCDataSection',
@@ -369,8 +365,6 @@
   'CSS.supports(DOMString conditionText)': 'supportsCondition',
   'CanvasRenderingContext2D.createPattern(HTMLImageElement image, '
       'DOMString repetitionType)': 'createPatternFromImage',
-  'CryptoOperation.process(ArrayBuffer data)': 'processByteBuffer',
-  'CryptoOperation.process(ArrayBufferView data)': 'processTypedData',
   'DataTransferItemList.add(File file)': 'addFile',
   'DataTransferItemList.add(DOMString data, DOMString type)': 'addData',
   'FormData.append(DOMString name, Blob value, DOMString filename)':
@@ -495,6 +489,7 @@
     'Window.get:frames',
     'Window.get:length',
     'Window.on:beforeUnload',
+    'Window.on:webkitTransitionEnd',
     'Window.pagePopupController',
     'Window.prompt',
     'Window.webkitCancelAnimationFrame',
@@ -536,13 +531,13 @@
     'Document.images',
     'Document.linkColor',
     'Document.location',
+    'Document.on:wheel',
     'Document.open',
     'Document.register',
     'Document.set:domain',
     'Document.vlinkColor',
     'Document.webkitCurrentFullScreenElement',
     'Document.webkitFullScreenKeyboardInputAllowed',
-    'Document.webkitRegister',
     'Document.write',
     'Document.writeln',
     'Document.xmlStandalone',
@@ -582,6 +577,7 @@
     'Element.getAttributeNodeNS',
     'Element.getElementsByTagNameNS',
     'Element.innerText',
+    'Element.on:wheel',
     'Element.outerText',
     'Element.removeAttributeNode',
     'Element.set:outerHTML',
@@ -734,8 +730,9 @@
     'Performance.webkitMeasure',
     'ShadowRoot.getElementsByTagNameNS',
     'SVGElement.getPresentationAttribute',
-    'SVGStyledElement.getPresentationAttribute',
+    'SVGElementInstance.on:wheel',
     'WheelEvent.wheelDelta',
+    'Window.on:wheel',
     'WorkerGlobalScope.webkitIndexedDB',
 # TODO(jacobr): should these be removed?
     'Document.close',
diff --git a/tools/dom/scripts/systemhtml.py b/tools/dom/scripts/systemhtml.py
index 2503ff9..fbe61c34 100644
--- a/tools/dom/scripts/systemhtml.py
+++ b/tools/dom/scripts/systemhtml.py
@@ -27,33 +27,36 @@
     'CanvasRenderingContext2D.drawImage',
     'CanvasRenderingContext2D.lineDashOffset',
     'Console.memory',
-    'Console.assertCondition',
-    'Console.count',
-    'Console.debug',
-    'Console.dir',
-    'Console.dirxml',
-    'Console.error',
-    'Console.group',
-    'Console.groupCollapsed',
-    'Console.groupEnd',
-    'Console.info',
-    'Console.log',
-    'Console.markTimeline',
-    'Console.profile',
-    'Console.profileEnd',
-    'Console.time',
-    'Console.timeEnd',
-    'Console.timeStamp',
-    'Console.trace',
-    'Console.warn',
+    'ConsoleBase.assertCondition',
+    'ConsoleBase.clear',
+    'ConsoleBase.count',
+    'ConsoleBase.debug',
+    'ConsoleBase.dir',
+    'ConsoleBase.dirxml',
+    'ConsoleBase.error',
+    'ConsoleBase.group',
+    'ConsoleBase.groupCollapsed',
+    'ConsoleBase.groupEnd',
+    'ConsoleBase.info',
+    'ConsoleBase.log',
+    'ConsoleBase.markTimeline',
+    'ConsoleBase.profile',
+    'ConsoleBase.profileEnd',
+    'ConsoleBase.table',
+    'ConsoleBase.time',
+    'ConsoleBase.timeEnd',
+    'ConsoleBase.timeStamp',
+    'ConsoleBase.trace',
+    'ConsoleBase.warn',
     'WebKitCSSKeyframesRule.insertRule',
     'CSSStyleDeclaration.setProperty',
     'Element.createShadowRoot',
     'Element.insertAdjacentElement',
     'Element.insertAdjacentHTML',
     'Element.insertAdjacentText',
-    'Element.webkitMatchesSelector',
     'Element.remove',
+    'Element.shadowRoot',
+    'Element.webkitMatchesSelector',
     'ElementEvents.mouseWheel',
     'ElementEvents.transitionEnd',
     'DOMException.name',
@@ -896,11 +899,14 @@
 
   def _AddConvertingGetter(self, attr, html_name, conversion):
     self._members_emitter.Emit(
-        '\n  $RETURN_TYPE get $HTML_NAME => $CONVERT(this._get_$(HTML_NAME));'
+        '\n  $(METADATA)$RETURN_TYPE get $HTML_NAME => '
+        '$CONVERT(this._get_$(HTML_NAME));'
         "\n  @JSName('$NAME')"
-        '\n  $(METADATA)final $NATIVE_TYPE _get_$HTML_NAME;'
+        '\n  $(JS_METADATA)final $NATIVE_TYPE _get_$HTML_NAME;'
         '\n',
-        METADATA=self._Metadata(attr.type.id, html_name, conversion.input_type),
+        METADATA=self._metadata.GetFormattedMetadata(
+            self._library_name, self._interface, html_name, '  '),
+        JS_METADATA=self._Metadata(attr.type.id, html_name, conversion.input_type),
         CONVERT=conversion.function_name,
         HTML_NAME=html_name,
         NAME=attr.id,
diff --git a/tools/dom/src/AttributeMap.dart b/tools/dom/src/AttributeMap.dart
index c926d8c..82e998e 100644
--- a/tools/dom/src/AttributeMap.dart
+++ b/tools/dom/src/AttributeMap.dart
@@ -92,15 +92,15 @@
   }
 
   String operator [](String key) {
-    return _element._getAttribute(key);
+    return _element.getAttribute(key);
   }
 
   void operator []=(String key, String value) {
-    _element._setAttribute(key, value);
+    _element.setAttribute(key, value);
   }
 
   String remove(String key) {
-    String value = _element._getAttribute(key);
+    String value = _element.getAttribute(key);
     _element._removeAttribute(key);
     return value;
   }
@@ -129,11 +129,11 @@
   }
 
   String operator [](String key) {
-    return _element._getAttributeNS(_namespace, key);
+    return _element.getAttributeNS(_namespace, key);
   }
 
   void operator []=(String key, String value) {
-    _element._setAttributeNS(_namespace, key, value);
+    _element.setAttributeNS(_namespace, key, value);
   }
 
   String remove(String key) {
diff --git a/tools/dom/src/dart2js_Conversions.dart b/tools/dom/src/dart2js_Conversions.dart
index 668ba3b..41b624e 100644
--- a/tools/dom/src/dart2js_Conversions.dart
+++ b/tools/dom/src/dart2js_Conversions.dart
@@ -42,3 +42,10 @@
     return e;
   }
 }
+
+_convertNativeToDart_XHR_Response(o) {
+  if (o is Document) {
+    return o;
+  }
+  return convertNativeToDart_SerializedScriptValue(o);
+}
diff --git a/tools/dom/templates/html/dart2js/impl_Console.darttemplate b/tools/dom/templates/html/dart2js/impl_Console.darttemplate
index 741c710..3f6c4cd 100644
--- a/tools/dom/templates/html/dart2js/impl_Console.darttemplate
+++ b/tools/dom/templates/html/dart2js/impl_Console.darttemplate
@@ -20,6 +20,10 @@
   void assertCondition(bool condition, Object arg) => _isConsoleDefined ?
       JS('void', 'console.assertCondition(#, #)', condition, arg) : null;
 
+  @DomName('Console.clear')
+  void clear(Object arg) => _isConsoleDefined ?
+      JS('void', 'console.clear(#)', arg) : null;
+
   @DomName('Console.count')
   void count(Object arg) => _isConsoleDefined ?
       JS('void', 'console.count(#)', arg) : null;
@@ -72,6 +76,10 @@
   void profileEnd(String title) => _isConsoleDefined ?
       JS('void', 'console.profileEnd(#)', title) : null;
 
+  @DomName('Console.table')
+  void table(Object arg) => _isConsoleDefined ?
+      JS('void', 'console.table(#)', arg) : null;
+
   @DomName('Console.time')
   void time(String title) => _isConsoleDefined ?
       JS('void', 'console.time(#)', title) : null;
diff --git a/tools/dom/templates/html/dart2js/indexed_db_dart2js.darttemplate b/tools/dom/templates/html/dart2js/indexed_db_dart2js.darttemplate
index 4b6314f..2ef0587 100644
--- a/tools/dom/templates/html/dart2js/indexed_db_dart2js.darttemplate
+++ b/tools/dom/templates/html/dart2js/indexed_db_dart2js.darttemplate
@@ -6,6 +6,78 @@
 // https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation
 // Auto-generated dart:svg library.
 
+/**
+ * A client-side key-value store with support for indexes.
+ *
+ * Many browsers support IndexedDB&mdash;a web standard for
+ * an indexed database.
+ * By storing data on the client in an IndexedDB,
+ * a web app gets some advantages, such as faster performance and persistence.
+ * To find out which browsers support IndexedDB,
+ * refer to [Can I Use?](http://caniuse.com/#feat=indexeddb)
+ *
+ * In IndexedDB, each record is identified by a unique index or key,
+ * making data retrieval speedy.
+ * You can store structured data,
+ * such as images, arrays, and maps using IndexedDB.
+ * The standard does not specify size limits for individual data items
+ * or for the database itself, but browsers may impose storage limits.
+ *
+ * ## Using indexed_db
+ *
+ * The classes in this library provide an interface
+ * to the browser's IndexedDB, if it has one.
+ * To use this library in your code:
+ *
+ *     import 'dart:indexed_db';
+ *
+ * A web app can determine if the browser supports
+ * IndexedDB with [IdbFactory.supported]:
+ *
+ *     if (IdbFactory.supported)
+ *       // Use indexeddb.
+ *     else
+ *       // Find an alternative.
+ *
+ * Access to the browser's IndexedDB is provided by the app's top-level
+ * [Window] object, which your code can refer to with `window.indexedDB`.
+ * So, for example,
+ * here's how to use window.indexedDB to open a database:
+ *
+ *     Future open() {
+ *       return window.indexedDB.open('myIndexedDB',
+ *           version: 1,
+ *           onUpgradeNeeded: _initializeDatabase)
+ *         .then(_loadFromDB);
+ *     }
+ *     void _initializeDatabase(VersionChangeEvent e) {
+ *       ...
+ *     }
+ *     Future _loadFromDB(Database db) {
+ *       ...
+ *     }
+ *
+ *
+ * All data in an IndexedDB is stored within an [ObjectStore].
+ * To manipulate the database use [Transaction]s.
+ *
+ * ## Other resources
+ *
+ * Other options for client-side data storage include:
+ *
+ * * [Window.localStorage]&mdash;a
+ * basic mechanism that stores data as a [Map],
+ * and where both the keys and the values are strings.
+ *
+ * * [dart:web_sql]&mdash;a database that can be queried with SQL.
+ * 
+ * For a tutorial about using the indexed_db library with Dart,
+ * check out
+ * [Use IndexedDB](http://www.dartlang.org/docs/tutorials/indexeddb/).
+ *
+ * [IndexedDB reference](http://docs.webplatform.org/wiki/apis/indexeddb)
+ * provides wiki-style docs about indexedDB
+ */
 library dart.dom.indexed_db;
 
 import 'dart:async';
diff --git a/tools/dom/templates/html/dart2js/svg_dart2js.darttemplate b/tools/dom/templates/html/dart2js/svg_dart2js.darttemplate
index 5fb394d..df8a304 100644
--- a/tools/dom/templates/html/dart2js/svg_dart2js.darttemplate
+++ b/tools/dom/templates/html/dart2js/svg_dart2js.darttemplate
@@ -2,6 +2,14 @@
 // https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation
 // Auto-generated dart:svg library.
 
+/**
+ * Scalable Vector Graphics:
+ * Two-dimensional vector graphics with support for events and animation.
+ *
+ * For details about the features and syntax of SVG, a W3C standard,
+ * refer to the
+ * [Scalable Vector Graphics Specification](http://www.w3.org/TR/SVG/).
+ */
 library dart.dom.svg;
 
 import 'dart:async';
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index 0bf8034..4c1a75a 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -939,6 +939,12 @@
       '(#.createShadowRoot || #.webkitCreateShadowRoot).call(#)',
       this, this, this);
   }
+
+  @DomName('Element.shadowRoot')
+  @SupportedBrowser(SupportedBrowser.CHROME, '25')
+  @Experimental()
+  ShadowRoot get shadowRoot =>
+      JS('ShadowRoot', '#.shadowRoot || #.webkitShadowRoot', this, this);
 $endif
 
 
diff --git a/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate b/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
index 6887091..e4aaa29 100644
--- a/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
+++ b/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
@@ -160,11 +160,18 @@
   Element get pointerLockElement =>
       _webkitPointerLockElement;
 
-  @DomName('Document.webkitVisibilityState')
+  @DomName('Document.visibilityState')
   @SupportedBrowser(SupportedBrowser.CHROME)
-  @SupportedBrowser(SupportedBrowser.SAFARI)
+  @SupportedBrowser(SupportedBrowser.FIREFOX)
+  @SupportedBrowser(SupportedBrowser.IE, '10')
   @Experimental()
+$if DART2JS
+  String get visibilityState => JS('String',
+    '(#.visibilityState || #.mozVisibilityState || #.msVisibilityState ||'
+      '#.webkitVisibilityState)', this, this, this, this);
+$else
   String get visibilityState => _webkitVisibilityState;
+$endif
 
   @Experimental
 $if DART2JS
@@ -182,4 +189,38 @@
 $endif
   // Note: used to polyfill <template>
   Document _templateContentsOwner;
+
+  @DomName('Document.visibilityChange')
+  @SupportedBrowser(SupportedBrowser.CHROME)
+  @SupportedBrowser(SupportedBrowser.FIREFOX)
+  @SupportedBrowser(SupportedBrowser.IE, '10')
+  @Experimental()
+  static const EventStreamProvider<Event> visibilityChangeEvent =
+      const _CustomEventStreamProvider<Event>(
+        _determineVisibilityChangeEventType);
+
+  static String _determineVisibilityChangeEventType(EventTarget e) {
+$if DART2JS
+    if (JS('bool', '(typeof #.hidden !== "undefined")', e)) {
+      // Opera 12.10 and Firefox 18 and later support
+      return 'visibilitychange';
+    } else if (JS('bool', '(typeof #.mozHidden !== "undefined")', e)) {
+      return 'mozvisibilitychange';
+    } else if (JS('bool', '(typeof #.msHidden !== "undefined")', e)) {
+      return 'msvisibilitychange';
+    } else if (JS('bool', '(typeof #.webkitHidden !== "undefined")', e)) {
+      return 'webkitvisibilitychange';
+    }
+    return 'visibilitychange';
+$else
+    return 'webkitvisibilitychange';
+$endif
+  }
+
+  @SupportedBrowser(SupportedBrowser.CHROME)
+  @SupportedBrowser(SupportedBrowser.FIREFOX)
+  @SupportedBrowser(SupportedBrowser.IE, '10')
+  @Experimental()
+  Stream<Event> get onVisibilityChange =>
+      visibilityChangeEvent.forTarget(this);
 }
diff --git a/tools/dom/templates/html/impl/impl_IDBIndex.darttemplate b/tools/dom/templates/html/impl/impl_IDBIndex.darttemplate
index 44f866c..03af72c 100644
--- a/tools/dom/templates/html/impl/impl_IDBIndex.darttemplate
+++ b/tools/dom/templates/html/impl/impl_IDBIndex.darttemplate
@@ -55,7 +55,12 @@
     } else {
       key_OR_range = range;
     }
-    var request = _openCursor(key_OR_range, direction);
+    var request;
+    if (direction == null) {
+      request = _openCursor(key_OR_range);
+    } else {
+      request = _openCursor(key_OR_range, direction);
+    }
     return ObjectStore._cursorStreamFromResult(request, autoAdvance);
   }
 
@@ -77,7 +82,12 @@
     } else {
       key_OR_range = range;
     }
-    var request = _openKeyCursor(key_OR_range, direction);
+    var request;
+    if (direction == null) {
+      request = _openKeyCursor(key_OR_range);
+    } else {
+      request = _openKeyCursor(key_OR_range, direction);
+    }
     return ObjectStore._cursorStreamFromResult(request, autoAdvance);
   }
 
diff --git a/tools/dom/templates/html/impl/impl_Node.darttemplate b/tools/dom/templates/html/impl/impl_Node.darttemplate
index e544887..8f2fc4a 100644
--- a/tools/dom/templates/html/impl/impl_Node.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Node.darttemplate
@@ -145,7 +145,7 @@
     _this._replaceChild(value, this[index]);
   }
 
-  Iterator<Node> get iterator => _this._childNodes.iterator;
+  Iterator<Node> get iterator => _this.childNodes.iterator;
 
   // From List<Node>:
 
@@ -167,15 +167,15 @@
   // -- end List<Node> mixins.
 
   // TODO(jacobr): benchmark whether this is more efficient or whether caching
-  // a local copy of _childNodes is more efficient.
-  int get length => _this._childNodes.length;
+  // a local copy of childNodes is more efficient.
+  int get length => _this.childNodes.length;
 
   void set length(int value) {
     throw new UnsupportedError(
         "Cannot set length on immutable List.");
   }
 
-  Node operator[](int index) => _this._childNodes[index];
+  Node operator[](int index) => _this.childNodes[index];
 }
 
 /** Information about the instantiated template. */
diff --git a/tools/dom/templates/html/impl/impl_ScriptProcessorNode.darttemplate b/tools/dom/templates/html/impl/impl_ScriptProcessorNode.darttemplate
deleted file mode 100644
index f6fda75..0000000
--- a/tools/dom/templates/html/impl/impl_ScriptProcessorNode.darttemplate
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 2013, 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.
-
-part of $LIBRARY;
-
-$(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$NATIVESPEC {
-  Stream<AudioProcessingEvent> _eventStream;
-
-  /**
-   * Get a Stream that fires events when AudioProcessingEvents occur.
-   * This particular stream is special in that it only allows one listener to a
-   * given stream. Converting the returned Stream [asBroadcast] will likely ruin
-   * the soft-real-time properties which which these events are fired and can
-   * be processed.
-   */
-  Stream<AudioProcessingEvent> get onAudioProcess {
-    if (_eventStream == null) {
-      var controller = new StreamController(sync: true);
-      var callback = (audioData) {
-          if (controller.hasListener) {
-            // This stream is a strange combination of broadcast and single
-            // subscriber streams. We only allow one listener, but if there is
-            // no listener, we don't queue up events, we just drop them on the
-            // floor.
-            controller.add(audioData);
-          }
-        };
-      _setEventListener(callback);
-      _eventStream = controller.stream;
-    }
-    return _eventStream;
-  }
-
-$if DART2JS
-    _setEventListener(callback) {
-      JS('void', '#.onaudioprocess = #', this,
-          convertDartClosureToJS(callback, 1));
-    }
-$endif
-
-$!MEMBERS
-}
diff --git a/tools/task_kill.py b/tools/task_kill.py
index b77d789..56b0de9 100755
--- a/tools/task_kill.py
+++ b/tools/task_kill.py
@@ -50,7 +50,7 @@
 def GetPidsPosix(process_name):
   # This is to have only one posix command, on linux we could just do:
   # pidof process_name
-  cmd = 'ps -e -o pid=,comm='
+  cmd = 'ps -e -o pid= -o comm='
   # Sample output:
   # 1 /sbin/launchd
   # 80943 /Applications/Safari.app/Contents/MacOS/Safari
@@ -166,7 +166,8 @@
     status += KillDart();
   if (options.kill_browsers):
     status += KillBrowsers()
-  return status
+  # Investigating hanging firefox, see issue 13121
+  return 0
 
 if __name__ == '__main__':
   sys.exit(Main())
diff --git a/tools/test.dart b/tools/test.dart
index f84a77c..aa9b362 100755
--- a/tools/test.dart
+++ b/tools/test.dart
@@ -55,7 +55,6 @@
     new Path('tests/chrome'),
     new Path('tests/compiler/dart2js'),
     new Path('tests/compiler/dart2js_extra'),
-    new Path('tests/compiler/dart2js_foreign'),
     new Path('tests/compiler/dart2js_native'),
     new Path('tests/corelib'),
     new Path('tests/html'),
@@ -154,9 +153,13 @@
       }
     }
 
-    // If people use selenium they will have issues if we use more than one
-    // ie browser at a time.
-    if (conf['runtime'].startsWith('ie') && !conf['use_browser_controller']) {
+    if (conf['runtime'].startsWith('ie')) {
+      // NOTE: We've experienced random timeouts of tests on ie9/ie10. The
+      // underlying issue has not been determined yet. Our current hypothesis
+      // is that windows does not handle the IE processes independently.
+      // If we have more than one browser and kill a browser we are seeing
+      // issues with starting up a new browser just after killing the hanging
+      // browser.
       maxBrowserProcesses = 1;
     } else if (conf['runtime'].startsWith('safari') &&
                conf['use_browser_controller']) {
diff --git a/tools/testing/dart/browser_controller.dart b/tools/testing/dart/browser_controller.dart
index a9992d9..c6e07e7 100644
--- a/tools/testing/dart/browser_controller.dart
+++ b/tools/testing/dart/browser_controller.dart
@@ -1005,6 +1005,9 @@
       var testing_window;
 
       var embedded_iframe = document.getElementById('embedded_iframe');
+      var number_div = document.getElementById('number');
+      var executing_div = document.getElementById('currently_executing');
+      var error_div = document.getElementById('unhandled_error');
       var use_iframe = ${useIframe};
       var start = new Date();
 
@@ -1054,7 +1057,8 @@
 
       function run(url) {
         number_of_tests++;
-        document.getElementById('number').innerHTML = number_of_tests;
+        number_div.innerHTML = number_of_tests;
+        executing_div.innerHTML = url;
         if (use_iframe) {
           embedded_iframe.src = url;
         } else {
@@ -1077,8 +1081,9 @@
       function reportError(msg) {
         function handleReady() {
           if (this.readyState == this.DONE && this.status != 200) {
-            // We could not report, pop up to notify if running interactively.
-            alert(this.status);
+            var error = 'Sending back error did not succeeed: ' + this.status;
+            error = error + '. Failed to send msg: ' + msg;
+            error_div.innerHTML = error;
           }
         }
         contactBrowserController(
@@ -1129,7 +1134,9 @@
   </script>
 </head>
   <body onload="startTesting()">
-    Dart test driver, number of tests: <div id="number"></div>
+    Dart test driver, number of tests: <div id="number"></div><br>
+    Currently executing: <div id="currently_executing"></div><br>
+    Unhandled error: <div id="unhandled_error"></div>
     <iframe id="embedded_iframe"></iframe>
   </body>
 </html>
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
index 8058f04..658a1c4 100644
--- a/tools/testing/dart/test_runner.dart
+++ b/tools/testing/dart/test_runner.dart
@@ -547,9 +547,9 @@
       }
 
       var flags = new Set.from(expectedOutcomes);
-      flags..remove(TIMEOUT)
+      flags..remove(OK)
            ..remove(SLOW);
-      return flags.contains(PASS) && flags.length > 1;
+      return flags.length > 1;
   }
 
   bool get isFinished {
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index aeb782b..022574d 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -969,33 +969,56 @@
       String dartWrapperFilename = '$tempDir/test.dart';
       String compiledDartWrapperFilename = '$tempDir/test.js';
 
-      String htmlPath = '$tempDir/test.html';
-      if (isWrappingRequired && !isWebTest) {
-        // test.dart will import the dart test.
-        _createWrapperFile(dartWrapperFilename, filePath);
-      } else {
-        dartWrapperFilename = filename;
-      }
-      String scriptPath = (compiler == 'none') ?
-          dartWrapperFilename : compiledDartWrapperFilename;
-      scriptPath = _createUrlPathFromFile(new Path(scriptPath));
-
-      // Create the HTML file for the test.
-      RandomAccessFile htmlTest =
-          new File(htmlPath).openSync(mode: FileMode.WRITE);
       String content = null;
       Path dir = filePath.directoryPath;
       String nameNoExt = filePath.filenameWithoutExtension;
 
       Path pngPath = dir.append('$nameNoExt.png');
       Path txtPath = dir.append('$nameNoExt.txt');
-      Path customHtmlPath = dir.append('$nameNoExt.html');
+      String customHtmlPath = dir.append('$nameNoExt.html').toNativePath();
+      File customHtml = new File(customHtmlPath);
       Path expectedOutput = null;
 
-      if (new File(customHtmlPath.toNativePath()).existsSync()) {
-        // Use existing HTML document if available.
-        htmlPath = customHtmlPath.toNativePath();
+      // Construct the command(s) that compile all the inputs needed by the
+      // browser test. For running Dart in DRT, this will be noop commands.
+      List<Command> commands = [];
+
+      // Use existing HTML document if available.
+      String htmlPath;
+      if (customHtml.existsSync()) {
+
+        // If necessary, run the Polymer deploy steps.
+        // TODO(jmesserly): this should be generalized for any tests that
+        // require Pub deploy, not just polymer.
+        if (compiler != 'none' &&
+            customHtml.readAsStringSync().contains('polymer/boot.js')) {
+
+          commands.add(_polymerDeployCommand(
+              customHtmlPath, tempDir, optionsFromFile));
+
+          htmlPath = '$tempDir/test/$nameNoExt.html';
+          dartWrapperFilename = '${htmlPath}_bootstrap.dart';
+          compiledDartWrapperFilename = '$dartWrapperFilename.js';
+        } else {
+          htmlPath = customHtmlPath;
+        }
       } else {
+        htmlPath = '$tempDir/test.html';
+        if (isWrappingRequired && !isWebTest) {
+          // test.dart will import the dart test.
+          _createWrapperFile(dartWrapperFilename, filePath);
+        } else {
+          dartWrapperFilename = filename;
+        }
+
+        // Create the HTML file for the test.
+        RandomAccessFile htmlTest =
+            new File(htmlPath).openSync(mode: FileMode.WRITE);
+
+        String scriptPath = (compiler == 'none') ?
+            dartWrapperFilename : compiledDartWrapperFilename;
+        scriptPath = _createUrlPathFromFile(new Path(scriptPath));
+
         if (new File(pngPath.toNativePath()).existsSync()) {
           expectedOutput = pngPath;
           content = getHtmlLayoutContents(scriptType, new Path("$scriptPath"));
@@ -1010,9 +1033,6 @@
         htmlTest.closeSync();
       }
 
-      // Construct the command(s) that compile all the inputs needed by the
-      // browser test. For running Dart in DRT, this will be noop commands.
-      List<Command> commands = [];
       if (compiler != 'none') {
         commands.add(_compileCommand(
             dartWrapperFilename, compiledDartWrapperFilename,
@@ -1152,6 +1172,20 @@
         dart2JsBootstrapDependencies, compilerPath, args, configurationDir);
   }
 
+  /** Helper to create a Polymer deploy command for a single HTML file. */
+  Command _polymerDeployCommand(String inputFile, String outputDir,
+      optionsFromFile) {
+    List<String> args = [];
+    String packageRoot = packageRootArgument(optionsFromFile['packageRoot']);
+    if (packageRoot != null) args.add(packageRoot);
+    args..add('package:polymer/deploy.dart')
+        ..add('--test')..add(inputFile)
+        ..add('--out')..add(outputDir);
+
+    return CommandBuilder.instance.getCommand(
+        'polymer_deploy', vmFileName, args, configurationDir);
+  }
+
   /**
    * Create a directory for the generated test.  If a Dart language test
    * needs to be run in a browser, the Dart test needs to be embedded in
diff --git a/tools/utils.py b/tools/utils.py
index 54a53a8..a81c7e6 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -437,7 +437,12 @@
   if IsWindows():
     return os.path.join(dart_binary_prefix, 'windows', 'dart.exe')
   else:
-    return os.path.join(dart_binary_prefix, GuessOS(), 'dart')
+    arch = GuessArchitecture()
+    system = GuessOS()
+    if arch == 'arm':
+      return os.path.join(dart_binary_prefix, system, 'dart-arm')
+    else:
+      return os.path.join(dart_binary_prefix, system, 'dart')
 
 
 def DartSdkBinary():