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'); |
76 static final Uri DART_ISOLATE_HELPER = | 78 static final Uri DART_ISOLATE_HELPER = |
77 new Uri(scheme: 'dart', path: '_isolate_helper'); | 79 new Uri(scheme: 'dart', path: '_isolate_helper'); |
78 static final Uri DART_HTML = | 80 static final Uri DART_HTML = |
79 new Uri(scheme: 'dart', path: 'html'); | 81 new Uri(scheme: 'dart', path: 'html'); |
80 | 82 |
81 static const String INVOKE_ON = '_getCachedInvocation'; | 83 static const String INVOKE_ON = '_getCachedInvocation'; |
82 static const String START_ROOT_ISOLATE = 'startRootIsolate'; | 84 static const String START_ROOT_ISOLATE = 'startRootIsolate'; |
83 | 85 |
84 | 86 |
85 /// The list of functions for classes in the [internalLibrary] that we want | 87 /// 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... |
357 /// dart:mirrors has been loaded. | 359 /// dart:mirrors has been loaded. |
358 FunctionElement preserveUrisMarker; | 360 FunctionElement preserveUrisMarker; |
359 | 361 |
360 /// Holds the method "preserveLibraryNames" in js_mirrors when | 362 /// Holds the method "preserveLibraryNames" in js_mirrors when |
361 /// dart:mirrors has been loaded. | 363 /// dart:mirrors has been loaded. |
362 FunctionElement preserveLibraryNamesMarker; | 364 FunctionElement preserveLibraryNamesMarker; |
363 | 365 |
364 /// Holds the method "requiresPreamble" in _js_helper. | 366 /// Holds the method "requiresPreamble" in _js_helper. |
365 FunctionElement requiresPreambleMarker; | 367 FunctionElement requiresPreambleMarker; |
366 | 368 |
| 369 /// Holds the class for the [JsGetName] enum. |
| 370 EnumClassElement jsGetNameEnum; |
| 371 |
367 /// True if a call to preserveMetadataMarker has been seen. This means that | 372 /// True if a call to preserveMetadataMarker has been seen. This means that |
368 /// metadata must be retained for dart:mirrors to work correctly. | 373 /// metadata must be retained for dart:mirrors to work correctly. |
369 bool mustRetainMetadata = false; | 374 bool mustRetainMetadata = false; |
370 | 375 |
371 /// True if any metadata has been retained. This is slightly different from | 376 /// True if any metadata has been retained. This is slightly different from |
372 /// [mustRetainMetadata] and tells us if any metadata was retained. For | 377 /// [mustRetainMetadata] and tells us if any metadata was retained. For |
373 /// example, if [mustRetainMetadata] is true but there is no metadata in the | 378 /// example, if [mustRetainMetadata] is true but there is no metadata in the |
374 /// program, this variable will stil be false. | 379 /// program, this variable will stil be false. |
375 bool hasRetainedMetadata = false; | 380 bool hasRetainedMetadata = false; |
376 | 381 |
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1863 getIsolateAffinityTagMarker = findMethod('getIsolateAffinityTag'); | 1868 getIsolateAffinityTagMarker = findMethod('getIsolateAffinityTag'); |
1864 | 1869 |
1865 requiresPreambleMarker = findMethod('requiresPreamble'); | 1870 requiresPreambleMarker = findMethod('requiresPreamble'); |
1866 } else if (uri == DART_JS_MIRRORS) { | 1871 } else if (uri == DART_JS_MIRRORS) { |
1867 disableTreeShakingMarker = find(library, 'disableTreeShaking'); | 1872 disableTreeShakingMarker = find(library, 'disableTreeShaking'); |
1868 preserveMetadataMarker = find(library, 'preserveMetadata'); | 1873 preserveMetadataMarker = find(library, 'preserveMetadata'); |
1869 preserveUrisMarker = find(library, 'preserveUris'); | 1874 preserveUrisMarker = find(library, 'preserveUris'); |
1870 preserveLibraryNamesMarker = find(library, 'preserveLibraryNames'); | 1875 preserveLibraryNamesMarker = find(library, 'preserveLibraryNames'); |
1871 } else if (uri == DART_JS_NAMES) { | 1876 } else if (uri == DART_JS_NAMES) { |
1872 preserveNamesMarker = find(library, 'preserveNames'); | 1877 preserveNamesMarker = find(library, 'preserveNames'); |
| 1878 } else if (uri == DART_EMBEDDED_NAMES) { |
| 1879 jsGetNameEnum = find(library, 'JsGetName'); |
1873 } else if (uri == DART_HTML) { | 1880 } else if (uri == DART_HTML) { |
1874 htmlLibraryIsLoaded = true; | 1881 htmlLibraryIsLoaded = true; |
1875 } | 1882 } |
1876 annotations.onLibraryScanned(library); | 1883 annotations.onLibraryScanned(library); |
1877 }); | 1884 }); |
1878 } | 1885 } |
1879 | 1886 |
1880 Future onLibrariesLoaded(LoadedLibraries loadedLibraries) { | 1887 Future onLibrariesLoaded(LoadedLibraries loadedLibraries) { |
1881 if (!loadedLibraries.containsLibrary(Compiler.DART_CORE)) { | 1888 if (!loadedLibraries.containsLibrary(Compiler.DART_CORE)) { |
1882 return new Future.value(); | 1889 return new Future.value(); |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2686 } | 2693 } |
2687 } | 2694 } |
2688 | 2695 |
2689 /// Records that [constant] is used by the element behind [registry]. | 2696 /// Records that [constant] is used by the element behind [registry]. |
2690 class Dependency { | 2697 class Dependency { |
2691 final ConstantValue constant; | 2698 final ConstantValue constant; |
2692 final Element annotatedElement; | 2699 final Element annotatedElement; |
2693 | 2700 |
2694 const Dependency(this.constant, this.annotatedElement); | 2701 const Dependency(this.constant, this.annotatedElement); |
2695 } | 2702 } |
OLD | NEW |