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

Side by Side Diff: runtime/lib/mirrors_impl.dart

Issue 19462008: Interpose an Expando cache on reflectClass(). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 // VM-specific implementation of the dart:mirrors library. 5 // VM-specific implementation of the dart:mirrors library.
6 6
7 // These values are allowed to be passed directly over the wire. 7 // These values are allowed to be passed directly over the wire.
8 bool _isSimpleValue(var value) { 8 bool _isSimpleValue(var value) {
9 return (value == null || value is num || value is String || value is bool); 9 return (value == null || value is num || value is String || value is bool);
10 } 10 }
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 1113
1114 // Creates a new local mirror for some Object. 1114 // Creates a new local mirror for some Object.
1115 static InstanceMirror reflect(Object reflectee) { 1115 static InstanceMirror reflect(Object reflectee) {
1116 return makeLocalInstanceMirror(reflectee); 1116 return makeLocalInstanceMirror(reflectee);
1117 } 1117 }
1118 1118
1119 // Creates a new local ClassMirror. 1119 // Creates a new local ClassMirror.
1120 static ClassMirror makeLocalClassMirror(Type key) 1120 static ClassMirror makeLocalClassMirror(Type key)
1121 native "Mirrors_makeLocalClassMirror"; 1121 native "Mirrors_makeLocalClassMirror";
1122 1122
1123 static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror");
1123 static ClassMirror reflectClass(Type key) { 1124 static ClassMirror reflectClass(Type key) {
1124 return makeLocalClassMirror(key); 1125 var classMirror = _classMirrorCache[key];
1126 if (classMirror == null) {
1127 classMirror = makeLocalClassMirror(key);
1128 _classMirrorCache[key] = classMirror;
1129 }
1130 return classMirror;
1125 } 1131 }
1126 } 1132 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698