| 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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |