Version 1.5.0-dev.4.10

svn merge -c 37238 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 37287 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 37297 https://dart.googlecode.com/svn/branches/bleeding_edge trunk

Narrow pub barback constraints by applying (see http://dartbug.com/19406 ) :
https://codereview.chromium.org/336543004/

git-svn-id: http://dart.googlecode.com/svn/trunk@37300 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index b66088c..1e66b82 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -385,6 +385,10 @@
   str = lib.name();
   args.SetAt(1, str);
   str = lib.url();
+  if (str.Equals("dart:builtin") || str.Equals("dart:_blink")) {
+    // Censored library (grumble).
+    return Instance::null();
+  }
   args.SetAt(2, str);
   return CreateMirror(Symbols::_LocalLibraryMirror(), args);
 }
@@ -406,6 +410,10 @@
   const Library& importee = Library::Handle(ns.library());
   const Instance& importee_mirror =
       Instance::Handle(CreateLibraryMirror(importee));
+  if (importee_mirror.IsNull()) {
+    // Imported library is censored: censor the import.
+    return Instance::null();
+  }
 
   const Array& show_names = Array::Handle(ns.show_names());
   const Array& hide_names = Array::Handle(ns.hide_names());
@@ -461,7 +469,9 @@
     ns ^= ports.At(i);
     if (!ns.IsNull()) {
       dep = CreateLibraryDependencyMirror(lib_mirror, ns, prefix, true);
-      deps.Add(dep);
+      if (!dep.IsNull()) {
+        deps.Add(dep);
+      }
     }
   }
 
@@ -470,7 +480,9 @@
   for (intptr_t i = 0; i < ports.Length(); i++) {
     ns ^= ports.At(i);
     dep = CreateLibraryDependencyMirror(lib_mirror, ns, prefix, false);
-    deps.Add(dep);
+    if (!dep.IsNull()) {
+      deps.Add(dep);
+    }
   }
 
   // Prefixed imports.
@@ -486,7 +498,9 @@
         ns ^= ports.At(i);
         if (!ns.IsNull()) {
           dep = CreateLibraryDependencyMirror(lib_mirror, ns, prefix, true);
-          deps.Add(dep);
+          if (!dep.IsNull()) {
+            deps.Add(dep);
+          }
         }
       }
     }
@@ -549,18 +563,21 @@
 
 static RawInstance* CreateMirrorSystem() {
   Isolate* isolate = Isolate::Current();
-  const GrowableObjectArray& libraries =
-      GrowableObjectArray::Handle(isolate->object_store()->libraries());
+  const GrowableObjectArray& libraries = GrowableObjectArray::Handle(
+      isolate, isolate->object_store()->libraries());
 
   const intptr_t num_libraries = libraries.Length();
-  const Array& library_mirrors = Array::Handle(Array::New(num_libraries));
-  Library& library = Library::Handle();
-  Instance& library_mirror = Instance::Handle();
+  const GrowableObjectArray& library_mirrors = GrowableObjectArray::Handle(
+      isolate, GrowableObjectArray::New(num_libraries));
+  Library& library = Library::Handle(isolate);
+  Instance& library_mirror = Instance::Handle(isolate);
 
   for (int i = 0; i < num_libraries; i++) {
     library ^= libraries.At(i);
     library_mirror = CreateLibraryMirror(library);
-    library_mirrors.SetAt(i, library_mirror);
+    if (!library_mirror.IsNull()) {
+      library_mirrors.Add(library_mirror);
+    }
   }
 
   const Instance& isolate_mirror = Instance::Handle(CreateIsolateMirror());
diff --git a/runtime/vm/debugger_api_impl_test.cc b/runtime/vm/debugger_api_impl_test.cc
index 16f73f7..04ad029 100644
--- a/runtime/vm/debugger_api_impl_test.cc
+++ b/runtime/vm/debugger_api_impl_test.cc
@@ -974,6 +974,94 @@
 }
 
 
