Version 1.9.1

svn merge -c 44666 https://dart.googlecode.com/svn/branches/bleeding_edge 1.9
svn merge -c 44668 https://dart.googlecode.com/svn/branches/bleeding_edge 1.9
svn merge -c 44669 https://dart.googlecode.com/svn/branches/bleeding_edge 1.9

Apply patch from:
https://codereview.chromium.org/1013543005/


git-svn-id: http://dart.googlecode.com/svn/branches/1.9@44672 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/runtime/lib/compact_hash.dart b/runtime/lib/compact_hash.dart
index 8e3fce9..70e646e 100644
--- a/runtime/lib/compact_hash.dart
+++ b/runtime/lib/compact_hash.dart
@@ -85,7 +85,7 @@
   bool get isNotEmpty => !isEmpty;
   
   void _rehash() {
-    if ((_deletedKeys << 1) > _usedData) {
+    if ((_deletedKeys << 2) > _usedData) {
       // TODO(koda): Consider shrinking.
       // TODO(koda): Consider in-place compaction and more costly CME check.
       _init(_index.length, _hashMask, _data, _usedData);
diff --git a/runtime/observatory/lib/src/elements/heap_profile.html b/runtime/observatory/lib/src/elements/heap_profile.html
index 3d0bfec..460a021 100644
--- a/runtime/observatory/lib/src/elements/heap_profile.html
+++ b/runtime/observatory/lib/src/elements/heap_profile.html
@@ -57,9 +57,11 @@
     <nav-refresh callback="{{ resetAccumulator }}" label="Reset Accumulator"></nav-refresh>
     <nav-refresh callback="{{ refreshGC }}" label="GC"></nav-refresh>
     <nav-refresh callback="{{ refresh }}"></nav-refresh>
+    <!-- Disabled dartbug.com/22970
     <div class="nav-option">
       <input type="checkbox" checked="{{ autoRefresh }}">Auto-refresh on GC
     </div>
+    -->
     <nav-control></nav-control>
   </nav-bar>
   <div class="content">
diff --git a/runtime/observatory/lib/src/elements/observatory_element.dart b/runtime/observatory/lib/src/elements/observatory_element.dart
index 46f1ef5..da2735e 100644
--- a/runtime/observatory/lib/src/elements/observatory_element.dart
+++ b/runtime/observatory/lib/src/elements/observatory_element.dart
@@ -164,7 +164,18 @@
 
   void clearShadowRoot() {
     // Remove all non-style elements.
-    shadowRoot.children.removeWhere((e) => e is! StyleElement);
+    // Have to do the following because removeWhere doesn't work on DOM child
+    // node lists. i.e. removeWhere((e) => e is! StyleElement);
+    var styleElements = [];
+    for (var child in shadowRoot.children) {
+      if (child is StyleElement) {
+        styleElements.add(child);
+      }
+    }
+    shadowRoot.children.clear();
+    for (var style in styleElements) {
+      shadowRoot.children.add(style);
+    }
   }
 
   void insertTextSpanIntoShadowRoot(String text) {
diff --git a/runtime/observatory/test/async_generator_breakpoint_test.dart b/runtime/observatory/test/async_generator_breakpoint_test.dart
new file mode 100644
index 0000000..5e8d802
--- /dev/null
+++ b/runtime/observatory/test/async_generator_breakpoint_test.dart
@@ -0,0 +1,89 @@
+// Copyright (c) 2015, 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=--verbose-debug
+
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+import 'test_helper.dart';
+import 'dart:async';
+
+printSync() {  // Line 12
+  print('sync');
+}
+printAsync() async {  // Line 15
+  print('async');
+}
+printAsyncStar() async* {  // Line 18
+  print('async*');
+}
+printSyncStar() sync* {  // Line 21
+  print('sync*');
+}
+
+var testerReady = false;
+testeeDo() {
+  // We block here rather than allowing the isolate to enter the
+  // paused-on-exit state before the tester gets a chance to set
+  // the breakpoints because we need the event loop to remain
+  // operational for the async bodies to run.
+  print('testee waiting');
+  while(!testerReady);
+
+  printSync();
+  var future = printAsync();
+  var stream = printAsyncStar();
+  var iterator = printSyncStar();
+
+  print('middle');  // Line 39.
+
+  future.then((v) => print(v));
+  stream.toList();
+  iterator.toList();
+}
+
+testAsync(Isolate isolate) async {
+  await isolate.rootLib.load();
+  var script = isolate.rootLib.scripts[0];
+
+  var bp1 = await isolate.addBreakpoint(script, 12);
+  expect(bp1, isNotNull);
+  expect(bp1 is Breakpoint, isTrue);
+  var bp2 = await isolate.addBreakpoint(script, 15);
+  expect(bp2, isNotNull);
+  expect(bp2 is Breakpoint, isTrue);
+  var bp3 = await isolate.addBreakpoint(script, 18);
+  expect(bp3, isNotNull);
+  expect(bp3 is Breakpoint, isTrue);
+  var bp4 = await isolate.addBreakpoint(script, 21);
+  expect(bp4, isNotNull);
+  expect(bp4 is Breakpoint, isTrue);
+  var bp5 = await isolate.addBreakpoint(script, 39);
+  expect(bp5, isNotNull);
+  expect(bp5 is Breakpoint, isTrue);
+
+  var hits = [];
+
+  isolate.eval(isolate.rootLib, 'testerReady = true;')
+      .then((ServiceObject result) {
+        expect(result.valueAsString, equals('true'));
+      });
+
+  await for (ServiceEvent event in isolate.vm.events.stream) {
+    if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+      var bp = event.breakpoint;
+      print('Hit $bp');
+      hits.add(bp);
+      isolate.resume();
+
+      if (hits.length == 5) break;
+    }
+  }
+
+  expect(hits, equals([bp1, bp5, bp4, bp2, bp3]));
+}
+
+var tests = [testAsync];
+
+main(args) => runIsolateTests(args, tests, testeeConcurrent: testeeDo);
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
index 1834063..3ffa06b 100644
--- a/runtime/vm/debugger.cc
+++ b/runtime/vm/debugger.cc
@@ -898,7 +898,7 @@
 
 
 void DebuggerStackTrace::AddActivation(ActivationFrame* frame) {
-  if (FLAG_show_invisible_frames || frame->function().is_debuggable()) {
+  if (FLAG_show_invisible_frames || frame->function().is_visible()) {
     trace_.Add(frame);
   }
 }
@@ -1317,7 +1317,7 @@
     // pre-allocated trace (such as a stack overflow) or (b) because a stack has
     // fewer frames that the pre-allocated trace (such as memory exhaustion with
     // a shallow stack).
-    if (!function.IsNull() && function.is_debuggable()) {
+    if (!function.IsNull() && function.is_visible()) {
       code = ex_trace.CodeAtFrame(i);
       ASSERT(function.raw() == code.function());
       uword pc = code.EntryPoint() + Smi::Value(ex_trace.PcOffsetAtFrame(i));
diff --git a/runtime/vm/megamorphic_cache_table.cc b/runtime/vm/megamorphic_cache_table.cc
index 565d8b7..3291b0f 100644
--- a/runtime/vm/megamorphic_cache_table.cc
+++ b/runtime/vm/megamorphic_cache_table.cc
@@ -68,6 +68,7 @@
                                      cls,
                                      0));  // No token position.
   function.set_is_debuggable(false);
+  function.set_is_visible(false);
   miss_handler_code_ = code.raw();
   miss_handler_function_ = function.raw();
   function.AttachCode(code);
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index dd85273..a0a8db4 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -2589,6 +2589,7 @@
   }
   invocation.set_result_type(Type::Handle(Type::DynamicType()));
   invocation.set_is_debuggable(false);
+  invocation.set_is_visible(false);
   invocation.set_is_reflectable(false);
   invocation.set_saved_args_desc(args_desc);
 
@@ -6136,6 +6137,7 @@
   result.set_is_external(is_external);
   result.set_is_native(is_native);
   result.set_is_reflectable(true);  // Will be computed later.
+  result.set_is_visible(true);  // Will be computed later.
   result.set_is_debuggable(true);  // Will be computed later.
   result.set_is_intrinsic(false);
   result.set_is_redirecting(false);
@@ -6237,6 +6239,7 @@
                     0));
   ASSERT(!script.IsNull());
   result.set_is_debuggable(false);
+  result.set_is_visible(false);
   result.set_eval_script(script);
   return result.raw();
 }
