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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 | 655 |
656 bool GlobalHandles::IsNearDeath(Object** location) { | 656 bool GlobalHandles::IsNearDeath(Object** location) { |
657 return Node::FromLocation(location)->IsNearDeath(); | 657 return Node::FromLocation(location)->IsNearDeath(); |
658 } | 658 } |
659 | 659 |
660 | 660 |
661 bool GlobalHandles::IsWeak(Object** location) { | 661 bool GlobalHandles::IsWeak(Object** location) { |
662 return Node::FromLocation(location)->IsWeak(); | 662 return Node::FromLocation(location)->IsWeak(); |
663 } | 663 } |
664 | 664 |
| 665 DISABLE_CFI_PERF |
665 void GlobalHandles::IterateWeakRoots(ObjectVisitor* v) { | 666 void GlobalHandles::IterateWeakRoots(ObjectVisitor* v) { |
666 for (NodeIterator it(this); !it.done(); it.Advance()) { | 667 for (NodeIterator it(this); !it.done(); it.Advance()) { |
667 Node* node = it.node(); | 668 Node* node = it.node(); |
668 if (node->IsWeakRetainer()) { | 669 if (node->IsWeakRetainer()) { |
669 // Pending weak phantom handles die immediately. Everything else survives. | 670 // Pending weak phantom handles die immediately. Everything else survives. |
670 if (node->IsPendingPhantomResetHandle()) { | 671 if (node->IsPendingPhantomResetHandle()) { |
671 node->ResetPhantomHandle(); | 672 node->ResetPhantomHandle(); |
672 ++number_of_phantom_handle_resets_; | 673 ++number_of_phantom_handle_resets_; |
673 } else if (node->IsPendingPhantomCallback()) { | 674 } else if (node->IsPendingPhantomCallback()) { |
674 node->CollectPhantomCallbackData(isolate(), | 675 node->CollectPhantomCallbackData(isolate(), |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 node->CollectPhantomCallbackData(isolate(), | 783 node->CollectPhantomCallbackData(isolate(), |
783 &pending_phantom_callbacks_); | 784 &pending_phantom_callbacks_); |
784 } else { | 785 } else { |
785 v->VisitPointer(node->location()); | 786 v->VisitPointer(node->location()); |
786 } | 787 } |
787 } | 788 } |
788 } | 789 } |
789 } | 790 } |
790 | 791 |
791 | 792 |
| 793 DISABLE_CFI_PERF |
792 bool GlobalHandles::IterateObjectGroups(ObjectVisitor* v, | 794 bool GlobalHandles::IterateObjectGroups(ObjectVisitor* v, |
793 WeakSlotCallbackWithHeap can_skip) { | 795 WeakSlotCallbackWithHeap can_skip) { |
794 ComputeObjectGroupsAndImplicitReferences(); | 796 ComputeObjectGroupsAndImplicitReferences(); |
795 int last = 0; | 797 int last = 0; |
796 bool any_group_was_visited = false; | 798 bool any_group_was_visited = false; |
797 for (int i = 0; i < object_groups_.length(); i++) { | 799 for (int i = 0; i < object_groups_.length(); i++) { |
798 ObjectGroup* entry = object_groups_.at(i); | 800 ObjectGroup* entry = object_groups_.at(i); |
799 DCHECK(entry != NULL); | 801 DCHECK(entry != NULL); |
800 | 802 |
801 Object*** objects = entry->objects; | 803 Object*** objects = entry->objects; |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 | 1141 |
1140 void GlobalHandles::IterateStrongRoots(ObjectVisitor* v) { | 1142 void GlobalHandles::IterateStrongRoots(ObjectVisitor* v) { |
1141 for (NodeIterator it(this); !it.done(); it.Advance()) { | 1143 for (NodeIterator it(this); !it.done(); it.Advance()) { |
1142 if (it.node()->IsStrongRetainer()) { | 1144 if (it.node()->IsStrongRetainer()) { |
1143 v->VisitPointer(it.node()->location()); | 1145 v->VisitPointer(it.node()->location()); |
1144 } | 1146 } |
1145 } | 1147 } |
1146 } | 1148 } |
1147 | 1149 |
1148 | 1150 |
| 1151 DISABLE_CFI_PERF |
1149 void GlobalHandles::IterateAllRoots(ObjectVisitor* v) { | 1152 void GlobalHandles::IterateAllRoots(ObjectVisitor* v) { |
1150 for (NodeIterator it(this); !it.done(); it.Advance()) { | 1153 for (NodeIterator it(this); !it.done(); it.Advance()) { |
1151 if (it.node()->IsRetainer()) { | 1154 if (it.node()->IsRetainer()) { |
1152 v->VisitPointer(it.node()->location()); | 1155 v->VisitPointer(it.node()->location()); |
1153 } | 1156 } |
1154 } | 1157 } |
1155 } | 1158 } |
1156 | 1159 |
1157 | 1160 |
| 1161 DISABLE_CFI_PERF |
1158 void GlobalHandles::IterateAllRootsWithClassIds(ObjectVisitor* v) { | 1162 void GlobalHandles::IterateAllRootsWithClassIds(ObjectVisitor* v) { |
1159 for (NodeIterator it(this); !it.done(); it.Advance()) { | 1163 for (NodeIterator it(this); !it.done(); it.Advance()) { |
1160 if (it.node()->IsRetainer() && it.node()->has_wrapper_class_id()) { | 1164 if (it.node()->IsRetainer() && it.node()->has_wrapper_class_id()) { |
1161 v->VisitEmbedderReference(it.node()->location(), | 1165 v->VisitEmbedderReference(it.node()->location(), |
1162 it.node()->wrapper_class_id()); | 1166 it.node()->wrapper_class_id()); |
1163 } | 1167 } |
1164 } | 1168 } |
1165 } | 1169 } |
1166 | 1170 |
1167 | 1171 |
| 1172 DISABLE_CFI_PERF |
1168 void GlobalHandles::IterateAllRootsInNewSpaceWithClassIds(ObjectVisitor* v) { | 1173 void GlobalHandles::IterateAllRootsInNewSpaceWithClassIds(ObjectVisitor* v) { |
1169 for (int i = 0; i < new_space_nodes_.length(); ++i) { | 1174 for (int i = 0; i < new_space_nodes_.length(); ++i) { |
1170 Node* node = new_space_nodes_[i]; | 1175 Node* node = new_space_nodes_[i]; |
1171 if (node->IsRetainer() && node->has_wrapper_class_id()) { | 1176 if (node->IsRetainer() && node->has_wrapper_class_id()) { |
1172 v->VisitEmbedderReference(node->location(), | 1177 v->VisitEmbedderReference(node->location(), |
1173 node->wrapper_class_id()); | 1178 node->wrapper_class_id()); |
1174 } | 1179 } |
1175 } | 1180 } |
1176 } | 1181 } |
1177 | 1182 |
1178 | 1183 |
| 1184 DISABLE_CFI_PERF |
1179 void GlobalHandles::IterateWeakRootsInNewSpaceWithClassIds(ObjectVisitor* v) { | 1185 void GlobalHandles::IterateWeakRootsInNewSpaceWithClassIds(ObjectVisitor* v) { |
1180 for (int i = 0; i < new_space_nodes_.length(); ++i) { | 1186 for (int i = 0; i < new_space_nodes_.length(); ++i) { |
1181 Node* node = new_space_nodes_[i]; | 1187 Node* node = new_space_nodes_[i]; |
1182 if (node->has_wrapper_class_id() && node->IsWeak()) { | 1188 if (node->has_wrapper_class_id() && node->IsWeak()) { |
1183 v->VisitEmbedderReference(node->location(), node->wrapper_class_id()); | 1189 v->VisitEmbedderReference(node->location(), node->wrapper_class_id()); |
1184 } | 1190 } |
1185 } | 1191 } |
1186 } | 1192 } |
1187 | 1193 |
1188 | 1194 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1505 blocks_[block][offset] = object; | 1511 blocks_[block][offset] = object; |
1506 if (isolate->heap()->InNewSpace(object)) { | 1512 if (isolate->heap()->InNewSpace(object)) { |
1507 new_space_indices_.Add(size_); | 1513 new_space_indices_.Add(size_); |
1508 } | 1514 } |
1509 *index = size_++; | 1515 *index = size_++; |
1510 } | 1516 } |
1511 | 1517 |
1512 | 1518 |
1513 } // namespace internal | 1519 } // namespace internal |
1514 } // namespace v8 | 1520 } // namespace v8 |
OLD | NEW |