+void TestBreakpointHandlerWithVerify(Dart_IsolateId isolate_id,
+                                     Dart_Breakpoint bpt,
+                                     Dart_StackTrace trace) {
+  breakpoint_hit = true;
+  breakpoint_hit_counter++;
+
+  Dart_ActivationFrame frame;
+  Dart_Handle res = Dart_GetActivationFrame(trace, 0, &frame);
+  EXPECT_VALID(res);
+  Dart_Handle func_name;
+  intptr_t line_number = -1;
+  res = Dart_ActivationFrameInfo(frame, &func_name, NULL, &line_number, NULL);
+  EXPECT_NE(-1, line_number);
+  if (verbose) OS::Print("Hit line %" Pd "\n", line_number);
+
+  VerifyPointersVisitor::VerifyPointers();
+}
+
+
+static void NoopNativeFunction(Dart_NativeArguments args) {
+  Dart_EnterScope();
+  Dart_SetReturnValue(args, Dart_True());
+  Dart_ExitScope();
+}
+
+
+static Dart_NativeFunction NoopNativeResolver(Dart_Handle name,
+                                              int arg_count,
+                                              bool* auto_setup_scope) {
+  ASSERT(auto_setup_scope != NULL);
+  *auto_setup_scope = false;
+  return &NoopNativeFunction;
+}
+
+
+TEST_CASE(Debug_BreakpointStubPatching) {
+  // Note changes to this script may require changes to the breakpoint line
+  // numbers below.
+  const char* kScriptChars =
+      "bar(i) {}                       \n"
+      "nat() native 'a';               \n"
+      "foo(n) {                        \n"
+      "  for(var i = 0; i < n; i++) {  \n"
+      "    bar(i);                     \n"  // Static call.
+      "    i++;                        \n"  // Instance call.
+      "    i == null;                  \n"  // Equality.
+      "    var x = i;                  \n"  // Debug step check.
+      "    i is int;                   \n"  // Subtype test.
+      "    y(z) => () => z + i;        \n"  // Allocate context.
+      "    y(i)();                     \n"  // Closure call.
+      "    nat();                      \n"  // Runtime call.
+      "    return y;                   \n"  // Return.
+      "  }                             \n"
+      "}                               \n"
+      "                                \n"
+      "main() {                        \n"
+      "  var i = 3;                    \n"
+      "  foo(i);                       \n"
+      "}                               \n";
+
+  LoadScript(kScriptChars);
+  Dart_Handle result = Dart_SetNativeResolver(script_lib,
+                                              &NoopNativeResolver,
+                                              NULL);
+  EXPECT_VALID(result);
+  Dart_SetBreakpointHandler(&TestBreakpointHandlerWithVerify);
+
+  Dart_Handle script_url = NewString(TestCase::url());
+
+  const intptr_t num_breakpoints = 9;
+  intptr_t breakpoint_lines[num_breakpoints] =
+      {5, 6, 7, 8, 9, 10, 11, 12, 13};
+
+  for (intptr_t i = 0; i < num_breakpoints; i++) {
+    result = Dart_SetBreakpoint(script_url, breakpoint_lines[i]);
+    EXPECT_VALID(result);
+    EXPECT(Dart_IsInteger(result));
+  }
+
+  breakpoint_hit = false;
+  breakpoint_hit_counter = 0;
+  Dart_Handle retval = Invoke("main");
+  EXPECT_VALID(retval);
+  EXPECT(breakpoint_hit == true);
+  EXPECT_EQ(num_breakpoints, breakpoint_hit_counter);
+}
+
+
 static intptr_t bp_id_to_be_deleted;
 
 static void DeleteBreakpointHandler(Dart_IsolateId isolate_id,
diff --git a/runtime/vm/flow_graph_compiler_arm.cc b/runtime/vm/flow_graph_compiler_arm.cc
index 45b72ca..e5108c8 100644
--- a/runtime/vm/flow_graph_compiler_arm.cc
+++ b/runtime/vm/flow_graph_compiler_arm.cc
@@ -1209,6 +1209,7 @@
                                          intptr_t token_pos,
                                          LocationSummary* locs) {
   ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0);
+  __ LoadImmediate(R4, 0);
   __ LoadObject(R5, ic_data);
   GenerateDartCall(deopt_id,
                    token_pos,
@@ -1216,6 +1217,9 @@
                    PcDescriptors::kIcCall,
                    locs);
   __ Drop(argument_count);
+#if defined(DEBUG)
+  __ LoadImmediate(R4, kInvalidObjectPointer);
+#endif
 }
 
 
@@ -1320,6 +1324,7 @@
     UNIMPLEMENTED();
   }
   ExternalLabel target_label(label_address);
+  __ LoadImmediate(R4, 0);
   __ LoadObject(R5, ic_data);
   GenerateDartCall(deopt_id,
                    token_pos,
@@ -1327,6 +1332,9 @@
                    PcDescriptors::kUnoptStaticCall,
                    locs);
   __ Drop(argument_count);
+#if defined(DEBUG)
+  __ LoadImmediate(R4, kInvalidObjectPointer);
+#endif
 }
 
 
@@ -1390,6 +1398,8 @@
       __ BranchLinkPatchable(
           &StubCode::OptimizedIdenticalWithNumberCheckLabel());
     } else {
+      __ LoadImmediate(R4, 0);
+      __ LoadImmediate(R5, 0);
       __ BranchLinkPatchable(
           &StubCode::UnoptimizedIdenticalWithNumberCheckLabel());
     }
@@ -1398,6 +1408,13 @@
                            Isolate::kNoDeoptId,
                            token_pos);
     }
+#if defined(DEBUG)
+    if (!is_optimizing()) {
+      // Do this *after* adding the pc descriptor!
+      __ LoadImmediate(R4, kInvalidObjectPointer);
+      __ LoadImmediate(R5, kInvalidObjectPointer);
+    }
+#endif
     // Stub returns result in flags (result of a cmpl, we need ZF computed).
     __ Pop(right);
     __ Pop(left);
diff --git a/runtime/vm/flow_graph_compiler_arm64.cc b/runtime/vm/flow_graph_compiler_arm64.cc
index 09a20f3..9303e38 100644
--- a/runtime/vm/flow_graph_compiler_arm64.cc
+++ b/runtime/vm/flow_graph_compiler_arm64.cc
@@ -1215,6 +1215,7 @@
                                          intptr_t token_pos,
                                          LocationSummary* locs) {
   ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0);
+  __ LoadImmediate(R4, 0, kNoPP);
   __ LoadObject(R5, ic_data, PP);
   GenerateDartCall(deopt_id,
                    token_pos,
@@ -1222,6 +1223,9 @@
                    PcDescriptors::kIcCall,
                    locs);
   __ Drop(argument_count);
+#if defined(DEBUG)
+  __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP);
+#endif
 }
 
 
@@ -1326,12 +1330,16 @@
     UNIMPLEMENTED();
   }
   ExternalLabel target_label(label_address);
+  __ LoadImmediate(R4, 0, kNoPP);
   __ LoadObject(R5, ic_data, PP);
   GenerateDartCall(deopt_id,
                    token_pos,
                    &target_label,
                    PcDescriptors::kUnoptStaticCall,
                    locs);
+#if defined(DEBUG)
+  __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP);
+#endif
   __ Drop(argument_count);
 }
 
@@ -1396,6 +1404,8 @@
       __ BranchLinkPatchable(
           &StubCode::OptimizedIdenticalWithNumberCheckLabel());
     } else {
+      __ LoadImmediate(R4, 0, kNoPP);
+      __ LoadImmediate(R5, 0, kNoPP);
       __ BranchLinkPatchable(
           &StubCode::UnoptimizedIdenticalWithNumberCheckLabel());
     }
@@ -1404,6 +1414,13 @@
                            Isolate::kNoDeoptId,
                            token_pos);
     }
+#if defined(DEBUG)
+    if (!is_optimizing()) {
+      // Do this *after* adding the pc descriptor!
+      __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP);
+      __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP);
+    }
+#endif
     // Stub returns result in flags (result of a cmpl, we need ZF computed).
     __ Pop(right);
     __ Pop(left);
diff --git a/runtime/vm/flow_graph_compiler_ia32.cc b/runtime/vm/flow_graph_compiler_ia32.cc
index 247e537..4a287b4 100644
--- a/runtime/vm/flow_graph_compiler_ia32.cc
+++ b/runtime/vm/flow_graph_compiler_ia32.cc
@@ -1199,6 +1199,7 @@
     UNIMPLEMENTED();
   }
   ExternalLabel target_label(label_address);
+  __ movl(EDX, Immediate(0));
   __ LoadObject(ECX, ic_data);
   GenerateDartCall(deopt_id,
                    token_pos,
@@ -1206,6 +1207,9 @@
                    PcDescriptors::kUnoptStaticCall,
                    locs);
   __ Drop(argument_count);
+#if defined(DEBUG)
+  __ movl(EDX, Immediate(kInvalidObjectPointer));
+#endif
 }
 
 
@@ -1256,6 +1260,7 @@
                                          intptr_t token_pos,
                                          LocationSummary* locs) {
   ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0);
+  __ movl(EDX, Immediate(0));
   __ LoadObject(ECX, ic_data);
   GenerateDartCall(deopt_id,
                    token_pos,
@@ -1263,6 +1268,9 @@
                    PcDescriptors::kIcCall,
                    locs);
   __ Drop(argument_count);
+#if defined(DEBUG)
+  __ movl(EDX, Immediate(kInvalidObjectPointer));
+#endif
 }
 
 
@@ -1399,6 +1407,8 @@
     if (is_optimizing()) {
       __ call(&StubCode::OptimizedIdenticalWithNumberCheckLabel());
     } else {
+      __ movl(EDX, Immediate(0));
+      __ movl(ECX, Immediate(0));
       __ call(&StubCode::UnoptimizedIdenticalWithNumberCheckLabel());
     }
     if (token_pos != Scanner::kNoSourcePos) {
@@ -1406,6 +1416,13 @@
                            Isolate::kNoDeoptId,
                            token_pos);
     }
+#if defined(DEBUG)
+    if (!is_optimizing()) {
+      // Do this *after* adding the pc descriptor!
+      __ movl(EDX, Immediate(kInvalidObjectPointer));
+      __ movl(ECX, Immediate(kInvalidObjectPointer));
+    }
+#endif
     // Stub returns result in flags (result of a cmpl, we need ZF computed).
     __ popl(right);
     __ popl(left);
diff --git a/runtime/vm/flow_graph_compiler_mips.cc b/runtime/vm/flow_graph_compiler_mips.cc
index afc9132..c4e47f5 100644
--- a/runtime/vm/flow_graph_compiler_mips.cc
+++ b/runtime/vm/flow_graph_compiler_mips.cc
@@ -1248,6 +1248,7 @@
                                          LocationSummary* locs) {
   ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0);
   __ TraceSimMsg("InstanceCall");
+  __ LoadImmediate(S4, 0);
   __ LoadObject(S5, ic_data);
   GenerateDartCall(deopt_id,
                    token_pos,
@@ -1256,6 +1257,9 @@
                    locs);
   __ TraceSimMsg("InstanceCall return");
   __ Drop(argument_count);
+#if defined(DEBUG)
+  __ LoadImmediate(S4, kInvalidObjectPointer);
+#endif
 }
 
 
@@ -1362,12 +1366,16 @@
     UNIMPLEMENTED();
   }
   ExternalLabel target_label(label_address);
+  __ LoadImmediate(S4, 0);
   __ LoadObject(S5, ic_data);
   GenerateDartCall(deopt_id,
                    token_pos,
                    &target_label,
                    PcDescriptors::kUnoptStaticCall,
                    locs);
+#if defined(DEBUG)
+  __ LoadImmediate(S4, kInvalidObjectPointer);
+#endif
   __ Drop(argument_count);
 }
 
@@ -1439,6 +1447,8 @@
       __ BranchLinkPatchable(
           &StubCode::OptimizedIdenticalWithNumberCheckLabel());
     } else {
+      __ LoadImmediate(S4, 0);
+      __ LoadImmediate(S5, 0);
       __ BranchLinkPatchable(
           &StubCode::UnoptimizedIdenticalWithNumberCheckLabel());
     }
@@ -1447,6 +1457,13 @@
                            Isolate::kNoDeoptId,
                            token_pos);
     }
+#if defined(DEBUG)
+    if (!is_optimizing()) {
+      // Do this *after* adding the pc descriptor!
+      __ LoadImmediate(S4, kInvalidObjectPointer);
+      __ LoadImmediate(S5, kInvalidObjectPointer);
+    }
+#endif
     __ TraceSimMsg("EqualityRegRegCompare return");
     // Stub returns result in CMPRES1. If it is 0, then left and right are
     // equal.
diff --git a/runtime/vm/flow_graph_compiler_x64.cc b/runtime/vm/flow_graph_compiler_x64.cc
index 01629ea..67f1d12 100644
--- a/runtime/vm/flow_graph_compiler_x64.cc
+++ b/runtime/vm/flow_graph_compiler_x64.cc
@@ -1237,6 +1237,7 @@
     UNIMPLEMENTED();
   }
   ExternalLabel target_label(label_address);
+  __ movq(R10, Immediate(0));
   __ LoadObject(RBX, ic_data, PP);
   GenerateDartCall(deopt_id,
                    token_pos,
@@ -1244,6 +1245,9 @@
                    PcDescriptors::kUnoptStaticCall,
                    locs);
   __ Drop(argument_count);
+#if defined(DEBUG)
+  __ movq(R10, Immediate(kInvalidObjectPointer));
+#endif
 }
 
 
@@ -1294,6 +1298,7 @@
                                          intptr_t token_pos,
                                          LocationSummary* locs) {
   ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0);
+  __ movq(R10, Immediate(0));
   __ LoadObject(RBX, ic_data, PP);
   GenerateDartCall(deopt_id,
                    token_pos,
@@ -1301,6 +1306,9 @@
                    PcDescriptors::kIcCall,
                    locs);
   __ Drop(argument_count);