@@ -20368,7 +20371,7 @@
         OS::SNPrint(chars, truncated_len, "%s", kTruncated);
         frame_strings.Add(chars);
       }
-    } else if (function.is_debuggable() || FLAG_show_invisible_frames) {
+    } else if (function.is_visible() || FLAG_show_invisible_frames) {
       code = CodeAtFrame(i);
       ASSERT(function.raw() == code.function());
       uword pc = code.EntryPoint() + Smi::Value(PcOffsetAtFrame(i));
@@ -20377,7 +20380,7 @@
         for (InlinedFunctionsIterator it(code, pc);
              !it.Done() && (*frame_index < max_frames); it.Advance()) {
           function = it.function();
-          if (function.is_debuggable() || FLAG_show_invisible_frames) {
+          if (function.is_visible() || FLAG_show_invisible_frames) {
             code = it.code();
             ASSERT(function.raw() == code.function());
             uword pc = it.pc();
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 7981b2b..46c1fa4 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -2253,9 +2253,12 @@
   // abstract: Skipped during instance-side resolution.
   // reflectable: Enumerated by mirrors, invocable by mirrors. False for private
   //              functions of dart: libraries.
-  // debuggable: Valid location of a break point. True for functions with source
-  //             code; false for synthetic functions such as dispatchers. Also
-  //             used to decide whether to include a frame in stack traces.
+  // debuggable: Valid location of a breakpoint. Synthetic code is not
+  //             debuggable.
+  // visible: Frame is included in stack traces. Synthetic code such as
+  //          dispatchers is not visible. Synthetic code that can trigger
+  //          exceptions such as the outer async functions that create Futures
+  //          is visible.
   // optimizable: Candidate for going through the optimizing compiler. False for
   //              some functions known to be execute infrequently and functions
   //              which have been de-optimized too many times.
@@ -2273,6 +2276,7 @@
   V(Const, is_const)                                                           \
   V(Abstract, is_abstract)                                                     \
   V(Reflectable, is_reflectable)                                               \
+  V(Visible, is_visible)                                                       \
   V(Debuggable, is_debuggable)                                                 \
   V(Optimizable, is_optimizable)                                               \
   V(Inlinable, is_inlinable)                                                   \
diff --git a/runtime/vm/resolver.cc b/runtime/vm/resolver.cc
index 7274efa..89d9ff6 100644
--- a/runtime/vm/resolver.cc
+++ b/runtime/vm/resolver.cc
@@ -91,6 +91,7 @@
 
   extractor.set_extracted_method_closure(closure_function);
   extractor.set_is_debuggable(false);
+  extractor.set_is_visible(false);
 
   owner.AddFunction(extractor);
 
diff --git a/sdk/lib/_internal/compiler/js_lib/js_helper.dart b/sdk/lib/_internal/compiler/js_lib/js_helper.dart
index 544eed6..c674b01 100644
--- a/sdk/lib/_internal/compiler/js_lib/js_helper.dart
+++ b/sdk/lib/_internal/compiler/js_lib/js_helper.dart
@@ -1163,7 +1163,7 @@
       }
       arguments = new List.from(arguments);
       for (int pos = argumentCount; pos < maxArgumentCount; pos++) {
-        arguments.add(info.defaultValue(pos));
+        arguments.add(getMetadata(info.defaultValue(pos)));
       }
     }
     // We bound 'this' to [function] because of how we compile
diff --git a/tests/corelib/apply4_test.dart b/tests/corelib/apply4_test.dart
index f617456..fba4b9d 100644
--- a/tests/corelib/apply4_test.dart
+++ b/tests/corelib/apply4_test.dart
@@ -16,5 +16,5 @@
   var a = new A();
   var clos = a.foo;
   Expect.equals(Function.apply(clos, ["well"]), "well 99");
-  Expect.equals(Function.apply(clos, ["well", 0, 1, 2, 3, 4, 5, 6]), "well 5");
+  Expect.equals(Function.apply(clos, ["well", 0, 2, 4, 3, 6, 9, 10]), "well 9");
 }
diff --git a/tests/language/async_or_generator_return_type_stacktrace_test.dart b/tests/language/async_or_generator_return_type_stacktrace_test.dart
new file mode 100644
index 0000000..1fa3d93
--- /dev/null
+++ b/tests/language/async_or_generator_return_type_stacktrace_test.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2015, 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";
+
+void badReturnTypeAsync() async {}  /// 01: static type warning
+void badReturnTypeAsyncStar() async* {}  /// 02: static type warning
+void badReturnTypeSyncStar() sync* {}  /// 03: static type warning
+
+main() {
+  try {
+    badReturnTypeAsync();  /// 01: continued
+  } catch(e, st) {
+    Expect.isTrue(e is TypeError, "wrong exception type");
+    Expect.isTrue(st.toString().contains("badReturnTypeAsync"),
+                  "missing frame");
+  }
+
+  try {
+    badReturnTypeAsyncStar();  /// 02: continued
+  } catch(e, st) {
+    Expect.isTrue(e is TypeError, "wrong exception type");
+    Expect.isTrue(st.toString().contains("badReturnTypeAsyncStar"),
+                  "missing frame");
+  }
+
+  try {
+    badReturnTypeSyncStar();  /// 03: continued
+  } catch(e, st) {
+    Expect.isTrue(e is TypeError, "wrong exception type");
+    Expect.isTrue(st.toString().contains("badReturnTypeSyncStar"),
+                  "missing frame");
+  }
+}
\ No newline at end of file
diff --git a/tests/language/language_analyzer.status b/tests/language/language_analyzer.status
index cc4d7a4..db08023 100644
--- a/tests/language/language_analyzer.status
+++ b/tests/language/language_analyzer.status
@@ -5,6 +5,8 @@
 [ $compiler == dartanalyzer ]
 async_return_types_test/wrongTypeParameter: MissingStaticWarning # Issue 22410
 async_return_types_test/wrongReturnType: MissingStaticWarning # Issue 22410
+async_or_generator_return_type_stacktrace_test/01: MissingStaticWarning # Issue 22410
+async_or_generator_return_type_stacktrace_test/02: MissingStaticWarning # Issue 22410
 async_return_types_test/nestedFuture: MissingStaticWarning # Issue 22410
 await_backwards_compatibility_test/none: CompileTimeError # Issue 22052
 await_test: CompileTimeError # Issue 22052
diff --git a/tools/VERSION b/tools/VERSION
index e5f0e10..93b652d 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -26,6 +26,6 @@
 CHANNEL stable
 MAJOR 1
 MINOR 9
-PATCH 0
+PATCH 1
 PRERELEASE 0
 PRERELEASE_PATCH 0