Ignore --fast-startup flag, assume true

Change-Id: I7a41160bf7f5bb403177b19613de2889e0fa2b44
Reviewed-on: https://dart-review.googlesource.com/c/87424
Reviewed-by: Sigmund Cherem <sigmund@google.com>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1134e55..2677614 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,13 @@
 
 #### dart2js
 
+* `--fast-startup` is forced on.  The flag is silently ignored and will be
+  deprecated and then removed at a later date.
+
+  The alternative 'full emitter' is no longer available. The generated code for
+  `--fast-startup` is optimized to load faster, even though it can be slightly
+  larger.
+
 * We fixed a bug in how deferred constructor calls were incorrectly not
   marked as deferred. The old behavior didn't cause breakages, but was imprecise
   and pushed more code to the main output unit.
diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart
index 74818db..daab7fc 100644
--- a/pkg/compiler/lib/src/dart2js.dart
+++ b/pkg/compiler/lib/src/dart2js.dart
@@ -340,7 +340,7 @@
     new OptionHandler('--out=.+|-o.*', setOutput, multipleArguments: true),
     new OptionHandler('-O.*', setOptimizationLevel),
     new OptionHandler(Flags.allowMockCompilation, ignoreOption),
-    new OptionHandler(Flags.fastStartup, passThrough),
+    new OptionHandler(Flags.fastStartup, ignoreOption),
     new OptionHandler(Flags.genericMethodSyntax, ignoreOption),
     new OptionHandler(Flags.initializingFormalAccess, ignoreOption),
     new OptionHandler(Flags.minify, passThrough),
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index 81ea82f..9ae8118 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -387,12 +387,13 @@
 
   JavaScriptBackend(this.compiler,
       {bool generateSourceMap: true,
-      bool useStartupEmitter: false,
+      bool useStartupEmitter: true,
       bool useMultiSourceInfo: false,
       bool useNewSourceInfo: false})
       : this.sourceInformationStrategy =
             compiler.backendStrategy.sourceInformationStrategy,
         constantCompilerTask = new JavaScriptConstantTask(compiler) {
+    useStartupEmitter = true;
     CommonElements commonElements = compiler.frontendStrategy.commonElements;
     _backendUsageBuilder =
         new BackendUsageBuilderImpl(compiler.frontendStrategy);
diff --git a/pkg/compiler/lib/src/options.dart b/pkg/compiler/lib/src/options.dart
index 41c32cc..f52a2fc 100644
--- a/pkg/compiler/lib/src/options.dart
+++ b/pkg/compiler/lib/src/options.dart
@@ -244,9 +244,9 @@
   /// (experimental)
   bool useNewSourceInfo = false;
 
-  /// Whether the user requested to use the fast startup emitter. The full
-  /// emitter might still be used if the program uses dart:mirrors.
-  bool useStartupEmitter = false;
+  /// Whether the user requested to use the fast startup emitter. Always `true`.
+  // TODO(sra): Remove.
+  bool useStartupEmitter = true;
 
   /// Enable verbose printing during compilation. Includes a time-breakdown
   /// between phases at the end.
@@ -358,7 +358,7 @@
           !_hasOption(options, Flags.noFrequencyBasedMinification)
       ..useMultiSourceInfo = _hasOption(options, Flags.useMultiSourceInfo)
       ..useNewSourceInfo = _hasOption(options, Flags.useNewSourceInfo)
-      ..useStartupEmitter = _hasOption(options, Flags.fastStartup)
+      ..useStartupEmitter = true
       ..verbose = _hasOption(options, Flags.verbose)
       ..showInternalProgress = _hasOption(options, Flags.progress)
       ..readDataUri = _extractUriOption(options, '${Flags.readData}=')
@@ -390,6 +390,8 @@
   }
 
   void deriveOptions() {
+    useStartupEmitter = true;
+
     if (benchmarkingProduction) {
       useStartupEmitter = true;
       trustPrimitives = true;
diff --git a/tests/compiler/dart2js/codegen/class_codegen_test.dart b/tests/compiler/dart2js/codegen/class_codegen_test.dart
index a9439f9..bb22e20 100644
--- a/tests/compiler/dart2js/codegen/class_codegen_test.dart
+++ b/tests/compiler/dart2js/codegen/class_codegen_test.dart
@@ -66,14 +66,14 @@
 
 twoClasses() async {
   String generated = await compileAll(TEST_ONE);
-  Expect.isTrue(generated.contains(new RegExp('A: {[ \n]*"\\^": "Object;"')));
-  Expect.isTrue(generated.contains(new RegExp('B: {[ \n]*"\\^": "Object;"')));
+  Expect.isTrue(generated.contains('A: function A()'));
+  Expect.isTrue(generated.contains('B: function B()'));
 }
 
 subClass() async {
   checkOutput(String generated) {
-    Expect.isTrue(generated.contains(new RegExp('A: {[ \n]*"\\^": "Object;"')));
-    Expect.isTrue(generated.contains(new RegExp('B: {[ \n]*"\\^": "A;"')));
+    Expect.isTrue(generated.contains(RegExp(r'_inherit\(.\.A, .\.Object\)')));
+    Expect.isTrue(generated.contains(RegExp(r'_inherit\(.\.B, .\.A\)')));
   }
 
   checkOutput(await compileAll(TEST_TWO));
@@ -82,12 +82,15 @@
 
 fieldTest() async {
   String generated = await compileAll(TEST_FOUR);
-  Expect.isTrue(generated
-      .contains(new RegExp('B: {[ \n]*"\\^": "A;y,z,x",[ \n]*static:')));
+  Expect.isTrue(generated.contains(RegExp(r'B: function B\(t0, t1, t2\) {'
+      r'\s*this.y = t0;'
+      r'\s*this.z = t1;'
+      r'\s*this.x = t2;')));
 }
 
 constructor1() async {
   String generated = await compileAll(TEST_FIVE);
+  print('--------------------\n$generated\n');
   Expect.isTrue(generated.contains(new RegExp(r"new [$A-Z]+\.A\(a\);")));
 }
 
diff --git a/tests/compiler/dart2js/codegen/gvn_test.dart b/tests/compiler/dart2js/codegen/gvn_test.dart
index 54f4d30..678d9fc 100644
--- a/tests/compiler/dart2js/codegen/gvn_test.dart
+++ b/tests/compiler/dart2js/codegen/gvn_test.dart
@@ -108,24 +108,22 @@
 main() {
   runTests() async {
     await compile(TEST_ONE, entry: 'foo', check: (String generated) {
-      RegExp regexp = new RegExp(r"1 \+ [a-z]+");
+      RegExp regexp = RegExp(r"1 \+ [a-z]+");
       checkNumberOfMatches(regexp.allMatches(generated).iterator, 1);
     });
     await compile(TEST_TWO, entry: 'foo', check: (String generated) {
-      checkNumberOfMatches(
-          new RegExp("length").allMatches(generated).iterator, 1);
+      checkNumberOfMatches(RegExp("length").allMatches(generated).iterator, 1);
     });
     await compile(TEST_THREE, entry: 'foo', check: (String generated) {
-      checkNumberOfMatches(
-          new RegExp("number").allMatches(generated).iterator, 1);
+      checkNumberOfMatches(RegExp("number").allMatches(generated).iterator, 1);
     });
     await compile(TEST_FOUR, entry: 'foo', check: (String generated) {
-      checkNumberOfMatches(new RegExp("shr").allMatches(generated).iterator, 1);
+      checkNumberOfMatches(RegExp("shr").allMatches(generated).iterator, 1);
     });
 
     await compileAll(TEST_FIVE).then((generated) {
       checkNumberOfMatches(
-          new RegExp("get\\\$foo").allMatches(generated).iterator, 1);
+          RegExp(r"get\$foo\(").allMatches(generated).iterator, 1);
     });
     await compileAll(TEST_SIX).then((generated) {
       Expect.isTrue(generated.contains('for (t1 = a.field === 54; t1;)'));
diff --git a/tests/compiler/dart2js/codegen/no_constructor_body_test.dart b/tests/compiler/dart2js/codegen/no_constructor_body_test.dart
index e34f13c..7edc700 100644
--- a/tests/compiler/dart2js/codegen/no_constructor_body_test.dart
+++ b/tests/compiler/dart2js/codegen/no_constructor_body_test.dart
@@ -20,9 +20,8 @@
 main() {
   runTest() async {
     String generated = await compileAll(TEST);
-
-    Expect.isTrue(generated
-        .contains(new RegExp('A: {[ \n]*"\\^": "Object;",[ \n]*static:')));
+    // No methods (including no constructor body method.
+    Expect.isTrue(generated.contains('.A.prototype = {}'));
   }
 
   asyncTest(() async {
diff --git a/tests/compiler/dart2js/codegen/no_duplicate_constructor_body_test.dart b/tests/compiler/dart2js/codegen/no_duplicate_constructor_body_test.dart
index 194fce2..8d18091 100644
--- a/tests/compiler/dart2js/codegen/no_duplicate_constructor_body_test.dart
+++ b/tests/compiler/dart2js/codegen/no_duplicate_constructor_body_test.dart
@@ -18,9 +18,14 @@
 main() {
   runTest() async {
     String generated = await compileAll(CODE);
-    RegExp regexp = new RegExp(r'\A: {[ \n]*"\^": "[A-Za-z]+;"');
+
+    RegExp regexp = RegExp(r'\.A\.prototype = {');
     Iterator<Match> matches = regexp.allMatches(generated).iterator;
     checkNumberOfMatches(matches, 1);
+
+    RegExp regexp2 = RegExp(r'A\$\w+: function');
+    Iterator<Match> matches2 = regexp2.allMatches(generated).iterator;
+    checkNumberOfMatches(matches2, 1);
   }
 
   asyncTest(() async {
diff --git a/tests/compiler/dart2js/deferred/inline_restrictions_test.dart b/tests/compiler/dart2js/deferred/inline_restrictions_test.dart
index 4d11985..70df323 100644
--- a/tests/compiler/dart2js/deferred/inline_restrictions_test.dart
+++ b/tests/compiler/dart2js/deferred/inline_restrictions_test.dart
@@ -57,7 +57,8 @@
 
     // Test that inlineSameContext was inlined into lib1.
     RegExp re4 = new RegExp(r"inline same context");
-    Expect.isFalse(re4.hasMatch(lib3Output));
+    // Output can be null when it contains no code.
+    Expect.isTrue(lib3Output == null || !re4.hasMatch(lib3Output));
     Expect.isTrue(re4.hasMatch(lib1Output));
   });
 }
diff --git a/tests/compiler/dart2js/end_to_end/uri_retention_test.dart b/tests/compiler/dart2js/end_to_end/uri_retention_test.dart
deleted file mode 100644
index 1fb8a72..0000000
--- a/tests/compiler/dart2js/end_to_end/uri_retention_test.dart
+++ /dev/null
@@ -1,64 +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.
-
-library dart2js.test.uri_retention_test;
-
-import 'dart:async';
-
-import 'package:async_helper/async_helper.dart';
-import 'package:compiler/compiler_new.dart';
-import 'package:compiler/src/commandline_options.dart';
-import 'package:expect/expect.dart';
-import '../helpers/memory_compiler.dart' show runCompiler, OutputCollector;
-
-Future<String> compileSources(sources, {bool minify}) async {
-  var options = <String>[];
-  if (minify) options.add(Flags.minify);
-  OutputCollector outputCollector = new OutputCollector();
-  await runCompiler(
-      memorySourceFiles: sources,
-      options: options,
-      outputProvider: outputCollector);
-  return outputCollector.getOutput('', OutputType.js);
-}
-
-Future test(sources, {bool libName, bool fileName}) {
-  return compileSources(sources, minify: false).then((output) {
-    // Unminified the sources should always contain the library name and the
-    // file name.
-    Expect.isTrue(output.contains("main_lib"));
-    Expect.isTrue(output.contains("main.dart"));
-  }).then((_) {
-    compileSources(sources, minify: true).then((output) {
-      Expect.equals(libName, output.contains("main_lib"));
-      Expect.isFalse(output.contains("main.dart"));
-    });
-  });
-}
-
-void main() {
-  runTests() async {
-    await test(MEMORY_SOURCE_FILES1, libName: false, fileName: false);
-  }
-
-  asyncTest(() async {
-    print('--test from kernel------------------------------------------------');
-    await runTests();
-  });
-}
-
-const MEMORY_SOURCE_FILES1 = const <String, String>{
-  'main.dart': """
-library main_lib;
-
-class A {
-  final uri = "foo";
-}
-
-main() {
-  print(Uri.base);
-  print(new A().uri);
-}
-""",
-};
diff --git a/tests/compiler/dart2js/rti/emission/closure_function_type.dart b/tests/compiler/dart2js/rti/emission/closure_function_type.dart
index 56d1d56..aed5de1 100644
--- a/tests/compiler/dart2js/rti/emission/closure_function_type.dart
+++ b/tests/compiler/dart2js/rti/emission/closure_function_type.dart
@@ -8,7 +8,7 @@
 test(o) => o is Function();
 
 main() {
-  test(/*checks=[],functionType,instance*/ () {});
+  test(/*checks=[$signature],instance*/ () {});
   test(
 
       /*strong.checks=[],instance*/
diff --git a/tests/compiler/dart2js/rti/emission/closure_signature.dart b/tests/compiler/dart2js/rti/emission/closure_signature.dart
index b1250b0..aedf5f6 100644
--- a/tests/compiler/dart2js/rti/emission/closure_signature.dart
+++ b/tests/compiler/dart2js/rti/emission/closure_signature.dart
@@ -13,7 +13,7 @@
 
   @NoInline()
   f() {
-    return /*checks=[],functionType,instance*/ (int t) {};
+    return /*checks=[$signature],instance*/ (int t) {};
   }
 }
 
diff --git a/tests/compiler/dart2js/rti/emission/runtime_type_instantiate_to_string1.dart b/tests/compiler/dart2js/rti/emission/runtime_type_instantiate_to_string1.dart
index 3123b79..dc43c4b 100644
--- a/tests/compiler/dart2js/rti/emission/runtime_type_instantiate_to_string1.dart
+++ b/tests/compiler/dart2js/rti/emission/runtime_type_instantiate_to_string1.dart
@@ -3,7 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 main() {
-  /*strong.checks=[],functionType,instance*/
+  /*strong.checks=[$signature],instance*/
   /*omit.checks=[],instance*/
   T id<T>(T t) => t;
   int Function(int) x = id;
diff --git a/tests/compiler/dart2js/rti/emission/subtype_named_args.dart b/tests/compiler/dart2js/rti/emission/subtype_named_args.dart
index 759210b..cb83d5e 100644
--- a/tests/compiler/dart2js/rti/emission/subtype_named_args.dart
+++ b/tests/compiler/dart2js/rti/emission/subtype_named_args.dart
@@ -53,50 +53,50 @@
 
 main() {
   Expect.isTrue(
-      /*strong.checks=[],functionType,instance*/
+      /*strong.checks=[$signature],instance*/
       /*omit.checks=[],instance*/
       ({D a, B b, C c, A d}) {} is classesFunc);
   Expect.isTrue(
-      /*checks=[],functionType,instance*/
+      /*checks=[$signature],instance*/
       ({A a, A b, A c, A d}) {} is classesFunc);
   Expect.isTrue(
-      /*strong.checks=[],functionType,instance*/
+      /*strong.checks=[$signature],instance*/
       /*omit.checks=[],instance*/
       ({D a, A1 b, A1 c, A1 d}) {} is classesFunc);
   Expect.isTrue(
-      /*strong.checks=[],functionType,instance*/
+      /*strong.checks=[$signature],instance*/
       /*omit.checks=[],instance*/
       ({D a, A2 b, A2 c, A2 d}) {} is classesFunc);
   Expect.isTrue(
-      /*strong.checks=[],functionType,instance*/
+      /*strong.checks=[$signature],instance*/
       /*omit.checks=[],instance*/
       ({D a, D b, D c, D d}) {} is classesFunc);
   Expect.isTrue(
-      /*checks=[],functionType,instance*/
+      /*checks=[$signature],instance*/
       ({var a, var b, var c, var d}) {} is classesFunc);
-  Expect.isTrue(/*checks=[],functionType,instance*/
+  Expect.isTrue(/*checks=[$signature],instance*/
       ({Object a, Object b, Object c, Object d}) {} is classesFunc);
 
-  Expect.isTrue(/*checks=[],functionType,instance*/
+  Expect.isTrue(/*checks=[$signature],instance*/
       ({Map<num, num> m, List<List<A1>> l, G<A, A1, A1, A1> g}) {}
           is genericsFunc);
   Expect.isTrue(
-      /*strong.checks=[],functionType,instance*/
+      /*strong.checks=[$signature],instance*/
       /*omit.checks=[],instance*/
       ({Map<int, int> m, List<List<D>> l, G<D, D, D, D> g}) {} is genericsFunc);
   Expect.isTrue(
-      /*checks=[],functionType,instance*/
+      /*checks=[$signature],instance*/
       ({var m, var l, var g}) {} is genericsFunc);
   Expect.isTrue(
-      /*checks=[],functionType,instance*/
+      /*checks=[$signature],instance*/
       ({Object m, Object l, Object g}) {} is genericsFunc);
 
   Expect.isTrue(
-      /*strong.checks=[],functionType,instance*/
+      /*strong.checks=[$signature],instance*/
       /*omit.checks=[],instance*/
       ({A x, G y, mixFunc z, var v}) {} is dynamicFunc);
   Expect.isTrue(
-      /*strong.checks=[],functionType,instance*/
+      /*strong.checks=[$signature],instance*/
       /*omit.checks=[],instance*/
       ({int x, bool y, List<Map> z, classesFunc v}) {} is dynamicFunc);
 
@@ -106,7 +106,7 @@
           {okWithClassesFunc_1 f1,
           okWithGenericsFunc_1 f2,
           okWithDynamicFunc_1 f3}) {} is funcFunc);
-  Expect.isTrue(/*checks=[],functionType,instance*/
+  Expect.isTrue(/*checks=[$signature],instance*/
       (
           {okWithClassesFunc_2 f1,
           okWithGenericsFunc_2 f2,