+#if defined(DEBUG)
+  __ movq(R10, Immediate(kInvalidObjectPointer));
+#endif
 }
 
 
@@ -1438,6 +1446,8 @@
     if (is_optimizing()) {
       __ CallPatchable(&StubCode::OptimizedIdenticalWithNumberCheckLabel());
     } else {
+      __ movq(R10, Immediate(0));
+      __ movq(RBX, Immediate(0));
       __ CallPatchable(&StubCode::UnoptimizedIdenticalWithNumberCheckLabel());
     }
     if (token_pos != Scanner::kNoSourcePos) {
@@ -1445,6 +1455,13 @@
                            Isolate::kNoDeoptId,
                            token_pos);
     }
+#if defined(DEBUG)
+    // Do this *after* adding the pc descriptor!
+    if (!is_optimizing()) {
+      __ movq(R10, Immediate(kInvalidObjectPointer));
+      __ movq(RBX, Immediate(kInvalidObjectPointer));
+    }
+#endif
     // Stub returns result in flags (result of a cmpl, we need ZF computed).
     __ popq(right);
     __ popq(left);
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index ea4f0ba..67f8142 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -1627,13 +1627,6 @@
 }
 
 
-void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
-  ASSERT(!compiler->is_optimizing());
-  const ExternalLabel label(StubCode::DebugStepCheckEntryPoint());
-  compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
-}
-
-
 Instruction* DebugStepCheckInstr::Canonicalize(FlowGraph* flow_graph) {
   return NULL;
 }
diff --git a/runtime/vm/intermediate_language_arm.cc b/runtime/vm/intermediate_language_arm.cc
index 5be62b3..5bdae56 100644
--- a/runtime/vm/intermediate_language_arm.cc
+++ b/runtime/vm/intermediate_language_arm.cc
@@ -6361,6 +6361,19 @@
   __ Drop(ArgumentCount());  // Discard arguments.
 }
 
+
+void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+  ASSERT(!compiler->is_optimizing());
+  const ExternalLabel label(StubCode::DebugStepCheckEntryPoint());
+  __ LoadImmediate(R4, 0);
+  __ LoadImmediate(R5, 0);
+  compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
+#if defined(DEBUG)
+  __ LoadImmediate(R4, kInvalidObjectPointer);
+  __ LoadImmediate(R5, kInvalidObjectPointer);
+#endif
+}
+
 }  // namespace dart
 
 #endif  // defined TARGET_ARCH_ARM
diff --git a/runtime/vm/intermediate_language_arm64.cc b/runtime/vm/intermediate_language_arm64.cc
index 1e1ae77..b83da77 100644
--- a/runtime/vm/intermediate_language_arm64.cc
+++ b/runtime/vm/intermediate_language_arm64.cc
@@ -5334,6 +5334,19 @@
   __ Drop(ArgumentCount());  // Discard arguments.
 }
 
+
+void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+  ASSERT(!compiler->is_optimizing());
+  const ExternalLabel label(StubCode::DebugStepCheckEntryPoint());
+  __ LoadImmediate(R4, 0, kNoPP);
+  __ LoadImmediate(R5, 0, kNoPP);
+  compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
+#if defined(DEBUG)
+  __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP);
+  __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP);
+#endif
+}
+
 }  // namespace dart
 
 #endif  // defined TARGET_ARCH_ARM64
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index e25e90e..50807147 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -6298,6 +6298,19 @@
   __ Drop(ArgumentCount());  // Discard arguments.
 }
 
+
+void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+  ASSERT(!compiler->is_optimizing());
+  const ExternalLabel label(StubCode::DebugStepCheckEntryPoint());
+  __ movl(EDX, Immediate(0));
+  __ movl(ECX, Immediate(0));
+  compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
+#if defined(DEBUG)
+  __ movl(EDX, Immediate(kInvalidObjectPointer));
+  __ movl(EDX, Immediate(kInvalidObjectPointer));
+#endif
+}
+
 }  // namespace dart
 
 #undef __
diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc
index b8ba0c0..9f99907 100644
--- a/runtime/vm/intermediate_language_mips.cc
+++ b/runtime/vm/intermediate_language_mips.cc
@@ -4687,6 +4687,19 @@
   __ Drop(ArgumentCount());  // Discard arguments.
 }
 
