| 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 part of js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 const VERBOSE_OPTIMIZER_HINTS = false; | 7 const VERBOSE_OPTIMIZER_HINTS = false; |
| 8 | 8 |
| 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); | 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 static final Uri DART_INTERCEPTORS = | 66 static final Uri DART_INTERCEPTORS = |
| 67 new Uri(scheme: 'dart', path: '_interceptors'); | 67 new Uri(scheme: 'dart', path: '_interceptors'); |
| 68 static final Uri DART_INTERNAL = | 68 static final Uri DART_INTERNAL = |
| 69 new Uri(scheme: 'dart', path: '_internal'); | 69 new Uri(scheme: 'dart', path: '_internal'); |
| 70 static final Uri DART_FOREIGN_HELPER = | 70 static final Uri DART_FOREIGN_HELPER = |
| 71 new Uri(scheme: 'dart', path: '_foreign_helper'); | 71 new Uri(scheme: 'dart', path: '_foreign_helper'); |
| 72 static final Uri DART_JS_MIRRORS = | 72 static final Uri DART_JS_MIRRORS = |
| 73 new Uri(scheme: 'dart', path: '_js_mirrors'); | 73 new Uri(scheme: 'dart', path: '_js_mirrors'); |
| 74 static final Uri DART_JS_NAMES = | 74 static final Uri DART_JS_NAMES = |
| 75 new Uri(scheme: 'dart', path: '_js_names'); | 75 new Uri(scheme: 'dart', path: '_js_names'); |
| 76 static final Uri DART_EMBEDDED_NAMES = | |
| 77 new Uri(scheme: 'dart', path: '_js_embedded_names'); | |
| 78 static final Uri DART_ISOLATE_HELPER = | 76 static final Uri DART_ISOLATE_HELPER = |
| 79 new Uri(scheme: 'dart', path: '_isolate_helper'); | 77 new Uri(scheme: 'dart', path: '_isolate_helper'); |
| 80 static final Uri DART_HTML = | 78 static final Uri DART_HTML = |
| 81 new Uri(scheme: 'dart', path: 'html'); | 79 new Uri(scheme: 'dart', path: 'html'); |
| 82 | 80 |
| 83 static const String INVOKE_ON = '_getCachedInvocation'; | 81 static const String INVOKE_ON = '_getCachedInvocation'; |
| 84 static const String START_ROOT_ISOLATE = 'startRootIsolate'; | 82 static const String START_ROOT_ISOLATE = 'startRootIsolate'; |
| 85 | 83 |
| 86 | 84 |
| 87 /// The list of functions for classes in the [internalLibrary] that we want | 85 /// The list of functions for classes in the [internalLibrary] that we want |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 /// dart:mirrors has been loaded. | 357 /// dart:mirrors has been loaded. |
| 360 FunctionElement preserveUrisMarker; | 358 FunctionElement preserveUrisMarker; |
| 361 | 359 |
| 362 /// Holds the method "preserveLibraryNames" in js_mirrors when | 360 /// Holds the method "preserveLibraryNames" in js_mirrors when |
| 363 /// dart:mirrors has been loaded. | 361 /// dart:mirrors has been loaded. |
| 364 FunctionElement preserveLibraryNamesMarker; | 362 FunctionElement preserveLibraryNamesMarker; |
| 365 | 363 |
| 366 /// Holds the method "requiresPreamble" in _js_helper. | 364 /// Holds the method "requiresPreamble" in _js_helper. |
| 367 FunctionElement requiresPreambleMarker; | 365 FunctionElement requiresPreambleMarker; |
| 368 | 366 |
| 369 /// Holds the class for the [JsGetName] enum. | |
| 370 EnumClassElement jsGetNameEnum; | |
| 371 | |
| 372 /// True if a call to preserveMetadataMarker has been seen. This means that | 367 /// True if a call to preserveMetadataMarker has been seen. This means that |
| 373 /// metadata must be retained for dart:mirrors to work correctly. | 368 /// metadata must be retained for dart:mirrors to work correctly. |
| 374 bool mustRetainMetadata = false; | 369 bool mustRetainMetadata = false; |
| 375 | 370 |
| 376 /// True if any metadata has been retained. This is slightly different from | 371 /// True if any metadata has been retained. This is slightly different from |
| 377 /// [mustRetainMetadata] and tells us if any metadata was retained. For | 372 /// [mustRetainMetadata] and tells us if any metadata was retained. For |
| 378 /// example, if [mustRetainMetadata] is true but there is no metadata in the | 373 /// example, if [mustRetainMetadata] is true but there is no metadata in the |
| 379 /// program, this variable will stil be false. | 374 /// program, this variable will stil be false. |
| 380 bool hasRetainedMetadata = false; | 375 bool hasRetainedMetadata = false; |
| 381 | 376 |
| (...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1874 getIsolateAffinityTagMarker = findMethod('getIsolateAffinityTag'); | 1869 getIsolateAffinityTagMarker = findMethod('getIsolateAffinityTag'); |
| 1875 | 1870 |
| 1876 requiresPreambleMarker = findMethod('requiresPreamble'); | 1871 requiresPreambleMarker = findMethod('requiresPreamble'); |
| 1877 } else if (uri == DART_JS_MIRRORS) { | 1872 } else if (uri == DART_JS_MIRRORS) { |
| 1878 disableTreeShakingMarker = find(library, 'disableTreeShaking'); | 1873 disableTreeShakingMarker = find(library, 'disableTreeShaking'); |
| 1879 preserveMetadataMarker = find(library, 'preserveMetadata'); | 1874 preserveMetadataMarker = find(library, 'preserveMetadata'); |
| 1880 preserveUrisMarker = find(library, 'preserveUris'); | 1875 preserveUrisMarker = find(library, 'preserveUris'); |
| 1881 preserveLibraryNamesMarker = find(library, 'preserveLibraryNames'); | 1876 preserveLibraryNamesMarker = find(library, 'preserveLibraryNames'); |
| 1882 } else if (uri == DART_JS_NAMES) { | 1877 } else if (uri == DART_JS_NAMES) { |
| 1883 preserveNamesMarker = find(library, 'preserveNames'); | 1878 preserveNamesMarker = find(library, 'preserveNames'); |
| 1884 } else if (uri == DART_EMBEDDED_NAMES) { | |
| 1885 jsGetNameEnum = find(library, 'JsGetName'); | |
| 1886 } else if (uri == DART_HTML) { | 1879 } else if (uri == DART_HTML) { |
| 1887 htmlLibraryIsLoaded = true; | 1880 htmlLibraryIsLoaded = true; |
| 1888 } | 1881 } |
| 1889 annotations.onLibraryScanned(library); | 1882 annotations.onLibraryScanned(library); |
| 1890 }); | 1883 }); |
| 1891 } | 1884 } |
| 1892 | 1885 |
| 1893 Future onLibrariesLoaded(LoadedLibraries loadedLibraries) { | 1886 Future onLibrariesLoaded(LoadedLibraries loadedLibraries) { |
| 1894 if (!loadedLibraries.containsLibrary(Compiler.DART_CORE)) { | 1887 if (!loadedLibraries.containsLibrary(Compiler.DART_CORE)) { |
| 1895 return new Future.value(); | 1888 return new Future.value(); |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2700 } | 2693 } |
| 2701 } | 2694 } |
| 2702 | 2695 |
| 2703 /// Records that [constant] is used by the element behind [registry]. | 2696 /// Records that [constant] is used by the element behind [registry]. |
| 2704 class Dependency { | 2697 class Dependency { |
| 2705 final ConstantValue constant; | 2698 final ConstantValue constant; |
| 2706 final Element annotatedElement; | 2699 final Element annotatedElement; |
| 2707 | 2700 |
| 2708 const Dependency(this.constant, this.annotatedElement); | 2701 const Dependency(this.constant, this.annotatedElement); |
| 2709 } | 2702 } |
| OLD | NEW |