| Index: runtime/vm/object.cc
|
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
|
| index 2ede7d1eda482b9aeddec89e43e1b5b06155c237..05ddfc4e3dddfd15175405f088c69e17456ca87b 100644
|
| --- a/runtime/vm/object.cc
|
| +++ b/runtime/vm/object.cc
|
| @@ -64,6 +64,7 @@ DEFINE_FLAG(bool, throw_on_javascript_int_overflow, false,
|
| DEFINE_FLAG(bool, use_field_guards, true, "Guard field cids.");
|
| DEFINE_FLAG(bool, use_lib_cache, true, "Use library name cache");
|
| DEFINE_FLAG(bool, trace_field_guards, false, "Trace changes in field's cids.");
|
| +DEFINE_FLAG(bool, use_mirrors, true, "Make dart:mirrors available.");
|
|
|
| DECLARE_FLAG(bool, error_on_bad_override);
|
| DECLARE_FLAG(bool, trace_compiler);
|
| @@ -1188,20 +1189,25 @@ RawError* Object::Init(Isolate* isolate) {
|
| object_store->set_weak_property_class(cls);
|
| RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib);
|
|
|
| - // Pre-register the mirrors library so we can place the vm class
|
| - // MirrorReference there rather than the core library.
|
| - lib = Library::LookupLibrary(Symbols::DartMirrors());
|
| - if (lib.IsNull()) {
|
| - lib = Library::NewLibraryHelper(Symbols::DartMirrors(), true);
|
| - lib.SetLoadRequested();
|
| - lib.Register();
|
| - object_store->set_bootstrap_library(ObjectStore::kMirrors, lib);
|
| - }
|
| - ASSERT(!lib.IsNull());
|
| - ASSERT(lib.raw() == Library::MirrorsLibrary());
|
| + if (FLAG_use_mirrors) {
|
| + // Pre-register the mirrors library so we can place the vm class
|
| + // MirrorReference there rather than the core library.
|
| + lib = Library::LookupLibrary(Symbols::DartMirrors());
|
| + if (lib.IsNull()) {
|
| + lib = Library::NewLibraryHelper(Symbols::DartMirrors(), true);
|
| + lib.SetLoadRequested();
|
| + lib.Register();
|
| + object_store->set_bootstrap_library(ObjectStore::kMirrors, lib);
|
| + }
|
| + ASSERT(!lib.IsNull());
|
| + ASSERT(lib.raw() == Library::MirrorsLibrary());
|
|
|
| - cls = Class::New<MirrorReference>();
|
| - RegisterPrivateClass(cls, Symbols::_MirrorReference(), lib);
|
| + cls = Class::New<MirrorReference>();
|
| + RegisterPrivateClass(cls, Symbols::_MirrorReference(), lib);
|
| + } else {
|
| + lib = Library::LookupLibrary(Symbols::DartMirrors());
|
| + ASSERT(lib.IsNull());
|
| + }
|
|
|
| // Pre-register the collection library so we can place the vm class
|
| // LinkedHashMap there rather than the core library.
|
|
|