Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 142193005: Fix JS-backend when MirrorsUsed target a static field, but there is no mirrors usage. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: One more test. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 // know if [mask] is not a more specific type than [indexing]. 1743 // know if [mask] is not a more specific type than [indexing].
1744 return isTypedArray(mask) || mask.containsMask(indexing, compiler); 1744 return isTypedArray(mask) || mask.containsMask(indexing, compiler);
1745 } 1745 }
1746 1746
1747 /// Called when [enqueuer] is empty, but before it is closed. 1747 /// Called when [enqueuer] is empty, but before it is closed.
1748 void onQueueEmpty(Enqueuer enqueuer) { 1748 void onQueueEmpty(Enqueuer enqueuer) {
1749 if (!enqueuer.isResolutionQueue && preMirrorsMethodCount == 0) { 1749 if (!enqueuer.isResolutionQueue && preMirrorsMethodCount == 0) {
1750 preMirrorsMethodCount = generatedCode.length; 1750 preMirrorsMethodCount = generatedCode.length;
1751 } 1751 }
1752 1752
1753 if (isTreeShakingDisabled) enqueuer.enqueueEverything(); 1753 if (isTreeShakingDisabled) {
1754 enqueuer.enqueueEverything();
1755 } else if (!targetsUsed.isEmpty) {
1756 // Add all static elements (not classes) that have been requested for
1757 // reflection. If there is no mirror-usage these are probably not
1758 // necessary, but the backend relies on them being resolved.
1759 List staticFields = [];
floitsch 2014/01/29 23:32:14 I wouldn't be surprised if there were better ways
1760 for (Element target in targetsUsed) {
1761 if (target == null) continue;
1762 if (target.isField()) {
1763 staticFields.add(target);
1764 } else if (target.isLibrary() || target.isClass()) {
1765 ScopeContainerElement container = target;
1766 container.forEachLocalMember((Element member) {
1767 if (!member.isInstanceMember() && member.isField()) {
1768 staticFields.add(member);
1769 }
1770 });
1771 }
1772 }
1773 enqueuer.enqueueReflectiveStaticFields(staticFields);
1774 }
1754 1775
1755 if (mustPreserveNames) compiler.log('Preserving names.'); 1776 if (mustPreserveNames) compiler.log('Preserving names.');
1756 1777
1757 if (mustRetainMetadata) { 1778 if (mustRetainMetadata) {
1758 compiler.log('Retaining metadata.'); 1779 compiler.log('Retaining metadata.');
1759 1780
1760 compiler.libraries.values.forEach(retainMetadataOf); 1781 compiler.libraries.values.forEach(retainMetadataOf);
1761 for (Dependency dependency in metadataConstants) { 1782 for (Dependency dependency in metadataConstants) {
1762 registerCompileTimeConstant( 1783 registerCompileTimeConstant(
1763 dependency.constant, dependency.user); 1784 dependency.constant, dependency.user);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 copy(constant.values); 1894 copy(constant.values);
1874 copy(constant.protoValue); 1895 copy(constant.protoValue);
1875 copy(constant); 1896 copy(constant);
1876 } 1897 }
1877 1898
1878 void visitConstructed(ConstructedConstant constant) { 1899 void visitConstructed(ConstructedConstant constant) {
1879 copy(constant.fields); 1900 copy(constant.fields);
1880 copy(constant); 1901 copy(constant);
1881 } 1902 }
1882 } 1903 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698