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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/kernel_reader.h" 5 #include "vm/kernel_reader.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/kernel_binary.h" 10 #include "vm/kernel_binary.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 205
206 // Either class finalization failed or we caught a compile error. 206 // Either class finalization failed or we caught a compile error.
207 // In both cases sticky error would be set. 207 // In both cases sticky error would be set.
208 Error& error = Error::Handle(Z); 208 Error& error = Error::Handle(Z);
209 error = thread_->sticky_error(); 209 error = thread_->sticky_error();
210 thread_->clear_sticky_error(); 210 thread_->clear_sticky_error();
211 return error; 211 return error;
212 } 212 }
213 213
214 void KernelReader::FindModifiedLibraries(Isolate* isolate,
215 BitVector* modified_libs,
216 bool force_reload) {
217 LongJumpScope jump;
218 if (setjmp(*jump.Set()) == 0) {
219 if (force_reload) {
220 // If a reload is being forced we mark all libraries as having
221 // been modified.
222 const GrowableObjectArray& libs =
223 GrowableObjectArray::Handle(isolate->object_store()->libraries());
224 intptr_t num_libs = libs.Length();
225 Library& lib = dart::Library::Handle(Z);
226 for (intptr_t i = 0; i < num_libs; i++) {
227 lib ^= libs.At(i);
228 if (!lib.is_dart_scheme()) {
229 modified_libs->Add(lib.index());
230 }
231 }
232 return;
233 }
234 // Now go through all the libraries that are present in the incremental
235 // kernel files, these will constitute the modified libraries.
236 intptr_t length = program_->library_count();
237 for (intptr_t i = 0; i < length; i++) {
238 intptr_t kernel_offset = library_offset(i);
239 builder_.SetOffset(kernel_offset);
240 LibraryHelper library_helper(&builder_);
241 library_helper.ReadUntilIncluding(LibraryHelper::kCanonicalName);
242 dart::Library& lib = LookupLibrary(library_helper.canonical_name_);
243 if (!lib.IsNull() && !lib.is_dart_scheme()) {
244 // This is a library that already exists so mark it as being modified.
245 modified_libs->Add(lib.index());
246 }
247 }
248 }
249 }
250
214 void KernelReader::ReadLibrary(intptr_t kernel_offset) { 251 void KernelReader::ReadLibrary(intptr_t kernel_offset) {
215 builder_.SetOffset(kernel_offset); 252 builder_.SetOffset(kernel_offset);
216 LibraryHelper library_helper(&builder_); 253 LibraryHelper library_helper(&builder_);
217 library_helper.ReadUntilIncluding(LibraryHelper::kCanonicalName); 254 library_helper.ReadUntilIncluding(LibraryHelper::kCanonicalName);
218 Library& library = LookupLibrary(library_helper.canonical_name_); 255 Library& library = LookupLibrary(library_helper.canonical_name_);
219 if (library.Loaded()) return; 256 if (library.Loaded()) return;
220 257
221 library_helper.ReadUntilIncluding(LibraryHelper::kName); 258 library_helper.ReadUntilIncluding(LibraryHelper::kName);
222 library.SetName(H.DartSymbol(library_helper.name_index_)); 259 library.SetName(H.DartSymbol(library_helper.name_index_));
223 260
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 initializer_fun.set_result_type(AbstractType::Handle(zone, field.type())); 1003 initializer_fun.set_result_type(AbstractType::Handle(zone, field.type()));
967 initializer_fun.set_is_debuggable(false); 1004 initializer_fun.set_is_debuggable(false);
968 initializer_fun.set_is_reflectable(false); 1005 initializer_fun.set_is_reflectable(false);
969 initializer_fun.set_is_inlinable(false); 1006 initializer_fun.set_is_inlinable(false);
970 return new (zone) ParsedFunction(thread, initializer_fun); 1007 return new (zone) ParsedFunction(thread, initializer_fun);
971 } 1008 }
972 1009
973 } // namespace kernel 1010 } // namespace kernel
974 } // namespace dart 1011 } // namespace dart
975 #endif // !defined(DART_PRECOMPILED_RUNTIME) 1012 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698