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

Unified Diff: runtime/vm/bootstrap.cc

Issue 2527693002: Add flag use_corelib_source_files to control how dart_bootstrap and gen_snapshot load core librarie… (Closed)
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/bootstrap.cc
diff --git a/runtime/vm/bootstrap.cc b/runtime/vm/bootstrap.cc
index 113dcd9d3f0dc0a667ec635ce0c0959a53ef382f..6d00087e59482ffdfc4ac6163237793a5c7b7ed7 100644
--- a/runtime/vm/bootstrap.cc
+++ b/runtime/vm/bootstrap.cc
@@ -20,6 +20,11 @@
namespace dart {
+DEFINE_FLAG(bool,
+ use_corelib_source_files,
+ false,
+ "Attempt to use source files directly when loading in the core "
+ "libraries during the bootstrap process");
struct BootstrapLibProps {
ObjectStore::BootstrapLibraryId index;
@@ -82,15 +87,20 @@ static RawString* GetLibrarySourceByIndex(intptr_t index,
const uint8_t* utf8_array = NULL;
intptr_t file_length = -1;
- Dart_FileOpenCallback file_open = Dart::file_open_callback();
- Dart_FileReadCallback file_read = Dart::file_read_callback();
- Dart_FileCloseCallback file_close = Dart::file_close_callback();
- if ((file_open != NULL) && (file_read != NULL) && (file_close != NULL)) {
- // Try to open and read the file.
- void* stream = (*file_open)(source_path, false);
- if (stream != NULL) {
- (*file_read)(&utf8_array, &file_length, stream);
- (*file_close)(stream);
+ // If flag to use the core library files directly is specified then try
+ // to read the file and extract it's contents otherwise just use the
+ // source data that has been backed into the binary.
+ if (FLAG_use_corelib_source_files) {
+ Dart_FileOpenCallback file_open = Dart::file_open_callback();
+ Dart_FileReadCallback file_read = Dart::file_read_callback();
+ Dart_FileCloseCallback file_close = Dart::file_close_callback();
+ if ((file_open != NULL) && (file_read != NULL) && (file_close != NULL)) {
+ // Try to open and read the file.
+ void* stream = (*file_open)(source_path, false);
+ if (stream != NULL) {
+ (*file_read)(&utf8_array, &file_length, stream);
+ (*file_close)(stream);
+ }
}
}
if (file_length == -1) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698