+
+void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+  ASSERT(!compiler->is_optimizing());
+  const ExternalLabel label(StubCode::DebugStepCheckEntryPoint());
+  __ LoadImmediate(S4, 0);
+  __ LoadImmediate(S5, 0);
+  compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
+#if defined(DEBUG)
+  __ LoadImmediate(S4, kInvalidObjectPointer);
+  __ LoadImmediate(S5, kInvalidObjectPointer);
+#endif
+}
+
 }  // namespace dart
 
 #endif  // defined TARGET_ARCH_MIPS
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
index 90aeed8..9093f7a 100644
--- a/runtime/vm/intermediate_language_x64.cc
+++ b/runtime/vm/intermediate_language_x64.cc
@@ -5827,6 +5827,19 @@
   __ Drop(ArgumentCount());  // Discard arguments.
 }
 
+
+void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+  ASSERT(!compiler->is_optimizing());
+  const ExternalLabel label(StubCode::DebugStepCheckEntryPoint());
+  __ movq(R10, Immediate(0));
+  __ movq(RBX, Immediate(0));
+  compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
+#if defined(DEBUG)
+  __ movq(R10, Immediate(kInvalidObjectPointer));
+  __ movq(RBX, Immediate(kInvalidObjectPointer));
+#endif
+}
+
 }  // namespace dart
 
 #undef __
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 363a42c..8d2ca96 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -181,6 +181,10 @@
   kSmiTagShift = 1,
 };
 
+enum {
+  kInvalidObjectPointer = kHeapObjectTag,
+};
+
 enum TypedDataElementType {
 #define V(name) k##name##Element,
 CLASS_LIST_TYPED_DATA(V)
diff --git a/runtime/vm/runtime_entry_arm.cc b/runtime/vm/runtime_entry_arm.cc
index de52089..1dbd019 100644
--- a/runtime/vm/runtime_entry_arm.cc
+++ b/runtime/vm/runtime_entry_arm.cc
@@ -20,7 +20,7 @@
 // function. Input for the stub is as follows:
 //   SP : points to the arguments and return value array.
 //   R5 : address of the runtime function to call.
-//   R4 : number of arguments to the call.
+//   R4 : number of arguments to the call as Smi.
 void RuntimeEntry::Call(Assembler* assembler, intptr_t argument_count) const {
   // Compute the effective address. When running under the simulator,
   // this is a redirection address that forces the simulator to call
@@ -48,7 +48,7 @@
     // Argument count is not checked here, but in the runtime entry for a more
     // informative error message.
     __ LoadImmediate(R5, entry);
-    __ LoadImmediate(R4, argument_count);
+    __ LoadImmediate(R4, Smi::RawValue(argument_count));
     __ BranchLink(&StubCode::CallToRuntimeLabel());
   }
 }
diff --git a/runtime/vm/runtime_entry_arm64.cc b/runtime/vm/runtime_entry_arm64.cc
index fcf228e..0112cc3 100644
--- a/runtime/vm/runtime_entry_arm64.cc
+++ b/runtime/vm/runtime_entry_arm64.cc
@@ -19,7 +19,7 @@
 // function. Input for the stub is as follows:
 //   SP : points to the arguments and return value array.
 //   R5 : address of the runtime function to call.
-//   R4 : number of arguments to the call.
+//   R4 : number of arguments to the call as Smi.
 void RuntimeEntry::Call(Assembler* assembler, intptr_t argument_count) const {
   // Compute the effective address. When running under the simulator,
   // this is a redirection address that forces the simulator to call
@@ -48,7 +48,7 @@
     // Argument count is not checked here, but in the runtime entry for a more
     // informative error message.
     __ LoadImmediate(R5, entry, kNoPP);
-    __ LoadImmediate(R4, argument_count, kNoPP);
+    __ LoadImmediate(R4, Smi::RawValue(argument_count), kNoPP);
     __ BranchLink(&StubCode::CallToRuntimeLabel(), PP);
   }
 }
diff --git a/runtime/vm/runtime_entry_ia32.cc b/runtime/vm/runtime_entry_ia32.cc
index 854afd0..160bf3c 100644
--- a/runtime/vm/runtime_entry_ia32.cc
+++ b/runtime/vm/runtime_entry_ia32.cc
@@ -20,7 +20,7 @@
 // For regular runtime calls -
 //   ESP : points to the arguments and return value array.
 //   ECX : address of the runtime function to call.
