| 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 bool allowSpeculativeOptimization = true; | 10 bool allowSpeculativeOptimization = true; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 final Tracer tracer; | 47 final Tracer tracer; |
| 48 | 48 |
| 49 CompilerTask measuredTask; | 49 CompilerTask measuredTask; |
| 50 Element _currentElement; | 50 Element _currentElement; |
| 51 LibraryElement coreLibrary; | 51 LibraryElement coreLibrary; |
| 52 LibraryElement coreImplLibrary; | 52 LibraryElement coreImplLibrary; |
| 53 LibraryElement jsHelperLibrary; | 53 LibraryElement jsHelperLibrary; |
| 54 LibraryElement mainApp; | 54 LibraryElement mainApp; |
| 55 ClassElement objectClass; | 55 ClassElement objectClass; |
| 56 ClassElement closureClass; |
| 56 | 57 |
| 57 Element get currentElement() => _currentElement; | 58 Element get currentElement() => _currentElement; |
| 58 withCurrentElement(Element element, f()) { | 59 withCurrentElement(Element element, f()) { |
| 59 Element old = currentElement; | 60 Element old = currentElement; |
| 60 _currentElement = element; | 61 _currentElement = element; |
| 61 try { | 62 try { |
| 62 return f(); | 63 return f(); |
| 63 } finally { | 64 } finally { |
| 64 _currentElement = old; | 65 _currentElement = old; |
| 65 } | 66 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 77 SsaCodeGeneratorTask generator; | 78 SsaCodeGeneratorTask generator; |
| 78 CodeEmitterTask emitter; | 79 CodeEmitterTask emitter; |
| 79 ConstantHandler constantHandler; | 80 ConstantHandler constantHandler; |
| 80 EnqueueTask enqueuer; | 81 EnqueueTask enqueuer; |
| 81 | 82 |
| 82 static final SourceString MAIN = const SourceString('main'); | 83 static final SourceString MAIN = const SourceString('main'); |
| 83 static final SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); | 84 static final SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); |
| 84 static final SourceString NO_SUCH_METHOD_EXCEPTION = | 85 static final SourceString NO_SUCH_METHOD_EXCEPTION = |
| 85 const SourceString('NoSuchMethodException'); | 86 const SourceString('NoSuchMethodException'); |
| 86 static final SourceString OBJECT = const SourceString('Object'); | 87 static final SourceString OBJECT = const SourceString('Object'); |
| 88 static final SourceString CLOSURE = const SourceString('Closure'); |
| 87 bool enabledNoSuchMethod = false; | 89 bool enabledNoSuchMethod = false; |
| 88 | 90 |
| 89 static final String GREEN_COLOR = '\u001b[32m'; | 91 static final String GREEN_COLOR = '\u001b[32m'; |
| 90 static final String RED_COLOR = '\u001b[31m'; | 92 static final String RED_COLOR = '\u001b[31m'; |
| 91 static final String MAGENTA_COLOR = '\u001b[35m'; | 93 static final String MAGENTA_COLOR = '\u001b[35m'; |
| 92 static final String NO_COLOR = '\u001b[0m'; | 94 static final String NO_COLOR = '\u001b[0m'; |
| 93 | 95 |
| 94 Compiler.withCurrentDirectory(String this.currentDirectory, | 96 Compiler.withCurrentDirectory(String this.currentDirectory, |
| 95 [this.tracer = const Tracer()]) | 97 [this.tracer = const Tracer()]) |
| 96 : types = new Types(), | 98 : types = new Types(), |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 invocations.add(new Invocation(2)); | 184 invocations.add(new Invocation(2)); |
| 183 } | 185 } |
| 184 | 186 |
| 185 abstract LibraryElement scanBuiltinLibrary(String filename); | 187 abstract LibraryElement scanBuiltinLibrary(String filename); |
| 186 | 188 |
| 187 void scanBuiltinLibraries() { | 189 void scanBuiltinLibraries() { |
| 188 coreImplLibrary = scanBuiltinLibrary('coreimpl.dart'); | 190 coreImplLibrary = scanBuiltinLibrary('coreimpl.dart'); |
| 189 jsHelperLibrary = scanBuiltinLibrary('js_helper.dart'); | 191 jsHelperLibrary = scanBuiltinLibrary('js_helper.dart'); |
| 190 coreLibrary = scanBuiltinLibrary('core.dart'); | 192 coreLibrary = scanBuiltinLibrary('core.dart'); |
| 191 objectClass = coreLibrary.find(OBJECT); | 193 objectClass = coreLibrary.find(OBJECT); |
| 194 closureClass = jsHelperLibrary.find(CLOSURE); |
| 192 // Since coreLibrary import the libraries "coreimpl", and | 195 // Since coreLibrary import the libraries "coreimpl", and |
| 193 // "js_helper", coreLibrary is null when they are being built. So | 196 // "js_helper", coreLibrary is null when they are being built. So |
| 194 // we add the implicit import of coreLibrary now. This can be | 197 // we add the implicit import of coreLibrary now. This can be |
| 195 // cleaned up when we have proper support for "dart:core" and | 198 // cleaned up when we have proper support for "dart:core" and |
| 196 // don't need to access it through the field "coreLibrary". | 199 // don't need to access it through the field "coreLibrary". |
| 197 // TODO(ahe): Clean this up as described above. | 200 // TODO(ahe): Clean this up as described above. |
| 198 scanner.importLibrary(coreImplLibrary, coreLibrary, null); | 201 scanner.importLibrary(coreImplLibrary, coreLibrary, null); |
| 199 scanner.importLibrary(jsHelperLibrary, coreLibrary, null); | 202 scanner.importLibrary(jsHelperLibrary, coreLibrary, null); |
| 200 addForeignFunctions(jsHelperLibrary); | 203 addForeignFunctions(jsHelperLibrary); |
| 201 | 204 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 } | 453 } |
| 451 } | 454 } |
| 452 | 455 |
| 453 class SourceSpan { | 456 class SourceSpan { |
| 454 final Uri uri; | 457 final Uri uri; |
| 455 final int begin; | 458 final int begin; |
| 456 final int end; | 459 final int end; |
| 457 | 460 |
| 458 const SourceSpan(this.uri, this.begin, this.end); | 461 const SourceSpan(this.uri, this.begin, this.end); |
| 459 } | 462 } |
| OLD | NEW |