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

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

Issue 21242002: Retain elements a finer granularity than library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Variable initialized too early. Created 7 years, 4 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 class JavaScriptItemCompilationContext extends ItemCompilationContext { 7 class JavaScriptItemCompilationContext extends ItemCompilationContext {
8 final Set<HInstruction> boundsChecked; 8 final Set<HInstruction> boundsChecked;
9 9
10 JavaScriptItemCompilationContext() 10 JavaScriptItemCompilationContext()
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 } else { 1455 } else {
1456 metadataGetOfStaticFunction.add(element); 1456 metadataGetOfStaticFunction.add(element);
1457 } 1457 }
1458 } 1458 }
1459 1459
1460 void registerMirrorUsage(Set<String> symbols, 1460 void registerMirrorUsage(Set<String> symbols,
1461 Set<Element> targets, 1461 Set<Element> targets,
1462 Set<Element> metaTargets) { 1462 Set<Element> metaTargets) {
1463 if (symbols != null) symbolsUsed.addAll(symbols); 1463 if (symbols != null) symbolsUsed.addAll(symbols);
1464 if (targets != null) { 1464 if (targets != null) {
1465 for (Element element in targets) { 1465 for (Element target in targets) {
1466 // TODO(ahe): Implement finer granularity. 1466 if (target.isAbstractField()) {
1467 targetsUsed.add(element.getLibrary()); 1467 AbstractFieldElement field = target;
1468 targetsUsed.add(field.getter);
1469 targetsUsed.add(field.setter);
1470 } else {
1471 targetsUsed.add(target);
1472 }
1468 } 1473 }
1469 } 1474 }
1470 if (metaTargets != null) metaTargetsUsed.addAll(metaTargets); 1475 if (metaTargets != null) metaTargetsUsed.addAll(metaTargets);
1471 } 1476 }
1472 1477
1473 bool isNeededForReflection(Element element) { 1478 bool isNeededForReflection(Element element) {
1474 // TODO(ahe): Implement this. 1479 // TODO(ahe): Implement this.
1475 if (!metaTargetsUsed.isEmpty) return true; 1480 if (!metaTargetsUsed.isEmpty) return true;
1476 if (targetsUsed.contains(element.getLibrary())) return true; 1481 if (!targetsUsed.isEmpty) {
1482 for (Element e = element; e != null; e = e.enclosingElement) {
1483 if (targetsUsed.contains(e)) return true;
1484 }
1485 }
1477 return false; 1486 return false;
1478 } 1487 }
1479 } 1488 }
1480 1489
1481 /// Records that [type] is used by [user.element]. 1490 /// Records that [type] is used by [user.element].
1482 class Dependency { 1491 class Dependency {
1483 final DartType type; 1492 final DartType type;
1484 final TreeElements user; 1493 final TreeElements user;
1485 1494
1486 const Dependency(this.type, this.user); 1495 const Dependency(this.type, this.user);
1487 } 1496 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698