| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 if (enabledNoSuchMethod) return; | 173 if (enabledNoSuchMethod) return; |
| 174 if (element.enclosingElement == objectClass) return; | 174 if (element.enclosingElement == objectClass) return; |
| 175 enabledNoSuchMethod = true; | 175 enabledNoSuchMethod = true; |
| 176 Set<Invocation> invocations = universe.invokedNames.putIfAbsent( | 176 Set<Invocation> invocations = universe.invokedNames.putIfAbsent( |
| 177 NO_SUCH_METHOD, () => new Set<Invocation>()); | 177 NO_SUCH_METHOD, () => new Set<Invocation>()); |
| 178 invocations.add(new Invocation(2)); | 178 invocations.add(new Invocation(2)); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void enableIsolateSupport(LibraryElement element) { | 181 void enableIsolateSupport(LibraryElement element) { |
| 182 isolateLibrary = element; | 182 isolateLibrary = element; |
| 183 addToWorkList(element.find(START_ROOT_ISOLATE)); | 183 addToWorkList(element.find(START_ROOT_ISOLATE)); |
| 184 } | 184 } |
| 185 | 185 |
| 186 bool hasIsolateSupport() => isolateLibrary !== null; |
| 187 |
| 186 void onLibraryLoaded(LibraryElement library, Uri uri) { | 188 void onLibraryLoaded(LibraryElement library, Uri uri) { |
| 187 if (uri.toString() == 'dart:isolate') { | 189 if (uri.toString() == 'dart:isolate') { |
| 188 enableIsolateSupport(library); | 190 enableIsolateSupport(library); |
| 189 } | 191 } |
| 190 } | 192 } |
| 191 | 193 |
| 192 abstract LibraryElement scanBuiltinLibrary(String filename); | 194 abstract LibraryElement scanBuiltinLibrary(String filename); |
| 193 | 195 |
| 194 void scanBuiltinLibraries() { | 196 void scanBuiltinLibraries() { |
| 195 coreImplLibrary = scanBuiltinLibrary('coreimpl.dart'); | 197 coreImplLibrary = scanBuiltinLibrary('coreimpl.dart'); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 212 } | 214 } |
| 213 | 215 |
| 214 /** Define the JS helper functions in the given library. */ | 216 /** Define the JS helper functions in the given library. */ |
| 215 void addForeignFunctions(LibraryElement library) { | 217 void addForeignFunctions(LibraryElement library) { |
| 216 library.define(new ForeignElement( | 218 library.define(new ForeignElement( |
| 217 const SourceString('JS'), library), this); | 219 const SourceString('JS'), library), this); |
| 218 library.define(new ForeignElement( | 220 library.define(new ForeignElement( |
| 219 const SourceString('UNINTERCEPTED'), library), this); | 221 const SourceString('UNINTERCEPTED'), library), this); |
| 220 library.define(new ForeignElement( | 222 library.define(new ForeignElement( |
| 221 const SourceString('JS_HAS_EQUALS'), library), this); | 223 const SourceString('JS_HAS_EQUALS'), library), this); |
| 224 library.define(new ForeignElement( |
| 225 const SourceString('JS_CURRENT_ISOLATE'), library), this); |
| 226 library.define(new ForeignElement( |
| 227 const SourceString('JS_CALL_IN_ISOLATE'), library), this); |
| 222 } | 228 } |
| 223 | 229 |
| 224 void runCompiler(Uri uri) { | 230 void runCompiler(Uri uri) { |
| 225 scanBuiltinLibraries(); | 231 scanBuiltinLibraries(); |
| 226 mainApp = scanner.loadLibrary(uri, null); | 232 mainApp = scanner.loadLibrary(uri, null); |
| 227 Element element; | 233 Element element; |
| 228 withCurrentElement(mainApp, () { | 234 withCurrentElement(mainApp, () { |
| 229 element = mainApp.find(MAIN); | 235 element = mainApp.find(MAIN); |
| 230 if (element === null) cancel('Could not find $MAIN'); | 236 if (element === null) cancel('Could not find $MAIN'); |
| 231 }); | 237 }); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 } | 480 } |
| 475 } | 481 } |
| 476 | 482 |
| 477 class SourceSpan { | 483 class SourceSpan { |
| 478 final Uri uri; | 484 final Uri uri; |
| 479 final int begin; | 485 final int begin; |
| 480 final int end; | 486 final int end; |
| 481 | 487 |
| 482 const SourceSpan(this.uri, this.begin, this.end); | 488 const SourceSpan(this.uri, this.begin, this.end); |
| 483 } | 489 } |
| OLD | NEW |