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

Unified Diff: runtime/vm/isolate.cc

Issue 9390001: Print top level functions as well when reproting invocation count. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.cc
===================================================================
--- runtime/vm/isolate.cc (revision 4186)
+++ runtime/vm/isolate.cc (working copy)
@@ -264,6 +264,22 @@
}
+static void AddFunctionsFromClass(const Class& cls,
+ GrowableArray<const Function*>* functions) {
+ const Array& class_functions = Array::Handle(cls.functions());
+ // Class 'Dynamic' is allocated/initialized in a special way, leaving
+ // the functions field NULL instead of empty.
+ const int func_len = class_functions.IsNull() ? 0 : class_functions.Length();
+ for (int j = 0; j < func_len; j++) {
+ Function& function = Function::Handle();
+ function ^= class_functions.At(j);
+ if (function.invocation_counter() > 0) {
+ functions->Add(&function);
+ }
+ }
+}
+
+
void Isolate::PrintInvokedFunctions() {
ASSERT(this == Isolate::Current());
Zone zone(this);
@@ -276,18 +292,13 @@
ClassDictionaryIterator iter(library);
while (iter.HasNext()) {
cls = iter.GetNextClass();
- const Array& functions = Array::Handle(cls.functions());
- // Class 'Dynamic' is allocated/initialized in a special way, leaving
- // the functions field NULL instead of empty.
- const int func_len = functions.IsNull() ? 0 : functions.Length();
- for (int j = 0; j < func_len; j++) {
- Function& function = Function::Handle();
- function ^= functions.At(j);
- if (function.invocation_counter() > 0) {
- invoked_functions.Add(&function);
- }
- }
+ AddFunctionsFromClass(cls, &invoked_functions);
}
+ Array& anon_classes = Array::Handle(library.raw_ptr()->anonymous_classes_);
+ for (int i = 0; i < library.raw_ptr()->num_anonymous_; i++) {
+ cls ^= anon_classes.At(i);
+ AddFunctionsFromClass(cls, &invoked_functions);
+ }
library = library.next_registered();
}
invoked_functions.Sort(MostCalledFunctionFirst);
« no previous file with comments | « no previous file | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698