Version 1.9.0-dev.8.1

svn merge -c 43730 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 43725 https://dart.googlecode.com/svn/branches/bleeding_edge trunk

git-svn-id: http://dart.googlecode.com/svn/trunk@43750 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 67a7a23..c76cef7 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -5174,6 +5174,14 @@
     for (int i = 0; i < count; i++) {
       _sourceChanged(changedSources[i]);
     }
+    int removalCount = 0;
+    for (Source source in missingSources) {
+      if (getLibrariesContaining(source).isEmpty &&
+          getLibrariesDependingOn(source).isEmpty) {
+        _cache.remove(source);
+        removalCount++;
+      }
+    }
     int consistencyCheckEnd = JavaSystem.nanoTime();
     if (changedSources.length > 0 || missingSources.length > 0) {
       StringBuffer buffer = new StringBuffer();
@@ -5185,7 +5193,9 @@
       buffer.writeln(" inconsistent entries");
       buffer.write("  ");
       buffer.write(missingSources.length);
-      buffer.writeln(" missing sources");
+      buffer.write(" missing sources (");
+      buffer.write(removalCount);
+      buffer.writeln(" removed");
       for (Source source in missingSources) {
         buffer.write("    ");
         buffer.writeln(source.fullName);
@@ -11844,18 +11854,6 @@
     result.value = value == null ? descriptor.defaultValue : value;
   }
 
-  /**
-   * Increment the count of the number of times that data represented by the
-   * given [descriptor] was transitioned from the current state (as found in the
-   * given [result] to a valid state.
-   */
-  static void countTransition(DataDescriptor descriptor, CachedResult result) {
-    Map<CacheState, int> countMap =
-        transitionMap.putIfAbsent(descriptor, () => new HashMap<CacheState, int>());
-    int count = countMap[result.state];
-    countMap[result.state] = count == null ? 1 : count + 1;
-  }
-
   @override
   String toString() {
     StringBuffer buffer = new StringBuffer();
@@ -12006,6 +12004,18 @@
     buffer.write(" = ");
     buffer.write(result == null ? CacheState.INVALID : result.state);
   }
+
+  /**
+   * Increment the count of the number of times that data represented by the
+   * given [descriptor] was transitioned from the current state (as found in the
+   * given [result] to a valid state.
+   */
+  static void countTransition(DataDescriptor descriptor, CachedResult result) {
+    Map<CacheState, int> countMap =
+        transitionMap.putIfAbsent(descriptor, () => new HashMap<CacheState, int>());
+    int count = countMap[result.state];
+    countMap[result.state] = count == null ? 1 : count + 1;
+  }
 }
 
 /**
diff --git a/pkg/analyzer/test/generated/engine_test.dart b/pkg/analyzer/test/generated/engine_test.dart
index 540f2d9..934334d 100644
--- a/pkg/analyzer/test/generated/engine_test.dart
+++ b/pkg/analyzer/test/generated/engine_test.dart
@@ -2704,7 +2704,9 @@
     DartEntry entry = _entryWithValidState(librarySource);
     entry.invalidateAllInformation();
     expect(entry.getState(SourceEntry.CONTENT), same(CacheState.INVALID));
-    expect(entry.getState(SourceEntry.CONTENT_ERRORS), same(CacheState.INVALID));
+    expect(
+        entry.getState(SourceEntry.CONTENT_ERRORS),
+        same(CacheState.INVALID));
     expect(entry.getState(SourceEntry.LINE_INFO), same(CacheState.INVALID));
     expect(
         entry.getState(DartEntry.CONTAINING_LIBRARIES),
@@ -7153,6 +7155,9 @@
   TimestampedData<String> get contents {
     throw 'Read error';
   }
+
+  @override
+  bool exists() => true;
 }
 
 
diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc
index 73c738d..d3091f6 100644
--- a/runtime/bin/eventhandler_win.cc
+++ b/runtime/bin/eventhandler_win.cc
@@ -1029,7 +1029,6 @@
         if (registry->CloseSafe(reinterpret_cast<intptr_t>(listen_socket))) {
           ASSERT(listen_socket->Mask() == 0);
           listen_socket->Close();
-          DeleteIfClosed(handle);
         }
 
         DartUtils::PostInt32(msg->dart_port, 1 << kDestroyedEvent);
@@ -1038,7 +1037,6 @@
       }
     } else {
       handle->EnsureInitialized(this);
-
       Handle::ScopedLock lock(handle);
 
       if (IS_COMMAND(msg->data, kReturnTokenCommand)) {
@@ -1101,8 +1099,9 @@
       } else {
         UNREACHABLE();
       }
-      DeleteIfClosed(handle);
     }
+
+    DeleteIfClosed(handle);
   }
 }
 
diff --git a/tools/VERSION b/tools/VERSION
index 314d74d..d21d407 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -28,4 +28,4 @@
 MINOR 9
 PATCH 0
 PRERELEASE 8
-PRERELEASE_PATCH 0
+PRERELEASE_PATCH 1