Index: runtime/vm/native_api_impl.cc |
diff --git a/runtime/vm/native_api_impl.cc b/runtime/vm/native_api_impl.cc |
index a3cd5c1a702822a7335e8989fb22987a10243da5..a6688976e9924ee175f08f01754ad6959514374d 100644 |
--- a/runtime/vm/native_api_impl.cc |
+++ b/runtime/vm/native_api_impl.cc |
@@ -11,6 +11,7 @@ |
#include "vm/message.h" |
#include "vm/native_message_handler.h" |
#include "vm/port.h" |
+#include "vm/precompiler.h" |
namespace dart { |
@@ -79,6 +80,16 @@ static void CompileAll(Isolate* isolate, Dart_Handle* result) { |
} |
} |
+static void Precompile(Isolate* isolate, Dart_Handle* result) { |
+ ASSERT(isolate != NULL); |
+ const Error& error = Error::Handle(isolate, Precompiler::CompileAll()); |
+ if (error.IsNull()) { |
+ *result = Api::Success(); |
+ } else { |
+ *result = Api::NewHandle(isolate, error.raw()); |
+ } |
+} |
+ |
DART_EXPORT Dart_Handle Dart_CompileAll() { |
Isolate* isolate = Isolate::Current(); |
@@ -92,4 +103,17 @@ DART_EXPORT Dart_Handle Dart_CompileAll() { |
return result; |
} |
+ |
+DART_EXPORT Dart_Handle Dart_Precompile() { |
+ Isolate* isolate = Isolate::Current(); |
+ DARTSCOPE(isolate); |
+ Dart_Handle result = Api::CheckAndFinalizePendingClasses(isolate); |
+ if (::Dart_IsError(result)) { |
+ return result; |
+ } |
+ CHECK_CALLBACK_STATE(isolate); |
+ Precompile(isolate, &result); |
+ return result; |
+} |
+ |
} // namespace dart |