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

Unified Diff: runtime/lib/mirrors.cc

Issue 1080393006: Mirrors memory usage tweaks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/mirrors.cc
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index 0b790a78e68d7b3226060756f4582ef1dd8d2c7c..a6fec414a5577dedff417025dc57d15046126233 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -242,26 +242,28 @@ static RawInstance* CreateFunctionTypeMirror(const Class& cls,
static RawInstance* CreateMethodMirror(const Function& func,
const Instance& owner_mirror,
const AbstractType& instantiator) {
- const Array& args = Array::Handle(Array::New(13));
+ const Array& args = Array::Handle(Array::New(6));
args.SetAt(0, MirrorReference::Handle(MirrorReference::New(func)));
String& name = String::Handle(func.name());
name = String::IdentifierPrettyNameRetainPrivate(name);
args.SetAt(1, name);
-
args.SetAt(2, owner_mirror);
args.SetAt(3, instantiator);
args.SetAt(4, Bool::Get(func.is_static()));
- args.SetAt(5, Bool::Get(func.is_abstract()));
- args.SetAt(6, Bool::Get(func.IsGetterFunction()));
- args.SetAt(7, Bool::Get(func.IsSetterFunction()));
+ // These offsets much be kept in sync with those in mirrors_impl.dart.
siva 2015/04/22 00:00:47 Can you declare some constants in mirrors_impl.dar
rmacnak 2015/04/22 17:09:02 Added debug-only hook in CreateMirrorSystem, which
+ intptr_t kind_flags = 0;
+ kind_flags |= (func.is_abstract() << 0);
+ kind_flags |= (func.IsGetterFunction() << 1);
+ kind_flags |= (func.IsSetterFunction() << 2);
bool isConstructor = (func.kind() == RawFunction::kConstructor);
- args.SetAt(8, Bool::Get(isConstructor));
- args.SetAt(9, Bool::Get(isConstructor && func.is_const()));
- args.SetAt(10, Bool::Get(isConstructor && func.IsGenerativeConstructor()));
- args.SetAt(11, Bool::Get(isConstructor && func.is_redirecting()));
- args.SetAt(12, Bool::Get(isConstructor && func.IsFactory()));
+ kind_flags |= (isConstructor << 3);
+ kind_flags |= ((isConstructor && func.is_const()) << 4);
+ kind_flags |= ((isConstructor && func.IsGenerativeConstructor()) << 5);
+ kind_flags |= ((isConstructor && func.is_redirecting()) << 6);
+ kind_flags |= ((isConstructor && func.IsFactory()) << 7);
+ args.SetAt(5, Smi::Handle(Smi::New(kind_flags)));
return CreateMirror(Symbols::_LocalMethodMirror(), args);
}
@@ -893,12 +895,12 @@ DEFINE_NATIVE_ENTRY(FunctionTypeMirror_return_type, 2) {
}
-DEFINE_NATIVE_ENTRY(ClassMirror_library, 1) {
+DEFINE_NATIVE_ENTRY(ClassMirror_libraryUri, 1) {
GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
const Class& klass = Class::Handle(ref.GetClassReferent());
const Library& library = Library::Handle(klass.library());
ASSERT(!library.IsNull());
- return CreateLibraryMirror(library);
+ return library.url();
}
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698