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 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1869 getIsolateAffinityTagMarker = findMethod('getIsolateAffinityTag'); | 1874 getIsolateAffinityTagMarker = findMethod('getIsolateAffinityTag'); |
1870 | 1875 |
1871 requiresPreambleMarker = findMethod('requiresPreamble'); | 1876 requiresPreambleMarker = findMethod('requiresPreamble'); |
1872 } else if (uri == DART_JS_MIRRORS) { | 1877 } else if (uri == DART_JS_MIRRORS) { |
1873 disableTreeShakingMarker = find(library, 'disableTreeShaking'); | 1878 disableTreeShakingMarker = find(library, 'disableTreeShaking'); |
1874 preserveMetadataMarker = find(library, 'preserveMetadata'); | 1879 preserveMetadataMarker = find(library, 'preserveMetadata'); |
1875 preserveUrisMarker = find(library, 'preserveUris'); | 1880 preserveUrisMarker = find(library, 'preserveUris'); |
1876 preserveLibraryNamesMarker = find(library, 'preserveLibraryNames'); | 1881 preserveLibraryNamesMarker = find(library, 'preserveLibraryNames'); |
1877 } else if (uri == DART_JS_NAMES) { | 1882 } else if (uri == DART_JS_NAMES) { |
1878 preserveNamesMarker = find(library, 'preserveNames'); | 1883 preserveNamesMarker = find(library, 'preserveNames'); |
| 1884 } else if (uri == DART_EMBEDDED_NAMES) { |
| 1885 jsGetNameEnum = find(library, 'JsGetName'); |
1879 } else if (uri == DART_HTML) { | 1886 } else if (uri == DART_HTML) { |
1880 htmlLibraryIsLoaded = true; | 1887 htmlLibraryIsLoaded = true; |
1881 } | 1888 } |
1882 annotations.onLibraryScanned(library); | 1889 annotations.onLibraryScanned(library); |
1883 }); | 1890 }); |
1884 } | 1891 } |
1885 | 1892 |
1886 Future onLibrariesLoaded(LoadedLibraries loadedLibraries) { | 1893 Future onLibrariesLoaded(LoadedLibraries loadedLibraries) { |
1887 if (!loadedLibraries.containsLibrary(Compiler.DART_CORE)) { | 1894 if (!loadedLibraries.containsLibrary(Compiler.DART_CORE)) { |
1888 return new Future.value(); | 1895 return new Future.value(); |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2693 } | 2700 } |
2694 } | 2701 } |
2695 | 2702 |
2696 /// Records that [constant] is used by the element behind [registry]. | 2703 /// Records that [constant] is used by the element behind [registry]. |
2697 class Dependency { | 2704 class Dependency { |
2698 final ConstantValue constant; | 2705 final ConstantValue constant; |
2699 final Element annotatedElement; | 2706 final Element annotatedElement; |
2700 | 2707 |
2701 const Dependency(this.constant, this.annotatedElement); | 2708 const Dependency(this.constant, this.annotatedElement); |
2702 } | 2709 } |
OLD | NEW |