[ddc] Add flag to use the new runtime type system

Currently the flag does nothing. Follow up changes will add support
incrementally.

Add a `--canary` flag to DDC that will enable all features in
development to simplify use in tests and benchmarks.

Issue: https://github.com/dart-lang/sdk/issues/48950

Change-Id: I4878c771bdb4f4c6e8b8cd618737009268b02cbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237602
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
diff --git a/pkg/dev_compiler/lib/src/compiler/shared_command.dart b/pkg/dev_compiler/lib/src/compiler/shared_command.dart
index 02472f7..e97cd33 100644
--- a/pkg/dev_compiler/lib/src/compiler/shared_command.dart
+++ b/pkg/dev_compiler/lib/src/compiler/shared_command.dart
@@ -95,6 +95,9 @@
 
   final bool soundNullSafety;
 
+  /// A canary feature that enables a new runtime type representation.
+  final bool newRuntimeTypes;
+
   SharedCompilerOptions(
       {this.sourceMap = true,
       this.inlineSourceMap = false,
@@ -110,7 +113,10 @@
       this.multiRootScheme,
       this.multiRootOutputPath,
       this.experiments = const {},
-      this.soundNullSafety = false});
+      this.soundNullSafety = false,
+      bool canaryFeatures = false})
+      : // Current canary features.
+        newRuntimeTypes = canaryFeatures;
 
   SharedCompilerOptions.fromArguments(ArgResults args)
       : this(
@@ -131,7 +137,8 @@
             multiRootOutputPath: args['multi-root-output-path'] as String,
             experiments: parseExperimentalArguments(
                 args['enable-experiment'] as List<String>),
-            soundNullSafety: args['sound-null-safety'] as bool);
+            soundNullSafety: args['sound-null-safety'] as bool,
+            canaryFeatures: args['canary'] as bool);
 
   SharedCompilerOptions.fromSdkRequiredArguments(ArgResults args)
       : this(
@@ -145,7 +152,8 @@
             multiRootOutputPath: args['multi-root-output-path'] as String,
             experiments: parseExperimentalArguments(
                 args['enable-experiment'] as List<String>),
-            soundNullSafety: args['sound-null-safety'] as bool);
+            soundNullSafety: args['sound-null-safety'] as bool,
+            canaryFeatures: args['canary'] as bool);
 
   static void addArguments(ArgParser parser, {bool hide = true}) {
     addSdkRequiredArguments(parser, hide: hide);
@@ -213,7 +221,14 @@
       ..addFlag('sound-null-safety',
           help: 'Compile for sound null safety at runtime.',
           negatable: true,
-          defaultsTo: false);
+          defaultsTo: false)
+      ..addFlag('canary',
+          help: 'Enable all compiler features under active development. '
+              'This option is intended for compiler development only. '
+              'Canary features are likely to be unstable and can be removed '
+              'without warning.',
+          defaultsTo: false,
+          hide: true);
   }
 
   static String _getModuleName(ArgResults args) {
diff --git a/pkg/dev_compiler/tool/ddb b/pkg/dev_compiler/tool/ddb
index a44b20b..5f3a651 100755
--- a/pkg/dev_compiler/tool/ddb
+++ b/pkg/dev_compiler/tool/ddb
@@ -69,6 +69,9 @@
         negatable: true)
     ..addFlag('weak-null-safety-errors',
         help: 'Treat weak null safety warnings as errors.', defaultsTo: false)
+    ..addFlag('canary',
+        help: 'Enable all compiler features under active development.',
+        defaultsTo: false)
     ..addFlag('observe',
         help:
             'Run the compiler in the Dart VM with --observe. Implies --debug.',
@@ -128,6 +131,7 @@
   var nonNullAsserts = options['null-assertions'] as bool;
   var nativeNonNullAsserts = options['native-null-assertions'] as bool;
   var weakNullSafetyErrors = options['weak-null-safety-errors'] as bool;
+  var canaryFeatures = options['canary'] as bool;
   var entry = p.canonicalize(options.rest.first);
   var out = (options['out'] as String) ?? p.setExtension(entry, '.js');
   var libRoot = p.dirname(entry);
@@ -240,6 +244,7 @@
       if (soundNullSafety) '--sound-null-safety',
       if (options['packages'] != null) '--packages=${options['packages']}',
       if (emitDebugSymbols) '--emit-debug-symbols',
+      if (canaryFeatures) '--canary',
       '-o',
       out,
       entry