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

Unified Diff: sdk/lib/_internal/compiler/implementation/dump_info.dart

Issue 435263002: Attribute closure sizes to their containing functions and closures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/dump_info.dart
diff --git a/sdk/lib/_internal/compiler/implementation/dump_info.dart b/sdk/lib/_internal/compiler/implementation/dump_info.dart
index 027dbbb9abe76e669a25708a3cd4bede19c58c3c..0c78050f9571a6178d03d3cbf60633c433bfa2c1 100644
--- a/sdk/lib/_internal/compiler/implementation/dump_info.dart
+++ b/sdk/lib/_internal/compiler/implementation/dump_info.dart
@@ -239,6 +239,17 @@ class ElementToJsonVisitor extends ElementVisitor<Map<String, dynamic>> {
Map<String, dynamic> childJson = this.process(member);
if (childJson != null) {
children.add(childJson['id']);
+
+ // Closures are placed in the library namespace, but
+ // we want to attribute them to a function, and by
+ // extension, this class. Process and add the sizes
+ // here.
+ for (Element closure in member.nestedClosures) {
+ Map<String, dynamic> child = this.process(closure);
sra1 2014/08/04 23:25:59 Does this cause the closure to be processed twice?
Ty Overby (Google) 2014/08/04 23:32:01 The `process` function is memoized. It actually e
+ if (child != null) {
+ size += child['size'];
+ }
+ }
}
});
@@ -306,13 +317,12 @@ class ElementToJsonVisitor extends ElementVisitor<Map<String, dynamic>> {
sideEffects = compiler.world.getSideEffectsOfElement(element).toString();
code = emittedCode.toString();
}
- if (element is MethodElement) {
- for (Element closure in element.nestedClosures) {
- Map<String, dynamic> child = this.process(closure);
- if (child != null) {
- children.add(child['id']);
- size += child['size'];
- }
+
+ for (Element closure in element.nestedClosures) {
+ Map<String, dynamic> child = this.process(closure);
+ if (child != null) {
+ children.add(child['id']);
+ size += child['size'];
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698