Chromium Code Reviews| 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 library native; | 5 library native; |
| 6 | 6 |
| 7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
| 8 import 'dart2jslib.dart'; | 8 import 'dart2jslib.dart'; |
| 9 import 'dart_types.dart'; | 9 import 'dart_types.dart'; |
| 10 import 'elements/elements.dart'; | 10 import 'elements/elements.dart'; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 /** | 83 /** |
| 84 * The set of all native classes. Each native class is in [nativeClasses] and | 84 * The set of all native classes. Each native class is in [nativeClasses] and |
| 85 * exactly one of [unusedClasses], [pendingClasses] and [registeredClasses]. | 85 * exactly one of [unusedClasses], [pendingClasses] and [registeredClasses]. |
| 86 */ | 86 */ |
| 87 final Set<ClassElement> nativeClasses = new Set<ClassElement>(); | 87 final Set<ClassElement> nativeClasses = new Set<ClassElement>(); |
| 88 | 88 |
| 89 final Set<ClassElement> registeredClasses = new Set<ClassElement>(); | 89 final Set<ClassElement> registeredClasses = new Set<ClassElement>(); |
| 90 final Set<ClassElement> pendingClasses = new Set<ClassElement>(); | 90 final Set<ClassElement> pendingClasses = new Set<ClassElement>(); |
| 91 final Set<ClassElement> unusedClasses = new Set<ClassElement>(); | 91 final Set<ClassElement> unusedClasses = new Set<ClassElement>(); |
| 92 | 92 |
| 93 final Set<LibraryElement> processedLibraries = | |
| 94 new Set<LibraryElement>.identity(); | |
| 95 | |
| 93 bool hasInstantiatedNativeClasses() => !registeredClasses.isEmpty; | 96 bool hasInstantiatedNativeClasses() => !registeredClasses.isEmpty; |
| 94 | 97 |
| 95 final Set<ClassElement> nativeClassesAndSubclasses = new Set<ClassElement>(); | 98 final Set<ClassElement> nativeClassesAndSubclasses = new Set<ClassElement>(); |
| 96 | 99 |
| 97 final Map<ClassElement, Set<ClassElement>> nonNativeSubclasses = | 100 final Map<ClassElement, Set<ClassElement>> nonNativeSubclasses = |
| 98 new Map<ClassElement, Set<ClassElement>>(); | 101 new Map<ClassElement, Set<ClassElement>>(); |
| 99 | 102 |
| 100 /** | 103 /** |
| 101 * Records matched constraints ([SpecialType] or [DartType]). Once a type | 104 * Records matched constraints ([SpecialType] or [DartType]). Once a type |
| 102 * constraint has been matched, there is no need to match it again. | 105 * constraint has been matched, there is no need to match it again. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 117 final bool enableLiveTypeAnalysis; | 120 final bool enableLiveTypeAnalysis; |
| 118 | 121 |
| 119 ClassElement _annotationCreatesClass; | 122 ClassElement _annotationCreatesClass; |
| 120 ClassElement _annotationReturnsClass; | 123 ClassElement _annotationReturnsClass; |
| 121 ClassElement _annotationJsNameClass; | 124 ClassElement _annotationJsNameClass; |
| 122 | 125 |
| 123 /// Subclasses of [NativeEnqueuerBase] are constructed by the backend. | 126 /// Subclasses of [NativeEnqueuerBase] are constructed by the backend. |
| 124 NativeEnqueuerBase(this.world, this.compiler, this.enableLiveTypeAnalysis); | 127 NativeEnqueuerBase(this.world, this.compiler, this.enableLiveTypeAnalysis); |
| 125 | 128 |
| 126 void processNativeClasses(Iterable<LibraryElement> libraries) { | 129 void processNativeClasses(Iterable<LibraryElement> libraries) { |
| 130 if (compiler.hasIncrementalSupport) { | |
| 131 libraries = libraries.where((library) => processedLibraries.add(library)); | |
|
floitsch
2014/06/19 12:00:24
where(processedLibraries.add)
It's ok without, bu
ahe
2014/06/19 13:50:10
Done.
| |
| 132 } | |
| 127 libraries.forEach(processNativeClassesInLibrary); | 133 libraries.forEach(processNativeClassesInLibrary); |
| 128 if (compiler.isolateHelperLibrary != null) { | 134 if (compiler.isolateHelperLibrary != null) { |
| 129 processNativeClassesInLibrary(compiler.isolateHelperLibrary); | 135 processNativeClassesInLibrary(compiler.isolateHelperLibrary); |
| 130 } | 136 } |
| 131 processSubclassesOfNativeClasses(libraries); | 137 processSubclassesOfNativeClasses(libraries); |
| 132 if (!enableLiveTypeAnalysis) { | 138 if (!enableLiveTypeAnalysis) { |
| 133 nativeClasses.forEach((c) => enqueueClass(c, 'forced')); | 139 nativeClasses.forEach((c) => enqueueClass(c, 'forced')); |
| 134 flushQueue(); | 140 flushQueue(); |
| 135 } | 141 } |
| 136 } | 142 } |
| (...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1182 LiteralString jsCode = nativeBody.asLiteralString(); | 1188 LiteralString jsCode = nativeBody.asLiteralString(); |
| 1183 builder.push(new HForeign.statement( | 1189 builder.push(new HForeign.statement( |
| 1184 js.js.statementTemplateYielding( | 1190 js.js.statementTemplateYielding( |
| 1185 new js.LiteralStatement(jsCode.dartString.slowToString())), | 1191 new js.LiteralStatement(jsCode.dartString.slowToString())), |
| 1186 <HInstruction>[], | 1192 <HInstruction>[], |
| 1187 new SideEffects(), | 1193 new SideEffects(), |
| 1188 null, | 1194 null, |
| 1189 backend.dynamicType)); | 1195 backend.dynamicType)); |
| 1190 } | 1196 } |
| 1191 } | 1197 } |
| OLD | NEW |