-//   EDX : number of arguments to the call.
+//   EDX : number of arguments to the call as Smi.
 // For leaf calls the caller is responsible to setup the arguments
 // and look for return values based on the C calling convention.
 void RuntimeEntry::Call(Assembler* assembler, intptr_t argument_count) const {
@@ -32,7 +32,7 @@
     // Argument count is not checked here, but in the runtime entry for a more
     // informative error message.
     __ movl(ECX, Immediate(GetEntryPoint()));
-    __ movl(EDX, Immediate(argument_count));
+    __ movl(EDX, Immediate(Smi::RawValue(argument_count)));
     __ call(&StubCode::CallToRuntimeLabel());
   }
 }
diff --git a/runtime/vm/runtime_entry_mips.cc b/runtime/vm/runtime_entry_mips.cc
index ca4a529..b57112a 100644
--- a/runtime/vm/runtime_entry_mips.cc
+++ b/runtime/vm/runtime_entry_mips.cc
@@ -20,7 +20,7 @@
 // function. Input for the stub is as follows:
 //   SP : points to the arguments and return value array.
 //   S5 : address of the runtime function to call.
-//   S4 : number of arguments to the call.
+//   S4 : number of arguments to the call as Smi.
 void RuntimeEntry::Call(Assembler* assembler, intptr_t argument_count) const {
   // Compute the effective address. When running under the simulator,
   // this is a redirection address that forces the simulator to call
@@ -48,7 +48,7 @@
     // Argument count is not checked here, but in the runtime entry for a more
     // informative error message.
     __ LoadImmediate(S5, entry);
-    __ LoadImmediate(S4, argument_count);
+    __ LoadImmediate(S4, Smi::RawValue(argument_count));
     __ BranchLink(&StubCode::CallToRuntimeLabel());
   }
 }
diff --git a/runtime/vm/runtime_entry_x64.cc b/runtime/vm/runtime_entry_x64.cc
index 0e78100..aa703b06 100644
--- a/runtime/vm/runtime_entry_x64.cc
+++ b/runtime/vm/runtime_entry_x64.cc
@@ -19,7 +19,7 @@
 // function. Input for the stub is as follows:
 //   RSP : points to the arguments and return value array.
 //   RBX : address of the runtime function to call.
-//   R10 : number of arguments to the call.
+//   R10 : number of arguments to the call as Smi.
 void RuntimeEntry::Call(Assembler* assembler, intptr_t argument_count) const {
   if (is_leaf()) {
     ASSERT(argument_count == this->argument_count());
@@ -29,7 +29,7 @@
     // Argument count is not checked here, but in the runtime entry for a more
     // informative error message.
     __ movq(RBX, Immediate(GetEntryPoint()));
-    __ movq(R10, Immediate(argument_count));
+    __ movq(R10, Immediate(Smi::RawValue(argument_count)));
     __ Call(&StubCode::CallToRuntimeLabel(), PP);
   }
 }
diff --git a/runtime/vm/stub_code_arm.cc b/runtime/vm/stub_code_arm.cc
index 4f1c8c3..61eb06c 100644
--- a/runtime/vm/stub_code_arm.cc
+++ b/runtime/vm/stub_code_arm.cc
@@ -46,6 +46,7 @@
   __ mov(IP, Operand(0));
   __ Push(IP);  // Push 0 for the PC marker.
   __ EnterFrame((1 << FP) | (1 << LR), 0);
+  __ SmiUntag(R4);
 
   // Load current Isolate pointer from Context structure into R0.
   __ ldr(R0, FieldAddress(CTX, Context::isolate_offset()));
diff --git a/runtime/vm/stub_code_arm64.cc b/runtime/vm/stub_code_arm64.cc
index ef20898..13f5a14 100644
--- a/runtime/vm/stub_code_arm64.cc
+++ b/runtime/vm/stub_code_arm64.cc
@@ -45,6 +45,7 @@
   __ SetPrologueOffset();
   __ Comment("CallToRuntimeStub");
   __ EnterFrame(0);
+  __ SmiUntag(R4);
 
   // Load current Isolate pointer from Context structure into R0.
   __ LoadFieldFromOffset(R0, CTX, Context::isolate_offset(), kNoPP);
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
index 8c1e3b9..cd64f41 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -37,7 +37,7 @@
 //   ESP + 4*EDX : address of first argument in argument array.
 //   ESP + 4*EDX + 4 : address of return value.
 //   ECX : address of the runtime function to call.
