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

Unified Diff: runtime/vm/object.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
« runtime/vm/dart_api_impl.cc ('K') | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« runtime/vm/dart_api_impl.cc ('K') | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698