Version 2.13.0-64.0.dev

Merge commit '2ad6249c05047d9440ada6dd6c565a50cc5e5cd5' into 'dev'
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index f687245..6e9dc2f 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -11,7 +11,7 @@
     "constraint, update this by running tools/generate_package_config.dart."
   ],
   "configVersion": 2,
-  "generated": "2021-02-19T10:27:13.251974",
+  "generated": "2021-02-22T14:34:08.519603",
   "generator": "tools/generate_package_config.dart",
   "packages": [
     {
@@ -214,7 +214,7 @@
       "name": "dart_internal",
       "rootUri": "../pkg/dart_internal",
       "packageUri": "lib/",
-      "languageVersion": "2.10"
+      "languageVersion": "2.12"
     },
     {
       "name": "dart_style",
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index df459d1..aa7ec99 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -16,7 +16,6 @@
 import 'package:analysis_server/src/analysis_server_abstract.dart';
 import 'package:analysis_server/src/channel/channel.dart';
 import 'package:analysis_server/src/computer/computer_highlights.dart';
-import 'package:analysis_server/src/computer/new_notifications.dart';
 import 'package:analysis_server/src/context_manager.dart';
 import 'package:analysis_server/src/domain_analysis.dart';
 import 'package:analysis_server/src/domain_analytics.dart';
@@ -379,9 +378,7 @@
   /// projects/contexts support.
   void setAnalysisRoots(String requestId, List<String> includedPaths,
       List<String> excludedPaths) {
-    if (notificationManager != null) {
-      notificationManager.setAnalysisRoots(includedPaths, excludedPaths);
-    }
+    notificationManager.setAnalysisRoots(includedPaths, excludedPaths);
     try {
       contextManager.setRoots(includedPaths, excludedPaths);
     } on UnimplementedError catch (e) {
@@ -393,9 +390,7 @@
   /// Implementation for `analysis.setSubscriptions`.
   void setAnalysisSubscriptions(
       Map<AnalysisService, Set<String>> subscriptions) {
-    if (notificationManager != null) {
-      notificationManager.setSubscriptions(subscriptions);
-    }
+    notificationManager.setSubscriptions(subscriptions);
     analysisServices = subscriptions;
     _sendSubscriptions(analysis: true);
   }
@@ -632,10 +627,12 @@
   /// The [ResourceProvider] by which paths are converted into [Resource]s.
   final ResourceProvider resourceProvider;
 
+  /// The set of files for which notifications were sent.
+  final Set<String> filesToFlush = {};
+
   ServerContextManagerCallbacks(this.analysisServer, this.resourceProvider);
 
-  @override
-  NotificationManager get notificationManager =>
+  NotificationManager get _notificationManager =>
       analysisServer.notificationManager;
 
   @override
@@ -645,6 +642,15 @@
   }
 
   @override
+  void afterContextsDestroyed() {
+    sendAnalysisNotificationFlushResults(
+      analysisServer,
+      filesToFlush.toList(),
+    );
+    filesToFlush.clear();
+  }
+
+  @override
   void afterWatchEvent(WatchEvent event) {
     analysisServer._onAnalysisSetChangedController.add(null);
   }
@@ -652,6 +658,7 @@
   @override
   void applyFileRemoved(String file) {
     sendAnalysisNotificationFlushResults(analysisServer, [file]);
+    filesToFlush.remove(file);
   }
 
   @override
@@ -664,46 +671,39 @@
   @override
   void listenAnalysisDriver(nd.AnalysisDriver analysisDriver) {
     analysisDriver.results.listen((result) {
-      var notificationManager = analysisServer.notificationManager;
       var path = result.path;
+      filesToFlush.add(path);
       if (analysisServer.shouldSendErrorsNotificationFor(path)) {
-        if (notificationManager != null) {
-          notificationManager.recordAnalysisErrors(NotificationManager.serverId,
-              path, server.doAnalysisError_listFromEngine(result));
-        } else {
-          new_sendErrorNotification(analysisServer, result);
-        }
+        _notificationManager.recordAnalysisErrors(NotificationManager.serverId,
+            path, server.doAnalysisError_listFromEngine(result));
       }
       var unit = result.unit;
       if (unit != null) {
-        if (notificationManager != null) {
-          if (analysisServer._hasAnalysisServiceSubscription(
-              AnalysisService.HIGHLIGHTS, path)) {
-            _runDelayed(() {
-              notificationManager.recordHighlightRegions(
-                  NotificationManager.serverId,
-                  path,
-                  _computeHighlightRegions(unit));
-            });
-          }
-          if (analysisServer._hasAnalysisServiceSubscription(
-              AnalysisService.NAVIGATION, path)) {
-            _runDelayed(() {
-              notificationManager.recordNavigationParams(
-                  NotificationManager.serverId,
-                  path,
-                  _computeNavigationParams(path, unit));
-            });
-          }
-          if (analysisServer._hasAnalysisServiceSubscription(
-              AnalysisService.OCCURRENCES, path)) {
-            _runDelayed(() {
-              notificationManager.recordOccurrences(
-                  NotificationManager.serverId,
-                  path,
-                  _computeOccurrences(unit));
-            });
-          }
+        if (analysisServer._hasAnalysisServiceSubscription(
+            AnalysisService.HIGHLIGHTS, path)) {
+          _runDelayed(() {
+            _notificationManager.recordHighlightRegions(
+                NotificationManager.serverId,
+                path,
+                _computeHighlightRegions(unit));
+          });
+        }
+        if (analysisServer._hasAnalysisServiceSubscription(
+            AnalysisService.NAVIGATION, path)) {
+          _runDelayed(() {
+            _notificationManager.recordNavigationParams(
+                NotificationManager.serverId,
+                path,
+                _computeNavigationParams(path, unit));
+          });
+        }
+        if (analysisServer._hasAnalysisServiceSubscription(
+            AnalysisService.OCCURRENCES, path)) {
+          _runDelayed(() {
+            _notificationManager.recordOccurrences(
+                NotificationManager.serverId, path, _computeOccurrences(unit));
+          });
+        }
 //          if (analysisServer._hasAnalysisServiceSubscription(
 //              AnalysisService.OUTLINE, path)) {
 //            _runDelayed(() {
@@ -713,26 +713,6 @@
 //                  path, _computeOutlineParams(path, unit, result.lineInfo));
 //            });
 //          }
-        } else {
-          if (analysisServer._hasAnalysisServiceSubscription(
-              AnalysisService.HIGHLIGHTS, path)) {
-            _runDelayed(() {
-              sendAnalysisNotificationHighlights(analysisServer, path, unit);
-            });
-          }
-          if (analysisServer._hasAnalysisServiceSubscription(
-              AnalysisService.NAVIGATION, path)) {
-            _runDelayed(() {
-              new_sendDartNotificationNavigation(analysisServer, result);
-            });
-          }
-          if (analysisServer._hasAnalysisServiceSubscription(
-              AnalysisService.OCCURRENCES, path)) {
-            _runDelayed(() {
-              new_sendDartNotificationOccurrences(analysisServer, result);
-            });
-          }
-        }
         if (analysisServer._hasAnalysisServiceSubscription(
             AnalysisService.CLOSING_LABELS, path)) {
           _runDelayed(() {
@@ -773,10 +753,10 @@
   }
 
   @override
-  void removeContext(Folder folder, List<String> flushedFiles) {
-    sendAnalysisNotificationFlushResults(analysisServer, flushedFiles);
-    var driver = analysisServer.driverMap.remove(folder);
-    driver?.dispose();
+  void recordAnalysisErrors(String path, List<AnalysisError> errors) {
+    filesToFlush.add(path);
+    _notificationManager.recordAnalysisErrors(
+        NotificationManager.serverId, path, errors);
   }
 
   List<HighlightRegion> _computeHighlightRegions(CompilationUnit unit) {
diff --git a/pkg/analysis_server/lib/src/computer/new_notifications.dart b/pkg/analysis_server/lib/src/computer/new_notifications.dart
deleted file mode 100644
index a30965d..0000000
--- a/pkg/analysis_server/lib/src/computer/new_notifications.dart
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2014, 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:analysis_server/src/analysis_server.dart' show AnalysisServer;
-import 'package:analysis_server/src/domains/analysis/occurrences.dart';
-import 'package:analysis_server/src/domains/analysis/occurrences_dart.dart';
-import 'package:analysis_server/src/protocol_server.dart' as protocol;
-import 'package:analyzer/dart/analysis/results.dart';
-import 'package:analyzer_plugin/src/utilities/navigation/navigation.dart';
-import 'package:analyzer_plugin/utilities/navigation/navigation_dart.dart';
-
-void new_sendDartNotificationNavigation(
-    AnalysisServer analysisServer, ResolvedUnitResult result) {
-  var unit = result.unit;
-  if (unit != null) {
-    var collector = NavigationCollectorImpl();
-    computeDartNavigation(
-        analysisServer.resourceProvider, collector, unit, null, null);
-    collector.createRegions();
-    var params = protocol.AnalysisNavigationParams(
-        result.path, collector.regions, collector.targets, collector.files);
-    analysisServer.sendNotification(params.toNotification());
-  }
-}
-
-void new_sendDartNotificationOccurrences(
-    AnalysisServer analysisServer, ResolvedUnitResult result) {
-  var unit = result.unit;
-  if (unit != null) {
-    var collector = OccurrencesCollectorImpl();
-    addDartOccurrences(collector, unit);
-    var params = protocol.AnalysisOccurrencesParams(
-        result.path, collector.allOccurrences);
-    analysisServer.sendNotification(params.toNotification());
-  }
-}
-
-void new_sendErrorNotification(
-    AnalysisServer analysisServer, ResolvedUnitResult result) {
-  var serverErrors = protocol.doAnalysisError_listFromEngine(result);
-  var params = protocol.AnalysisErrorsParams(result.path, serverErrors);
-  analysisServer.sendNotification(params.toNotification());
-}
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index a404e8c..bdbede3 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -5,9 +5,7 @@
 import 'dart:async';
 import 'dart:collection';
 import 'dart:core';
-import 'dart:io';
 
-import 'package:analysis_server/src/plugin/notification_manager.dart';
 import 'package:analysis_server/src/services/correction/fix/data_driven/transform_set_parser.dart';
 import 'package:analyzer/error/listener.dart';
 import 'package:analyzer/file_system/file_system.dart';
@@ -118,13 +116,14 @@
 /// operations return data structures describing how context state should be
 /// modified.
 abstract class ContextManagerCallbacks {
-  /// Return the notification manager associated with the server.
-  AbstractNotificationManager get notificationManager;
-
-  /// Called after contexts are rebuilt, such as after recovering from a watcher
-  /// failure.
+  /// Called after analysis contexts are created, usually when new analysis
+  /// roots are set, or after detecting a change that required rebuilding
+  /// the set of analysis contexts.
   void afterContextsCreated();
 
+  /// Called after analysis contexts are destroyed.
+  void afterContextsDestroyed();
+
   /// An [event] was processed, so analysis state might be different now.
   void afterWatchEvent(WatchEvent event);
 
@@ -139,10 +138,8 @@
   /// TODO(scheglov) Just pass results in here?
   void listenAnalysisDriver(AnalysisDriver driver);
 
-  /// Remove the context associated with the given [folder].  [flushedFiles] is
-  /// a list of the files which will be "orphaned" by removing this context
-  /// (they will no longer be analyzed by any context).
-  void removeContext(Folder folder, List<String> flushedFiles);
+  /// Record error information for the file with the given [path].
+  void recordAnalysisErrors(String path, List<protocol.AnalysisError> errors);
 }
 
 /// Class that maintains a mapping from included/excluded paths to a set of
@@ -244,7 +241,12 @@
 
   @override
   bool isInAnalysisRoot(String path) {
-    return _collection.contexts.any(
+    var collection = _collection;
+    if (collection == null) {
+      return false;
+    }
+
+    return collection.contexts.any(
       (context) => context.contextRoot.isAnalyzed(path),
     );
   }
@@ -265,7 +267,7 @@
   /// Use the given analysis [driver] to analyze the content of the analysis
   /// options file at the given [path].
   void _analyzeAnalysisOptionsFile(AnalysisDriver driver, String path) {
-    List<protocol.AnalysisError> convertedErrors;
+    var convertedErrors = const <protocol.AnalysisError>[];
     try {
       var content = _readFile(path);
       var lineInfo = _computeLineInfo(content);
@@ -280,16 +282,13 @@
       // If the file cannot be analyzed, fall through to clear any previous
       // errors.
     }
-    callbacks.notificationManager.recordAnalysisErrors(
-        NotificationManager.serverId,
-        path,
-        convertedErrors ?? <protocol.AnalysisError>[]);
+    callbacks.recordAnalysisErrors(path, convertedErrors);
   }
 
   /// Use the given analysis [driver] to analyze the content of the
   /// data file at the given [path].
   void _analyzeDataFile(AnalysisDriver driver, String path) {
-    List<protocol.AnalysisError> convertedErrors;
+    var convertedErrors = const <protocol.AnalysisError>[];
     try {
       var file = resourceProvider.getFile(path);
       var packageName = file.parent2.parent2.shortName;
@@ -305,16 +304,13 @@
       // If the file cannot be analyzed, fall through to clear any previous
       // errors.
     }
-    callbacks.notificationManager.recordAnalysisErrors(
-        NotificationManager.serverId,
-        path,
-        convertedErrors ?? const <protocol.AnalysisError>[]);
+    callbacks.recordAnalysisErrors(path, convertedErrors);
   }
 
   /// Use the given analysis [driver] to analyze the content of the
   /// AndroidManifest file at the given [path].
   void _analyzeManifestFile(AnalysisDriver driver, String path) {
-    List<protocol.AnalysisError> convertedErrors;
+    var convertedErrors = const <protocol.AnalysisError>[];
     try {
       var content = _readFile(path);
       var validator =
@@ -329,16 +325,13 @@
       // If the file cannot be analyzed, fall through to clear any previous
       // errors.
     }
-    callbacks.notificationManager.recordAnalysisErrors(
-        NotificationManager.serverId,
-        path,
-        convertedErrors ?? <protocol.AnalysisError>[]);
+    callbacks.recordAnalysisErrors(path, convertedErrors);
   }
 
   /// Use the given analysis [driver] to analyze the content of the pubspec file
   /// at the given [path].
   void _analyzePubspecFile(AnalysisDriver driver, String path) {
-    List<protocol.AnalysisError> convertedErrors;
+    var convertedErrors = const <protocol.AnalysisError>[];
     try {
       var content = _readFile(path);
       var node = loadYamlNode(content);
@@ -388,10 +381,7 @@
       // If the file cannot be analyzed, fall through to clear any previous
       // errors.
     }
-    callbacks.notificationManager.recordAnalysisErrors(
-        NotificationManager.serverId,
-        path,
-        convertedErrors ?? <protocol.AnalysisError>[]);
+    callbacks.recordAnalysisErrors(path, convertedErrors);
   }
 
   void _checkForDataFileUpdate(String path) {
@@ -417,12 +407,7 @@
   }
 
   void _createAnalysisContexts() {
-    if (_collection != null) {
-      for (var analysisContext in _collection.contexts) {
-        var contextImpl = analysisContext as DriverBasedAnalysisContext;
-        _destroyContext(contextImpl);
-      }
-    }
+    _destroyAnalysisContexts();
 
     _collection = AnalysisContextCollectionImpl(
       includedPaths: includedPaths,
@@ -501,13 +486,23 @@
   }
 
   /// Clean up and destroy the context associated with the given folder.
-  void _destroyContext(DriverBasedAnalysisContext context) {
+  void _destroyAnalysisContext(DriverBasedAnalysisContext context) {
+    context.driver.dispose();
+
     var rootFolder = context.contextRoot.root;
     changeSubscriptions.remove(rootFolder)?.cancel();
     bazelSubscriptions.remove(rootFolder)?.cancel();
+    driverMap.remove(rootFolder);
+  }
 
-    var flushedFiles = context.driver.addedFiles.toList();
-    callbacks.removeContext(rootFolder, flushedFiles);
+  void _destroyAnalysisContexts() {
+    if (_collection != null) {
+      for (var analysisContext in _collection.contexts) {
+        var contextImpl = analysisContext as DriverBasedAnalysisContext;
+        _destroyAnalysisContext(contextImpl);
+      }
+      callbacks.afterContextsDestroyed();
+    }
   }
 
   /// Establishes watch(es) for the Bazel generated files provided in
@@ -594,20 +589,21 @@
             break;
           case ChangeType.REMOVE:
             analysisContext.driver.removeFile(path);
-            // TODO(scheglov) Why not `isInAnalysisRoot()`?
-            // TODO(scheglov) Why not always?
-            var resource = resourceProvider.getResource(path);
-            if (resource is File &&
-                _shouldFileBeAnalyzed(resource, mustExist: false)) {
-              callbacks.applyFileRemoved(path);
-            }
             break;
         }
       }
     }
 
-    _checkForManifestUpdate(path);
-    _checkForDataFileUpdate(path);
+    switch (type) {
+      case ChangeType.ADD:
+      case ChangeType.MODIFY:
+        _checkForManifestUpdate(path);
+        _checkForDataFileUpdate(path);
+        break;
+      case ChangeType.REMOVE:
+        callbacks.applyFileRemoved(path);
+        break;
+    }
   }
 
   /// On windows, the directory watcher may overflow, and we must recover.
@@ -644,22 +640,6 @@
     return resourceProvider.getFile(path).readAsStringSync();
   }
 
-  /// Return `true` if the given [file] should be analyzed.
-  bool _shouldFileBeAnalyzed(File file, {bool mustExist = true}) {
-    for (var glob in analyzedFilesGlobs) {
-      if (glob.matches(file.path)) {
-        // Emacs creates dummy links to track the fact that a file is open for
-        // editing and has unsaved changes (e.g. having unsaved changes to
-        // 'foo.dart' causes a link '.#foo.dart' to be created, which points to
-        // the non-existent file 'username@hostname.pid'. To avoid these dummy
-        // links causing the analyzer to thrash, just ignore links to
-        // non-existent files.
-        return !mustExist || file.exists;
-      }
-    }
-    return false;
-  }
-
   /// Listens to files generated by Bazel that were found or searched for.
   ///
   /// This is handled specially because the files are outside the package
diff --git a/pkg/analysis_server/lib/src/lsp/constants.dart b/pkg/analysis_server/lib/src/lsp/constants.dart
index 8e751a4..952a5c5 100644
--- a/pkg/analysis_server/lib/src/lsp/constants.dart
+++ b/pkg/analysis_server/lib/src/lsp/constants.dart
@@ -68,13 +68,11 @@
     organizeImports,
     sendWorkspaceEdit,
     performRefactor,
-    fixAllOfErrorCodeInFile,
   ];
   static const sortMembers = 'edit.sortMembers';
   static const organizeImports = 'edit.organizeImports';
   static const sendWorkspaceEdit = 'edit.sendWorkspaceEdit';
   static const performRefactor = 'refactor.perform';
-  static const fixAllOfErrorCodeInFile = 'edit.fixAll.errorCodeInFile';
 }
 
 abstract class CustomMethods {
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/fix_all_of_error_code_in_file.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/fix_all_of_error_code_in_file.dart
deleted file mode 100644
index d43b9d9..0000000
--- a/pkg/analysis_server/lib/src/lsp/handlers/commands/fix_all_of_error_code_in_file.dart
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (c) 2020, 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:analysis_server/lsp_protocol/protocol_generated.dart';
-import 'package:analysis_server/lsp_protocol/protocol_special.dart';
-import 'package:analysis_server/src/lsp/constants.dart';
-import 'package:analysis_server/src/lsp/handlers/commands/simple_edit_handler.dart';
-import 'package:analysis_server/src/lsp/handlers/handlers.dart';
-import 'package:analysis_server/src/lsp/lsp_analysis_server.dart';
-import 'package:analysis_server/src/lsp/mapping.dart';
-import 'package:analysis_server/src/lsp/progress.dart';
-import 'package:analysis_server/src/services/correction/bulk_fix_processor.dart';
-import 'package:analysis_server/src/services/correction/change_workspace.dart';
-
-/// This command allows a client to request request applying all fixes for a
-/// type of error.
-class FixAllOfErrorCodeInFileCommandHandler extends SimpleEditCommandHandler {
-  FixAllOfErrorCodeInFileCommandHandler(LspAnalysisServer server)
-      : super(server);
-
-  @override
-  String get commandName => 'Fix All of Error Code in File';
-
-  @override
-  Future<ErrorOr<void>> handle(List<dynamic> arguments,
-      ProgressReporter reporter, CancellationToken cancellationToken) async {
-    if (arguments == null ||
-        arguments.length != 3 ||
-        arguments[0] is! String ||
-        arguments[1] is! String ||
-        (arguments[2] is! int && arguments[2] != null)) {
-      return ErrorOr.error(ResponseError(
-        code: ServerErrorCodes.InvalidCommandArguments,
-        message: '$commandName requires three arguments: '
-            '1) an ErrorCode, '
-            '2) a file path, '
-            '3) a document version',
-      ));
-    }
-
-    final errorCode = arguments[0] as String;
-    final path = arguments[1] as String;
-    final clientDocumentVersion = arguments[2] as int;
-
-    if (fileHasBeenModified(path, clientDocumentVersion)) {
-      return fileModifiedError;
-    }
-
-    final result = await requireResolvedUnit(path);
-
-    if (cancellationToken.isCancellationRequested) {
-      return error(ErrorCodes.RequestCancelled, 'Request was cancelled');
-    }
-
-    return result.mapResult((result) async {
-      final workspace = DartChangeWorkspace(server.currentSessions);
-      final processor =
-          BulkFixProcessor(server.instrumentationService, workspace);
-
-      final changeBuilder = await processor.fixOfTypeInUnit(result, errorCode);
-
-      final edit =
-          createWorkspaceEdit(server, changeBuilder.sourceChange.edits);
-
-      return await sendWorkspaceEditToClient(edit);
-    });
-  }
-}
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart
index 87d5edb..24a0131 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart
@@ -15,7 +15,6 @@
 import 'package:analysis_server/src/protocol_server.dart' hide Position;
 import 'package:analysis_server/src/services/correction/assist.dart';
 import 'package:analysis_server/src/services/correction/assist_internal.dart';
-import 'package:analysis_server/src/services/correction/bulk_fix_processor.dart';
 import 'package:analysis_server/src/services/correction/change_workspace.dart';
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analysis_server/src/services/correction/fix/dart/top_level_declarations.dart';
@@ -26,7 +25,6 @@
     show InconsistentAnalysisException;
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/src/generated/engine.dart' show AnalysisEngine;
-import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
 import 'package:collection/collection.dart' show groupBy;
 
 class CodeActionHandler extends MessageHandler<CodeActionParams,
@@ -172,26 +170,6 @@
     );
   }
 
-  /// Creates a CodeAction command to apply a particular fix for all instances of
-  /// a specific error in the file for [path].
-  CodeAction _createFixAllCommand(Fix fix, Diagnostic diagnostic, String path) {
-    final title = 'Apply all: ${fix.change.message}';
-    return CodeAction(
-      title: title,
-      kind: CodeActionKind.QuickFix,
-      diagnostics: [diagnostic],
-      command: Command(
-        command: Commands.fixAllOfErrorCodeInFile,
-        title: title,
-        arguments: [
-          diagnostic.code,
-          path,
-          server.getVersionedDocumentIdentifier(path).version
-        ],
-      ),
-    );
-  }
-
   /// Dedupes/merges actions that have the same title, selecting the one nearest [pos].
   ///
   /// If actions perform the same edit/command, their diagnostics will be merged
@@ -312,7 +290,6 @@
   ) async {
     final lineInfo = unit.lineInfo;
     final codeActions = <CodeAction>[];
-    final fixAllCodeActions = <CodeAction>[];
     final fixContributor = DartFixContributor();
 
     try {
@@ -323,13 +300,6 @@
             (errorCodeCounts[error.errorCode] ?? 0) + 1;
       }
 
-      // Because an error code may appear multiple times, cache the possible fixes
-      // as we discover them to avoid re-computing them for a given diagnostic.
-      final possibleFixesForErrorCode = <ErrorCode, Set<FixKind>>{};
-      final workspace = DartChangeWorkspace(server.currentSessions);
-      final processor =
-          BulkFixProcessor(server.instrumentationService, workspace);
-
       for (final error in unit.errors) {
         // Server lineNumber is one-based so subtract one.
         var errorLine = lineInfo.getLocation(error.offset).lineNumber - 1;
@@ -358,35 +328,9 @@
           codeActions.addAll(
             fixes.map((fix) => _createFixAction(fix, diagnostic)),
           );
-
-          // Only consider an apply-all if there's more than one of these errors.
-          if (errorCodeCounts[error.errorCode] > 1) {
-            // Find out which fixes the bulk processor can handle.
-            possibleFixesForErrorCode[error.errorCode] ??=
-                processor.producableFixesForError(unit, error).toSet();
-
-            // Get the intersection of single-fix kinds we created and those
-            // the bulk processor can handle.
-            final possibleFixes = possibleFixesForErrorCode[error.errorCode]
-                .intersection(fixes.map((f) => f.kind).toSet())
-                  // Exclude data-driven fixes as they're more likely to apply
-                  // different fixes for the same error/fix kind that users
-                  // might not expect.
-                  ..remove(DartFixKind.DATA_DRIVEN);
-
-            // Until we can apply a specific fix, only include apply-all when
-            // there's exactly one.
-            if (possibleFixes.length == 1) {
-              fixAllCodeActions.addAll(fixes.map(
-                  (fix) => _createFixAllCommand(fix, diagnostic, unit.path)));
-            }
-          }
         }
       }
 
-      // Append all fix-alls to the very end.
-      codeActions.addAll(fixAllCodeActions);
-
       final dedupedActions = _dedupeActions(codeActions, range.start);
 
       return dedupedActions
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_execute_command.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_execute_command.dart
index 60416b4..967e8e8 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_execute_command.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_execute_command.dart
@@ -5,7 +5,6 @@
 import 'package:analysis_server/lsp_protocol/protocol_generated.dart';
 import 'package:analysis_server/lsp_protocol/protocol_special.dart';
 import 'package:analysis_server/src/lsp/constants.dart';
-import 'package:analysis_server/src/lsp/handlers/commands/fix_all_of_error_code_in_file.dart';
 import 'package:analysis_server/src/lsp/handlers/commands/organize_imports.dart';
 import 'package:analysis_server/src/lsp/handlers/commands/perform_refactor.dart';
 import 'package:analysis_server/src/lsp/handlers/commands/send_workspace_edit.dart';
@@ -25,8 +24,6 @@
           Commands.organizeImports: OrganizeImportsCommandHandler(server),
           Commands.performRefactor: PerformRefactorCommandHandler(server),
           Commands.sendWorkspaceEdit: SendWorkspaceEditCommandHandler(server),
-          Commands.fixAllOfErrorCodeInFile:
-              FixAllOfErrorCodeInFileCommandHandler(server),
         },
         super(server);
 
diff --git a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
index 993388c..2f04089 100644
--- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
+++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
@@ -26,6 +26,7 @@
 import 'package:analysis_server/src/lsp/notification_manager.dart';
 import 'package:analysis_server/src/lsp/progress.dart';
 import 'package:analysis_server/src/lsp/server_capabilities_computer.dart';
+import 'package:analysis_server/src/plugin/notification_manager.dart';
 import 'package:analysis_server/src/plugin/plugin_manager.dart';
 import 'package:analysis_server/src/protocol_server.dart' as protocol;
 import 'package:analysis_server/src/server/crash_reporting_attachments.dart';
@@ -768,11 +769,10 @@
   /// The [ResourceProvider] by which paths are converted into [Resource]s.
   final ResourceProvider resourceProvider;
 
-  LspServerContextManagerCallbacks(this.analysisServer, this.resourceProvider);
+  /// The set of files for which notifications were sent.
+  final Set<String> filesToFlush = {};
 
-  @override
-  LspNotificationManager get notificationManager =>
-      analysisServer.notificationManager;
+  LspServerContextManagerCallbacks(this.analysisServer, this.resourceProvider);
 
   @override
   void afterContextsCreated() {
@@ -780,6 +780,14 @@
   }
 
   @override
+  void afterContextsDestroyed() {
+    for (var file in filesToFlush) {
+      analysisServer.publishDiagnostics(file, []);
+    }
+    filesToFlush.clear();
+  }
+
+  @override
   void afterWatchEvent(WatchEvent event) {
     // TODO: implement afterWatchEvent
   }
@@ -787,6 +795,7 @@
   @override
   void applyFileRemoved(String file) {
     analysisServer.publishDiagnostics(file, []);
+    filesToFlush.remove(file);
   }
 
   @override
@@ -808,6 +817,7 @@
             []);
     analysisDriver.results.listen((result) {
       var path = result.path;
+      filesToFlush.add(path);
       if (analysisServer.shouldSendErrorsNotificationFor(path)) {
         final serverErrors = protocol.mapEngineErrors(
             result,
@@ -851,12 +861,10 @@
   }
 
   @override
-  void removeContext(Folder folder, List<String> flushedFiles) {
-    var driver = analysisServer.driverMap.remove(folder);
-    // Flush any errors for these files that the client may be displaying.
-    flushedFiles
-        ?.forEach((path) => analysisServer.publishDiagnostics(path, const []));
-    driver.dispose();
+  void recordAnalysisErrors(String path, List<protocol.AnalysisError> errors) {
+    filesToFlush.add(path);
+    analysisServer.notificationManager
+        .recordAnalysisErrors(NotificationManager.serverId, path, errors);
   }
 
   bool _shouldSendDiagnostic(AnalysisError error) =>
diff --git a/pkg/analysis_server/lib/src/operation/operation_analysis.dart b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
index a53a0cf..e6672f4 100644
--- a/pkg/analysis_server/lib/src/operation/operation_analysis.dart
+++ b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
@@ -5,7 +5,6 @@
 import 'package:analysis_server/src/analysis_server.dart';
 import 'package:analysis_server/src/computer/computer_closingLabels.dart';
 import 'package:analysis_server/src/computer/computer_folding.dart';
-import 'package:analysis_server/src/computer/computer_highlights.dart';
 import 'package:analysis_server/src/computer/computer_outline.dart';
 import 'package:analysis_server/src/computer/computer_overrides.dart';
 import 'package:analysis_server/src/domains/analysis/implemented_dart.dart';
@@ -96,15 +95,6 @@
   });
 }
 
-void sendAnalysisNotificationHighlights(
-    AnalysisServer server, String file, CompilationUnit dartUnit) {
-  _sendNotification(server, () {
-    var regions = DartUnitHighlightsComputer(dartUnit).compute();
-    var params = protocol.AnalysisHighlightsParams(file, regions);
-    server.sendNotification(params.toNotification());
-  });
-}
-
 void sendAnalysisNotificationOutline(
     AnalysisServer server, ResolvedUnitResult resolvedUnit) {
   _sendNotification(server, () {
diff --git a/pkg/analysis_server/test/client/completion_driver_test.dart b/pkg/analysis_server/test/client/completion_driver_test.dart
index d80900b..ace6ad3 100644
--- a/pkg/analysis_server/test/client/completion_driver_test.dart
+++ b/pkg/analysis_server/test/client/completion_driver_test.dart
@@ -142,7 +142,7 @@
     );
     driver.createProject(packageRoots: packageRoots);
 
-    newFile('$projectPath/pubspec.yaml', content: '');
+    newPubspecYamlFile(projectPath, '');
     newFile('$projectPath/.packages', content: '''
 project:${toUri('$projectPath/lib')}
 ''');
diff --git a/pkg/analysis_server/test/domain_analysis_test.dart b/pkg/analysis_server/test/domain_analysis_test.dart
index dfa44a4..7849c51 100644
--- a/pkg/analysis_server/test/domain_analysis_test.dart
+++ b/pkg/analysis_server/test/domain_analysis_test.dart
@@ -58,7 +58,7 @@
   }
 
   Future<void> test_setAnalysisRoots_included_newFolder() async {
-    newFile('/project/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/project', 'name: project');
     var file = newFile('/project/bin/test.dart', content: 'main() {}').path;
     var response = testSetAnalysisRoots([projectPath], []);
     var serverRef = server;
@@ -342,6 +342,7 @@
     if (notification.event == ANALYSIS_NOTIFICATION_FLUSH_RESULTS) {
       var decoded = AnalysisFlushResultsParams.fromNotification(notification);
       flushResults.addAll(decoded.files);
+      decoded.files.forEach(filesErrors.remove);
     }
     if (notification.event == ANALYSIS_NOTIFICATION_ERRORS) {
       var decoded = AnalysisErrorsParams.fromNotification(notification);
@@ -397,7 +398,7 @@
       notAnalyzed: [options_path],
     );
 
-    // Add a non-Dart file that we know how to analyze.
+    // Add 'analysis_options.yaml' that has an error.
     newFile(options_path, content: '''
 analyzer:
   error:
@@ -645,6 +646,7 @@
   }
 
   Future<void> test_fileSystem_changeFile_analysisOptions() async {
+    var options_path = '$testPackageRootPath/analysis_options.yaml';
     var a_path = '$testPackageLibPath/a.dart';
     var b_path = '$testPackageLibPath/b.dart';
     var c_path = '$testPackageLibPath/c.dart';
@@ -652,7 +654,7 @@
     _createFilesWithErrors([a_path, b_path, c_path]);
 
     // Exclude b.dart from analysis.
-    newFile('$testPackageRootPath/analysis_options.yaml', content: r'''
+    newFile(options_path, content: r'''
 analyzer:
   exclude:
     - lib/b.dart
@@ -668,7 +670,7 @@
     );
 
     // Exclude c.dart from analysis.
-    newFile('$testPackageRootPath/analysis_options.yaml', content: r'''
+    newFile(options_path, content: r'''
 analyzer:
   exclude:
     - lib/c.dart
@@ -678,9 +680,10 @@
     await server.onAnalysisComplete;
 
     // Errors for all files were flushed, a.dart and b.dart analyzed.
-    _assertFlushedResults([a_path, c_path]);
+    _assertFlushedResults([options_path, a_path, c_path]);
     _assertAnalyzedFiles(
       hasErrors: [a_path, b_path],
+      noErrors: [options_path],
       notAnalyzed: [c_path],
     );
   }
@@ -710,7 +713,7 @@
     await pumpEventQueue();
     await server.onAnalysisComplete;
 
-    // An error was reports.
+    // An error was reported.
     assertHasErrors(path);
   }
 
@@ -896,13 +899,14 @@
   }
 
   Future<void> test_fileSystem_deleteFile_analysisOptions() async {
+    var options_path = '$testPackageRootPath/analysis_options.yaml';
     var a_path = '$testPackageLibPath/a.dart';
     var b_path = '$testPackageLibPath/b.dart';
 
     _createFilesWithErrors([a_path, b_path]);
 
     // Exclude b.dart from analysis.
-    newFile('$testPackageRootPath/analysis_options.yaml', content: r'''
+    newFile(options_path, content: r'''
 analyzer:
   exclude:
     - lib/b.dart
@@ -918,19 +922,46 @@
     );
 
     // Delete the options file.
-    deleteFile('$testPackageRootPath/analysis_options.yaml');
+    deleteFile(options_path);
 
     await pumpEventQueue();
     await server.onAnalysisComplete;
 
     // Errors for a.dart were flushed, a.dart and b.dart analyzed.
-    _assertFlushedResults([a_path]);
+    _assertFlushedResults([options_path, a_path]);
     _assertAnalyzedFiles(
       hasErrors: [a_path, b_path],
-      notAnalyzed: [],
+      notAnalyzed: [options_path],
     );
   }
 
+  Future<void> test_fileSystem_deleteFile_androidManifestXml() async {
+    var path = '$testPackageRootPath/AndroidManifest.xml';
+
+    newFile('$testPackageLibPath/a.dart', content: '');
+
+    // Has an error - no touch screen.
+    newFile(path, content: '<manifest/>');
+
+    newFile('$testPackageRootPath/analysis_options.yaml', content: '''
+analyzer:
+  optional-checks:
+    chrome-os-manifest-checks: true
+''');
+
+    setRoots(included: [workspaceRootPath], excluded: []);
+
+    // An error was reported.
+    _assertAnalyzedFiles(hasErrors: [path], notAnalyzed: []);
+
+    // Delete the file.
+    deleteFile(path);
+    await pumpEventQueue();
+
+    // We received a flush notification.
+    _assertAnalyzedFiles(hasErrors: [], notAnalyzed: [path]);
+  }
+
   Future<void> test_fileSystem_deleteFile_dart() async {
     var a_path = '$testPackageLibPath/a.dart';
 
@@ -941,7 +972,6 @@
 
     // a.dart was analyzed
     assertHasErrors(a_path);
-    forgetReceivedErrors();
 
     deleteFile(a_path);
     await pumpEventQueue();
@@ -1025,6 +1055,33 @@
     assertNoErrorsNotification(a_path);
   }
 
+  Future<void> test_fileSystem_deleteFile_fixDataYaml() async {
+    var path = '$testPackageLibPath/fix_data.yaml';
+
+    newFile('$testPackageLibPath/a.dart', content: '');
+
+    // Make sure that it is a package.
+    writePackageConfig(
+      '$testPackageRootPath/.dart_tool/package_config.json',
+      PackageConfigFileBuilder(),
+    );
+
+    // This file has an error.
+    newFile(path, content: '0: 1');
+
+    setRoots(included: [workspaceRootPath], excluded: []);
+
+    // The file was analyzed.
+    _assertAnalyzedFiles(hasErrors: [path], notAnalyzed: []);
+
+    // Delete the file.
+    deleteFile(path);
+    await pumpEventQueue();
+
+    // We received a flush notification.
+    _assertAnalyzedFiles(hasErrors: [], notAnalyzed: [path]);
+  }
+
   Future<void> test_fileSystem_deleteFile_packageConfigJsonFile() async {
     var aaaRootPath = '/packages/aaa';
     var a_path = '$aaaRootPath/lib/a.dart';
@@ -1295,12 +1352,17 @@
 
   void _assertAnalyzedFiles({
     @required List<String> hasErrors,
+    List<String> noErrors = const [],
     @required List<String> notAnalyzed,
   }) {
     for (var path in hasErrors) {
       assertHasErrors(path);
     }
 
+    for (var path in noErrors) {
+      assertNoErrors(path);
+    }
+
     for (var path in notAnalyzed) {
       assertNoErrorsNotification(path);
     }
diff --git a/pkg/analysis_server/test/domain_diagnostic_test.dart b/pkg/analysis_server/test/domain_diagnostic_test.dart
index 7fe3a38..f6a615c 100644
--- a/pkg/analysis_server/test/domain_diagnostic_test.dart
+++ b/pkg/analysis_server/test/domain_diagnostic_test.dart
@@ -25,7 +25,7 @@
   }
 
   Future<void> test_getDiagnostics() async {
-    newFile('/project/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/project', 'name: project');
     newFile('/project/bin/test.dart', content: 'main() {}');
 
     server.setAnalysisRoots('0', [convertPath('/project')], []);
diff --git a/pkg/analysis_server/test/edit/fixes_test.dart b/pkg/analysis_server/test/edit/fixes_test.dart
index 660af49..7a0ca44 100644
--- a/pkg/analysis_server/test/edit/fixes_test.dart
+++ b/pkg/analysis_server/test/edit/fixes_test.dart
@@ -151,7 +151,7 @@
 aaa:${toUri('/aaa/lib')}
 bbb:${toUri('/bbb/lib')}
 ''');
-    newFile('/aaa/pubspec.yaml', content: r'''
+    newPubspecYamlFile('/aaa', r'''
 dependencies:
   bbb: any
 ''');
diff --git a/pkg/analysis_server/test/lsp/code_actions_abstract.dart b/pkg/analysis_server/test/lsp/code_actions_abstract.dart
index 3f59ec8..67d220b 100644
--- a/pkg/analysis_server/test/lsp/code_actions_abstract.dart
+++ b/pkg/analysis_server/test/lsp/code_actions_abstract.dart
@@ -4,7 +4,6 @@
 
 import 'package:analysis_server/lsp_protocol/protocol_generated.dart';
 import 'package:analysis_server/lsp_protocol/protocol_special.dart';
-import 'package:analysis_server/src/lsp/constants.dart';
 import 'package:test/test.dart';
 
 import 'server_abstract.dart';
@@ -77,11 +76,13 @@
 
   Future<Either2<Command, CodeAction>> getFixAllAction(
       String title, Uri uri, String content) async {
-    final codeActions =
-        await getCodeActions(uri.toString(), range: rangeFromMarkers(content));
-    final fixAction =
-        findCommand(codeActions, Commands.fixAllOfErrorCodeInFile, title);
-    return fixAction;
+    // TODO(dantup): Fix this once new server support has landed.
+    throw UnimplementedError();
+    // final codeActions =
+    //     await getCodeActions(uri.toString(), range: rangeFromMarkers(content));
+    // final fixAction =
+    //     findCommand(codeActions, Commands.fixAllOfErrorCodeInFile, title);
+    // return fixAction;
   }
 
   /// Verifies that executing the given code actions command on the server
diff --git a/pkg/analysis_server/test/lsp/code_actions_fixes_test.dart b/pkg/analysis_server/test/lsp/code_actions_fixes_test.dart
index eadaf30..abc67e7 100644
--- a/pkg/analysis_server/test/lsp/code_actions_fixes_test.dart
+++ b/pkg/analysis_server/test/lsp/code_actions_fixes_test.dart
@@ -272,43 +272,10 @@
   @override
   String get testPackageLanguageVersion => latestLanguageVersion;
 
-  Future<void> test_fixAll_notForAmbigiousProducers() async {
-    // The ReplaceWithIsEmpty producer does not provide a FixKind up-front, as
-    // it may produce `REPLACE_WITH_IS_EMPTY` or `REPLACE_WITH_IS_NOT_EMPTY`
-    // depending on the code.
-    // This test ensures this does not crash, and does not produce an apply-all.
-    registerLintRules();
-    newFile(analysisOptionsPath, content: '''
-linter:
-  rules:
-    - prefer_is_empty
-    ''');
-
-    const content = '''
-var a = [];
-var b = a.[[length]] == 0;
-var c = a.length == 0;
-    ''';
-
-    newFile(mainFilePath, content: withoutMarkers(content));
-    await initialize(
-      textDocumentCapabilities: withCodeActionKinds(
-          emptyTextDocumentClientCapabilities, [CodeActionKind.QuickFix]),
-    );
-
-    final allFixes = await getCodeActions(mainFileUri.toString(),
-        range: rangeFromMarkers(content));
-
-    // Expect only the single-fix, there should be no apply-all.
-    expect(allFixes, hasLength(1));
-    final fixTitle = allFixes.first.map((f) => f.title, (f) => f.title);
-    expect(fixTitle, equals("Replace with \'isEmpty\'"));
-  }
-
   Future<void> test_fixAll_notWhenNoBatchFix() async {
     // Some fixes (for example 'create function foo') are not available in the
-    // batch processor, so should not generate Apply-all fixes even if there
-    // are multiple.
+    // batch processor, so should not generate fix-all-in-file fixes even if there
+    // are multiple instances.
     const content = '''
 var a = [[foo]]();
 var b = bar();
@@ -329,7 +296,10 @@
     expect(fixTitle, equals("Create function 'foo'"));
   }
 
+  @failingTest
   Future<void> test_fixAll_notWhenSingle() async {
+    // TODO(dantup): Fix the text used to locate the fix once the
+    // new server support has landed.
     const content = '''
 void f(String a) {
   [[print(a!)]];
@@ -349,7 +319,10 @@
     expect(fixAction, isNull);
   }
 
+  @failingTest
   Future<void> test_fixAll_whenMultiple() async {
+    // TODO(dantup): Fix this test up to use the new server support for
+    // fix-all-in-file once landed.
     const content = '''
 void f(String a) {
   [[print(a!!)]];
diff --git a/pkg/analysis_server/test/src/domains/completion/available_suggestions_base.dart b/pkg/analysis_server/test/src/domains/completion/available_suggestions_base.dart
index 095ebcb..1f4317b 100644
--- a/pkg/analysis_server/test/src/domains/completion/available_suggestions_base.dart
+++ b/pkg/analysis_server/test/src/domains/completion/available_suggestions_base.dart
@@ -79,7 +79,7 @@
     projectPath = convertPath('/home');
     testFile = convertPath('/home/test/lib/test.dart');
 
-    newFile('/home/test/pubspec.yaml', content: '');
+    newPubspecYamlFile('/home/test', '');
     newFile('/home/test/.packages', content: '''
 test:${toUri('/home/test/lib')}
 ''');
diff --git a/pkg/analysis_server/test/src/domains/flutter/base.dart b/pkg/analysis_server/test/src/domains/flutter/base.dart
index cab39fd..2cadf8b 100644
--- a/pkg/analysis_server/test/src/domains/flutter/base.dart
+++ b/pkg/analysis_server/test/src/domains/flutter/base.dart
@@ -43,7 +43,7 @@
     projectPath = convertPath('/home');
     testFile = convertPath('/home/test/lib/test.dart');
 
-    newFile('/home/test/pubspec.yaml', content: '');
+    newPubspecYamlFile('/home/test', '');
     newFile('/home/test/.packages', content: '''
 test:${toUri('/home/test/lib')}
 ''');
diff --git a/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart b/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
index ba21d9d..5a00d64 100644
--- a/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
+++ b/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
@@ -508,7 +508,7 @@
           buffer.writeln('  $dependency: any');
         }
       }
-      newFile('$packageRoot/pubspec.yaml', content: buffer.toString());
+      newPubspecYamlFile(packageRoot, buffer.toString());
       return packageRoot;
     }
 
diff --git a/pkg/analysis_server/test/src/plugin/plugin_watcher_test.dart b/pkg/analysis_server/test/src/plugin/plugin_watcher_test.dart
index 08c6c05..7fbb0e6 100644
--- a/pkg/analysis_server/test/src/plugin/plugin_watcher_test.dart
+++ b/pkg/analysis_server/test/src/plugin/plugin_watcher_test.dart
@@ -40,7 +40,7 @@
     var pkg1Path = newFolder('/pkg1').path;
     newFile('/pkg1/lib/test1.dart');
     newFile('/pkg2/lib/pkg2.dart');
-    newFile('/pkg2/pubspec.yaml', content: 'name: pkg2');
+    newPubspecYamlFile('/pkg2', 'name: pkg2');
     newFile(
         '/pkg2/${PluginLocator.toolsFolderName}/${PluginLocator.defaultPluginFolderName}/bin/plugin.dart');
 
diff --git a/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart b/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart
index 9e5a66a..fcfed31 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart
@@ -72,7 +72,7 @@
         ..add(name: 'my_pkg', rootPath: '/.pub-cache/my_pkg'),
     );
 
-    newFile('/home/test/pubspec.yaml', content: r'''
+    newPubspecYamlFile('/home/test', r'''
 dependencies:
   my_pkg: any
 ''');
@@ -106,7 +106,7 @@
         ..add(name: 'my_pkg', rootPath: '/.pub-cache/my_pkg'),
     );
 
-    newFile('/home/test/pubspec.yaml', content: r'''
+    newPubspecYamlFile('/home/test', r'''
 dependencies:
   my_pkg: any
 ''');
@@ -134,7 +134,7 @@
         ..add(name: 'my_pkg', rootPath: '/.pub-cache/my_pkg'),
     );
 
-    newFile('/home/test/pubspec.yaml', content: r'''
+    newPubspecYamlFile('/home/test', r'''
 dependencies:
   my_pkg: any
 ''');
@@ -620,7 +620,7 @@
         ..add(name: 'my_pkg', rootPath: '/.pub-cache/my_pkg'),
     );
 
-    newFile('/home/test/pubspec.yaml', content: r'''
+    newPubspecYamlFile('/home/test', r'''
 dependencies:
   my_pkg: any
 ''');
@@ -649,7 +649,7 @@
         ..add(name: 'my_pkg', rootPath: '/.pub-cache/my_pkg'),
     );
 
-    newFile('/home/test/pubspec.yaml', content: r'''
+    newPubspecYamlFile('/home/test', r'''
 dependencies:
   my_pkg: any
 ''');
@@ -682,7 +682,7 @@
         ..add(name: 'my_pkg', rootPath: '/.pub-cache/my_pkg'),
     );
 
-    newFile('/home/test/pubspec.yaml', content: r'''
+    newPubspecYamlFile('/home/test', r'''
 dependencies:
   my_pkg: any
 ''');
diff --git a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
index e588646..6e0252d 100644
--- a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
+++ b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
@@ -908,6 +908,8 @@
 }
 
 dynamic JS(a, b, c, d) {}
+
+class File {}
 ''',
     )
   ],
diff --git a/pkg/analyzer/lib/src/test_utilities/resource_provider_mixin.dart b/pkg/analyzer/lib/src/test_utilities/resource_provider_mixin.dart
index 4358c03..bf332b0 100644
--- a/pkg/analyzer/lib/src/test_utilities/resource_provider_mixin.dart
+++ b/pkg/analyzer/lib/src/test_utilities/resource_provider_mixin.dart
@@ -5,6 +5,7 @@
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/file_system/memory_file_system.dart';
 import 'package:analyzer/src/dart/analysis/context_locator.dart';
+import 'package:analyzer/src/util/file_paths.dart' as file_paths;
 
 /// A mixin for test classes that adds a [ResourceProvider] and utility methods
 /// for manipulating the file system. The utility methods all take a posix style
@@ -70,6 +71,11 @@
     return newFile(path);
   }
 
+  File newPubspecYamlFile(String directoryPath, String content) {
+    String path = join(directoryPath, file_paths.pubspecYaml);
+    return newFile(path, content: content);
+  }
+
   Uri toUri(String path) {
     path = convertPath(path);
     return resourceProvider.pathContext.toUri(path);
diff --git a/pkg/analyzer/test/src/context/builder_test.dart b/pkg/analyzer/test/src/context/builder_test.dart
index 071f9e2..7b4e4fa 100644
--- a/pkg/analyzer/test/src/context/builder_test.dart
+++ b/pkg/analyzer/test/src/context/builder_test.dart
@@ -395,14 +395,14 @@
   void test_createWorkspace_hasPackagesFile_hasDartToolAndPubspec() {
     newFile('/workspace/.packages');
     newFolder('/workspace/.dart_tool/build/generated/project/lib');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     Workspace workspace = _createWorkspace('/workspace/project/lib/lib.dart');
     expect(workspace, TypeMatcher<PackageBuildWorkspace>());
   }
 
   void test_createWorkspace_hasPackagesFile_hasPubspec() {
     newFile('/workspace/.packages');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     Workspace workspace = _createWorkspace('/workspace/project/lib/lib.dart');
     expect(workspace, TypeMatcher<PubWorkspace>());
   }
@@ -422,7 +422,7 @@
 
   void test_createWorkspace_noPackagesFile_hasDartToolAndPubspec() {
     newFolder('/workspace/.dart_tool/build/generated/project/lib');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     Workspace workspace = _createWorkspace('/workspace/project/lib/lib.dart');
     expect(workspace, TypeMatcher<PackageBuildWorkspace>());
   }
@@ -440,7 +440,7 @@
   }
 
   void test_createWorkspace_noPackagesFile_hasPubspec() {
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     Workspace workspace = _createWorkspace('/workspace/project/lib/lib.dart');
     expect(workspace, TypeMatcher<PubWorkspace>());
   }
diff --git a/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart b/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
index 350f2f6..3582753 100644
--- a/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
+++ b/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
@@ -329,10 +329,7 @@
   }
 
   void writeTestPackagePubspecYamlFile(PubspecYamlFileConfig config) {
-    newFile(
-      '$testPackageRootPath/pubspec.yaml',
-      content: config.toContent(),
-    );
+    newPubspecYamlFile(testPackageRootPath, config.toContent());
   }
 }
 
diff --git a/pkg/analyzer/test/src/diagnostics/ambiguous_import_test.dart b/pkg/analyzer/test/src/diagnostics/ambiguous_import_test.dart
index 1dbb8a7..dd7b71f 100644
--- a/pkg/analyzer/test/src/diagnostics/ambiguous_import_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/ambiguous_import_test.dart
@@ -55,18 +55,6 @@
     ]);
   }
 
-  @FailingTest(reason: 'Different approach to MockSdk')
-  test_dart() async {
-    await assertErrorsInCode('''
-import 'dart:async';
-import 'dart:async2';
-
-Future v;
-''', [
-      error(CompileTimeErrorCode.AMBIGUOUS_IMPORT, 44, 6),
-    ]);
-  }
-
   test_extends() async {
     newFile("$testPackageLibPath/lib1.dart", content: '''
 library lib1;
@@ -177,6 +165,30 @@
     ]);
   }
 
+  test_systemLibrary_nonSystemLibrary() async {
+    // From the spec, "a declaration from a non-system library shadows
+    // declarations from system libraries."
+    newFile('$testPackageLibPath/a.dart', content: '''
+class StreamController {}
+''');
+    await assertNoErrorsInCode('''
+import 'dart:async'; // ignore: unused_import
+import 'a.dart';
+
+StreamController s = StreamController();
+''');
+  }
+
+  test_systemLibrary_systemLibrary() async {
+    await assertErrorsInCode('''
+import 'dart:html';
+import 'dart:io';
+g(File f) {}
+''', [
+      error(CompileTimeErrorCode.AMBIGUOUS_IMPORT, 40, 4),
+    ]);
+  }
+
   test_typeAnnotation() async {
     newFile("$testPackageLibPath/lib1.dart", content: '''
 library lib1;
diff --git a/pkg/analyzer/test/src/diagnostics/deprecated_member_use_test.dart b/pkg/analyzer/test/src/diagnostics/deprecated_member_use_test.dart
index 20c8729..a54b50c 100644
--- a/pkg/analyzer/test/src/diagnostics/deprecated_member_use_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/deprecated_member_use_test.dart
@@ -343,10 +343,10 @@
   }
 
   test_differentPackage() async {
-    newFile('$workspaceRootPath/my/pubspec.yaml');
+    newPubspecYamlFile('$workspaceRootPath/my', '');
     newFile('$workspaceRootPath/my/BUILD.gn');
 
-    newFile('$workspaceRootPath/aaa/pubspec.yaml');
+    newPubspecYamlFile('$workspaceRootPath/aaa', '');
     newFile('$workspaceRootPath/aaa/BUILD.gn');
 
     _writeWorkspacePackagesFile({
@@ -369,7 +369,7 @@
   }
 
   test_samePackage() async {
-    newFile('$workspaceRootPath/my/pubspec.yaml');
+    newPubspecYamlFile('$workspaceRootPath/my', '');
     newFile('$workspaceRootPath/my/BUILD.gn');
 
     _writeWorkspacePackagesFile({
@@ -422,7 +422,7 @@
         ..add(name: 'aaa', rootPath: '$workspaceRootPath/aaa'),
     );
 
-    newFile('$testPackageRootPath/pubspec.yaml', content: 'name: test');
+    newPubspecYamlFile(testPackageRootPath, 'name: test');
     _newTestPackageGeneratedFile(
       packageName: 'aaa',
       pathInLib: 'a.dart',
@@ -452,7 +452,7 @@
 class A {}
 ''');
 
-    newFile('$testPackageRootPath/pubspec.yaml', content: 'name: test');
+    newPubspecYamlFile(testPackageRootPath, 'name: test');
     _createTestPackageBuildMarker();
 
     await assertErrorsInCode(r'''
@@ -1466,7 +1466,7 @@
 class DeprecatedMemberUseFromSamePackage_PackageBuildWorkspaceTest
     extends _PackageBuildWorkspaceBase {
   test_generated() async {
-    newFile('$testPackageRootPath/pubspec.yaml', content: 'name: test');
+    newPubspecYamlFile(testPackageRootPath, 'name: test');
 
     _newTestPackageGeneratedFile(
       packageName: 'test',
@@ -1487,7 +1487,7 @@
   }
 
   test_lib() async {
-    newFile('$testPackageRootPath/pubspec.yaml', content: 'name: test');
+    newPubspecYamlFile(testPackageRootPath, 'name: test');
     _createTestPackageBuildMarker();
 
     newFile('$testPackageLibPath/a.dart', content: r'''
diff --git a/pkg/analyzer/test/src/diagnostics/invalid_export_of_internal_element_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_export_of_internal_element_test.dart
index b960a44..c52be8b 100644
--- a/pkg/analyzer/test/src/diagnostics/invalid_export_of_internal_element_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/invalid_export_of_internal_element_test.dart
@@ -282,7 +282,7 @@
   void setUp() async {
     super.setUp();
     writeTestPackageConfigWithMeta();
-    newFile('$testPackageRootPath/pubspec.yaml', content: r'''
+    newPubspecYamlFile(testPackageRootPath, r'''
 name: test
 version: 0.0.1
 ''');
diff --git a/pkg/analyzer/test/src/diagnostics/invalid_internal_annotation_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_internal_annotation_test.dart
index 8a3ca44..af21ed0 100644
--- a/pkg/analyzer/test/src/diagnostics/invalid_internal_annotation_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/invalid_internal_annotation_test.dart
@@ -21,7 +21,7 @@
   void setUp() async {
     super.setUp();
     writeTestPackageConfigWithMeta();
-    newFile('$testPackageRootPath/pubspec.yaml', content: r'''
+    newPubspecYamlFile(testPackageRootPath, r'''
 name: test
 version: 0.0.1
 ''');
diff --git a/pkg/analyzer/test/src/lint/linter/linter_context_impl_test.dart b/pkg/analyzer/test/src/lint/linter/linter_context_impl_test.dart
index c9f2359..d650578 100644
--- a/pkg/analyzer/test/src/lint/linter/linter_context_impl_test.dart
+++ b/pkg/analyzer/test/src/lint/linter/linter_context_impl_test.dart
@@ -463,7 +463,7 @@
 @reflectiveTest
 class PubDependencyTest extends AbstractLinterContextTest {
   test_dependencies() async {
-    newFile('$testPackageRootPath/pubspec.yaml', content: '''
+    newPubspecYamlFile(testPackageRootPath, '''
 name: test
 
 dependencies:
diff --git a/pkg/analyzer/test/src/pubspec/pubspec_validator_test.dart b/pkg/analyzer/test/src/pubspec/pubspec_validator_test.dart
index 7e2437f..7ad97b0 100644
--- a/pkg/analyzer/test/src/pubspec/pubspec_validator_test.dart
+++ b/pkg/analyzer/test/src/pubspec/pubspec_validator_test.dart
@@ -298,7 +298,7 @@
 
   test_dependencyPath_noVersion_valid() {
     newFolder('/foo');
-    newFile('/foo/pubspec.yaml', content: '''
+    newPubspecYamlFile('/foo', '''
 name: foo
 ''');
     assertNoErrors('''
@@ -321,7 +321,7 @@
 
   test_dependencyPath_pubspecExists() {
     newFolder('/foo');
-    newFile('/foo/pubspec.yaml', content: '''
+    newPubspecYamlFile('/foo', '''
 name: foo
 ''');
     assertNoErrors('''
@@ -334,7 +334,7 @@
 
   test_dependencyPath_valid_absolute() {
     newFolder('/foo');
-    newFile('/foo/pubspec.yaml', content: '''
+    newPubspecYamlFile('/foo', '''
 name: foo
 ''');
     assertNoErrors('''
@@ -347,7 +347,7 @@
 
   test_dependencyPath_valid_relative() {
     newFolder('/foo');
-    newFile('/foo/pubspec.yaml', content: '''
+    newPubspecYamlFile('/foo', '''
 name: foo
 ''');
     assertNoErrors('''
@@ -360,7 +360,7 @@
 
   test_dependencyPath_version_error() {
     newFolder('/foo');
-    newFile('/foo/pubspec.yaml', content: '''
+    newPubspecYamlFile('/foo', '''
 name: foo
 ''');
     assertErrors('''
@@ -374,7 +374,7 @@
 
   test_dependencyPath_version_valid() {
     newFolder('/foo');
-    newFile('/foo/pubspec.yaml', content: '''
+    newPubspecYamlFile('/foo', '''
 name: foo
 ''');
     assertNoErrors('''
@@ -442,7 +442,7 @@
 
   test_devDependencyPathExists() {
     newFolder('/foo');
-    newFile('/foo/pubspec.yaml', content: '''
+    newPubspecYamlFile('/foo', '''
 name: foo
 ''');
     assertNoErrors('''
@@ -507,7 +507,7 @@
 
   test_pathNotPosix_error() {
     newFolder('/foo');
-    newFile('/foo/pubspec.yaml', content: '''
+    newPubspecYamlFile('/foo', '''
 name: foo
 ''');
     assertErrors(r'''
diff --git a/pkg/analyzer/test/src/services/available_declarations_test.dart b/pkg/analyzer/test/src/services/available_declarations_test.dart
index 752bf6d..6ba066f 100644
--- a/pkg/analyzer/test/src/services/available_declarations_test.dart
+++ b/pkg/analyzer/test/src/services/available_declarations_test.dart
@@ -115,14 +115,14 @@
   test_changesStream_noDuplicates() async {
     newFile('/home/aaa/lib/a.dart', content: 'class A {}');
 
-    newFile('/home/bbb/pubspec.yaml', content: r'''
+    newPubspecYamlFile('/home/bbb', r'''
 dependencies:
   aaa: any
 ''');
     addDotPackagesDependency('/home/bbb/.packages', 'aaa', '/home/aaa');
     newFile('/home/bbb/lib/b.dart', content: 'class B {}');
 
-    newFile('/home/ccc/pubspec.yaml', content: r'''
+    newPubspecYamlFile('/home/ccc', r'''
 dependencies:
   aaa: any
 ''');
@@ -553,7 +553,7 @@
     var testPath = convertPath('/home/test');
     var filePath = convertPath('/packages/aaa/lib/a.dart');
 
-    newFile('/home/test/pubspec.yaml', content: r'''
+    newPubspecYamlFile('/home/test', r'''
 name: test
 dependencies:
   aaa: any
@@ -3123,7 +3123,7 @@
     newFile('/home/ccc/lib/c.dart', content: 'class C {}');
     newFile('/home/ccc/lib/src/c2.dart', content: 'class C2 {}');
 
-    newFile('/home/test/pubspec.yaml', content: r'''
+    newPubspecYamlFile('/home/test', r'''
 name: test
 dependencies:
   aaa: any
@@ -3135,7 +3135,7 @@
     newFile('/home/test/bin/t3.dart', content: 'class T3 {}');
     newFile('/home/test/test/t4.dart', content: 'class T4 {}');
 
-    newFile('/home/test/samples/basic/pubspec.yaml', content: r'''
+    newPubspecYamlFile('/home/test/samples/basic', r'''
 name: test
 dependencies:
   ccc: any
diff --git a/pkg/analyzer/test/src/workspace/gn_test.dart b/pkg/analyzer/test/src/workspace/gn_test.dart
index d25eb2a..1672d60 100644
--- a/pkg/analyzer/test/src/workspace/gn_test.dart
+++ b/pkg/analyzer/test/src/workspace/gn_test.dart
@@ -158,7 +158,7 @@
   void test_find_withRoot() {
     newFolder('/workspace/.jiri_root');
     newFolder('/workspace/some/code');
-    newFile('/workspace/some/code/pubspec.yaml');
+    newPubspecYamlFile('/workspace/some/code', '');
     String buildDir = convertPath('out/debug-x87_128');
     newFile('/workspace/.fx-build-dir', content: '$buildDir\n');
     newFile(
@@ -171,7 +171,7 @@
   void test_packages() {
     newFolder('/workspace/.jiri_root');
     newFolder('/workspace/some/code');
-    newFile('/workspace/some/code/pubspec.yaml');
+    newPubspecYamlFile('/workspace/some/code', '');
     String buildDir = convertPath('out/debug-x87_128');
     newFile('/workspace/.fx-build-dir', content: '$buildDir\n');
     String packageLocation = convertPath('/workspace/this/is/the/package');
@@ -200,7 +200,7 @@
   void test_packages_absoluteBuildDir() {
     newFolder('/workspace/.jiri_root');
     newFolder('/workspace/some/code');
-    newFile('/workspace/some/code/pubspec.yaml');
+    newPubspecYamlFile('/workspace/some/code', '');
     String buildDir = convertPath('/workspace/out/debug-x87_128');
     newFile('/workspace/.fx-build-dir', content: '$buildDir\n');
     String packageLocation = convertPath('/workspace/this/is/the/package');
@@ -229,7 +229,7 @@
   void test_packages_fallbackBuildDir() {
     newFolder('/workspace/.jiri_root');
     newFolder('/workspace/some/code');
-    newFile('/workspace/some/code/pubspec.yaml');
+    newPubspecYamlFile('/workspace/some/code', '');
     String packageLocation = convertPath('/workspace/this/is/the/package');
     Uri packageUri = resourceProvider.pathContext.toUri(packageLocation);
     newFile(
@@ -256,7 +256,7 @@
   void test_packages_fallbackBuildDirWithUselessConfig() {
     newFolder('/workspace/.jiri_root');
     newFolder('/workspace/some/code');
-    newFile('/workspace/some/code/pubspec.yaml');
+    newPubspecYamlFile('/workspace/some/code', '');
     newFile('/workspace/.fx-build-dir', content: '');
     String packageLocation = convertPath('/workspace/this/is/the/package');
     Uri packageUri = resourceProvider.pathContext.toUri(packageLocation);
@@ -284,7 +284,7 @@
   void test_packages_multipleCandidates() {
     newFolder('/workspace/.jiri_root');
     newFolder('/workspace/some/code');
-    newFile('/workspace/some/code/pubspec.yaml');
+    newPubspecYamlFile('/workspace/some/code', '');
     String buildDir = convertPath('out/release-y22_256');
     newFile('/workspace/.fx-build-dir', content: '$buildDir\n');
     String packageLocation = convertPath('/workspace/this/is/the/package');
@@ -329,7 +329,7 @@
   void test_packages_multipleFiles() {
     newFolder('/workspace/.jiri_root');
     newFolder('/workspace/some/code');
-    newFile('/workspace/some/code/pubspec.yaml');
+    newPubspecYamlFile('/workspace/some/code', '');
     String buildDir = convertPath('out/debug-x87_128');
     newFile('/workspace/.fx-build-dir', content: '$buildDir\n');
     String packageOneLocation = convertPath('/workspace/this/is/the/package');
diff --git a/pkg/analyzer/test/src/workspace/package_build_test.dart b/pkg/analyzer/test/src/workspace/package_build_test.dart
index 7531186..8ce842f 100644
--- a/pkg/analyzer/test/src/workspace/package_build_test.dart
+++ b/pkg/analyzer/test/src/workspace/package_build_test.dart
@@ -46,7 +46,7 @@
 
   void setUp() {
     newFolder('/workspace/.dart_tool/build/generated/project/lib');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
 
     workspace = PackageBuildWorkspace.find(
       resourceProvider,
@@ -132,7 +132,7 @@
   }
 
   void setUp() {
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
   }
 
   void test_resolveAbsolute_generated() {
@@ -239,7 +239,7 @@
   String get myWorkspacePath => '/workspace';
 
   void setUp() {
-    newFile('$myPackageRootPath/pubspec.yaml', content: 'name: my');
+    newPubspecYamlFile(myPackageRootPath, 'name: my');
     newFolder(myPackageGeneratedPath);
 
     myWorkspace = PackageBuildWorkspace.find(
@@ -386,7 +386,7 @@
 class PackageBuildWorkspaceTest with ResourceProviderMixin {
   void test_builtFile_currentProject() {
     newFolder('/workspace/.dart_tool/build');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     PackageBuildWorkspace workspace =
         _createWorkspace('/workspace', ['project']);
 
@@ -398,7 +398,7 @@
 
   void test_builtFile_importedPackage() {
     newFolder('/workspace/.dart_tool/build');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     PackageBuildWorkspace workspace =
         _createWorkspace('/workspace', ['project', 'foo']);
 
@@ -409,7 +409,7 @@
 
   void test_builtFile_notInPackagesGetsHidden() {
     newFolder('/workspace/.dart_tool/build');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
 
     // Ensure package:bar is not configured.
     PackageBuildWorkspace workspace =
@@ -437,10 +437,10 @@
 
   void test_find_hasBuild_hasPubspec_malformed_dontGoToUp() {
     newFolder('/workspace/.dart_tool/build/generated');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
 
     newFolder('/workspace/aaa/.dart_tool/build/generated');
-    newFile('/workspace/aaa/pubspec.yaml', content: '*');
+    newPubspecYamlFile('/workspace/aaa', '*');
 
     var workspace = PackageBuildWorkspace.find(
       resourceProvider,
@@ -452,7 +452,7 @@
 
   void test_find_hasDartToolAndPubspec() {
     newFolder('/workspace/.dart_tool/build/generated/project/lib');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     var workspace = PackageBuildWorkspace.find(
       resourceProvider,
       {},
@@ -465,9 +465,8 @@
   void test_find_hasDartToolAndPubspec_inParentDirectory() {
     newFolder('/workspace/.dart_tool/build/generated/project/lib');
     newFolder('/workspace/opened/up/a/child/dir/.dart_tool/build');
-    newFile('/workspace/opened/up/a/child/dir/pubspec.yaml',
-        content: 'name: subproject');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace/opened/up/a/child/dir', 'name: subproject');
+    newPubspecYamlFile('/workspace', 'name: project');
     var workspace = PackageBuildWorkspace.find(
       resourceProvider,
       {},
@@ -481,7 +480,7 @@
     newFolder('/workspace/.dart_tool/build/generated/project/lib');
     newFolder('/workspace/opened/up/a/child/dir');
     newFolder('/workspace/opened/up/a/child/dir/.dart_tool/build');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     var workspace = PackageBuildWorkspace.find(
       resourceProvider,
       {},
@@ -494,7 +493,7 @@
   void test_find_hasDartToolNoBuild() {
     // Edge case: an empty .dart_tool directory. Don't assume package:build.
     newFolder('/workspace/.dart_tool');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     var workspace = PackageBuildWorkspace.find(
       resourceProvider,
       {},
@@ -516,7 +515,7 @@
   void test_find_hasDartToolPubButNotBuild() {
     // Dart projects will have this directory, that don't use package:build.
     newFolder('/workspace/.dart_tool/pub');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     var workspace = PackageBuildWorkspace.find(
       resourceProvider,
       {},
@@ -527,7 +526,7 @@
 
   void test_find_hasMalformedPubspec() {
     newFolder('/workspace/.dart_tool/build/generated/project/lib');
-    newFile('/workspace/pubspec.yaml', content: 'not: yaml: here! 1111');
+    newPubspecYamlFile('/workspace', 'not: yaml: here! 1111');
     var workspace = PackageBuildWorkspace.find(
       resourceProvider,
       {},
@@ -538,9 +537,9 @@
 
   void test_find_hasPubspec_noDartTool_dontGoUp() {
     newFolder('/workspace/.dart_tool/build/generated');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
 
-    newFile('/workspace/aaa/pubspec.yaml', content: '*');
+    newPubspecYamlFile('/workspace/aaa', '*');
 
     var workspace = PackageBuildWorkspace.find(
       resourceProvider,
@@ -551,7 +550,7 @@
   }
 
   void test_find_hasPubspecNoDartTool() {
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     var workspace = PackageBuildWorkspace.find(
       resourceProvider,
       {},
@@ -562,7 +561,7 @@
 
   void test_findFile_bin() {
     newFolder('/workspace/.dart_tool/build/generated/project/bin');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     PackageBuildWorkspace workspace =
         _createWorkspace('/workspace', ['project']);
 
@@ -573,7 +572,7 @@
 
   void test_findFile_binGenerated() {
     newFolder('/workspace/.dart_tool/build/generated/project/bin');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     PackageBuildWorkspace workspace =
         _createWorkspace('/workspace', ['project']);
 
@@ -585,7 +584,7 @@
 
   void test_findFile_libGenerated() {
     newFolder('/workspace/.dart_tool/build/generated/project/lib');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     PackageBuildWorkspace workspace =
         _createWorkspace('/workspace', ['project']);
 
@@ -597,7 +596,7 @@
 
   void test_findFile_test() {
     newFolder('/workspace/.dart_tool/build/generated/project/test');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     PackageBuildWorkspace workspace =
         _createWorkspace('/workspace', ['project']);
 
@@ -608,7 +607,7 @@
 
   void test_findFile_testGenerated() {
     newFolder('/workspace/.dart_tool/build/generated/project/test');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     PackageBuildWorkspace workspace =
         _createWorkspace('/workspace', ['project']);
 
@@ -620,7 +619,7 @@
 
   void test_findFile_web() {
     newFolder('/workspace/.dart_tool/build/generated/project/web');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     PackageBuildWorkspace workspace =
         _createWorkspace('/workspace', ['project']);
 
@@ -631,7 +630,7 @@
 
   void test_findFile_webGenerated() {
     newFolder('/workspace/.dart_tool/build/generated/project/web');
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     PackageBuildWorkspace workspace =
         _createWorkspace('/workspace', ['project']);
 
diff --git a/pkg/analyzer/test/src/workspace/pub_test.dart b/pkg/analyzer/test/src/workspace/pub_test.dart
index 12ab9c6..f69f1c2 100644
--- a/pkg/analyzer/test/src/workspace/pub_test.dart
+++ b/pkg/analyzer/test/src/workspace/pub_test.dart
@@ -20,7 +20,7 @@
 @reflectiveTest
 class PubWorkspacePackageTest extends WorkspacePackageTest {
   setUp() {
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     workspace = PubWorkspace.find(
         resourceProvider,
         {
@@ -85,7 +85,7 @@
 @reflectiveTest
 class PubWorkspaceTest with ResourceProviderMixin {
   void test_find_directory() {
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     var workspace =
         PubWorkspace.find(resourceProvider, {}, convertPath('/workspace'))!;
     expect(workspace.isBazel, isFalse);
@@ -100,7 +100,7 @@
   }
 
   void test_find_file() {
-    newFile('/workspace/pubspec.yaml', content: 'name: project');
+    newPubspecYamlFile('/workspace', 'name: project');
     var workspace = PubWorkspace.find(
         resourceProvider, {}, convertPath('/workspace/lib/lib1.dart'))!;
     expect(workspace.root, convertPath('/workspace'));
diff --git a/pkg/dart_internal/pubspec.yaml b/pkg/dart_internal/pubspec.yaml
index 64adb7f..3be9909 100644
--- a/pkg/dart_internal/pubspec.yaml
+++ b/pkg/dart_internal/pubspec.yaml
@@ -1,5 +1,5 @@
 name: dart_internal
-version: 0.1.12-nullsafety.1
+version: 0.2.0
 repository: https://github.com/dart-lang/sdk/tree/master/pkg/dart_internal
 description: >
   This package is not intended for wide use. It provides a temporary API to
@@ -16,4 +16,4 @@
 environment:
   # Restrict the upper bound so that we can remove support for this in a later
   # version of the SDK without it being a breaking change.
-  sdk: ">=2.10.0-0 <2.12.0"
+  sdk: ">=2.12.0-0 <2.13.0"
diff --git a/pkg/dartdev/lib/dartdev.dart b/pkg/dartdev/lib/dartdev.dart
index b194847..a8f9780 100644
--- a/pkg/dartdev/lib/dartdev.dart
+++ b/pkg/dartdev/lib/dartdev.dart
@@ -10,6 +10,7 @@
 import 'package:args/command_runner.dart';
 import 'package:cli_util/cli_logging.dart';
 import 'package:dart_style/src/cli/format_command.dart';
+import 'package:meta/meta.dart';
 import 'package:nnbd_migration/migration_cli.dart';
 import 'package:pedantic/pedantic.dart';
 import 'package:pub/pub.dart';
@@ -112,22 +113,30 @@
   String get invocation =>
       'dart [<vm-flags>] <command|dart-file> [<arguments>]';
 
+  @visibleForTesting
+  Analytics get analytics => _analytics;
+  Analytics _analytics;
+
   @override
   Future<int> runCommand(ArgResults topLevelResults) async {
     final stopwatch = Stopwatch()..start();
     // The Analytics instance used to report information back to Google Analytics;
     // see lib/src/analytics.dart.
-    final analytics = createAnalyticsInstance(!topLevelResults['analytics']);
+    _analytics = createAnalyticsInstance(
+      topLevelResults.wasParsed('analytics')
+          ? !topLevelResults['analytics']
+          : false,
+    );
 
     // If we have not printed the analyticsNoticeOnFirstRunMessage to stdout,
     // the user is on a terminal, and the machine is not a bot, then print the
     // disclosure and set analytics.disclosureShownOnTerminal to true.
     if (analytics is DartdevAnalytics &&
-        !analytics.disclosureShownOnTerminal &&
+        !(analytics as DartdevAnalytics).disclosureShownOnTerminal &&
         io.stdout.hasTerminal &&
         !isBot()) {
       print(analyticsNoticeOnFirstRunMessage);
-      analytics.disclosureShownOnTerminal = true;
+      (analytics as DartdevAnalytics).disclosureShownOnTerminal = true;
     }
 
     // When `--disable-analytics` or `--enable-analytics` are called we perform
diff --git a/pkg/dartdev/test/analytics_test.dart b/pkg/dartdev/test/analytics_test.dart
index 6158b0d..0254384 100644
--- a/pkg/dartdev/test/analytics_test.dart
+++ b/pkg/dartdev/test/analytics_test.dart
@@ -5,6 +5,7 @@
 import 'dart:convert';
 import 'dart:io';
 
+import 'package:dartdev/dartdev.dart';
 import 'package:dartdev/src/analytics.dart';
 import 'package:test/test.dart';
 
@@ -20,6 +21,24 @@
 void main() {
   group('DisabledAnalytics', disabledAnalyticsObject);
 
+  group('VM -> CLI --analytics flag smoke test:', () {
+    final command = DartdevRunner(['--analytics']);
+    test('--analytics', () {
+      command.runCommand(command.parse(['--analytics']));
+      expect(command.analytics is! DisabledAnalytics, true);
+    });
+
+    test('--no-analytics', () {
+      command.runCommand(command.parse(['--no-analytics']));
+      expect(command.analytics is DisabledAnalytics, true);
+    });
+
+    test('No flag', () {
+      command.runCommand(command.parse([]));
+      expect(command.analytics is! DisabledAnalytics, true);
+    });
+  });
+
   test('Analytics control smoke test', () {
     final p = project(logAnalytics: true);
     var result = p.runSync(['--disable-analytics']);
diff --git a/pkg/nnbd_migration/test/abstract_single_unit.dart b/pkg/nnbd_migration/test/abstract_single_unit.dart
index a9dad66..2e1ea9b 100644
--- a/pkg/nnbd_migration/test/abstract_single_unit.dart
+++ b/pkg/nnbd_migration/test/abstract_single_unit.dart
@@ -68,7 +68,7 @@
 ''');
     }
     if (analyzeWithNnbd) {
-      newFile('$testRoot/pubspec.yaml', content: '''
+      newPubspecYamlFile(testRoot, '''
 name: tests
 version: 1.0.0
 environment:
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index 05300a9..65332f5 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -673,6 +673,7 @@
   IsolateGroupReloadContext::SetFileModifiedCallback(NULL);
   Service::SetEmbedderStreamCallbacks(NULL, NULL);
 #endif  // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
+  VirtualMemory::Cleanup();
   return NULL;
 }
 
diff --git a/runtime/vm/heap/pages.cc b/runtime/vm/heap/pages.cc
index 43628c6..8070a58 100644
--- a/runtime/vm/heap/pages.cc
+++ b/runtime/vm/heap/pages.cc
@@ -392,6 +392,11 @@
   if (page == nullptr) {
     IncreaseCapacityInWordsLocked(-page_size_in_words);
     return nullptr;
+  } else {
+    intptr_t actual_size_in_words = page->memory_->size() >> kWordSizeLog2;
+    if (actual_size_in_words != page_size_in_words) {
+      IncreaseCapacityInWordsLocked(actual_size_in_words - page_size_in_words);
+    }
   }
   if (is_exec) {
     AddExecPageLocked(page);
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 286f4f1..bb608ff 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -2510,8 +2510,12 @@
       // If the size is greater than both kNewAllocatableSize and
       // kAllocatablePageSize, the object must have been allocated to a new
       // large page, which must already have been zero initialized by the OS.
+#if defined(DART_COMPRESSED_POINTERS)
+      needs_init = true;
+#else
       needs_init = Heap::IsAllocatableInNewSpace(size) ||
                    Heap::IsAllocatableViaFreeLists(size);
+#endif
     } else {
       initial_value = static_cast<uword>(null_);
       needs_init = true;
diff --git a/runtime/vm/virtual_memory.cc b/runtime/vm/virtual_memory.cc
index 48ba867..4f0ba43 100644
--- a/runtime/vm/virtual_memory.cc
+++ b/runtime/vm/virtual_memory.cc
@@ -19,12 +19,13 @@
   ASSERT(new_size <= size());
   if (reserved_.size() ==
       region_.size()) {  // Don't create holes in reservation.
-    FreeSubSegment(reinterpret_cast<void*>(start() + new_size),
-                   size() - new_size);
-    reserved_.set_size(new_size);
-    if (AliasOffset() != 0) {
-      FreeSubSegment(reinterpret_cast<void*>(alias_.start() + new_size),
-                     alias_.size() - new_size);
+    if (FreeSubSegment(reinterpret_cast<void*>(start() + new_size),
+                       size() - new_size)) {
+      reserved_.set_size(new_size);
+      if (AliasOffset() != 0) {
+        FreeSubSegment(reinterpret_cast<void*>(alias_.start() + new_size),
+                       alias_.size() - new_size);
+      }
     }
   }
   region_.Subregion(region_, 0, new_size);
diff --git a/runtime/vm/virtual_memory.h b/runtime/vm/virtual_memory.h
index 823b806..54ffc7b 100644
--- a/runtime/vm/virtual_memory.h
+++ b/runtime/vm/virtual_memory.h
@@ -32,6 +32,7 @@
   intptr_t AliasOffset() const { return alias_.start() - region_.start(); }
 
   static void Init();
+  static void Cleanup();
 
   // Returns true if dual mapping is enabled.
   static bool DualMappingEnabled();
@@ -87,7 +88,7 @@
 
   // Free a sub segment. On operating systems that support it this
   // can give back the virtual memory to the system. Returns true on success.
-  static void FreeSubSegment(void* address, intptr_t size);
+  static bool FreeSubSegment(void* address, intptr_t size);
 
   // These constructors are only used internally when reserving new virtual
   // spaces. They do not reserve any virtual address space on their own.
diff --git a/runtime/vm/virtual_memory_fuchsia.cc b/runtime/vm/virtual_memory_fuchsia.cc
index ec747b0..a5a6d14 100644
--- a/runtime/vm/virtual_memory_fuchsia.cc
+++ b/runtime/vm/virtual_memory_fuchsia.cc
@@ -51,6 +51,8 @@
   page_size_ = CalculatePageSize();
 }
 
+void VirtualMemory::Cleanup() {}
+
 static void Unmap(zx_handle_t vmar, uword start, uword end) {
   ASSERT(start <= end);
   const uword size = end - start;
@@ -174,10 +176,11 @@
   }
 }
 
-void VirtualMemory::FreeSubSegment(void* address, intptr_t size) {
+bool VirtualMemory::FreeSubSegment(void* address, intptr_t size) {
   const uword start = reinterpret_cast<uword>(address);
   Unmap(zx_vmar_root_self(), start, start + size);
   LOG_INFO("zx_vmar_unmap(0x%p, 0x%lx) success\n", address, size);
+  return true;
 }
 
 void VirtualMemory::Protect(void* address, intptr_t size, Protection mode) {
diff --git a/runtime/vm/virtual_memory_posix.cc b/runtime/vm/virtual_memory_posix.cc
index 350c241..700bc33 100644
--- a/runtime/vm/virtual_memory_posix.cc
+++ b/runtime/vm/virtual_memory_posix.cc
@@ -43,6 +43,43 @@
 
 uword VirtualMemory::page_size_ = 0;
 
+static void unmap(uword start, uword end);
+
+#if defined(DART_COMPRESSED_POINTERS)
+static uword compressed_heap_base_ = 0;
+static uint8_t* compressed_heap_pages_ = nullptr;
+static uword compressed_heap_minimum_free_page_id_ = 0;
+static Mutex* compressed_heap_mutex_ = nullptr;
+
+static constexpr intptr_t kCompressedHeapSize = 2 * GB;
+static constexpr intptr_t kCompressedHeapAlignment = 4 * GB;
+static constexpr intptr_t kCompressedHeapPageSize = kOldPageSize;
+static constexpr intptr_t kCompressedHeapNumPages =
+    kCompressedHeapSize / kOldPageSize;
+static constexpr intptr_t kCompressedHeapBitmapSize =
+    kCompressedHeapNumPages / 8;
+#endif  // defined(DART_COMPRESSED_POINTERS)
+
+static void* GenericMapAligned(int prot,
+                               intptr_t size,
+                               intptr_t alignment,
+                               intptr_t allocated_size,
+                               int map_flags) {
+  void* address = mmap(nullptr, allocated_size, prot, map_flags, -1, 0);
+  LOG_INFO("mmap(nullptr, 0x%" Px ", %u, ...): %p\n", allocated_size, prot,
+           address);
+  if (address == MAP_FAILED) {
+    return nullptr;
+  }
+
+  const uword base = reinterpret_cast<uword>(address);
+  const uword aligned_base = Utils::RoundUp(base, alignment);
+
+  unmap(base, aligned_base);
+  unmap(aligned_base + size, base + allocated_size);
+  return reinterpret_cast<void*>(aligned_base);
+}
+
 intptr_t VirtualMemory::CalculatePageSize() {
   const intptr_t page_size = getpagesize();
   ASSERT(page_size != 0);
@@ -51,6 +88,20 @@
 }
 
 void VirtualMemory::Init() {
+#if defined(DART_COMPRESSED_POINTERS)
+  if (compressed_heap_pages_ == nullptr) {
+    compressed_heap_pages_ = new uint8_t[kCompressedHeapBitmapSize];
+    memset(compressed_heap_pages_, 0, kCompressedHeapBitmapSize);
+    compressed_heap_base_ = reinterpret_cast<uword>(GenericMapAligned(
+        PROT_READ | PROT_WRITE, kCompressedHeapSize, kCompressedHeapAlignment,
+        kCompressedHeapSize + kCompressedHeapAlignment,
+        MAP_PRIVATE | MAP_ANONYMOUS));
+    ASSERT(compressed_heap_base_ != 0);
+    ASSERT(Utils::IsAligned(compressed_heap_base_, kCompressedHeapAlignment));
+    compressed_heap_mutex_ = new Mutex(NOT_IN_PRODUCT("compressed_heap_mutex"));
+  }
+#endif  // defined(DART_COMPRESSED_POINTERS)
+
   if (page_size_ != 0) {
     // Already initialized.
     return;
@@ -78,7 +129,7 @@
     intptr_t size = PageSize();
     intptr_t alignment = kOldPageSize;
     VirtualMemory* vm = AllocateAligned(size, alignment, true, "memfd-test");
-    if (vm == NULL) {
+    if (vm == nullptr) {
       LOG_INFO("memfd_create not supported; disabling dual mapping of code.\n");
       FLAG_dual_map_code = false;
       return;
@@ -115,6 +166,18 @@
 #endif
 }
 
+void VirtualMemory::Cleanup() {
+#if defined(DART_COMPRESSED_POINTERS)
+  unmap(compressed_heap_base_, compressed_heap_base_ + kCompressedHeapSize);
+  delete[] compressed_heap_pages_;
+  delete compressed_heap_mutex_;
+  compressed_heap_base_ = 0;
+  compressed_heap_pages_ = nullptr;
+  compressed_heap_minimum_free_page_id_ = 0;
+  compressed_heap_mutex_ = nullptr;
+#endif  // defined(DART_COMPRESSED_POINTERS)
+}
+
 bool VirtualMemory::DualMappingEnabled() {
   return FLAG_dual_map_code;
 }
@@ -156,12 +219,12 @@
                         intptr_t size,
                         intptr_t alignment,
                         intptr_t allocated_size) {
-  void* address =
-      mmap(NULL, allocated_size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-  LOG_INFO("mmap(NULL, 0x%" Px ", PROT_NONE, ...): %p\n", allocated_size,
+  void* address = mmap(nullptr, allocated_size, PROT_NONE,
+                       MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+  LOG_INFO("mmap(nullptr, 0x%" Px ", PROT_NONE, ...): %p\n", allocated_size,
            address);
   if (address == MAP_FAILED) {
-    return NULL;
+    return nullptr;
   }
 
   const uword base = reinterpret_cast<uword>(address);
@@ -176,7 +239,7 @@
            prot, address);
   if (address == MAP_FAILED) {
     unmap(base, base + allocated_size);
-    return NULL;
+    return nullptr;
   }
   ASSERT(address == reinterpret_cast<void*>(aligned_base));
   unmap(base, aligned_base);
@@ -185,6 +248,93 @@
 }
 #endif  // defined(DUAL_MAPPING_SUPPORTED)
 
+#if defined(DART_COMPRESSED_POINTERS)
+uint8_t PageMask(uword page_id) {
+  return static_cast<uint8_t>(1 << (page_id % 8));
+}
+bool IsCompressedHeapPageUsed(uword page_id) {
+  if (page_id >= kCompressedHeapNumPages) return false;
+  return compressed_heap_pages_[page_id / 8] & PageMask(page_id);
+}
+void SetCompressedHeapPageUsed(uword page_id) {
+  ASSERT(page_id < kCompressedHeapNumPages);
+  compressed_heap_pages_[page_id / 8] |= PageMask(page_id);
+}
+void ClearCompressedHeapPageUsed(uword page_id) {
+  ASSERT(page_id < kCompressedHeapNumPages);
+  compressed_heap_pages_[page_id / 8] &= ~PageMask(page_id);
+}
+static MemoryRegion MapInCompressedHeap(intptr_t size, intptr_t alignment) {
+  ASSERT(alignment <= kCompressedHeapAlignment);
+  const intptr_t allocated_size = Utils::RoundUp(size, kCompressedHeapPageSize);
+  uword pages = allocated_size / kCompressedHeapPageSize;
+  uword page_alignment = alignment > kCompressedHeapPageSize
+                             ? alignment / kCompressedHeapPageSize
+                             : 1;
+  MutexLocker ml(compressed_heap_mutex_);
+
+  // Find a gap with enough empty pages, using the bitmap. Note that reading
+  // outside the bitmap range always returns 0, so this loop will terminate.
+  uword page_id =
+      Utils::RoundUp(compressed_heap_minimum_free_page_id_, page_alignment);
+  for (uword gap = 0;;) {
+    if (IsCompressedHeapPageUsed(page_id)) {
+      gap = 0;
+      page_id = Utils::RoundUp(page_id + 1, page_alignment);
+    } else {
+      ++gap;
+      if (gap >= pages) {
+        page_id += 1 - gap;
+        break;
+      }
+      ++page_id;
+    }
+  }
+  ASSERT(page_id % page_alignment == 0);
+
+  // Make sure we're not trying to allocate past the end of the heap.
+  uword end = page_id + pages;
+  if (end > kCompressedHeapSize / kCompressedHeapPageSize) {
+    return MemoryRegion();
+  }
+
+  // Mark all the pages in the bitmap as allocated.
+  for (uword i = page_id; i < end; ++i) {
+    ASSERT(!IsCompressedHeapPageUsed(i));
+    SetCompressedHeapPageUsed(i);
+  }
+
+  // Find the next free page, to speed up subsequent allocations.
+  while (IsCompressedHeapPageUsed(compressed_heap_minimum_free_page_id_)) {
+    ++compressed_heap_minimum_free_page_id_;
+  }
+
+  uword address = compressed_heap_base_ + page_id * kCompressedHeapPageSize;
+  ASSERT(Utils::IsAligned(address, kCompressedHeapPageSize));
+  return MemoryRegion(reinterpret_cast<void*>(address), allocated_size);
+}
+
+static void UnmapInCompressedHeap(uword start, uword size) {
+  ASSERT(Utils::IsAligned(start, kCompressedHeapPageSize));
+  ASSERT(Utils::IsAligned(size, kCompressedHeapPageSize));
+  MutexLocker ml(compressed_heap_mutex_);
+  ASSERT(start >= compressed_heap_base_);
+  uword page_id = (start - compressed_heap_base_) / kCompressedHeapPageSize;
+  uword end = page_id + size / kCompressedHeapPageSize;
+  for (uword i = page_id; i < end; ++i) {
+    ClearCompressedHeapPageUsed(i);
+  }
+  if (page_id < compressed_heap_minimum_free_page_id_) {
+    compressed_heap_minimum_free_page_id_ = page_id;
+  }
+}
+
+static bool IsInCompressedHeap(uword address) {
+  return address >= compressed_heap_base_ &&
+         address < compressed_heap_base_ + kCompressedHeapSize;
+}
+#endif  // defined(DART_COMPRESSED_POINTERS)
+
 VirtualMemory* VirtualMemory::AllocateAligned(intptr_t size,
                                               intptr_t alignment,
                                               bool is_executable,
@@ -199,6 +349,18 @@
   ASSERT(Utils::IsPowerOfTwo(alignment));
   ASSERT(Utils::IsAligned(alignment, PageSize()));
   ASSERT(name != nullptr);
+
+#if defined(DART_COMPRESSED_POINTERS)
+  if (!is_executable) {
+    MemoryRegion region = MapInCompressedHeap(size, alignment);
+    if (region.pointer() == nullptr) {
+      return nullptr;
+    }
+    mprotect(region.pointer(), region.size(), PROT_READ | PROT_WRITE);
+    return new VirtualMemory(region, region);
+  }
+#endif  // defined(DART_COMPRESSED_POINTERS)
+
   const intptr_t allocated_size = size + alignment - PageSize();
 #if defined(DUAL_MAPPING_SUPPORTED)
   const bool dual_mapping =
@@ -206,18 +368,18 @@
   if (dual_mapping) {
     int fd = memfd_create(name, MFD_CLOEXEC);
     if (fd == -1) {
-      return NULL;
+      return nullptr;
     }
     if (ftruncate(fd, size) == -1) {
       close(fd);
-      return NULL;
+      return nullptr;
     }
     const int region_prot = PROT_READ | PROT_WRITE;
     void* region_ptr =
         MapAligned(fd, region_prot, size, alignment, allocated_size);
-    if (region_ptr == NULL) {
+    if (region_ptr == nullptr) {
       close(fd);
-      return NULL;
+      return nullptr;
     }
     // The mapping will be RX and stays that way until it will eventually be
     // unmapped.
@@ -228,10 +390,10 @@
     void* alias_ptr =
         MapAligned(fd, alias_prot, size, alignment, allocated_size);
     close(fd);
-    if (alias_ptr == NULL) {
+    if (alias_ptr == nullptr) {
       const uword region_base = reinterpret_cast<uword>(region_ptr);
       unmap(region_base, region_base + size);
-      return NULL;
+      return nullptr;
     }
     ASSERT(region_ptr != alias_ptr);
     MemoryRegion alias(alias_ptr, size);
@@ -250,16 +412,16 @@
   if (FLAG_dual_map_code) {
     int fd = memfd_create(name, MFD_CLOEXEC);
     if (fd == -1) {
-      return NULL;
+      return nullptr;
     }
     if (ftruncate(fd, size) == -1) {
       close(fd);
-      return NULL;
+      return nullptr;
     }
     void* region_ptr = MapAligned(fd, prot, size, alignment, allocated_size);
     close(fd);
-    if (region_ptr == NULL) {
-      return NULL;
+    if (region_ptr == nullptr) {
+      return nullptr;
     }
     MemoryRegion region(region_ptr, size);
     return new VirtualMemory(region, region);
@@ -272,24 +434,23 @@
     map_flags |= MAP_JIT;
   }
 #endif  // defined(HOST_OS_MACOS)
-  void* address = mmap(NULL, allocated_size, prot, map_flags, -1, 0);
-  LOG_INFO("mmap(NULL, 0x%" Px ", %u, ...): %p\n", allocated_size, prot,
-           address);
+  void* address =
+      GenericMapAligned(prot, size, alignment, allocated_size, map_flags);
   if (address == MAP_FAILED) {
-    return NULL;
+    return nullptr;
   }
 
-  const uword base = reinterpret_cast<uword>(address);
-  const uword aligned_base = Utils::RoundUp(base, alignment);
-
-  unmap(base, aligned_base);
-  unmap(aligned_base + size, base + allocated_size);
-
-  MemoryRegion region(reinterpret_cast<void*>(aligned_base), size);
+  MemoryRegion region(reinterpret_cast<void*>(address), size);
   return new VirtualMemory(region, region);
 }
 
 VirtualMemory::~VirtualMemory() {
+#if defined(DART_COMPRESSED_POINTERS)
+  if (IsInCompressedHeap(reserved_.start())) {
+    UnmapInCompressedHeap(reserved_.start(), reserved_.size());
+    return;
+  }
+#endif  // defined(DART_COMPRESSED_POINTERS)
   if (vm_owns_region()) {
     unmap(reserved_.start(), reserved_.end());
     const intptr_t alias_offset = AliasOffset();
@@ -299,10 +460,16 @@
   }
 }
 
-void VirtualMemory::FreeSubSegment(void* address,
-                                   intptr_t size) {
+bool VirtualMemory::FreeSubSegment(void* address, intptr_t size) {
   const uword start = reinterpret_cast<uword>(address);
+#if defined(DART_COMPRESSED_POINTERS)
+  // Don't free the sub segment if it's managed by the compressed pointer heap.
+  if (IsInCompressedHeap(start)) {
+    return false;
+  }
+#endif  // defined(DART_COMPRESSED_POINTERS)
   unmap(start, start + size);
+  return true;
 }
 
 void VirtualMemory::Protect(void* address, intptr_t size, Protection mode) {
diff --git a/runtime/vm/virtual_memory_test.cc b/runtime/vm/virtual_memory_test.cc
index 8ef5d82..e50cb85 100644
--- a/runtime/vm/virtual_memory_test.cc
+++ b/runtime/vm/virtual_memory_test.cc
@@ -24,9 +24,14 @@
       VirtualMemory::Allocate(kVirtualMemoryBlockSize, false, "test");
   EXPECT(vm != NULL);
   EXPECT(vm->address() != NULL);
-  EXPECT_EQ(kVirtualMemoryBlockSize, vm->size());
   EXPECT_EQ(vm->start(), reinterpret_cast<uword>(vm->address()));
+#if defined(DART_COMPRESSED_POINTERS)
+  EXPECT_EQ(kOldPageSize, vm->size());
+  EXPECT_EQ(vm->start() + kOldPageSize, vm->end());
+#else
+  EXPECT_EQ(kVirtualMemoryBlockSize, vm->size());
   EXPECT_EQ(vm->start() + kVirtualMemoryBlockSize, vm->end());
+#endif  // defined(DART_COMPRESSED_POINTERS)
   EXPECT(vm->Contains(vm->start()));
   EXPECT(vm->Contains(vm->start() + 1));
   EXPECT(vm->Contains(vm->start() + kVirtualMemoryBlockSize - 1));
diff --git a/runtime/vm/virtual_memory_win.cc b/runtime/vm/virtual_memory_win.cc
index fd7c5d1..a220b91 100644
--- a/runtime/vm/virtual_memory_win.cc
+++ b/runtime/vm/virtual_memory_win.cc
@@ -31,6 +31,8 @@
   page_size_ = CalculatePageSize();
 }
 
+void VirtualMemory::Cleanup() {}
+
 bool VirtualMemory::DualMappingEnabled() {
   return false;
 }
@@ -80,11 +82,11 @@
   }
 }
 
-void VirtualMemory::FreeSubSegment(void* address,
-                                   intptr_t size) {
+bool VirtualMemory::FreeSubSegment(void* address, intptr_t size) {
   if (VirtualFree(address, size, MEM_DECOMMIT) == 0) {
     FATAL1("VirtualFree failed: Error code %d\n", GetLastError());
   }
+  return true;
 }
 
 void VirtualMemory::Protect(void* address, intptr_t size, Protection mode) {
diff --git a/tests/web/bound_closure_interceptor_type_test.dart b/tests/web/bound_closure_interceptor_type_test.dart
deleted file mode 100644
index 3410dbe..0000000
--- a/tests/web/bound_closure_interceptor_type_test.dart
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright (c) 2014, 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 for type checks against tear-off closures generated in different
-// optimization contexts.
-//
-// The type of a tear-off closure depends on the receiver when the method
-// signature uses a type parameter of the method's class.  This means that type
-// checking needs to reference the receiver correctly, either during closure
-// creation or during the type test.
-
-class A<T> {
-  const A();
-  void add(T x) {}
-  T elementAt(int index) => index == 0 ? 42 as dynamic : 'string';
-
-  // This call get:elementAt has a known receiver type, so is is potentially
-  // eligible for a dummy receiver optimization.
-  getElementAt() => this.elementAt;
-  // Same for get:add.
-  getAdd() => this.add;
-
-  toString() => 'A<$T>';
-}
-
-var getAddOfA = (a) => a.getAdd();
-var getElementAtOfA = (a) => a.getElementAt();
-
-var getAdd1 = (a) => a.add; // receiver has unknown type here.
-
-var getAdd2 = (a) {
-  // Call needs to be indirect to avoid inlining.
-  if (a is A) return getAddOfA(a);
-  return a.add;
-};
-
-var getElementAt1 = (a) => a.elementAt; // receiver has unknown type here.
-
-var getElementAt2 = (a) {
-  // Call needs to be indirect to avoid inlining.
-  if (a is A) return getElementAtOfA(a);
-  return a.elementAt;
-};
-
-typedef void IntToVoid(int x);
-typedef void StringToVoid(String x);
-
-typedef int IntToInt(int x);
-typedef String IntToString(int x);
-typedef T IntToT<T>(int x);
-
-var inscrutable;
-
-var checkers = {
-  'IntToVoid': (x) => x is IntToVoid,
-  'StringToVoid': (x) => x is StringToVoid,
-  'IntToInt': (x) => x is IntToInt,
-  'IntToString': (x) => x is IntToString,
-  'IntToT<int>': (x) => x is IntToT<int>,
-  'IntToT<String>': (x) => x is IntToT<String>,
-};
-
-var methods = {
-  'getAdd1': (x) => getAdd1(x),
-  'getAdd2': (x) => getAdd2(x),
-  'getElementAt1': (x) => getElementAt1(x),
-  'getElementAt2': (x) => getElementAt2(x),
-};
-
-main() {
-  inscrutable = (x) => x;
-
-  getAdd1 = inscrutable(getAdd1);
-  getAdd2 = inscrutable(getAdd2);
-  getElementAt1 = inscrutable(getElementAt1);
-  getElementAt2 = inscrutable(getElementAt2);
-  getAddOfA = inscrutable(getAddOfA);
-  getElementAtOfA = inscrutable(getElementAtOfA);
-
-  check(methodNames, objects, trueCheckNames) {
-    for (var trueCheckName in trueCheckNames) {
-      if (!checkers.containsKey(trueCheckName)) {
-        Expect.fail("unknown check '$trueCheckName'");
-      }
-    }
-
-    for (var object in objects) {
-      for (var methodName in methodNames) {
-        var methodFn = methods[methodName] as dynamic;
-        var description = '$object';
-        checkers.forEach((checkName, checkFn) {
-          bool answer = trueCheckNames.contains(checkName);
-          Expect.equals(answer, checkFn(methodFn(object)),
-              '$methodName($description) is $checkName');
-        });
-      }
-    }
-  }
-
-  var objectsDyn = [[], new A(), new A<dynamic>()];
-  var objectsInt = [<int>[], new A<int>()];
-  var objectsStr = [<String>[], new A<String>()];
-  var objectsLst = [<List>[], new A<List>()];
-
-  var m = ['getAdd1', 'getAdd2'];
-  check(m, objectsDyn, ['IntToVoid', 'StringToVoid']);
-  check(m, objectsInt, ['IntToVoid']);
-  check(m, objectsStr, ['StringToVoid']);
-  check(m, objectsLst, []);
-
-  m = ['getElementAt1', 'getElementAt2'];
-  check(m, objectsDyn, [
-    'IntToInt',
-    'IntToString',
-    'IntToVoid',
-    'IntToT<int>',
-    'IntToT<String>'
-  ]);
-  check(m, objectsInt, ['IntToInt', 'IntToVoid', 'IntToT<int>']);
-  check(m, objectsStr, ['IntToString', 'IntToVoid', 'IntToT<String>']);
-  check(m, objectsLst, ['IntToVoid']);
-}
diff --git a/tests/web/constant_javascript_semantics4_test.dart b/tests/web/constant_javascript_semantics4_test.dart
deleted file mode 100644
index 9d19957..0000000
--- a/tests/web/constant_javascript_semantics4_test.dart
+++ /dev/null
@@ -1,16 +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.
-
-// Make sure we use JavaScript semantics when compiling compile-time constants.
-
-// In checked mode, this return will not fail. If the compiler thinks
-// it will, then dead code will remove the throw in the main method.
-int getInt() {
-  return -0.0;
-}
-
-main() {
-  getInt();
-  throw 'Should fail';
-}
diff --git a/tests/web/constant_javascript_semantics_test.dart b/tests/web/constant_javascript_semantics_test.dart
deleted file mode 100644
index 1a09423..0000000
--- a/tests/web/constant_javascript_semantics_test.dart
+++ /dev/null
@@ -1,36 +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";
-
-// Make sure we use JavaScript semantics when compiling compile-time constants.
-
-const x = 1234567890123456789;
-const y = 1234567890123456788;
-const z = x - y;
-
-const a = 1.0;
-const b = a << 3; // //# 01: compile-time error
-
-const c = -0.0;
-const d = c << 1; // //# 02: compile-time error
-
-foo() => 12345678901234567891 - 12345678901234567890;
-
-main() {
-  Expect.equals(0, z);
-  Expect.equals(0, x - y);
-  Expect.equals(0, foo());
-  Expect.isTrue(x is double);
-  Expect.isTrue(x is int);
-  Expect.equals(8, b); // //# 01: continued
-  Expect.equals(8, 1.0 << 3); // //# 03: static type warning
-  Expect.isTrue(1 == 1.0);
-  Expect.equals(0, d); // //# 02: continued
-  Expect.equals(0, -0.0 << 1); // //# 04: static type warning
-  // Make sure the 1 is not shifted into the 32 bit range.
-  Expect.equals(0, 0x100000000 >> 3);
-  // The dynamic int-check also allows -0.0.
-  Expect.isTrue((-0.0) is int);
-}
diff --git a/tests/web/private_symbol_literal_test.dart b/tests/web/private_symbol_literal_test.dart
deleted file mode 100644
index 1f12b06..0000000
--- a/tests/web/private_symbol_literal_test.dart
+++ /dev/null
@@ -1,22 +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.
-
-// 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/web/regress/4562_test.dart b/tests/web/regress/4562_test.dart
deleted file mode 100644
index 61ba859..0000000
--- a/tests/web/regress/4562_test.dart
+++ /dev/null
@@ -1,16 +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.
-
-void main() {
-  var foo = new Foo();
-  var bar = new Bar(); //# 01: compile-time error
-}
-
-class Foo {
-  factory Foo() => null;
-}
-
-class Bar extends Foo {
-  Bar(); //# 01: continued
-}
diff --git a/tests/web/statements_test.dart b/tests/web/statements_test.dart
deleted file mode 100644
index 7e45397..0000000
--- a/tests/web/statements_test.dart
+++ /dev/null
@@ -1,26 +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.
-
-void main() {
-  print(3);
-  print(4);
-  if (true) {
-    print('hest');
-  }
-  if (false) {
-    print('hest');
-  } else {
-    print('fisk');
-  }
-  int foo() {}
-  int i = 0;
-
-  for (int j = 0; j < 10; j += 1) {
-    print('kat');
-  }
-
-  if (false) throw;
-
-  if (false) throw 'dwarf';
-}
diff --git a/tests/web/type_constant_switch_test.dart b/tests/web/type_constant_switch_test.dart
deleted file mode 100644
index 875c9d8..0000000
--- a/tests/web/type_constant_switch_test.dart
+++ /dev/null
@@ -1,16 +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.
-
-// Test that switching on type literals leads to a compile time error in
-// dart2js since its implementation of [Type] implements 'operator =='.
-
-class C {}
-
-var v;
-
-main() {
-  switch (v) {
-    case C: break; // //# 01: compile-time error
-  }
-}
diff --git a/tests/web_2/bound_closure_interceptor_type_test.dart b/tests/web_2/bound_closure_interceptor_type_test.dart
deleted file mode 100644
index 39271c3..0000000
--- a/tests/web_2/bound_closure_interceptor_type_test.dart
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (c) 2014, 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 = 2.7
-
-import "package:expect/expect.dart";
-
-// Test for type checks against tear-off closures generated in different
-// optimization contexts.
-//
-// The type of a tear-off closure depends on the receiver when the method
-// signature uses a type parameter of the method's class.  This means that type
-// checking needs to reference the receiver correctly, either during closure
-// creation or during the type test.
-
-class A<T> {
-  const A();
-  void add(T x) {}
-  T elementAt(int index) => index == 0 ? 42 : 'string';
-
-  // This call get:elementAt has a known receiver type, so is is potentially
-  // eligible for a dummy receiver optimization.
-  getElementAt() => this.elementAt;
-  // Same for get:add.
-  getAdd() => this.add;
-
-  toString() => 'A<$T>';
-}
-
-var getAddOfA = (a) => a.getAdd();
-var getElementAtOfA = (a) => a.getElementAt();
-
-var getAdd1 = (a) => a.add; // receiver has unknown type here.
-
-var getAdd2 = (a) {
-  // Call needs to be indirect to avoid inlining.
-  if (a is A) return getAddOfA(a);
-  return a.add;
-};
-
-var getElementAt1 = (a) => a.elementAt; // receiver has unknown type here.
-
-var getElementAt2 = (a) {
-  // Call needs to be indirect to avoid inlining.
-  if (a is A) return getElementAtOfA(a);
-  return a.elementAt;
-};
-
-typedef void IntToVoid(int x);
-typedef void StringToVoid(String x);
-
-typedef int IntToInt(int x);
-typedef String IntToString(int x);
-typedef T IntToT<T>(int x);
-
-var inscrutable;
-
-var checkers = {
-  'IntToVoid': (x) => x is IntToVoid,
-  'StringToVoid': (x) => x is StringToVoid,
-  'IntToInt': (x) => x is IntToInt,
-  'IntToString': (x) => x is IntToString,
-  'IntToT<int>': (x) => x is IntToT<int>,
-  'IntToT<String>': (x) => x is IntToT<String>,
-};
-
-var methods = {
-  'getAdd1': (x) => getAdd1(x),
-  'getAdd2': (x) => getAdd2(x),
-  'getElementAt1': (x) => getElementAt1(x),
-  'getElementAt2': (x) => getElementAt2(x),
-};
-
-main() {
-  inscrutable = (x) => x;
-
-  getAdd1 = inscrutable(getAdd1);
-  getAdd2 = inscrutable(getAdd2);
-  getElementAt1 = inscrutable(getElementAt1);
-  getElementAt2 = inscrutable(getElementAt2);
-  getAddOfA = inscrutable(getAddOfA);
-  getElementAtOfA = inscrutable(getElementAtOfA);
-
-  check(methodNames, objects, trueCheckNames) {
-    for (var trueCheckName in trueCheckNames) {
-      if (!checkers.containsKey(trueCheckName)) {
-        Expect.fail("unknown check '$trueCheckName'");
-      }
-    }
-
-    for (var object in objects) {
-      for (var methodName in methodNames) {
-        var methodFn = methods[methodName];
-        var description = '$object';
-        checkers.forEach((checkName, checkFn) {
-          bool answer = trueCheckNames.contains(checkName);
-          Expect.equals(answer, checkFn(methodFn(object)),
-              '$methodName($description) is $checkName');
-        });
-      }
-    }
-  }
-
-  var objectsDyn = [[], new A(), new A<dynamic>()];
-  var objectsInt = [<int>[], new A<int>()];
-  var objectsStr = [<String>[], new A<String>()];
-  var objectsLst = [<List>[], new A<List>()];
-
-  var m = ['getAdd1', 'getAdd2'];
-  check(m, objectsDyn, ['IntToVoid', 'StringToVoid']);
-  check(m, objectsInt, ['IntToVoid']);
-  check(m, objectsStr, ['StringToVoid']);
-  check(m, objectsLst, []);
-
-  m = ['getElementAt1', 'getElementAt2'];
-  check(m, objectsDyn, [
-    'IntToInt',
-    'IntToString',
-    'IntToVoid',
-    'IntToT<int>',
-    'IntToT<String>'
-  ]);
-  check(m, objectsInt, ['IntToInt', 'IntToVoid', 'IntToT<int>']);
-  check(m, objectsStr, ['IntToString', 'IntToVoid', 'IntToT<String>']);
-  check(m, objectsLst, ['IntToVoid']);
-}
diff --git a/tests/web_2/constant_javascript_semantics4_test.dart b/tests/web_2/constant_javascript_semantics4_test.dart
deleted file mode 100644
index a3b26d4..0000000
--- a/tests/web_2/constant_javascript_semantics4_test.dart
+++ /dev/null
@@ -1,18 +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.
-
-// @dart = 2.7
-
-// Make sure we use JavaScript semantics when compiling compile-time constants.
-
-// In checked mode, this return will not fail. If the compiler thinks
-// it will, then dead code will remove the throw in the main method.
-int getInt() {
-  return -0.0;
-}
-
-main() {
-  getInt();
-  throw 'Should fail';
-}
diff --git a/tests/web_2/constant_javascript_semantics_test.dart b/tests/web_2/constant_javascript_semantics_test.dart
deleted file mode 100644
index 5f31542..0000000
--- a/tests/web_2/constant_javascript_semantics_test.dart
+++ /dev/null
@@ -1,38 +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.
-
-// @dart = 2.7
-
-import "package:expect/expect.dart";
-
-// Make sure we use JavaScript semantics when compiling compile-time constants.
-
-const x = 1234567890123456789;
-const y = 1234567890123456788;
-const z = x - y;
-
-const a = 1.0;
-const b = a << 3; // //# 01: compile-time error
-
-const c = -0.0;
-const d = c << 1; // //# 02: compile-time error
-
-foo() => 12345678901234567891 - 12345678901234567890;
-
-main() {
-  Expect.equals(0, z);
-  Expect.equals(0, x - y);
-  Expect.equals(0, foo());
-  Expect.isTrue(x is double);
-  Expect.isTrue(x is int);
-  Expect.equals(8, b); // //# 01: continued
-  Expect.equals(8, 1.0 << 3); // //# 03: static type warning
-  Expect.isTrue(1 == 1.0);
-  Expect.equals(0, d); // //# 02: continued
-  Expect.equals(0, -0.0 << 1); // //# 04: static type warning
-  // Make sure the 1 is not shifted into the 32 bit range.
-  Expect.equals(0, 0x100000000 >> 3);
-  // The dynamic int-check also allows -0.0.
-  Expect.isTrue((-0.0) is int);
-}
diff --git a/tests/web_2/private_symbol_literal_test.dart b/tests/web_2/private_symbol_literal_test.dart
deleted file mode 100644
index 0b1a3c3..0000000
--- a/tests/web_2/private_symbol_literal_test.dart
+++ /dev/null
@@ -1,24 +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.
-
-// @dart = 2.7
-
-// 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/web_2/regress/4562_test.dart b/tests/web_2/regress/4562_test.dart
deleted file mode 100644
index ba1b145..0000000
--- a/tests/web_2/regress/4562_test.dart
+++ /dev/null
@@ -1,18 +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.
-
-// @dart = 2.7
-
-void main() {
-  var foo = new Foo();
-  var bar = new Bar(); //# 01: compile-time error
-}
-
-class Foo {
-  factory Foo() => null;
-}
-
-class Bar extends Foo {
-  Bar(); //# 01: continued
-}
diff --git a/tests/web_2/statements_test.dart b/tests/web_2/statements_test.dart
deleted file mode 100644
index 8bc5323..0000000
--- a/tests/web_2/statements_test.dart
+++ /dev/null
@@ -1,28 +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 = 2.7
-
-void main() {
-  print(3);
-  print(4);
-  if (true) {
-    print('hest');
-  }
-  if (false) {
-    print('hest');
-  } else {
-    print('fisk');
-  }
-  int foo() {}
-  int i = 0;
-
-  for (int j = 0; j < 10; j += 1) {
-    print('kat');
-  }
-
-  if (false) throw;
-
-  if (false) throw 'dwarf';
-}
diff --git a/tests/web_2/type_constant_switch_test.dart b/tests/web_2/type_constant_switch_test.dart
deleted file mode 100644
index f3a45b0..0000000
--- a/tests/web_2/type_constant_switch_test.dart
+++ /dev/null
@@ -1,18 +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.
-
-// @dart = 2.7
-
-// Test that switching on type literals leads to a compile time error in
-// dart2js since its implementation of [Type] implements 'operator =='.
-
-class C {}
-
-var v;
-
-main() {
-  switch (v) {
-    case C: break; // //# 01: compile-time error
-  }
-}
diff --git a/tools/VERSION b/tools/VERSION
index 59569bb..b9fcd91 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 13
 PATCH 0
-PRERELEASE 63
+PRERELEASE 64
 PRERELEASE_PATCH 0
\ No newline at end of file