Revert "[vm/kernel/aot] Exclude vmservice_io from "product" AOT snapshots."

This reverts commit 23fff58503744ae06c73fde08f8e8293f6dbe1dd.

Reason: failures on vm-kernel-precomp-linux-debug-x64-4-8-be,
precomp-linux-debug-x64-1-3-be, precomp-linux-product-x64-be bots.
Change-Id: I7bd67038aac3795c4b6ec9562c6fd4afead41a36
Reviewed-on: https://dart-review.googlesource.com/59242
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
diff --git a/pkg/vm/bin/gen_kernel.dart b/pkg/vm/bin/gen_kernel.dart
index 7d91811..151be0e 100644
--- a/pkg/vm/bin/gen_kernel.dart
+++ b/pkg/vm/bin/gen_kernel.dart
@@ -15,7 +15,7 @@
     show globalDebuggingNames, NameSystem;
 import 'package:vm/bytecode/gen_bytecode.dart' show isKernelBytecodeEnabled;
 import 'package:vm/kernel_front_end.dart'
-    show compileToKernel, ErrorDetector, ErrorPrinter, parseCommandLineDefines;
+    show compileToKernel, ErrorDetector, ErrorPrinter;
 
 final ArgParser _argParser = new ArgParser(allowTrailingOptions: true)
   ..addOption('platform',
@@ -93,7 +93,7 @@
   final bool enableConstantEvaluation = options['enable-constant-evaluation'];
   final Map<String, String> environmentDefines = {};
 
-  if (!parseCommandLineDefines(options['define'], environmentDefines, _usage)) {
+  if (!_parseDefines(options['define'], environmentDefines)) {
     return _badUsageExitCode;
   }
 
@@ -179,3 +179,22 @@
     }
   });
 }
+
+bool _parseDefines(
+    List<String> dFlags, Map<String, String> environmentDefines) {
+  for (final String dflag in dFlags) {
+    final equalsSignIndex = dflag.indexOf('=');
+    if (equalsSignIndex < 0) {
+      environmentDefines[dflag] = '';
+    } else if (equalsSignIndex > 0) {
+      final key = dflag.substring(0, equalsSignIndex);
+      final value = dflag.substring(equalsSignIndex + 1);
+      environmentDefines[key] = value;
+    } else {
+      print('The environment constant options must have a key (was: "$dflag")');
+      print(_usage);
+      return false;
+    }
+  }
+  return true;
+}
diff --git a/pkg/vm/lib/frontend_server.dart b/pkg/vm/lib/frontend_server.dart
index dba6fbf..38b2e10 100644
--- a/pkg/vm/lib/frontend_server.dart
+++ b/pkg/vm/lib/frontend_server.dart
@@ -29,8 +29,7 @@
 import 'package:path/path.dart' as path;
 import 'package:usage/uuid/uuid.dart';
 import 'package:vm/incremental_compiler.dart' show IncrementalCompiler;
