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