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

Unified Diff: src/global-handles.cc

Issue 14886: Bring toiger up to date with bleeding edge 984. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 12 years 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 | « src/global-handles.h ('k') | src/globals.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/global-handles.cc
===================================================================
--- src/global-handles.cc (revision 1004)
+++ src/global-handles.cc (working copy)
@@ -352,29 +352,26 @@
#endif
-List<ObjectGroup*> GlobalHandles::object_groups_(4);
+List<ObjectGroup*>* GlobalHandles::ObjectGroups() {
+ // Lazily initialize the list to avoid startup time static constructors.
+ static List<ObjectGroup*> groups(4);
+ return &groups;
+}
-void GlobalHandles::AddToGroup(void* id, Object** handle) {
- for (int i = 0; i < object_groups_.length(); i++) {
- ObjectGroup* entry = object_groups_[i];
- if (entry->id_ == id) {
- entry->objects_.Add(handle);
- return;
- }
- }
-
- // not found
- ObjectGroup* new_entry = new ObjectGroup(id);
- new_entry->objects_.Add(handle);
- object_groups_.Add(new_entry);
+void GlobalHandles::AddGroup(Object*** handles, size_t length) {
+ ObjectGroup* new_entry = new ObjectGroup(length);
+ for (size_t i = 0; i < length; ++i)
+ new_entry->objects_.Add(handles[i]);
+ ObjectGroups()->Add(new_entry);
}
void GlobalHandles::RemoveObjectGroups() {
- for (int i = 0; i< object_groups_.length(); i++) {
- delete object_groups_[i];
+ List<ObjectGroup*>* object_groups = ObjectGroups();
+ for (int i = 0; i< object_groups->length(); i++) {
+ delete object_groups->at(i);
}
- object_groups_.Clear();
+ object_groups->Clear();
}
« no previous file with comments | « src/global-handles.h ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698