-import 'package:vm/kernel_front_end.dart'
-    show compileToKernel, parseCommandLineDefines;
+import 'package:vm/kernel_front_end.dart' show compileToKernel;
 
 ArgParser argParser = new ArgParser(allowTrailingOptions: true)
   ..addFlag('train',
@@ -93,10 +92,7 @@
       help: 'Normally the output dill is used to specify which dill to '
           'initialize from, but it can be overwritten here.',
       defaultsTo: null,
-      hide: true)
-  ..addMultiOption('define',
-      abbr: 'D',
-      help: 'The values for the environment constants (e.g. -Dkey=value).');
+      hide: true);
 
 String usage = '''
 Usage: server [options] [input.dart]
@@ -296,12 +292,6 @@
       }
     }
 
-    final Map<String, String> environmentDefines = {};
-    if (!parseCommandLineDefines(
-        options['define'], environmentDefines, usage)) {
-      return false;
-    }
-
     final TargetFlags targetFlags = new TargetFlags(
         strongMode: options['strong'], syncAsync: options['sync-async']);
     compilerOptions.target = getTarget(options['target'], targetFlags);
@@ -332,8 +322,7 @@
           _mainSource, compilerOptions,
           aot: options['aot'],
           useGlobalTypeFlowAnalysis: options['tfa'],
-          entryPoints: options['entry-points'],
-          environmentDefines: environmentDefines));
+          entryPoints: options['entry-points']));
     }
     if (component != null) {
       if (transformer != null) {
diff --git a/pkg/vm/lib/kernel_front_end.dart b/pkg/vm/lib/kernel_front_end.dart
index 928cac8..72a6607 100644
--- a/pkg/vm/lib/kernel_front_end.dart
+++ b/pkg/vm/lib/kernel_front_end.dart
@@ -330,22 +330,3 @@
     return node == null ? TreeNode.noOffset : node.fileOffset;
   }
 }
-
-bool parseCommandLineDefines(
-    List<String> dFlags, Map<String, String> environmentDefines, String usage) {
-  for (final String dflag in dFlags) {
-    final equalsSignIndex = dflag.indexOf('=');
-    if (equalsSignIndex < 0) {
-      environmentDefines[dflag] = '';
-    } else if (equalsSignIndex > 0) {
-      final key = dflag.substring(0, equalsSignIndex);
-      final value = dflag.substring(equalsSignIndex + 1);
-      environmentDefines[key] = value;
-    } else {
-      print('The environment constant options must have a key (was: "$dflag")');
-      print(usage);
-      return false;
-    }
-  }
-  return true;
-}
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index 8d529d7..59b994e 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -37,8 +37,6 @@
 #include "bin/gzip.h"
 #endif
 
-#include "vm/flags.h"
-
 extern "C" {
 extern const uint8_t kDartVmSnapshotData[];
 extern const uint8_t kDartVmSnapshotInstructions[];
@@ -293,12 +291,10 @@
   result = DartUtils::PrepareForScriptLoading(false, Options::trace_loading());
   CHECK_RESULT(result);
 
-  if (FLAG_support_service || !kDartPrecompiledRuntime) {
-    // Set up the load port provided by the service isolate so that we can
-    // load scripts.
-    result = DartUtils::SetupServiceLoadPort();
-    CHECK_RESULT(result);
-  }
+  // Set up the load port provided by the service isolate so that we can
+  // load scripts.
+  result = DartUtils::SetupServiceLoadPort();
+  CHECK_RESULT(result);
 
   // Setup package root if specified.
   result = DartUtils::SetupPackageRoot(package_root, packages_config);
diff --git a/runtime/bin/vmservice/vmservice_io.dart b/runtime/bin/vmservice/vmservice_io.dart
index 3747f4e..9dc5954 100644
--- a/runtime/bin/vmservice/vmservice_io.dart
+++ b/runtime/bin/vmservice/vmservice_io.dart
@@ -220,7 +220,7 @@
   _signalSubscription = _signalWatch(ProcessSignal.SIGQUIT).listen(_onSignal);
 }
 
-@pragma("vm.entry_point", !const bool.fromEnvironment("dart.vm.product"))
+@pragma("vm.entry_point")
 main() {
   // Set embedder hooks.
   VMServiceEmbedderHooks.cleanup = cleanupCallback;
diff --git a/runtime/vm/compiler/aot/precompiler.cc b/runtime/vm/compiler/aot/precompiler.cc
index ff286b6..e419327 100644
--- a/runtime/vm/compiler/aot/precompiler.cc
+++ b/runtime/vm/compiler/aot/precompiler.cc
@@ -342,6 +342,7 @@
       I->object_store()->set_future_class(null_class);
       I->object_store()->set_pragma_class(null_class);
       I->object_store()->set_completer_class(null_class);
+      I->object_store()->set_stream_iterator_class(null_class);
       I->object_store()->set_symbol_class(null_class);
       I->object_store()->set_compiletime_error_class(null_class);
       I->object_store()->set_simple_instance_of_function(null_function);
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index 6318284..034de31 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -307,11 +307,15 @@
     Service::SetGetServiceAssetsCallback(get_service_assets);
   }
 
-  const bool is_dart2_aot_precompiler =
-      FLAG_strong && FLAG_precompiled_mode && !kDartPrecompiledRuntime;
+#if defined(DART_PRECOMPILED_RUNTIME)
+  const bool is_precompiled_runtime = true;
+#else
+  const bool is_precompiled_runtime = false;
+#endif
 
-  if (!is_dart2_aot_precompiler &&
-      (FLAG_support_service || !kDartPrecompiledRuntime)) {
+  const bool is_dart2_aot_precompiler =
+      FLAG_strong && FLAG_precompiled_mode && !is_precompiled_runtime;
+  if (!is_dart2_aot_precompiler) {
     ServiceIsolate::Run();
   }
 
diff --git a/runtime/vm/flag_list.h b/runtime/vm/flag_list.h
index 7dd0cc2..432e3d3 100644
--- a/runtime/vm/flag_list.h
+++ b/runtime/vm/flag_list.h
@@ -26,12 +26,6 @@
 #define USING_PRODUCT false
 #endif
 
-#if defined(DART_PRECOMPILED_RUNTIME)
-constexpr bool kDartPrecompiledRuntime = true;
-#else
-constexpr bool kDartPrecompiledRuntime = false;
-#endif
-
 // List of all flags in the VM.
 // Flags can be one of three categories:
 // * P roduct flags: Can be set in any of the deployment modes, including in
diff --git a/runtime/vm/object_store.cc b/runtime/vm/object_store.cc
index b9eeeba..e2d676d 100644
--- a/runtime/vm/object_store.cc
+++ b/runtime/vm/object_store.cc
@@ -149,6 +149,9 @@
   cls = async_lib.LookupClass(Symbols::Completer());
   ASSERT(!cls.IsNull());
   set_completer_class(cls);
+  cls = async_lib.LookupClass(Symbols::StreamIterator());
+  ASSERT(!cls.IsNull());
+  set_stream_iterator_class(cls);
 
   String& function_name = String::Handle(zone);
   Function& function = Function::Handle(zone);
diff --git a/runtime/vm/object_store.h b/runtime/vm/object_store.h
index 01b5a52..74f3dfb 100644
--- a/runtime/vm/object_store.h
+++ b/runtime/vm/object_store.h
@@ -58,6 +58,7 @@
   RW(Class, pragma_class)                                                      \
   RW(Class, future_class)                                                      \
   RW(Class, completer_class)                                                   \
+  RW(Class, stream_iterator_class)                                             \
   RW(Class, symbol_class)                                                      \
   RW(Class, one_byte_string_class)                                             \
   RW(Class, two_byte_string_class)                                             \
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 3c67253..ba1f60e 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -9290,7 +9290,7 @@
   // Build creation of implicit StreamIterator.
   // var :for-in-iter = new StreamIterator(stream_expr).
   const Class& stream_iterator_cls =
-      Class::ZoneHandle(Z, async_lib.LookupClass(Symbols::StreamIterator()));
+      Class::ZoneHandle(Z, I->object_store()->stream_iterator_class());
   ASSERT(!stream_iterator_cls.IsNull());
   const Function& iterator_ctor = Function::ZoneHandle(
       Z,
diff --git a/sdk/lib/core/annotations.dart b/sdk/lib/core/annotations.dart
index 4c7c812..c0234f5 100644
--- a/sdk/lib/core/annotations.dart
+++ b/sdk/lib/core/annotations.dart
@@ -248,7 +248,6 @@
  * function foo is annotated with a pragma 'other-pragma' specific to OtherTool.
  *
  */
-@pragma('vm.entry_point')
 class pragma {
   /**
    * The name of the hint.