| 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 bool allowSpeculativeOptimization = true; | 9 bool allowSpeculativeOptimization = true; |
| 10 List<HTypeGuard> guards = const <HTypeGuard>[]; | 10 List<HTypeGuard> guards = const <HTypeGuard>[]; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 Types types; | 38 Types types; |
| 39 | 39 |
| 40 final Tracer tracer; | 40 final Tracer tracer; |
| 41 | 41 |
| 42 CompilerTask measuredTask; | 42 CompilerTask measuredTask; |
| 43 Element _currentElement; | 43 Element _currentElement; |
| 44 LibraryElement coreLibrary; | 44 LibraryElement coreLibrary; |
| 45 LibraryElement coreImplLibrary; | 45 LibraryElement coreImplLibrary; |
| 46 LibraryElement isolateLibrary; | 46 LibraryElement isolateLibrary; |
| 47 LibraryElement jsHelperLibrary; | 47 LibraryElement jsHelperLibrary; |
| 48 LibraryElement interceptorsLibrary; |
| 48 LibraryElement mainApp; | 49 LibraryElement mainApp; |
| 50 |
| 49 ClassElement objectClass; | 51 ClassElement objectClass; |
| 50 ClassElement closureClass; | 52 ClassElement closureClass; |
| 51 ClassElement dynamicClass; | 53 ClassElement dynamicClass; |
| 52 ClassElement boolClass; | 54 ClassElement boolClass; |
| 53 ClassElement numClass; | 55 ClassElement numClass; |
| 54 ClassElement intClass; | 56 ClassElement intClass; |
| 55 ClassElement doubleClass; | 57 ClassElement doubleClass; |
| 56 ClassElement stringClass; | 58 ClassElement stringClass; |
| 57 ClassElement functionClass; | 59 ClassElement functionClass; |
| 58 ClassElement nullClass; | 60 ClassElement nullClass; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 nullClass = lookupSpecialClass(const SourceString('Null')); | 236 nullClass = lookupSpecialClass(const SourceString('Null')); |
| 235 types = new Types(dynamicClass); | 237 types = new Types(dynamicClass); |
| 236 if (!coreLibValid) { | 238 if (!coreLibValid) { |
| 237 cancel('core library does not contain required classes'); | 239 cancel('core library does not contain required classes'); |
| 238 } | 240 } |
| 239 } | 241 } |
| 240 | 242 |
| 241 void scanBuiltinLibraries() { | 243 void scanBuiltinLibraries() { |
| 242 coreImplLibrary = scanBuiltinLibrary('coreimpl'); | 244 coreImplLibrary = scanBuiltinLibrary('coreimpl'); |
| 243 jsHelperLibrary = scanBuiltinLibrary('_js_helper'); | 245 jsHelperLibrary = scanBuiltinLibrary('_js_helper'); |
| 246 interceptorsLibrary = scanBuiltinLibrary('_interceptors'); |
| 244 coreLibrary = scanBuiltinLibrary('core'); | 247 coreLibrary = scanBuiltinLibrary('core'); |
| 245 | 248 |
| 246 // Since coreLibrary import the libraries "coreimpl", and | 249 // Since coreLibrary import the libraries "coreimpl", "js_helper", |
| 247 // "js_helper", coreLibrary is null when they are being built. So | 250 // and "interceptors", coreLibrary is null when they are being |
| 248 // we add the implicit import of coreLibrary now. This can be | 251 // built. So we add the implicit import of coreLibrary now. This |
| 249 // cleaned up when we have proper support for "dart:core" and | 252 // can be cleaned up when we have proper support for "dart:core" |
| 250 // don't need to access it through the field "coreLibrary". | 253 // and don't need to access it through the field "coreLibrary". |
| 251 // TODO(ahe): Clean this up as described above. | 254 // TODO(ahe): Clean this up as described above. |
| 252 scanner.importLibrary(coreImplLibrary, coreLibrary, null); | 255 scanner.importLibrary(coreImplLibrary, coreLibrary, null); |
| 253 scanner.importLibrary(jsHelperLibrary, coreLibrary, null); | 256 scanner.importLibrary(jsHelperLibrary, coreLibrary, null); |
| 257 scanner.importLibrary(interceptorsLibrary, coreLibrary, null); |
| 254 addForeignFunctions(jsHelperLibrary); | 258 addForeignFunctions(jsHelperLibrary); |
| 259 addForeignFunctions(interceptorsLibrary); |
| 255 | 260 |
| 256 universe.libraries['dart:core'] = coreLibrary; | 261 universe.libraries['dart:core'] = coreLibrary; |
| 257 universe.libraries['dart:coreimpl'] = coreImplLibrary; | 262 universe.libraries['dart:coreimpl'] = coreImplLibrary; |
| 258 | 263 |
| 259 initializeSpecialClasses(); | 264 initializeSpecialClasses(); |
| 260 } | 265 } |
| 261 | 266 |
| 262 /** Define the JS helper functions in the given library. */ | 267 /** Define the JS helper functions in the given library. */ |
| 263 void addForeignFunctions(LibraryElement library) { | 268 void addForeignFunctions(LibraryElement library) { |
| 264 library.define(new ForeignElement( | 269 library.define(new ForeignElement( |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 } | 495 } |
| 491 | 496 |
| 492 Script readScript(Uri uri, [ScriptTag node]) { | 497 Script readScript(Uri uri, [ScriptTag node]) { |
| 493 unimplemented('Compiler.readScript'); | 498 unimplemented('Compiler.readScript'); |
| 494 } | 499 } |
| 495 | 500 |
| 496 String get legDirectory() { | 501 String get legDirectory() { |
| 497 unimplemented('Compiler.legDirectory'); | 502 unimplemented('Compiler.legDirectory'); |
| 498 } | 503 } |
| 499 | 504 |
| 500 Element findHelper(SourceString name) => jsHelperLibrary.find(name); | 505 Element findHelper(SourceString name) |
| 506 => jsHelperLibrary.findLocal(name); |
| 507 Element findInterceptor(SourceString name) |
| 508 => interceptorsLibrary.findLocal(name); |
| 501 | 509 |
| 502 bool get isMockCompilation() => false; | 510 bool get isMockCompilation() => false; |
| 503 } | 511 } |
| 504 | 512 |
| 505 class CompilerTask { | 513 class CompilerTask { |
| 506 final Compiler compiler; | 514 final Compiler compiler; |
| 507 final Stopwatch watch; | 515 final Stopwatch watch; |
| 508 | 516 |
| 509 CompilerTask(this.compiler) : watch = new Stopwatch(); | 517 CompilerTask(this.compiler) : watch = new Stopwatch(); |
| 510 | 518 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 } | 563 } |
| 556 } | 564 } |
| 557 | 565 |
| 558 class SourceSpan { | 566 class SourceSpan { |
| 559 final Uri uri; | 567 final Uri uri; |
| 560 final int begin; | 568 final int begin; |
| 561 final int end; | 569 final int end; |
| 562 | 570 |
| 563 const SourceSpan(this.uri, this.begin, this.end); | 571 const SourceSpan(this.uri, this.begin, this.end); |
| 564 } | 572 } |
| OLD | NEW |