| OLD | NEW |
| 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 part of js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A function element that represents a closure call. The signature is copied | 8 * A function element that represents a closure call. The signature is copied |
| 9 * from the given element. | 9 * from the given element. |
| 10 */ | 10 */ |
| (...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 extraArg = 'receiver'; | 1401 extraArg = 'receiver'; |
| 1402 } else { | 1402 } else { |
| 1403 cache = boundClosureCache; | 1403 cache = boundClosureCache; |
| 1404 } | 1404 } |
| 1405 List<String> fieldNames = compiler.enableMinification | 1405 List<String> fieldNames = compiler.enableMinification |
| 1406 ? inInterceptor ? const ['a', 'b', 'c'] | 1406 ? inInterceptor ? const ['a', 'b', 'c'] |
| 1407 : const ['a', 'b'] | 1407 : const ['a', 'b'] |
| 1408 : inInterceptor ? const ['self', 'target', 'receiver'] | 1408 : inInterceptor ? const ['self', 'target', 'receiver'] |
| 1409 : const ['self', 'target']; | 1409 : const ['self', 'target']; |
| 1410 | 1410 |
| 1411 Collection<Element> typedefChecks = | 1411 Iterable<Element> typedefChecks = |
| 1412 getTypedefChecksOn(member.computeType(compiler)); | 1412 getTypedefChecksOn(member.computeType(compiler)); |
| 1413 bool hasTypedefChecks = !typedefChecks.isEmpty; | 1413 bool hasTypedefChecks = !typedefChecks.isEmpty; |
| 1414 | 1414 |
| 1415 bool canBeShared = !hasOptionalParameters && !hasTypedefChecks; | 1415 bool canBeShared = !hasOptionalParameters && !hasTypedefChecks; |
| 1416 | 1416 |
| 1417 String closureClass = canBeShared ? cache[parameterCount] : null; | 1417 String closureClass = canBeShared ? cache[parameterCount] : null; |
| 1418 if (closureClass == null) { | 1418 if (closureClass == null) { |
| 1419 // Either the class was not cached yet, or there are optional parameters. | 1419 // Either the class was not cached yet, or there are optional parameters. |
| 1420 // Create a new closure class. | 1420 // Create a new closure class. |
| 1421 SourceString name = const SourceString("BoundClosure"); | 1421 SourceString name = const SourceString("BoundClosure"); |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2082 if (backend.objectInterceptorClass == null) return; | 2082 if (backend.objectInterceptorClass == null) return; |
| 2083 String objectName = namer.isolateAccess(backend.objectInterceptorClass); | 2083 String objectName = namer.isolateAccess(backend.objectInterceptorClass); |
| 2084 backend.specializedGetInterceptors.forEach( | 2084 backend.specializedGetInterceptors.forEach( |
| 2085 (String key, Collection<ClassElement> classes) { | 2085 (String key, Collection<ClassElement> classes) { |
| 2086 emitGetInterceptorMethod(buffer, objectName, key, classes); | 2086 emitGetInterceptorMethod(buffer, objectName, key, classes); |
| 2087 }); | 2087 }); |
| 2088 } | 2088 } |
| 2089 | 2089 |
| 2090 void computeNeededClasses() { | 2090 void computeNeededClasses() { |
| 2091 instantiatedClasses = | 2091 instantiatedClasses = |
| 2092 compiler.codegenWorld.instantiatedClasses.where(computeClassFilter()); | 2092 compiler.codegenWorld.instantiatedClasses.where(computeClassFilter()) |
| 2093 .toSet(); |
| 2093 neededClasses = instantiatedClasses.toSet(); | 2094 neededClasses = instantiatedClasses.toSet(); |
| 2094 for (ClassElement element in instantiatedClasses) { | 2095 for (ClassElement element in instantiatedClasses) { |
| 2095 for (ClassElement superclass = element.superclass; | 2096 for (ClassElement superclass = element.superclass; |
| 2096 superclass != null; | 2097 superclass != null; |
| 2097 superclass = superclass.superclass) { | 2098 superclass = superclass.superclass) { |
| 2098 if (neededClasses.contains(superclass)) break; | 2099 if (neededClasses.contains(superclass)) break; |
| 2099 neededClasses.add(superclass); | 2100 neededClasses.add(superclass); |
| 2100 } | 2101 } |
| 2101 } | 2102 } |
| 2102 } | 2103 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2182 """; | 2183 """; |
| 2183 const String HOOKS_API_USAGE = """ | 2184 const String HOOKS_API_USAGE = """ |
| 2184 // The code supports the following hooks: | 2185 // The code supports the following hooks: |
| 2185 // dartPrint(message) - if this function is defined it is called | 2186 // dartPrint(message) - if this function is defined it is called |
| 2186 // instead of the Dart [print] method. | 2187 // instead of the Dart [print] method. |
| 2187 // dartMainRunner(main) - if this function is defined, the Dart [main] | 2188 // dartMainRunner(main) - if this function is defined, the Dart [main] |
| 2188 // method will not be invoked directly. | 2189 // method will not be invoked directly. |
| 2189 // Instead, a closure that will invoke [main] is | 2190 // Instead, a closure that will invoke [main] is |
| 2190 // passed to [dartMainRunner]. | 2191 // passed to [dartMainRunner]. |
| 2191 """; | 2192 """; |
| OLD | NEW |