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

Side by Side Diff: sdk/lib/_internal/compiler/js_lib/js_mirrors.dart

Issue 974803002: Defer addStubs to class instantiation time. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Ensure fast prototypes and avoid polymorphic access in constructor Created 5 years, 9 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart._js_mirrors; 5 library dart._js_mirrors;
6 6
7 import 'dart:_js_embedded_names' show 7 import 'dart:_js_embedded_names' show
8 ALL_CLASSES, 8 ALL_CLASSES,
9 LAZIES, 9 LAZIES,
10 LIBRARIES, 10 LIBRARIES,
(...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 if (typeVariables.isEmpty) return _jsConstructor; 1666 if (typeVariables.isEmpty) return _jsConstructor;
1667 var type = [_jsConstructor]; 1667 var type = [_jsConstructor];
1668 for (int i = 0; i < typeVariables.length; i ++) { 1668 for (int i = 0; i < typeVariables.length; i ++) {
1669 type.add(JsMirrorSystem._dynamicType._asRuntimeType); 1669 type.add(JsMirrorSystem._dynamicType._asRuntimeType);
1670 } 1670 }
1671 return type; 1671 return type;
1672 } 1672 }
1673 1673
1674 List<JsMethodMirror> _getMethodsWithOwner(DeclarationMirror methodOwner) { 1674 List<JsMethodMirror> _getMethodsWithOwner(DeclarationMirror methodOwner) {
1675 var prototype = JS('', '#.prototype', _jsConstructor); 1675 var prototype = JS('', '#.prototype', _jsConstructor);
1676 // The prototype might not have been processed yet, so do that now.
1677 if (JS('bool', '!!#.\$deferredAction', prototype)) {
sra1 2015/03/05 18:23:25 Other places use the namer. Perhaps use a differen
herhut 2015/03/06 12:36:45 Thanks for catching this. I will have it go throug
floitsch 2015/03/09 16:35:06 not done yet.
1678 JS('', '#.\$deferredAction()', prototype);
1679 }
1676 List<String> keys = extractKeys(prototype); 1680 List<String> keys = extractKeys(prototype);
1677 var result = <JsMethodMirror>[]; 1681 var result = <JsMethodMirror>[];
1678 for (String key in keys) { 1682 for (String key in keys) {
1679 if (isReflectiveDataInPrototype(key)) continue; 1683 if (isReflectiveDataInPrototype(key)) continue;
1680 String simpleName = mangledNames[key]; 1684 String simpleName = mangledNames[key];
1681 // [simpleName] can be null if [key] represents an implementation 1685 // [simpleName] can be null if [key] represents an implementation
1682 // detail, for example, a bailout method, or runtime type support. 1686 // detail, for example, a bailout method, or runtime type support.
1683 // It might also be null if the user has limited what is reified for 1687 // It might also be null if the user has limited what is reified for
1684 // reflection with metadata. 1688 // reflection with metadata.
1685 if (simpleName == null) continue; 1689 if (simpleName == null) continue;
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
3027 // have a part (following a '.') that starts with '_'. 3031 // have a part (following a '.') that starts with '_'.
3028 const int UNDERSCORE = 0x5f; 3032 const int UNDERSCORE = 0x5f;
3029 if (name.isEmpty) return true; 3033 if (name.isEmpty) return true;
3030 int index = -1; 3034 int index = -1;
3031 do { 3035 do {
3032 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false; 3036 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false;
3033 index = name.indexOf('.', index + 1); 3037 index = name.indexOf('.', index + 1);
3034 } while (index >= 0 && index + 1 < name.length); 3038 } while (index >= 0 && index + 1 < name.length);
3035 return true; 3039 return true;
3036 } 3040 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698