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 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); | 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); |
(...skipping 344 matching lines...) Loading... |
355 /// True if a call to preserveMetadataMarker has been seen. This means that | 355 /// True if a call to preserveMetadataMarker has been seen. This means that |
356 /// metadata must be retained for dart:mirrors to work correctly. | 356 /// metadata must be retained for dart:mirrors to work correctly. |
357 bool mustRetainMetadata = false; | 357 bool mustRetainMetadata = false; |
358 | 358 |
359 /// True if any metadata has been retained. This is slightly different from | 359 /// True if any metadata has been retained. This is slightly different from |
360 /// [mustRetainMetadata] and tells us if any metadata was retained. For | 360 /// [mustRetainMetadata] and tells us if any metadata was retained. For |
361 /// example, if [mustRetainMetadata] is true but there is no metadata in the | 361 /// example, if [mustRetainMetadata] is true but there is no metadata in the |
362 /// program, this variable will stil be false. | 362 /// program, this variable will stil be false. |
363 bool hasRetainedMetadata = false; | 363 bool hasRetainedMetadata = false; |
364 | 364 |
365 /// True if a call to preserveUris has been seen. | 365 /// True if a call to preserveUris has been seen and the preserve-uris flag |
366 bool mustRetainUris = false; | 366 /// is set. |
| 367 bool mustPreserveUris = false; |
367 | 368 |
368 /// True if a call to preserveLibraryNames has been seen. | 369 /// True if a call to preserveLibraryNames has been seen. |
369 bool mustRetainLibraryNames = false; | 370 bool mustRetainLibraryNames = false; |
370 | 371 |
371 /// True if a call to preserveNames has been seen. | 372 /// True if a call to preserveNames has been seen. |
372 bool mustPreserveNames = false; | 373 bool mustPreserveNames = false; |
373 | 374 |
374 /// True if a call to disableTreeShaking has been seen. | 375 /// True if a call to disableTreeShaking has been seen. |
375 bool isTreeShakingDisabled = false; | 376 bool isTreeShakingDisabled = false; |
376 | 377 |
(...skipping 1184 matching lines...) Loading... |
1561 void registerStaticUse(Element element, Enqueuer enqueuer) { | 1562 void registerStaticUse(Element element, Enqueuer enqueuer) { |
1562 if (element == disableTreeShakingMarker) { | 1563 if (element == disableTreeShakingMarker) { |
1563 compiler.disableTypeInferenceForMirrors = true; | 1564 compiler.disableTypeInferenceForMirrors = true; |
1564 isTreeShakingDisabled = true; | 1565 isTreeShakingDisabled = true; |
1565 typeVariableHandler.onTreeShakingDisabled(enqueuer); | 1566 typeVariableHandler.onTreeShakingDisabled(enqueuer); |
1566 } else if (element == preserveNamesMarker) { | 1567 } else if (element == preserveNamesMarker) { |
1567 mustPreserveNames = true; | 1568 mustPreserveNames = true; |
1568 } else if (element == preserveMetadataMarker) { | 1569 } else if (element == preserveMetadataMarker) { |
1569 mustRetainMetadata = true; | 1570 mustRetainMetadata = true; |
1570 } else if (element == preserveUrisMarker) { | 1571 } else if (element == preserveUrisMarker) { |
1571 mustRetainUris = true; | 1572 if (compiler.preserveUris) mustPreserveUris = true; |
1572 } else if (element == preserveLibraryNamesMarker) { | 1573 } else if (element == preserveLibraryNamesMarker) { |
1573 mustRetainLibraryNames = true; | 1574 mustRetainLibraryNames = true; |
1574 } else if (element == getIsolateAffinityTagMarker) { | 1575 } else if (element == getIsolateAffinityTagMarker) { |
1575 needToInitializeIsolateAffinityTag = true; | 1576 needToInitializeIsolateAffinityTag = true; |
1576 } else if (element.isDeferredLoaderGetter) { | 1577 } else if (element.isDeferredLoaderGetter) { |
1577 // TODO(sigurdm): Create a function registerLoadLibraryAccess. | 1578 // TODO(sigurdm): Create a function registerLoadLibraryAccess. |
1578 if (compiler.loadLibraryFunction == null) { | 1579 if (compiler.loadLibraryFunction == null) { |
1579 compiler.loadLibraryFunction = | 1580 compiler.loadLibraryFunction = |
1580 findHelper("_loadLibraryWrapper"); | 1581 findHelper("_loadLibraryWrapper"); |
1581 enqueueInResolution(compiler.loadLibraryFunction, | 1582 enqueueInResolution(compiler.loadLibraryFunction, |
(...skipping 854 matching lines...) Loading... |
2436 } | 2437 } |
2437 } | 2438 } |
2438 | 2439 |
2439 /// Records that [constant] is used by the element behind [registry]. | 2440 /// Records that [constant] is used by the element behind [registry]. |
2440 class Dependency { | 2441 class Dependency { |
2441 final ConstantValue constant; | 2442 final ConstantValue constant; |
2442 final Element annotatedElement; | 2443 final Element annotatedElement; |
2443 | 2444 |
2444 const Dependency(this.constant, this.annotatedElement); | 2445 const Dependency(this.constant, this.annotatedElement); |
2445 } | 2446 } |
OLD | NEW |