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

Side by Side Diff: runtime/vm/isolate.cc

Issue 23072013: - Avoid double iteration when accessing anonymous classes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "platform/json.h" 9 #include "platform/json.h"
10 #include "lib/mirrors.h" 10 #include "lib/mirrors.h"
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 ASSERT(this == Isolate::Current()); 714 ASSERT(this == Isolate::Current());
715 StackZone zone(this); 715 StackZone zone(this);
716 HandleScope handle_scope(this); 716 HandleScope handle_scope(this);
717 const GrowableObjectArray& libraries = 717 const GrowableObjectArray& libraries =
718 GrowableObjectArray::Handle(object_store()->libraries()); 718 GrowableObjectArray::Handle(object_store()->libraries());
719 Library& library = Library::Handle(); 719 Library& library = Library::Handle();
720 GrowableArray<const Function*> invoked_functions; 720 GrowableArray<const Function*> invoked_functions;
721 for (int i = 0; i < libraries.Length(); i++) { 721 for (int i = 0; i < libraries.Length(); i++) {
722 library ^= libraries.At(i); 722 library ^= libraries.At(i);
723 Class& cls = Class::Handle(); 723 Class& cls = Class::Handle();
724 ClassDictionaryIterator iter(library); 724 ClassDictionaryIterator iter(library,
725 ClassDictionaryIterator::kIteratePrivate);
725 while (iter.HasNext()) { 726 while (iter.HasNext()) {
726 cls = iter.GetNextClass(); 727 cls = iter.GetNextClass();
727 AddFunctionsFromClass(cls, &invoked_functions); 728 AddFunctionsFromClass(cls, &invoked_functions);
728 } 729 }
729 Array& anon_classes = Array::Handle(library.raw_ptr()->anonymous_classes_);
730 for (int i = 0; i < library.raw_ptr()->num_anonymous_; i++) {
731 cls ^= anon_classes.At(i);
732 AddFunctionsFromClass(cls, &invoked_functions);
733 }
734 } 730 }
735 invoked_functions.Sort(MostUsedFunctionFirst); 731 invoked_functions.Sort(MostUsedFunctionFirst);
736 for (int i = 0; i < invoked_functions.length(); i++) { 732 for (int i = 0; i < invoked_functions.length(); i++) {
737 OS::Print("%10"Pd" x %s\n", 733 OS::Print("%10"Pd" x %s\n",
738 invoked_functions[i]->usage_counter(), 734 invoked_functions[i]->usage_counter(),
739 invoked_functions[i]->ToFullyQualifiedCString()); 735 invoked_functions[i]->ToFullyQualifiedCString());
740 } 736 }
741 } 737 }
742 738
743 739
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 return func.raw(); 1185 return func.raw();
1190 } 1186 }
1191 1187
1192 1188
1193 void IsolateSpawnState::Cleanup() { 1189 void IsolateSpawnState::Cleanup() {
1194 SwitchIsolateScope switch_scope(isolate()); 1190 SwitchIsolateScope switch_scope(isolate());
1195 Dart::ShutdownIsolate(); 1191 Dart::ShutdownIsolate();
1196 } 1192 }
1197 1193
1198 } // namespace dart 1194 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698