| OLD | NEW |
| 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 ObjectGroup* new_entry = new ObjectGroup(length, info); |
| 562 for (size_t i = 0; i < length; ++i) { | 562 for (size_t i = 0; i < length; ++i) { |
| 563 new_entry->objects_.Add(handles[i]); | 563 new_entry->objects_.Add(handles[i]); |
| 564 } | 564 } |
| 565 object_groups_.Add(new_entry); | 565 object_groups_.Add(new_entry); |
| 566 } | 566 } |
| 567 | 567 |
| 568 | 568 |
| 569 List<ImplicitRefGroup*>* GlobalHandles::ImplicitRefGroups() { | |
| 570 // Lazily initialize the list to avoid startup time static constructors. | |
| 571 static List<ImplicitRefGroup*> groups(4); | |
| 572 return &groups; | |
| 573 } | |
| 574 | |
| 575 | |
| 576 void GlobalHandles::AddImplicitReferences(HeapObject* parent, | 569 void GlobalHandles::AddImplicitReferences(HeapObject* parent, |
| 577 Object*** children, | 570 Object*** children, |
| 578 size_t length) { | 571 size_t length) { |
| 579 ImplicitRefGroup* new_entry = new ImplicitRefGroup(parent, length); | 572 ImplicitRefGroup* new_entry = new ImplicitRefGroup(parent, length); |
| 580 for (size_t i = 0; i < length; ++i) { | 573 for (size_t i = 0; i < length; ++i) { |
| 581 new_entry->children_.Add(children[i]); | 574 new_entry->children_.Add(children[i]); |
| 582 } | 575 } |
| 583 ImplicitRefGroups()->Add(new_entry); | 576 implicit_ref_groups_.Add(new_entry); |
| 584 } | 577 } |
| 585 | 578 |
| 586 | 579 |
| 587 void GlobalHandles::RemoveObjectGroups() { | 580 void GlobalHandles::RemoveObjectGroups() { |
| 588 for (int i = 0; i< object_groups_.length(); i++) { | 581 for (int i = 0; i < object_groups_.length(); i++) { |
| 589 delete object_groups_.at(i); | 582 delete object_groups_.at(i); |
| 590 } | 583 } |
| 591 object_groups_.Clear(); | 584 object_groups_.Clear(); |
| 592 } | 585 } |
| 593 | 586 |
| 594 | 587 |
| 595 void GlobalHandles::RemoveImplicitRefGroups() { | 588 void GlobalHandles::RemoveImplicitRefGroups() { |
| 596 List<ImplicitRefGroup*>* ref_groups = ImplicitRefGroups(); | 589 for (int i = 0; i < implicit_ref_groups_.length(); i++) { |
| 597 for (int i = 0; i< ref_groups->length(); i++) { | 590 delete implicit_ref_groups_.at(i); |
| 598 delete ref_groups->at(i); | |
| 599 } | 591 } |
| 600 ref_groups->Clear(); | 592 implicit_ref_groups_.Clear(); |
| 601 } | 593 } |
| 602 | 594 |
| 603 | 595 |
| 604 } } // namespace v8::internal | 596 } } // namespace v8::internal |
| OLD | NEW |