Revert "Remove kernel isolate API from the public dart_api.h"

This reverts commit 9906819fb71b7857195dd544373c063b1bd6a253.

Reason for revert: Follow up CLs are more complicated than I thought, so I don't want to leave it in an inconsistent state.

Original change's description:
> Remove kernel isolate API from the public dart_api.h
> 
> This is the first step in moving the kernel isolate out
> of the VM and into the standalone embedder.
> 
> Bug: https://github.com/dart-lang/sdk/issues/33433
> Change-Id: Ie8d9ac1c27efe2661f0441b75275119966d197af
> Reviewed-on: https://dart-review.googlesource.com/c/84829
> Commit-Queue: Liam Appelbe <liama@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,liama@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/33433
Change-Id: Iaf753c210e918df167364b50ee823b2557896628
Reviewed-on: https://dart-review.googlesource.com/c/87623
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn
index a5c2317..f220caa 100644
--- a/runtime/bin/BUILD.gn
+++ b/runtime/bin/BUILD.gn
@@ -157,8 +157,6 @@
       "dfe.cc",
       "dfe.h",
       "gen_snapshot.cc",
-      "kernel_isolate.cc",
-      "kernel_isolate.h",
       "options.cc",
       "options.h",
       "vmservice_impl.cc",
@@ -717,8 +715,6 @@
                 "dart_embedder_api_impl.cc",
                 "error_exit.cc",
                 "error_exit.h",
-                "kernel_isolate.cc",
-                "kernel_isolate.h",
                 "main.cc",
                 "main_options.cc",
                 "main_options.h",
@@ -941,8 +937,6 @@
               "dfe.h",
               "error_exit.cc",
               "error_exit.h",
-              "kernel_isolate.cc",
-              "kernel_isolate.h",
               "run_vm_tests.cc",
               "snapshot_utils.cc",
               "snapshot_utils.h",
diff --git a/runtime/bin/dfe.h b/runtime/bin/dfe.h
index 47d95d2..af520658 100644
--- a/runtime/bin/dfe.h
+++ b/runtime/bin/dfe.h
@@ -5,7 +5,6 @@
 #ifndef RUNTIME_BIN_DFE_H_
 #define RUNTIME_BIN_DFE_H_
 
-#include "bin/kernel_isolate.h"
 #include "include/dart_api.h"
 #include "include/dart_native_api.h"
 #include "platform/assert.h"
