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

Side by Side Diff: src/global-handles.cc

Issue 6800003: Make object groups and implicit references a bit more lightweight. (Closed)
Patch Set: Review fixes Created 9 years, 8 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
« no previous file with comments | « src/global-handles.h ('k') | src/mark-compact.cc » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 } 551 }
552 } 552 }
553 553
554 #endif 554 #endif
555 555
556 556
557 557
558 void GlobalHandles::AddObjectGroup(Object*** handles, 558 void GlobalHandles::AddObjectGroup(Object*** handles,
559 size_t length, 559 size_t length,
560 v8::RetainedObjectInfo* info) { 560 v8::RetainedObjectInfo* info) {
561 ObjectGroup* new_entry = new ObjectGroup(length, info); 561 if (length == 0) {
562 for (size_t i = 0; i < length; ++i) { 562 if (info != NULL) info->Dispose();
563 new_entry->objects_.Add(handles[i]); 563 return;
564 } 564 }
565 object_groups_.Add(new_entry); 565 object_groups_.Add(ObjectGroup::New(handles, length, info));
566 } 566 }
567 567
568 568
569 void GlobalHandles::AddImplicitReferences(HeapObject* parent, 569 void GlobalHandles::AddImplicitReferences(HeapObject** parent,
570 Object*** children, 570 Object*** children,
571 size_t length) { 571 size_t length) {
572 ImplicitRefGroup* new_entry = new ImplicitRefGroup(parent, length); 572 if (length == 0) return;
573 for (size_t i = 0; i < length; ++i) { 573 implicit_ref_groups_.Add(ImplicitRefGroup::New(parent, children, length));
574 new_entry->children_.Add(children[i]);
575 }
576 implicit_ref_groups_.Add(new_entry);
577 } 574 }
578 575
579 576
580 void GlobalHandles::RemoveObjectGroups() { 577 void GlobalHandles::RemoveObjectGroups() {
581 for (int i = 0; i < object_groups_.length(); i++) { 578 for (int i = 0; i < object_groups_.length(); i++) {
582 delete object_groups_.at(i); 579 object_groups_.at(i)->Dispose();
583 } 580 }
584 object_groups_.Clear(); 581 object_groups_.Clear();
585 } 582 }
586 583
587 584
588 void GlobalHandles::RemoveImplicitRefGroups() { 585 void GlobalHandles::RemoveImplicitRefGroups() {
589 for (int i = 0; i < implicit_ref_groups_.length(); i++) { 586 for (int i = 0; i < implicit_ref_groups_.length(); i++) {
590 delete implicit_ref_groups_.at(i); 587 implicit_ref_groups_.at(i)->Dispose();
591 } 588 }
592 implicit_ref_groups_.Clear(); 589 implicit_ref_groups_.Clear();
593 } 590 }
594 591
595 592
596 } } // namespace v8::internal 593 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/global-handles.h ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698