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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 /// Holds the method "preserveLibraryNames" in js_mirrors when | 503 /// Holds the method "preserveLibraryNames" in js_mirrors when |
504 /// dart:mirrors has been loaded. | 504 /// dart:mirrors has been loaded. |
505 FunctionElement preserveLibraryNamesMarker; | 505 FunctionElement preserveLibraryNamesMarker; |
506 | 506 |
507 /// Holds the method "requiresPreamble" in _js_helper. | 507 /// Holds the method "requiresPreamble" in _js_helper. |
508 FunctionElement requiresPreambleMarker; | 508 FunctionElement requiresPreambleMarker; |
509 | 509 |
510 /// Holds the class for the [JsGetName] enum. | 510 /// Holds the class for the [JsGetName] enum. |
511 EnumClassElement jsGetNameEnum; | 511 EnumClassElement jsGetNameEnum; |
512 | 512 |
| 513 /// Holds the class for the [JsBuiltins] enum. |
| 514 EnumClassElement jsBuiltinEnum; |
| 515 |
513 /// True if a call to preserveMetadataMarker has been seen. This means that | 516 /// True if a call to preserveMetadataMarker has been seen. This means that |
514 /// metadata must be retained for dart:mirrors to work correctly. | 517 /// metadata must be retained for dart:mirrors to work correctly. |
515 bool mustRetainMetadata = false; | 518 bool mustRetainMetadata = false; |
516 | 519 |
517 /// True if any metadata has been retained. This is slightly different from | 520 /// True if any metadata has been retained. This is slightly different from |
518 /// [mustRetainMetadata] and tells us if any metadata was retained. For | 521 /// [mustRetainMetadata] and tells us if any metadata was retained. For |
519 /// example, if [mustRetainMetadata] is true but there is no metadata in the | 522 /// example, if [mustRetainMetadata] is true but there is no metadata in the |
520 /// program, this variable will stil be false. | 523 /// program, this variable will stil be false. |
521 bool hasRetainedMetadata = false; | 524 bool hasRetainedMetadata = false; |
522 | 525 |
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2012 requiresPreambleMarker = findMethod('requiresPreamble'); | 2015 requiresPreambleMarker = findMethod('requiresPreamble'); |
2013 } else if (uri == DART_JS_MIRRORS) { | 2016 } else if (uri == DART_JS_MIRRORS) { |
2014 disableTreeShakingMarker = find(library, 'disableTreeShaking'); | 2017 disableTreeShakingMarker = find(library, 'disableTreeShaking'); |
2015 preserveMetadataMarker = find(library, 'preserveMetadata'); | 2018 preserveMetadataMarker = find(library, 'preserveMetadata'); |
2016 preserveUrisMarker = find(library, 'preserveUris'); | 2019 preserveUrisMarker = find(library, 'preserveUris'); |
2017 preserveLibraryNamesMarker = find(library, 'preserveLibraryNames'); | 2020 preserveLibraryNamesMarker = find(library, 'preserveLibraryNames'); |
2018 } else if (uri == DART_JS_NAMES) { | 2021 } else if (uri == DART_JS_NAMES) { |
2019 preserveNamesMarker = find(library, 'preserveNames'); | 2022 preserveNamesMarker = find(library, 'preserveNames'); |
2020 } else if (uri == DART_EMBEDDED_NAMES) { | 2023 } else if (uri == DART_EMBEDDED_NAMES) { |
2021 jsGetNameEnum = find(library, 'JsGetName'); | 2024 jsGetNameEnum = find(library, 'JsGetName'); |
| 2025 jsBuiltinEnum = find(library, 'JsBuiltin'); |
2022 } else if (uri == DART_HTML) { | 2026 } else if (uri == DART_HTML) { |
2023 htmlLibraryIsLoaded = true; | 2027 htmlLibraryIsLoaded = true; |
2024 } | 2028 } |
2025 annotations.onLibraryScanned(library); | 2029 annotations.onLibraryScanned(library); |
2026 }); | 2030 }); |
2027 } | 2031 } |
2028 | 2032 |
2029 Future onLibrariesLoaded(LoadedLibraries loadedLibraries) { | 2033 Future onLibrariesLoaded(LoadedLibraries loadedLibraries) { |
2030 if (!loadedLibraries.containsLibrary(Compiler.DART_CORE)) { | 2034 if (!loadedLibraries.containsLibrary(Compiler.DART_CORE)) { |
2031 return new Future.value(); | 2035 return new Future.value(); |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2869 } | 2873 } |
2870 } | 2874 } |
2871 | 2875 |
2872 /// Records that [constant] is used by the element behind [registry]. | 2876 /// Records that [constant] is used by the element behind [registry]. |
2873 class Dependency { | 2877 class Dependency { |
2874 final ConstantValue constant; | 2878 final ConstantValue constant; |
2875 final Element annotatedElement; | 2879 final Element annotatedElement; |
2876 | 2880 |
2877 const Dependency(this.constant, this.annotatedElement); | 2881 const Dependency(this.constant, this.annotatedElement); |
2878 } | 2882 } |
OLD | NEW |