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

Unified Diff: runtime/vm/dart.cc

Issue 1152833002: Add a runtime flag to control availability of dart:mirrors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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/dart.cc
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index d14ba97bc2d846093787a9a39430bcb36b16ddbd..1f37ed9c1f1352eb19b636df29c8f78b8cff1a60 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -46,6 +46,7 @@ DEFINE_FLAG(bool, keep_code, false,
DECLARE_FLAG(bool, print_class_table);
DECLARE_FLAG(bool, trace_isolates);
+DECLARE_FLAG(bool, use_mirrors);
Isolate* Dart::vm_isolate_ = NULL;
ThreadPool* Dart::thread_pool_ = NULL;
@@ -277,6 +278,28 @@ RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) {
if (!error.IsNull()) {
return error.raw();
}
+
+ if (!FLAG_use_mirrors) {
+ const Object& libmirrors =
+ Object::Handle(isolate->object_store()->mirrors_library());
Ivan Posva 2015/05/29 06:02:24 Should we at this point set the value in the objec
rmacnak 2015/06/13 00:11:09 Actually, this is unsafe. We sometimes lookup libr
+ if (!libmirrors.IsNull()) {
+ // Mirrors were enabled when the snapshot was taken. Retroactively
+ // remove them.
+ const GrowableObjectArray& old_libs =
Ivan Posva 2015/05/29 06:02:24 Instead of creating a new array, you could find th
+ GrowableObjectArray::Handle(isolate->object_store()->libraries());
+ const GrowableObjectArray& new_libs = GrowableObjectArray::Handle(
+ GrowableObjectArray::New(old_libs.Length(), Heap::kOld));
+ Object& lib = Object::Handle();
+ for (intptr_t i = 0; i < old_libs.Length(); i++) {
+ lib = old_libs.At(i);
+ if (lib.raw() != libmirrors.raw()) {
+ new_libs.Add(lib);
+ }
+ }
+ isolate->object_store()->set_libraries(new_libs);
+ }
+ }
+
if (FLAG_trace_isolates) {
isolate->heap()->PrintSizes();
isolate->megamorphic_cache_table()->PrintSizes();

Powered by Google App Engine
This is Rietveld 408576698