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

Unified Diff: runtime/bin/loader.cc

Issue 2411823003: VM support for running Kernel binaries. (Closed)
Patch Set: Address comments Created 4 years, 2 months 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/gen_snapshot.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/loader.cc
diff --git a/runtime/bin/loader.cc b/runtime/bin/loader.cc
index 4d35728d228eeeffe234ec83ad1fd1bf6a310ac7..d69def19f857ba943deb0db4c61c938685151b54 100644
--- a/runtime/bin/loader.cc
+++ b/runtime/bin/loader.cc
@@ -336,15 +336,12 @@ bool Loader::ProcessResultLocked(Loader* loader, Loader::IOResult* result) {
}
// Check for payload and load accordingly.
- bool is_snapshot = false;
const uint8_t* payload = result->payload;
intptr_t payload_length = result->payload_length;
- payload =
- DartUtils::SniffForMagicNumber(payload,
- &payload_length,
- &is_snapshot);
+ const DartUtils::MagicNumber payload_type =
+ DartUtils::SniffForMagicNumber(&payload, &payload_length);
Dart_Handle source = Dart_Null();
- if (!is_snapshot) {
+ if (payload_type == DartUtils::kUnknownMagicNumber) {
source = Dart_NewStringFromUTF8(result->payload,
result->payload_length);
if (Dart_IsError(source)) {
@@ -377,8 +374,10 @@ bool Loader::ProcessResultLocked(Loader* loader, Loader::IOResult* result) {
}
break;
case Dart_kScriptTag:
- if (is_snapshot) {
+ if (payload_type == DartUtils::kSnapshotMagicNumber) {
dart_result = Dart_LoadScriptFromSnapshot(payload, payload_length);
+ } else if (payload_type == DartUtils::kKernelMagicNumber) {
+ dart_result = Dart_LoadKernel(payload, payload_length);
} else {
dart_result = Dart_LoadScript(uri, resolved_uri, source, 0, 0);
}
« no previous file with comments | « runtime/bin/gen_snapshot.cc ('k') | runtime/include/dart_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698