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

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
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..3295f64192c91be844ff5a1591003dfd119d868b 100644
--- a/sdk/lib/_internal/compiler/implementation/dump_info.dart
+++ b/sdk/lib/_internal/compiler/implementation/dump_info.dart
@@ -239,6 +239,19 @@ 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.
+ if (member is MemberElement) {
+ for (Element closure in member.nestedClosures) {
+ Map<String, dynamic> child = this.process(closure);
+ if (child != null) {
+ size += child['size'];
+ }
+ }
+ }
}
});
@@ -306,8 +319,10 @@ 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) {
+
+ if (element is MemberElement) {
+ MemberElement member = element as MemberElement;
floitsch 2014/08/11 16:03:17 no need to write "as ...".
+ for (Element closure in member.nestedClosures) {
Map<String, dynamic> child = this.process(closure);
if (child != null) {
children.add(child['id']);

Powered by Google App Engine
This is Rietveld 408576698