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

Unified Diff: runtime/bin/main.cc

Issue 2525623002: VM: [Kernel] Split kernel API into 3 steps: ([read binary], parse-binary, bootstrap, load program) (Closed)
Patch Set: addressed comments 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
« no previous file with comments | « runtime/bin/loader.cc ('k') | runtime/include/dart_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/main.cc
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index fc9af70c529d42a6888ad15a7cb52c77f00b2731..8accb9221209f85510cbbd0d772bf5dc20849200 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -806,18 +806,19 @@ static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri,
!run_app_snapshot &&
TryReadKernel(script_uri, &kernel_file, &kernel_length);
+ void* kernel_program = NULL;
+ if (is_kernel) {
+ kernel_program = Dart_ReadKernelBinary(kernel_file, kernel_length);
+ free(const_cast<uint8_t*>(kernel_file));
+ }
+
IsolateData* isolate_data =
new IsolateData(script_uri, package_root, packages_config);
Dart_Isolate isolate =
- is_kernel ? Dart_CreateIsolateFromKernel(script_uri, main, kernel_file,
- kernel_length, flags,
- isolate_data, error)
+ is_kernel ? Dart_CreateIsolateFromKernel(script_uri, main, kernel_program,
+ flags, isolate_data, error)
: Dart_CreateIsolate(script_uri, main, isolate_snapshot_buffer,
flags, isolate_data, error);
- if (is_kernel) {
- free(const_cast<uint8_t*>(kernel_file));
- }
-
if (isolate == NULL) {
delete isolate_data;
return NULL;
@@ -830,12 +831,7 @@ static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri,
CHECK_RESULT(result);
if (is_kernel) {
- // TODO(27590): We should not read the kernel file again!
- if (!TryReadKernel(script_uri, &kernel_file, &kernel_length)) {
- FATAL("Failed to read kernel second time");
- }
- Dart_Handle result = Dart_LoadKernel(kernel_file, kernel_length);
- free(const_cast<uint8_t*>(kernel_file));
+ Dart_Handle result = Dart_LoadKernel(kernel_program);
CHECK_RESULT(result);
}
if (is_kernel || (isolate_snapshot_buffer != NULL)) {
« no previous file with comments | « runtime/bin/loader.cc ('k') | runtime/include/dart_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698