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

Side by Side 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 unified diff | Download patch
« runtime/vm/dart_api_impl.cc ('K') | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 "with the type arguments of its super type."); 57 "with the type arguments of its super type.");
58 DEFINE_FLAG(bool, show_internal_names, false, 58 DEFINE_FLAG(bool, show_internal_names, false,
59 "Show names of internal classes (e.g. \"OneByteString\") in error messages " 59 "Show names of internal classes (e.g. \"OneByteString\") in error messages "
60 "instead of showing the corresponding interface names (e.g. \"String\")"); 60 "instead of showing the corresponding interface names (e.g. \"String\")");
61 DEFINE_FLAG(bool, throw_on_javascript_int_overflow, false, 61 DEFINE_FLAG(bool, throw_on_javascript_int_overflow, false,
62 "Throw an exception when the result of an integer calculation will not " 62 "Throw an exception when the result of an integer calculation will not "
63 "fit into a javascript integer."); 63 "fit into a javascript integer.");
64 DEFINE_FLAG(bool, use_field_guards, true, "Guard field cids."); 64 DEFINE_FLAG(bool, use_field_guards, true, "Guard field cids.");
65 DEFINE_FLAG(bool, use_lib_cache, true, "Use library name cache"); 65 DEFINE_FLAG(bool, use_lib_cache, true, "Use library name cache");
66 DEFINE_FLAG(bool, trace_field_guards, false, "Trace changes in field's cids."); 66 DEFINE_FLAG(bool, trace_field_guards, false, "Trace changes in field's cids.");
67 DEFINE_FLAG(bool, use_mirrors, true, "Make dart:mirrors available.");
67 68
68 DECLARE_FLAG(bool, error_on_bad_override); 69 DECLARE_FLAG(bool, error_on_bad_override);
69 DECLARE_FLAG(bool, trace_compiler); 70 DECLARE_FLAG(bool, trace_compiler);
70 DECLARE_FLAG(bool, trace_deoptimization); 71 DECLARE_FLAG(bool, trace_deoptimization);
71 DECLARE_FLAG(bool, trace_deoptimization_verbose); 72 DECLARE_FLAG(bool, trace_deoptimization_verbose);
72 DECLARE_FLAG(bool, show_invisible_frames); 73 DECLARE_FLAG(bool, show_invisible_frames);
73 DECLARE_FLAG(charp, coverage_dir); 74 DECLARE_FLAG(charp, coverage_dir);
74 DECLARE_FLAG(bool, write_protect_code); 75 DECLARE_FLAG(bool, write_protect_code);
75 76
76 static const char* kGetterPrefix = "get:"; 77 static const char* kGetterPrefix = "get:";
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 cls.set_is_prefinalized(); 1182 cls.set_is_prefinalized();
1182 RegisterPrivateClass(cls, Symbols::FunctionImpl(), core_lib); 1183 RegisterPrivateClass(cls, Symbols::FunctionImpl(), core_lib);
1183 pending_classes.Add(cls); 1184 pending_classes.Add(cls);
1184 type = Type::NewNonParameterizedType(cls); 1185 type = Type::NewNonParameterizedType(cls);
1185 object_store->set_function_impl_type(type); 1186 object_store->set_function_impl_type(type);
1186 1187
1187 cls = Class::New<WeakProperty>(); 1188 cls = Class::New<WeakProperty>();
1188 object_store->set_weak_property_class(cls); 1189 object_store->set_weak_property_class(cls);
1189 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib); 1190 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib);
1190 1191
1191 // Pre-register the mirrors library so we can place the vm class 1192 if (FLAG_use_mirrors) {
1192 // MirrorReference there rather than the core library. 1193 // Pre-register the mirrors library so we can place the vm class
1193 lib = Library::LookupLibrary(Symbols::DartMirrors()); 1194 // MirrorReference there rather than the core library.
1194 if (lib.IsNull()) { 1195 lib = Library::LookupLibrary(Symbols::DartMirrors());
1195 lib = Library::NewLibraryHelper(Symbols::DartMirrors(), true); 1196 if (lib.IsNull()) {
1196 lib.SetLoadRequested(); 1197 lib = Library::NewLibraryHelper(Symbols::DartMirrors(), true);
1197 lib.Register(); 1198 lib.SetLoadRequested();
1198 object_store->set_bootstrap_library(ObjectStore::kMirrors, lib); 1199 lib.Register();
1200 object_store->set_bootstrap_library(ObjectStore::kMirrors, lib);
1201 }
1202 ASSERT(!lib.IsNull());
1203 ASSERT(lib.raw() == Library::MirrorsLibrary());
1204
1205 cls = Class::New<MirrorReference>();
1206 RegisterPrivateClass(cls, Symbols::_MirrorReference(), lib);
1207 } else {
1208 lib = Library::LookupLibrary(Symbols::DartMirrors());
1209 ASSERT(lib.IsNull());
1199 } 1210 }
1200 ASSERT(!lib.IsNull());
1201 ASSERT(lib.raw() == Library::MirrorsLibrary());
1202
1203 cls = Class::New<MirrorReference>();
1204 RegisterPrivateClass(cls, Symbols::_MirrorReference(), lib);
1205 1211
1206 // Pre-register the collection library so we can place the vm class 1212 // Pre-register the collection library so we can place the vm class
1207 // LinkedHashMap there rather than the core library. 1213 // LinkedHashMap there rather than the core library.
1208 lib = Library::LookupLibrary(Symbols::DartCollection()); 1214 lib = Library::LookupLibrary(Symbols::DartCollection());
1209 if (lib.IsNull()) { 1215 if (lib.IsNull()) {
1210 lib = Library::NewLibraryHelper(Symbols::DartCollection(), true); 1216 lib = Library::NewLibraryHelper(Symbols::DartCollection(), true);
1211 lib.SetLoadRequested(); 1217 lib.SetLoadRequested();
1212 lib.Register(); 1218 lib.Register();
1213 object_store->set_bootstrap_library(ObjectStore::kCollection, lib); 1219 object_store->set_bootstrap_library(ObjectStore::kCollection, lib);
1214 } 1220 }
(...skipping 19575 matching lines...) Expand 10 before | Expand all | Expand 10 after
20790 return tag_label.ToCString(); 20796 return tag_label.ToCString();
20791 } 20797 }
20792 20798
20793 20799
20794 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20800 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20795 Instance::PrintJSONImpl(stream, ref); 20801 Instance::PrintJSONImpl(stream, ref);
20796 } 20802 }
20797 20803
20798 20804
20799 } // namespace dart 20805 } // namespace dart
OLDNEW
« 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