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

Unified Diff: runtime/vm/kernel_reader.cc

Issue 2998983002: 1. Figure out the modified libraries from the specifeid kernel file during (Closed)
Patch Set: Address code review comments. Created 3 years, 4 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
Index: runtime/vm/kernel_reader.cc
diff --git a/runtime/vm/kernel_reader.cc b/runtime/vm/kernel_reader.cc
index 490474c2f444a9dfc1235a5e89f7a0c06da4cd43..bbb439a7267cdc866c32cb785b7d13c20521b14b 100644
--- a/runtime/vm/kernel_reader.cc
+++ b/runtime/vm/kernel_reader.cc
@@ -211,6 +211,43 @@ Object& KernelReader::ReadProgram() {
return error;
}
+void KernelReader::FindModifiedLibraries(Isolate* isolate,
+ BitVector* modified_libs,
+ bool force_reload) {
+ LongJumpScope jump;
+ if (setjmp(*jump.Set()) == 0) {
+ if (force_reload) {
+ // If a reload is being forced we mark all libraries as having
+ // been modified.
+ const GrowableObjectArray& libs =
+ GrowableObjectArray::Handle(isolate->object_store()->libraries());
+ intptr_t num_libs = libs.Length();
+ Library& lib = dart::Library::Handle(Z);
+ for (intptr_t i = 0; i < num_libs; i++) {
+ lib ^= libs.At(i);
+ if (!lib.is_dart_scheme()) {
+ modified_libs->Add(lib.index());
+ }
+ }
+ return;
+ }
+ // Now go through all the libraries that are present in the incremental
+ // kernel files, these will constitute the modified libraries.
+ intptr_t length = program_->library_count();
+ for (intptr_t i = 0; i < length; i++) {
+ intptr_t kernel_offset = library_offset(i);
+ builder_.SetOffset(kernel_offset);
+ LibraryHelper library_helper(&builder_);
+ library_helper.ReadUntilIncluding(LibraryHelper::kCanonicalName);
+ dart::Library& lib = LookupLibrary(library_helper.canonical_name_);
+ if (!lib.IsNull() && !lib.is_dart_scheme()) {
+ // This is a library that already exists so mark it as being modified.
+ modified_libs->Add(lib.index());
+ }
+ }
+ }
+}
+
void KernelReader::ReadLibrary(intptr_t kernel_offset) {
builder_.SetOffset(kernel_offset);
LibraryHelper library_helper(&builder_);

Powered by Google App Engine
This is Rietveld 408576698