anchor.diff:   */
   wrapException(ex) {
     if (ex == null) ex = new NullThrownError();
  -  var wrapper = new DartError(ex);
  -
  -  if (JS('bool', '!!Error.captureStackTrace')) {
  -    // Use V8 API for recording a "fast" stack trace (this installs a
  -    // "stack" property getter on [wrapper]).
  -    JS('void', r'Error.captureStackTrace(#, #)',
  -       wrapper, RAW_DART_FUNCTION_REF(wrapException));
  +  var wrapper = JS('', 'new Error()');
  +  // [unwrapException] looks for the property 'dartException'.
  +  JS('void', '#.dartException = #', wrapper, ex);
  +
  +  if (JS('bool', '"defineProperty" in Object')) {
  +    // Define a JavaScript getter for 'message'. This is to work around V8 bug
  +    // (https://code.google.com/p/v8/issues/detail?id=2519).  The default
  +    // toString on Error returns the value of 'message' if 'name' is
  +    // empty. Setting toString directly doesn't work, see the bug.
  +    JS('void', 'Object.defineProperty(#, "message", { get: # })',
  +       wrapper, DART_CLOSURE_TO_JS(toStringWrapper));
  +    JS('void', '#.name = ""', wrapper);
     } else {
  -    // Otherwise, produce a stack trace and record it in the wrapper.
  -    // This is a slower way to create a stack trace which works on
  -    // some browsers, but may simply evaluate to null.
  -    String stackTrace = JS('', 'new Error().stack');
  -    JS('void', '#.stack = #', wrapper, stackTrace);
  -  }
  +    // In the unlikely event the browser doesn't support Object.defineProperty,
  +    // hope that it just calls toString.
  +    JS('void', '#.toString = #', wrapper, DART_CLOSURE_TO_JS(toStringWrapper));
  +  }
  +
     return wrapper;
  +}
  +
  +/// Do not call directly.
  +toStringWrapper() {
  +  // This method gets installed as toString on a JavaScript object. Due to the
  +  // weird scope rules of JavaScript, JS 'this' will refer to that object.
  +  return JS('', r'this.dartException').toString();
   }
   
   /**
  
positive.code:   if (exception == null) return null;
    if (JS('bool', 'typeof # !== "object"', exception)) return null;
    if (JS('bool', r'"stack" in #', exception)) {
      return new _StackTrace(JS("var", r"#.stack", exception));
    } else {
      return null;
    }
  }
  
  class _StackTrace implements StackTrace {
    var _stack;
    _StackTrace(this._stack);
    String toString() => _stack != null ? _stack : '';
  }
  
  
  /**
   * Called by generated code to build a map literal. [keyValuePairs] is
  
negative.code:  */
  throwExpression(ex) {
    JS('void', 'throw #', wrapException(ex));
  }
  
  makeLiteralListConst(list) {
  