diff --git a/runtime/bin/kernel_isolate.cc b/runtime/bin/kernel_isolate.cc
deleted file mode 100644
index c6bc711..0000000
--- a/runtime/bin/kernel_isolate.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright (c) 2018, 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.
-
-#include "bin/kernel_isolate.h"
-
-#include "vm/dart_api_impl.h"
-#include "vm/isolate.h"
-#include "vm/kernel_isolate.h"
-
-namespace dart {
-
-DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate) {
-#if defined(DART_PRECOMPILED_RUNTIME)
-  return false;
-#else
-  Isolate* iso = reinterpret_cast<Isolate*>(isolate);
-  return KernelIsolate::IsKernelIsolate(iso);
-#endif
-}
-
-DART_EXPORT bool Dart_KernelIsolateIsRunning() {
-#if defined(DART_PRECOMPILED_RUNTIME)
-  return false;
-#else
-  return KernelIsolate::IsRunning();
-#endif
-}
-
-DART_EXPORT Dart_Port Dart_KernelPort() {
-#if defined(DART_PRECOMPILED_RUNTIME)
-  return false;
-#else
-  return KernelIsolate::KernelPort();
-#endif
-}
-
-DART_EXPORT Dart_KernelCompilationResult
-Dart_CompileToKernel(const char* script_uri,
-                     const uint8_t* platform_kernel,
-                     intptr_t platform_kernel_size,
-                     bool incremental_compile,
-                     const char* package_config) {
-  API_TIMELINE_DURATION(Thread::Current());
-
-  Dart_KernelCompilationResult result;
-#if defined(DART_PRECOMPILED_RUNTIME)
-  result.status = Dart_KernelCompilationStatus_Unknown;
-  result.error = strdup("Dart_CompileToKernel is unsupported.");
-#else
-  result = KernelIsolate::CompileToKernel(script_uri, platform_kernel,
-                                          platform_kernel_size, 0, NULL,
-                                          incremental_compile, package_config);
-  if (result.status == Dart_KernelCompilationStatus_Ok) {
-    Dart_KernelCompilationResult accept_result =
-        KernelIsolate::AcceptCompilation();
-    if (accept_result.status != Dart_KernelCompilationStatus_Ok) {
-      FATAL1(
-          "An error occurred in the CFE while accepting the most recent"
-          " compilation results: %s",
-          accept_result.error);
-    }
-  }
-#endif
-  return result;
-}
-
-DART_EXPORT Dart_KernelCompilationResult
-Dart_CompileSourcesToKernel(const char* script_uri,
-                            const uint8_t* platform_kernel,
-                            intptr_t platform_kernel_size,
-                            int source_files_count,
-                            Dart_SourceFile sources[],
-                            bool incremental_compile,
-                            const char* package_config,
-                            const char* multiroot_filepaths,
-                            const char* multiroot_scheme) {
-  Dart_KernelCompilationResult result;
-#if defined(DART_PRECOMPILED_RUNTIME)
-  result.status = Dart_KernelCompilationStatus_Unknown;
-  result.error = strdup("Dart_CompileSourcesToKernel is unsupported.");
-#else
-  result = KernelIsolate::CompileToKernel(
-      script_uri, platform_kernel, platform_kernel_size, source_files_count,
-      sources, incremental_compile, package_config, multiroot_filepaths,
-      multiroot_scheme);
-  if (result.status == Dart_KernelCompilationStatus_Ok) {
-    if (KernelIsolate::AcceptCompilation().status !=
-        Dart_KernelCompilationStatus_Ok) {
-      FATAL(
-          "An error occurred in the CFE while accepting the most recent"
-          " compilation results.");
-    }
-  }
-#endif
-  return result;
-}
-
-DART_EXPORT Dart_KernelCompilationResult Dart_KernelListDependencies() {
-  Dart_KernelCompilationResult result;
-#if defined(DART_PRECOMPILED_RUNTIME)
-  result.status = Dart_KernelCompilationStatus_Unknown;
-  result.error = strdup("Dart_KernelListDependencies is unsupported.");
-#else
-  result = KernelIsolate::ListDependencies();
-#endif
-  return result;
-}
-
-}  // namespace dart
diff --git a/runtime/bin/kernel_isolate.h b/runtime/bin/kernel_isolate.h
deleted file mode 100644
index 4a9e667..0000000
--- a/runtime/bin/kernel_isolate.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2018, 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.
-
-#ifndef RUNTIME_BIN_KERNEL_ISOLATE_H_
-#define RUNTIME_BIN_KERNEL_ISOLATE_H_
-
-#include "include/dart_api.h"
-
-namespace dart {
-
-typedef enum {
-  Dart_KernelCompilationStatus_Unknown = -1,
-  Dart_KernelCompilationStatus_Ok = 0,
-  Dart_KernelCompilationStatus_Error = 1,
-  Dart_KernelCompilationStatus_Crash = 2,
-} Dart_KernelCompilationStatus;
-
-typedef struct {
-  Dart_KernelCompilationStatus status;
-  char* error;
-
-  uint8_t* kernel;
-  intptr_t kernel_size;
-} Dart_KernelCompilationResult;
-
-DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate);
-DART_EXPORT bool Dart_KernelIsolateIsRunning();
-DART_EXPORT Dart_Port Dart_KernelPort();
-DART_EXPORT Dart_KernelCompilationResult
-Dart_CompileToKernel(const char* script_uri,
-                     const uint8_t* platform_kernel,
-                     const intptr_t platform_kernel_size,
-                     bool incremental_compile,
-                     const char* package_config);
-
-typedef struct {
-  const char* uri;
-  const char* source;
-} Dart_SourceFile;
-DART_EXPORT Dart_KernelCompilationResult
-Dart_CompileSourcesToKernel(const char* script_uri,
-                            const uint8_t* platform_kernel,
-                            intptr_t platform_kernel_size,
-                            int source_files_count,
-                            Dart_SourceFile source_files[],
-                            bool incremental_compile,
-                            const char* package_config,
-                            const char* multiroot_filepaths,
-                            const char* multiroot_scheme);
-
-DART_EXPORT Dart_KernelCompilationResult Dart_KernelListDependencies();
-
-#define DART_KERNEL_ISOLATE_NAME "kernel-service"
-
-}  // namespace dart
-
-#endif  // RUNTIME_BIN_KERNEL_ISOLATE_H_
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index 661a146..5ac0f25 100644
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -3069,6 +3069,65 @@
 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer);
 
 /*
+ * ======
+ * Kernel
+ * ======
+ */
+
+/**
+ * Experimental support for Dart to Kernel parser isolate.
+ *
+ * TODO(hausner): Document finalized interface.
+ *
+ */
+
+// TODO(33433): Remove kernel service from the embedding API.
+
+typedef enum {
+  Dart_KernelCompilationStatus_Unknown = -1,
+  Dart_KernelCompilationStatus_Ok = 0,
+  Dart_KernelCompilationStatus_Error = 1,
+  Dart_KernelCompilationStatus_Crash = 2,
+} Dart_KernelCompilationStatus;
+
+typedef struct {
+  Dart_KernelCompilationStatus status;
+  char* error;
+
+  uint8_t* kernel;
+  intptr_t kernel_size;
+} Dart_KernelCompilationResult;
+
+DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate);
+DART_EXPORT bool Dart_KernelIsolateIsRunning();
+DART_EXPORT Dart_Port Dart_KernelPort();
+DART_EXPORT Dart_KernelCompilationResult
+Dart_CompileToKernel(const char* script_uri,
+                     const uint8_t* platform_kernel,
+                     const intptr_t platform_kernel_size,
+                     bool incremental_compile,
+                     const char* package_config);
+
+typedef struct {
+  const char* uri;
+  const char* source;
+} Dart_SourceFile;
+DART_EXPORT Dart_KernelCompilationResult
+Dart_CompileSourcesToKernel(const char* script_uri,
+                            const uint8_t* platform_kernel,
+                            intptr_t platform_kernel_size,
+                            int source_files_count,
+                            Dart_SourceFile source_files[],
+                            bool incremental_compile,
+                            const char* package_config,
+                            const char* multiroot_filepaths,
+                            const char* multiroot_scheme);
+
+DART_EXPORT Dart_KernelCompilationResult Dart_KernelListDependencies();
+
+#define DART_KERNEL_ISOLATE_NAME "kernel-service"
+
+/*
  * =======
  * Service
  * =======
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index e3e5603..18a5f5c 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -5373,6 +5373,105 @@
   return Api::Success();
 }
 
+// --- Dart Front-End (Kernel) support ---
+
+DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate) {
+#if defined(DART_PRECOMPILED_RUNTIME)
+  return false;
+#else
+  Isolate* iso = reinterpret_cast<Isolate*>(isolate);
+  return KernelIsolate::IsKernelIsolate(iso);
+#endif
+}
+
+DART_EXPORT bool Dart_KernelIsolateIsRunning() {
+#if defined(DART_PRECOMPILED_RUNTIME)
+  return false;
+#else
+  return KernelIsolate::IsRunning();
+#endif
+}
+
+DART_EXPORT Dart_Port Dart_KernelPort() {
+#if defined(DART_PRECOMPILED_RUNTIME)
+  return false;
+#else
+  return KernelIsolate::KernelPort();
+#endif
+}
+
+DART_EXPORT Dart_KernelCompilationResult
+Dart_CompileToKernel(const char* script_uri,
+                     const uint8_t* platform_kernel,
+                     intptr_t platform_kernel_size,
+                     bool incremental_compile,
+                     const char* package_config) {
+  API_TIMELINE_DURATION(Thread::Current());
+
+  Dart_KernelCompilationResult result;
+#if defined(DART_PRECOMPILED_RUNTIME)
+  result.status = Dart_KernelCompilationStatus_Unknown;
+  result.error = strdup("Dart_CompileToKernel is unsupported.");
+#else
+  result = KernelIsolate::CompileToKernel(script_uri, platform_kernel,
+                                          platform_kernel_size, 0, NULL,
+                                          incremental_compile, package_config);
+  if (result.status == Dart_KernelCompilationStatus_Ok) {
+    Dart_KernelCompilationResult accept_result =
+        KernelIsolate::AcceptCompilation();
+    if (accept_result.status != Dart_KernelCompilationStatus_Ok) {
+      FATAL1(
+          "An error occurred in the CFE while accepting the most recent"
+          " compilation results: %s",
+          accept_result.error);
+    }
+  }
+#endif
+  return result;
+}
+
+DART_EXPORT Dart_KernelCompilationResult
+Dart_CompileSourcesToKernel(const char* script_uri,
+                            const uint8_t* platform_kernel,
+                            intptr_t platform_kernel_size,
+                            int source_files_count,
+                            Dart_SourceFile sources[],
+                            bool incremental_compile,
+                            const char* package_config,
+                            const char* multiroot_filepaths,
+                            const char* multiroot_scheme) {
+  Dart_KernelCompilationResult result;
+#if defined(DART_PRECOMPILED_RUNTIME)
+  result.status = Dart_KernelCompilationStatus_Unknown;
+  result.error = strdup("Dart_CompileSourcesToKernel is unsupported.");
+#else
+  result = KernelIsolate::CompileToKernel(
+      script_uri, platform_kernel, platform_kernel_size, source_files_count,
+      sources, incremental_compile, package_config, multiroot_filepaths,
+      multiroot_scheme);
+  if (result.status == Dart_KernelCompilationStatus_Ok) {
+    if (KernelIsolate::AcceptCompilation().status !=
+        Dart_KernelCompilationStatus_Ok) {
+      FATAL(
+          "An error occurred in the CFE while accepting the most recent"
+          " compilation results.");
+    }
+  }
+#endif
+  return result;
+}
+
+DART_EXPORT Dart_KernelCompilationResult Dart_KernelListDependencies() {
+  Dart_KernelCompilationResult result;
+#if defined(DART_PRECOMPILED_RUNTIME)
+  result.status = Dart_KernelCompilationStatus_Unknown;
+  result.error = strdup("Dart_KernelListDependencies is unsupported.");
+#else
+  result = KernelIsolate::ListDependencies();
+#endif
+  return result;
+}
+
 // --- Service support ---
 
 DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate) {
diff --git a/runtime/vm/isolate_reload.h b/runtime/vm/isolate_reload.h
index 35e6a7d..082bc48 100644
--- a/runtime/vm/isolate_reload.h
+++ b/runtime/vm/isolate_reload.h
@@ -7,7 +7,6 @@
 
 #include "include/dart_tools_api.h"
 
-#include "bin/kernel_isolate.h"
 #include "vm/globals.h"
 #include "vm/growable_array.h"
 #include "vm/hash_map.h"
diff --git a/runtime/vm/kernel_isolate.h b/runtime/vm/kernel_isolate.h
index ed610c5..a271351 100644
--- a/runtime/vm/kernel_isolate.h
+++ b/runtime/vm/kernel_isolate.h
@@ -8,7 +8,6 @@
 #include "include/dart_api.h"
 #include "include/dart_native_api.h"
 
-#include "bin/kernel_isolate.h"
 #include "vm/allocation.h"
 #include "vm/dart.h"
 #include "vm/os_thread.h"
diff --git a/runtime/vm/unit_test.h b/runtime/vm/unit_test.h
index e99f521..6c53746 100644
--- a/runtime/vm/unit_test.h
+++ b/runtime/vm/unit_test.h
@@ -9,7 +9,6 @@
 
 #include "platform/globals.h"
 
-#include "bin/kernel_isolate.h"
 #include "vm/dart.h"
 #include "vm/dart_api_state.h"
 #include "vm/dart_entry.h"