| 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 class WorkItem { | 5 class WorkItem { |
| 6 final Element element; | 6 final Element element; |
| 7 TreeElements resolutionTree; | 7 TreeElements resolutionTree; |
| 8 Function run; | 8 Function run; |
| 9 Map<int, BailoutInfo> bailouts = null; | 9 Map<int, BailoutInfo> bailouts = null; |
| 10 | 10 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // TODO(floitsch): find a more efficient way of doing this. | 144 // TODO(floitsch): find a more efficient way of doing this. |
| 145 // Run through the classes and see if we need to compile methods. | 145 // Run through the classes and see if we need to compile methods. |
| 146 for (ClassElement classElement in universe.instantiatedClasses) { | 146 for (ClassElement classElement in universe.instantiatedClasses) { |
| 147 for (ClassElement currentClass = classElement; | 147 for (ClassElement currentClass = classElement; |
| 148 currentClass !== null; | 148 currentClass !== null; |
| 149 currentClass = currentClass.superClass) { | 149 currentClass = currentClass.superClass) { |
| 150 // TODO(floitsch): we don't need to add members that have been | 150 // TODO(floitsch): we don't need to add members that have been |
| 151 // overwritten by subclasses. | 151 // overwritten by subclasses. |
| 152 for (Element member in currentClass.members) { | 152 for (Element member in currentClass.members) { |
| 153 SourceString name = member.name; | 153 SourceString name = member.name; |
| 154 if (Elements.isInstanceMethod(member) && | 154 if (universe.generatedCode[member] !== null) continue; |
| 155 universe.generatedCode[member] === null) { | 155 if (!member.isInstanceMember()) continue; |
| 156 if (member.kind == ElementKind.FUNCTION) { |
| 156 FunctionElement element = member; | 157 FunctionElement element = member; |
| 157 Set<int> invocations = universe.invokedNames[name]; | 158 Set<int> invocations = universe.invokedNames[name]; |
| 158 if (invocations != null | 159 if (invocations != null |
| 159 && invocations.contains(element.parameterCount(this))) { | 160 && invocations.contains(element.parameterCount(this))) { |
| 160 addToWorklist(member); | 161 addToWorklist(member); |
| 161 } | 162 } |
| 163 } else if (member.kind == ElementKind.GETTER) { |
| 164 if (universe.invokedGetters.contains(name)) { |
| 165 addToWorklist(member); |
| 166 } |
| 167 } else if (member.kind === ElementKind.SETTER) { |
| 168 if (universe.invokedSetters.contains(name)) { |
| 169 addToWorklist(member); |
| 170 } |
| 162 } | 171 } |
| 163 } | 172 } |
| 164 } | 173 } |
| 165 } | 174 } |
| 166 } | 175 } |
| 167 | 176 |
| 168 void runCompiler(Script script) { | 177 void runCompiler(Script script) { |
| 169 scanCoreLibrary(); | 178 scanCoreLibrary(); |
| 170 currentElement = new CompilationUnitElement(script, currentLibrary); | 179 currentElement = new CompilationUnitElement(script, currentLibrary); |
| 171 scanner.scan(currentElement); | 180 scanner.scan(currentElement); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 307 |
| 299 class CompilerCancelledException implements Exception { | 308 class CompilerCancelledException implements Exception { |
| 300 final String reason; | 309 final String reason; |
| 301 CompilerCancelledException(this.reason); | 310 CompilerCancelledException(this.reason); |
| 302 | 311 |
| 303 String toString() { | 312 String toString() { |
| 304 String banner = 'compiler cancelled'; | 313 String banner = 'compiler cancelled'; |
| 305 return (reason !== null) ? '$banner: $reason' : '$banner'; | 314 return (reason !== null) ? '$banner: $reason' : '$banner'; |
| 306 } | 315 } |
| 307 } | 316 } |
| OLD | NEW |