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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 } | 534 } |
535 | 535 |
536 #endif | 536 #endif |
537 | 537 |
538 List<ObjectGroup*>* GlobalHandles::ObjectGroups() { | 538 List<ObjectGroup*>* GlobalHandles::ObjectGroups() { |
539 // Lazily initialize the list to avoid startup time static constructors. | 539 // Lazily initialize the list to avoid startup time static constructors. |
540 static List<ObjectGroup*> groups(4); | 540 static List<ObjectGroup*> groups(4); |
541 return &groups; | 541 return &groups; |
542 } | 542 } |
543 | 543 |
544 void GlobalHandles::AddGroup(Object*** handles, | 544 |
545 size_t length, | 545 void GlobalHandles::AddObjectGroup(Object*** handles, |
546 v8::RetainedObjectInfo* info) { | 546 size_t length, |
| 547 v8::RetainedObjectInfo* info) { |
547 ObjectGroup* new_entry = new ObjectGroup(length, info); | 548 ObjectGroup* new_entry = new ObjectGroup(length, info); |
548 for (size_t i = 0; i < length; ++i) | 549 for (size_t i = 0; i < length; ++i) { |
549 new_entry->objects_.Add(handles[i]); | 550 new_entry->objects_.Add(handles[i]); |
| 551 } |
550 ObjectGroups()->Add(new_entry); | 552 ObjectGroups()->Add(new_entry); |
551 } | 553 } |
552 | 554 |
553 | 555 |
| 556 List<ImplicitRefGroup*>* GlobalHandles::ImplicitRefGroups() { |
| 557 // Lazily initialize the list to avoid startup time static constructors. |
| 558 static List<ImplicitRefGroup*> groups(4); |
| 559 return &groups; |
| 560 } |
| 561 |
| 562 |
| 563 void GlobalHandles::AddImplicitRefGroup(HeapObject* parent, |
| 564 Object*** children, |
| 565 size_t length) { |
| 566 ImplicitRefGroup* new_entry = new ImplicitRefGroup(parent, length); |
| 567 for (size_t i = 0; i < length; ++i) { |
| 568 new_entry->children_.Add(children[i]); |
| 569 } |
| 570 ImplicitRefGroups()->Add(new_entry); |
| 571 } |
| 572 |
| 573 |
554 void GlobalHandles::RemoveObjectGroups() { | 574 void GlobalHandles::RemoveObjectGroups() { |
555 List<ObjectGroup*>* object_groups = ObjectGroups(); | 575 List<ObjectGroup*>* object_groups = ObjectGroups(); |
556 for (int i = 0; i< object_groups->length(); i++) { | 576 for (int i = 0; i< object_groups->length(); i++) { |
557 delete object_groups->at(i); | 577 delete object_groups->at(i); |
558 } | 578 } |
559 object_groups->Clear(); | 579 object_groups->Clear(); |
560 } | 580 } |
561 | 581 |
| 582 |
| 583 void GlobalHandles::RemoveImplicitRefGroups() { |
| 584 List<ImplicitRefGroup*>* ref_groups = ImplicitRefGroups(); |
| 585 for (int i = 0; i< ref_groups->length(); i++) { |
| 586 delete ref_groups->at(i); |
| 587 } |
| 588 ref_groups->Clear(); |
| 589 } |
| 590 |
| 591 |
562 } } // namespace v8::internal | 592 } } // namespace v8::internal |
OLD | NEW |