Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/global-handles.h" | 5 #include "src/global-handles.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 #include "src/vm-state-inl.h" | 9 #include "src/vm-state-inl.h" |
| 10 | 10 |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 680 node->CollectPhantomCallbackData(isolate(), | 680 node->CollectPhantomCallbackData(isolate(), |
| 681 &pending_phantom_callbacks_); | 681 &pending_phantom_callbacks_); |
| 682 } else { | 682 } else { |
| 683 v->VisitPointer(node->location()); | 683 v->VisitPointer(node->location()); |
| 684 } | 684 } |
| 685 } | 685 } |
| 686 } | 686 } |
| 687 } | 687 } |
| 688 | 688 |
| 689 | 689 |
| 690 void GlobalHandles::IterateNewSpaceWeakRoots(ObjectVisitor* v, | |
| 691 WeakSlotCallback can_skip) { | |
| 692 for (int i = 0; i < new_space_nodes_.length(); ++i) { | |
| 693 Node* node = new_space_nodes_[i]; | |
| 694 Object* object = node->object(); | |
| 695 // If node->location is used instead of &object, import-expando-gc.html | |
| 696 // fails | |
| 697 if (node->IsWeak() && !can_skip(node->location())) | |
| 698 v->VisitPointer(&object); // node->location()); | |
| 699 } | |
| 700 } | |
| 701 | |
| 702 | |
| 690 bool GlobalHandles::IterateObjectGroups(ObjectVisitor* v, | 703 bool GlobalHandles::IterateObjectGroups(ObjectVisitor* v, |
| 691 WeakSlotCallbackWithHeap can_skip) { | 704 WeakSlotCallbackWithHeap can_skip) { |
| 692 ComputeObjectGroupsAndImplicitReferences(); | 705 ComputeObjectGroupsAndImplicitReferences(); |
| 693 int last = 0; | 706 int last = 0; |
| 694 bool any_group_was_visited = false; | 707 bool any_group_was_visited = false; |
| 695 for (int i = 0; i < object_groups_.length(); i++) { | 708 for (int i = 0; i < object_groups_.length(); i++) { |
| 696 ObjectGroup* entry = object_groups_.at(i); | 709 ObjectGroup* entry = object_groups_.at(i); |
| 697 DCHECK(entry != NULL); | 710 DCHECK(entry != NULL); |
| 698 | 711 |
| 699 Object*** objects = entry->objects; | 712 Object*** objects = entry->objects; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 711 if (!group_should_be_visited) { | 724 if (!group_should_be_visited) { |
| 712 object_groups_[last++] = entry; | 725 object_groups_[last++] = entry; |
| 713 continue; | 726 continue; |
| 714 } | 727 } |
| 715 | 728 |
| 716 // An object in the group requires visiting, so iterate over all | 729 // An object in the group requires visiting, so iterate over all |
| 717 // objects in the group. | 730 // objects in the group. |
| 718 for (size_t j = 0; j < entry->length; ++j) { | 731 for (size_t j = 0; j < entry->length; ++j) { |
| 719 Object* object = *objects[j]; | 732 Object* object = *objects[j]; |
| 720 if (object->IsHeapObject()) { | 733 if (object->IsHeapObject()) { |
| 721 v->VisitPointer(&object); | 734 // v->VisitPointer(&object); |
| 735 v->VisitPointer(objects[j]); | |
|
mythria
2015/09/22 10:57:00
If I pass objects[j] instead of &object for the vi
| |
| 722 any_group_was_visited = true; | 736 any_group_was_visited = true; |
| 723 } | 737 } |
| 724 } | 738 } |
| 725 | 739 |
| 726 // Once the entire group has been iterated over, set the object | 740 // Once the entire group has been iterated over, set the object |
| 727 // group to NULL so it won't be processed again. | 741 // group to NULL so it won't be processed again. |
| 728 delete entry; | 742 delete entry; |
| 729 object_groups_.at(i) = NULL; | 743 object_groups_.at(i) = NULL; |
| 730 } | 744 } |
| 731 object_groups_.Rewind(last); | 745 object_groups_.Rewind(last); |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1274 blocks_[block][offset] = object; | 1288 blocks_[block][offset] = object; |
| 1275 if (isolate->heap()->InNewSpace(object)) { | 1289 if (isolate->heap()->InNewSpace(object)) { |
| 1276 new_space_indices_.Add(size_); | 1290 new_space_indices_.Add(size_); |
| 1277 } | 1291 } |
| 1278 *index = size_++; | 1292 *index = size_++; |
| 1279 } | 1293 } |
| 1280 | 1294 |
| 1281 | 1295 |
| 1282 } // namespace internal | 1296 } // namespace internal |
| 1283 } // namespace v8 | 1297 } // namespace v8 |
| OLD | NEW |