| OLD | NEW |
| 1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #include "src/vm/weak_pointer.h" | 5 #include "src/vm/weak_pointer.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include "src/vm/object.h" | 9 #include "src/vm/object.h" |
| 10 #include "src/vm/object_memory.h" | 10 #include "src/vm/object_memory.h" |
| 11 | 11 |
| 12 namespace fletch { | 12 namespace dartino { |
| 13 | 13 |
| 14 WeakPointer::WeakPointer(HeapObject* object, WeakPointerCallback callback, | 14 WeakPointer::WeakPointer(HeapObject* object, WeakPointerCallback callback, |
| 15 WeakPointer* next) | 15 WeakPointer* next) |
| 16 : object_(object), callback_(callback), prev_(NULL), next_(next) {} | 16 : object_(object), callback_(callback), prev_(NULL), next_(next) {} |
| 17 | 17 |
| 18 void WeakPointer::Process(Space* space, WeakPointer** pointers, Heap* heap) { | 18 void WeakPointer::Process(Space* space, WeakPointer** pointers, Heap* heap) { |
| 19 WeakPointer* new_list = NULL; | 19 WeakPointer* new_list = NULL; |
| 20 WeakPointer* previous = NULL; | 20 WeakPointer* previous = NULL; |
| 21 WeakPointer* current = *pointers; | 21 WeakPointer* current = *pointers; |
| 22 while (current != NULL) { | 22 while (current != NULL) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 void WeakPointer::Visit(WeakPointer* pointers, PointerVisitor* visitor) { | 96 void WeakPointer::Visit(WeakPointer* pointers, PointerVisitor* visitor) { |
| 97 while (pointers != NULL) { | 97 while (pointers != NULL) { |
| 98 visitor->Visit(reinterpret_cast<Object**>(&pointers->object_)); | 98 visitor->Visit(reinterpret_cast<Object**>(&pointers->object_)); |
| 99 pointers = pointers->next_; | 99 pointers = pointers->next_; |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace fletch | 103 } // namespace dartino |
| OLD | NEW |