-//   EDX : number of arguments to the call.
+//   EDX : number of arguments to the call as Smi.
 // Must preserve callee saved registers EDI and EBX.
 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) {
   const intptr_t isolate_offset = NativeArguments::isolate_offset();
@@ -46,6 +46,7 @@
   const intptr_t retval_offset = NativeArguments::retval_offset();
 
   __ EnterFrame(0);
+  __ SmiUntag(EDX);
 
   // Load current Isolate pointer from Context structure into EAX.
   __ movl(EAX, FieldAddress(CTX, Context::isolate_offset()));
diff --git a/runtime/vm/stub_code_mips.cc b/runtime/vm/stub_code_mips.cc
index 604045a..6718260 100644
--- a/runtime/vm/stub_code_mips.cc
+++ b/runtime/vm/stub_code_mips.cc
@@ -34,7 +34,7 @@
 //   SP + 4*S4 - 4 : address of first argument in argument array.
 //   SP + 4*S4 : address of return value.
 //   S5 : address of the runtime function to call.
-//   S4 : number of arguments to the call.
+//   S4 : number of arguments to the call as Smi.
 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) {
   const intptr_t isolate_offset = NativeArguments::isolate_offset();
   const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset();
@@ -49,6 +49,7 @@
   __ sw(RA, Address(SP, 1 * kWordSize));
   __ sw(FP, Address(SP, 0 * kWordSize));
   __ mov(FP, SP);
+  __ SmiUntag(S4);
 
   // Load current Isolate pointer from Context structure into A0.
   __ lw(A0, FieldAddress(CTX, Context::isolate_offset()));
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index cafb218..5fd0af6 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -83,6 +83,7 @@
   __ movq(Address(RSP, isolate_offset), CTX);  // Set isolate in NativeArgs.
   // There are no runtime calls to closures, so we do not need to set the tag
   // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_.
+  __ SmiUntag(R10);
   __ movq(Address(RSP, argc_tag_offset), R10);  // Set argc in NativeArguments.
   __ leaq(RAX, Address(RBP, R10, TIMES_8, 1 * kWordSize));  // Compute argv.
   __ movq(Address(RSP, argv_offset), RAX);  // Set argv in NativeArguments.
diff --git a/sdk/lib/_internal/pub/lib/src/barback.dart b/sdk/lib/_internal/pub/lib/src/barback.dart
index 83b63de..d0f11f7 100644
--- a/sdk/lib/_internal/pub/lib/src/barback.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback.dart
@@ -34,7 +34,7 @@
 /// constraint and barback's version.
 ///
 /// [compat]: https://gist.github.com/nex3/10942218
-final supportedVersions = new VersionConstraint.parse(">=0.13.0 <0.14.2");
+final supportedVersions = new VersionConstraint.parse(">=0.13.0 <0.14.1");
 
 /// A list of the names of all built-in transformers that pub exposes.
 const _BUILT_IN_TRANSFORMERS = const ['\$dart2js'];
diff --git a/tests/lib/mirrors/mirrors_reader_test.dart b/tests/lib/mirrors/mirrors_reader_test.dart
index 1c69b07..e66c5f0 100644
--- a/tests/lib/mirrors/mirrors_reader_test.dart
+++ b/tests/lib/mirrors/mirrors_reader_test.dart
@@ -7,16 +7,29 @@
 library test.mirrors.reader;
 
 import 'dart:mirrors';
+import 'package:expect/expect.dart';
 import 'mirrors_reader.dart';
 
 class RuntimeMirrorsReader extends MirrorsReader {
+  final MirrorSystem mirrorSystem;
   final String mirrorSystemType;
 
   RuntimeMirrorsReader(MirrorSystem mirrorSystem,
                       {bool verbose: false, bool includeStackTrace: false})
-      : this.mirrorSystemType = '${mirrorSystem.runtimeType}',
+      : this.mirrorSystem = mirrorSystem,
+        this.mirrorSystemType = '${mirrorSystem.runtimeType}',
         super(verbose: verbose, includeStackTrace: includeStackTrace);
 
+  visitLibraryMirror(LibraryMirror mirror) {
+    super.visitLibraryMirror(mirror);
+    Expect.equals(mirror, mirrorSystem.libraries[mirror.uri]);
+  }
+
+  visitClassMirror(ClassMirror mirror) {
+    super.visitClassMirror(mirror);
+    Expect.isNotNull(mirror.owner);
+  }
+
   bool allowUnsupported(var receiver, String tag, UnsupportedError exception) {
     if (mirrorSystemType == '_LocalMirrorSystem') {
       // VM mirror system.
diff --git a/tools/VERSION b/tools/VERSION
index 6ae6d22..11c4208 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -28,4 +28,4 @@
 MINOR 5
 PATCH 0
 PRERELEASE 4
-PRERELEASE_PATCH 9
+PRERELEASE_PATCH 10