Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 2485993002: VM: Support bootstrapping core libraries from Kernel binaries instead of source. (Closed)
Patch Set: Done Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index ab5d16f919665d6c44817b18ae2ff7df971d84a6..faef85162df7a347e2b7d54edcf274df1cda84f7 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -1241,12 +1241,15 @@ static char* BuildIsolateName(const char* script_uri, const char* main) {
}
-DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri,
- const char* main,
- const uint8_t* snapshot,
- Dart_IsolateFlags* flags,
- void* callback_data,
- char** error) {
+static Dart_Isolate CreateIsolate(const char* script_uri,
+ const char* main,
+ const uint8_t* snapshot_buffer,
+ intptr_t snapshot_length,
+ bool from_kernel,
+ Dart_IsolateFlags* flags,
+ void* callback_data,
+ char** error) {
+ ASSERT(!from_kernel || (snapshot_buffer != NULL));
CHECK_NO_ISOLATE(Isolate::Current());
char* isolate_name = BuildIsolateName(script_uri, main);
@@ -1270,11 +1273,12 @@ DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri,
// bootstrap library files which call out to a tag handler that may create
// Api Handles when an error is encountered.
Dart_EnterScope();
- const Error& error_obj =
- Error::Handle(Z, Dart::InitializeIsolate(snapshot, callback_data));
+ const Error& error_obj = Error::Handle(
+ Z, Dart::InitializeIsolate(snapshot_buffer, snapshot_length,
+ from_kernel, callback_data));
if (error_obj.IsNull()) {
#if defined(DART_NO_SNAPSHOT) && !defined(PRODUCT)
- if (FLAG_check_function_fingerprints) {
+ if (FLAG_check_function_fingerprints && !from_kernel) {
Library::CheckFunctionFingerprints();
}
#endif // defined(DART_NO_SNAPSHOT) && !defined(PRODUCT).
@@ -1297,6 +1301,30 @@ DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri,
}
+DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri,
+ const char* main,
+ const uint8_t* snapshot_buffer,
+ Dart_IsolateFlags* flags,
+ void* callback_data,
+ char** error) {
+ return CreateIsolate(script_uri, main, snapshot_buffer, -1, false, flags,
+ callback_data, error);
+}
+
+
+DART_EXPORT Dart_Isolate Dart_CreateIsolateFromKernel(
+ const char* script_uri,
+ const char* main,
+ const uint8_t* kernel_file,
+ intptr_t kernel_length,
+ Dart_IsolateFlags* flags,
+ void* callback_data,
+ char** error) {
+ return CreateIsolate(script_uri, main, kernel_file, kernel_length, true,
+ flags, callback_data, error);
+}
+
+
DART_EXPORT void Dart_ShutdownIsolate() {
Thread* T = Thread::Current();
Isolate* I = T->isolate();
@@ -5332,7 +5360,7 @@ DART_EXPORT Dart_Handle Dart_LoadKernel(const uint8_t* buffer,
DARTSCOPE(Thread::Current());
StackZone zone(T);
-#if defined(DART_PRECOMPILED_RUNTIME) && !defined(DART_PRECOMPILER)
+#if defined(DART_PRECOMPILED_RUNTIME)
return Api::NewError("%s: Can't load Kernel files from precompiled runtime.",
CURRENT_FUNC);
#else

Powered by Google App Engine
This is Rietveld 408576698