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

Unified Diff: runtime/bin/dfe.cc

Issue 2933203004: Replace the --platform vm option with --kernel-binaries option. (Closed)
Patch Set: s/set_kernel_binaries_directory/SetKernelBinaries Created 3 years, 6 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/dfe.h ('k') | runtime/bin/main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/dfe.cc
diff --git a/runtime/bin/dfe.cc b/runtime/bin/dfe.cc
index 45d81aeded9261d824c946c8f341b0da7155a238..9b37e98cb722d802bcb2f270a42cfebc677cf90e 100644
--- a/runtime/bin/dfe.cc
+++ b/runtime/bin/dfe.cc
@@ -5,12 +5,16 @@
#include "bin/dfe.h"
#include "bin/dartutils.h"
#include "bin/error_exit.h"
+#include "bin/file.h"
#include "vm/kernel.h"
namespace dart {
namespace bin {
+const char kPlatformBinaryName[] = "platform.dill";
+
+
DFE::DFE()
: frontend_filename_(NULL),
platform_binary_filename_(NULL),
@@ -19,13 +23,29 @@ DFE::DFE()
DFE::~DFE() {
frontend_filename_ = NULL;
- platform_binary_filename_ = NULL;
+
+ if (platform_binary_filename_ != NULL) {
+ delete platform_binary_filename_;
+ platform_binary_filename_ = NULL;
+ }
+
if (kernel_platform_ != NULL) {
delete reinterpret_cast<kernel::Program*>(kernel_platform_);
+ kernel_platform_ = NULL;
}
- kernel_platform_ = NULL;
}
+
+void DFE::SetKernelBinaries(const char* name) {
+ intptr_t len = snprintf(NULL, 0, "%s%s%s", name, File::PathSeparator(),
+ kPlatformBinaryName) +
+ 1;
+ platform_binary_filename_ = new char[len];
+ snprintf(platform_binary_filename_, len, "%s%s%s", name,
+ File::PathSeparator(), kPlatformBinaryName);
+}
+
+
Dart_Handle DFE::ReloadScript(Dart_Isolate isolate, const char* url_string) {
ASSERT(!Dart_IsServiceIsolate(isolate) && !Dart_IsKernelIsolate(isolate));
// First check if the URL points to a Kernel IR file in which case we
@@ -85,15 +105,7 @@ void* DFE::CompileAndReadScript(const char* script_uri,
void* DFE::ReadPlatform() {
- const uint8_t* buffer = NULL;
- intptr_t buffer_length = -1;
- bool result =
- TryReadKernelFile(platform_binary_filename_, &buffer, &buffer_length);
- if (result) {
- kernel_platform_ = Dart_ReadKernelBinary(buffer, buffer_length);
- return kernel_platform_;
- }
- return NULL;
+ return kernel_platform_ = ReadScript(platform_binary_filename_);
}
« no previous file with comments | « runtime/bin/dfe.h ('k') | runtime/bin/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698