| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 // Make the global handle weak and set the callback parameter for the | 123 // Make the global handle weak and set the callback parameter for the |
| 124 // handle. When the garbage collector recognizes that only weak global | 124 // handle. When the garbage collector recognizes that only weak global |
| 125 // handles point to an object the handles are cleared and the callback | 125 // handles point to an object the handles are cleared and the callback |
| 126 // function is invoked (for each handle) with the handle and corresponding | 126 // function is invoked (for each handle) with the handle and corresponding |
| 127 // parameter as arguments. Note: cleared means set to Smi::FromInt(0). The | 127 // parameter as arguments. Note: cleared means set to Smi::FromInt(0). The |
| 128 // reason is that Smi::FromInt(0) does not change during garage collection. | 128 // reason is that Smi::FromInt(0) does not change during garage collection. |
| 129 void MakeWeak(Object** location, | 129 void MakeWeak(Object** location, |
| 130 void* parameter, | 130 void* parameter, |
| 131 WeakReferenceCallback callback); | 131 WeakReferenceCallback callback); |
| 132 void MakeWeak(Object** location, |
| 133 void* parameter, |
| 134 WeakenedReferenceCallback callback); |
| 132 | 135 |
| 133 static void SetWrapperClassId(Object** location, uint16_t class_id); | 136 static void SetWrapperClassId(Object** location, uint16_t class_id); |
| 134 static uint16_t GetWrapperClassId(Object** location); | 137 static uint16_t GetWrapperClassId(Object** location); |
| 135 | 138 |
| 136 // Returns the current number of weak handles. | 139 // Returns the current number of weak handles. |
| 137 int NumberOfWeakHandles() { return number_of_weak_handles_; } | 140 int NumberOfWeakHandles() { return number_of_weak_handles_; } |
| 138 | 141 |
| 139 void RecordStats(HeapStats* stats); | 142 void RecordStats(HeapStats* stats); |
| 140 | 143 |
| 141 // Returns the current number of weak handles to global objects. | 144 // Returns the current number of weak handles to global objects. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 179 |
| 177 // Iterates over all handles. | 180 // Iterates over all handles. |
| 178 void IterateAllRoots(ObjectVisitor* v); | 181 void IterateAllRoots(ObjectVisitor* v); |
| 179 | 182 |
| 180 // Iterates over all handles that have embedder-assigned class ID. | 183 // Iterates over all handles that have embedder-assigned class ID. |
| 181 void IterateAllRootsWithClassIds(ObjectVisitor* v); | 184 void IterateAllRootsWithClassIds(ObjectVisitor* v); |
| 182 | 185 |
| 183 // Iterates over all weak roots in heap. | 186 // Iterates over all weak roots in heap. |
| 184 void IterateWeakRoots(ObjectVisitor* v); | 187 void IterateWeakRoots(ObjectVisitor* v); |
| 185 | 188 |
| 186 // Iterates over weak roots that are bound to a given callback. | |
| 187 void IterateWeakRoots(WeakReferenceGuest f, | |
| 188 WeakReferenceCallback callback); | |
| 189 | |
| 190 // Find all weak handles satisfying the callback predicate, mark | 189 // Find all weak handles satisfying the callback predicate, mark |
| 191 // them as pending. | 190 // them as pending. |
| 192 void IdentifyWeakHandles(WeakSlotCallback f); | 191 void IdentifyWeakHandles(WeakSlotCallback f); |
| 193 | 192 |
| 194 // NOTE: Three ...NewSpace... functions below are used during | 193 // NOTE: Three ...NewSpace... functions below are used during |
| 195 // scavenge collections and iterate over sets of handles that are | 194 // scavenge collections and iterate over sets of handles that are |
| 196 // guaranteed to contain all handles holding new space objects (but | 195 // guaranteed to contain all handles holding new space objects (but |
| 197 // may also include old space objects). | 196 // may also include old space objects). |
| 198 | 197 |
| 199 // Iterates over strong and dependent handles. See the node above. | 198 // Iterates over strong and dependent handles. See the node above. |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 288 |
| 290 friend class Isolate; | 289 friend class Isolate; |
| 291 | 290 |
| 292 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); | 291 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); |
| 293 }; | 292 }; |
| 294 | 293 |
| 295 | 294 |
| 296 } } // namespace v8::internal | 295 } } // namespace v8::internal |
| 297 | 296 |
| 298 #endif // V8_GLOBAL_HANDLES_H_ | 297 #endif // V8_GLOBAL_HANDLES_H_ |
| OLD | NEW |