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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 for (Node* current = head_; current != NULL; current = current->next()) { | 257 for (Node* current = head_; current != NULL; current = current->next()) { |
258 if (current->state_ == Node::WEAK | 258 if (current->state_ == Node::WEAK |
259 || current->state_ == Node::PENDING | 259 || current->state_ == Node::PENDING |
260 || current->state_ == Node::NEAR_DEATH) { | 260 || current->state_ == Node::NEAR_DEATH) { |
261 v->VisitPointer(¤t->object_); | 261 v->VisitPointer(¤t->object_); |
262 } | 262 } |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 | 266 |
| 267 void GlobalHandles::IterateWeakRoots(WeakReferenceGuest f, |
| 268 WeakReferenceCallback callback) { |
| 269 for (Node* current = head_; current != NULL; current = current->next()) { |
| 270 if (current->IsWeak() && current->callback() == callback) { |
| 271 f(current->object_, current->parameter()); |
| 272 } |
| 273 } |
| 274 } |
| 275 |
| 276 |
267 void GlobalHandles::IdentifyWeakHandles(WeakSlotCallback f) { | 277 void GlobalHandles::IdentifyWeakHandles(WeakSlotCallback f) { |
268 for (Node* current = head_; current != NULL; current = current->next()) { | 278 for (Node* current = head_; current != NULL; current = current->next()) { |
269 if (current->state_ == Node::WEAK) { | 279 if (current->state_ == Node::WEAK) { |
270 if (f(¤t->object_)) { | 280 if (f(¤t->object_)) { |
271 current->state_ = Node::PENDING; | 281 current->state_ = Node::PENDING; |
272 LOG(HandleEvent("GlobalHandle::Pending", current->handle().location())); | 282 LOG(HandleEvent("GlobalHandle::Pending", current->handle().location())); |
273 } | 283 } |
274 } | 284 } |
275 } | 285 } |
276 } | 286 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 void GlobalHandles::RemoveObjectGroups() { | 401 void GlobalHandles::RemoveObjectGroups() { |
392 List<ObjectGroup*>* object_groups = ObjectGroups(); | 402 List<ObjectGroup*>* object_groups = ObjectGroups(); |
393 for (int i = 0; i< object_groups->length(); i++) { | 403 for (int i = 0; i< object_groups->length(); i++) { |
394 delete object_groups->at(i); | 404 delete object_groups->at(i); |
395 } | 405 } |
396 object_groups->Clear(); | 406 object_groups->Clear(); |
397 } | 407 } |
398 | 408 |
399 | 409 |
400 } } // namespace v8::internal | 410 } } // namespace v8::internal |
OLD | NEW |