| OLD | NEW |
| 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 #include "vm/isolate.h" | 5 #include "vm/isolate.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "lib/mirrors.h" | 9 #include "lib/mirrors.h" |
| 10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 functions->Add(&function); | 317 functions->Add(&function); |
| 318 } | 318 } |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 | 321 |
| 322 | 322 |
| 323 void Isolate::PrintInvokedFunctions() { | 323 void Isolate::PrintInvokedFunctions() { |
| 324 ASSERT(this == Isolate::Current()); | 324 ASSERT(this == Isolate::Current()); |
| 325 Zone zone(this); | 325 Zone zone(this); |
| 326 HandleScope handle_scope(this); | 326 HandleScope handle_scope(this); |
| 327 const GrowableObjectArray& libraries = |
| 328 GrowableObjectArray::Handle(object_store()->libraries()); |
| 327 Library& library = Library::Handle(); | 329 Library& library = Library::Handle(); |
| 328 library = object_store()->registered_libraries(); | |
| 329 GrowableArray<const Function*> invoked_functions; | 330 GrowableArray<const Function*> invoked_functions; |
| 330 while (!library.IsNull()) { | 331 for (int i = 0; i < libraries.Length(); i++) { |
| 332 library ^= libraries.At(i); |
| 331 Class& cls = Class::Handle(); | 333 Class& cls = Class::Handle(); |
| 332 ClassDictionaryIterator iter(library); | 334 ClassDictionaryIterator iter(library); |
| 333 while (iter.HasNext()) { | 335 while (iter.HasNext()) { |
| 334 cls = iter.GetNextClass(); | 336 cls = iter.GetNextClass(); |
| 335 AddFunctionsFromClass(cls, &invoked_functions); | 337 AddFunctionsFromClass(cls, &invoked_functions); |
| 336 } | 338 } |
| 337 Array& anon_classes = Array::Handle(library.raw_ptr()->anonymous_classes_); | 339 Array& anon_classes = Array::Handle(library.raw_ptr()->anonymous_classes_); |
| 338 for (int i = 0; i < library.raw_ptr()->num_anonymous_; i++) { | 340 for (int i = 0; i < library.raw_ptr()->num_anonymous_; i++) { |
| 339 cls ^= anon_classes.At(i); | 341 cls ^= anon_classes.At(i); |
| 340 AddFunctionsFromClass(cls, &invoked_functions); | 342 AddFunctionsFromClass(cls, &invoked_functions); |
| 341 } | 343 } |
| 342 library = library.next_registered(); | |
| 343 } | 344 } |
| 344 invoked_functions.Sort(MostUsedFunctionFirst); | 345 invoked_functions.Sort(MostUsedFunctionFirst); |
| 345 for (int i = 0; i < invoked_functions.length(); i++) { | 346 for (int i = 0; i < invoked_functions.length(); i++) { |
| 346 OS::Print("%10d x %s\n", | 347 OS::Print("%10d x %s\n", |
| 347 invoked_functions[i]->usage_counter(), | 348 invoked_functions[i]->usage_counter(), |
| 348 invoked_functions[i]->ToFullyQualifiedCString()); | 349 invoked_functions[i]->ToFullyQualifiedCString()); |
| 349 } | 350 } |
| 350 } | 351 } |
| 351 | 352 |
| 352 | 353 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 | 457 |
| 457 | 458 |
| 458 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, | 459 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, |
| 459 bool visit_prologue_weak_handles) { | 460 bool visit_prologue_weak_handles) { |
| 460 if (api_state() != NULL) { | 461 if (api_state() != NULL) { |
| 461 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); | 462 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); |
| 462 } | 463 } |
| 463 } | 464 } |
| 464 | 465 |
| 465 } // namespace dart | 466 } // namespace dart |
| OLD | NEW |