| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 static void Destroy(Object** location); | 131 static void Destroy(Object** location); |
| 132 | 132 |
| 133 typedef WeakReferenceCallbacks<v8::Value, void>::Revivable RevivableCallback; | 133 typedef WeakReferenceCallbacks<v8::Value, void>::Revivable RevivableCallback; |
| 134 | 134 |
| 135 // Make the global handle weak and set the callback parameter for the | 135 // Make the global handle weak and set the callback parameter for the |
| 136 // handle. When the garbage collector recognizes that only weak global | 136 // handle. When the garbage collector recognizes that only weak global |
| 137 // handles point to an object the handles are cleared and the callback | 137 // handles point to an object the handles are cleared and the callback |
| 138 // function is invoked (for each handle) with the handle and corresponding | 138 // function is invoked (for each handle) with the handle and corresponding |
| 139 // parameter as arguments. Note: cleared means set to Smi::FromInt(0). The | 139 // parameter as arguments. Note: cleared means set to Smi::FromInt(0). The |
| 140 // reason is that Smi::FromInt(0) does not change during garage collection. | 140 // reason is that Smi::FromInt(0) does not change during garage collection. |
| 141 void MakeWeak(Object** location, | 141 static void MakeWeak(Object** location, |
| 142 void* parameter, | 142 void* parameter, |
| 143 RevivableCallback weak_reference_callback, | 143 RevivableCallback weak_reference_callback, |
| 144 NearDeathCallback near_death_callback); | 144 NearDeathCallback near_death_callback); |
| 145 | 145 |
| 146 void RecordStats(HeapStats* stats); | 146 void RecordStats(HeapStats* stats); |
| 147 | 147 |
| 148 // Returns the current number of weak handles. | 148 // Returns the current number of weak handles. |
| 149 int NumberOfWeakHandles(); | 149 int NumberOfWeakHandles(); |
| 150 | 150 |
| 151 // Returns the current number of weak handles to global objects. | 151 // Returns the current number of weak handles to global objects. |
| 152 // These handles are also included in NumberOfWeakHandles(). | 152 // These handles are also included in NumberOfWeakHandles(). |
| 153 int NumberOfGlobalObjectWeakHandles(); | 153 int NumberOfGlobalObjectWeakHandles(); |
| 154 | 154 |
| 155 // Returns the current number of handles to global objects. | 155 // Returns the current number of handles to global objects. |
| 156 int NumberOfGlobalHandles() { | 156 int NumberOfGlobalHandles() { |
| 157 return number_of_global_handles_; | 157 return number_of_global_handles_; |
| 158 } | 158 } |
| 159 | 159 |
| 160 // Clear the weakness of a global handle. | 160 // Clear the weakness of a global handle. |
| 161 void ClearWeakness(Object** location); | 161 static void ClearWeakness(Object** location); |
| 162 | 162 |
| 163 // Clear the weakness of a global handle. | 163 // Clear the weakness of a global handle. |
| 164 void MarkIndependent(Object** location); | 164 static void MarkIndependent(Object** location); |
| 165 | 165 |
| 166 // Mark the reference to this object externaly unreachable. | 166 // Mark the reference to this object externaly unreachable. |
| 167 void MarkPartiallyDependent(Object** location); | 167 static void MarkPartiallyDependent(Object** location); |
| 168 | 168 |
| 169 static bool IsIndependent(Object** location); | 169 static bool IsIndependent(Object** location); |
| 170 | 170 |
| 171 // Tells whether global handle is near death. | 171 // Tells whether global handle is near death. |
| 172 static bool IsNearDeath(Object** location); | 172 static bool IsNearDeath(Object** location); |
| 173 | 173 |
| 174 // Tells whether global handle is weak. | 174 // Tells whether global handle is weak. |
| 175 static bool IsWeak(Object** location); | 175 static bool IsWeak(Object** location); |
| 176 | 176 |
| 177 // Process pending weak handles. | 177 // Process pending weak handles. |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 328 |
| 329 friend class Isolate; | 329 friend class Isolate; |
| 330 | 330 |
| 331 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); | 331 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); |
| 332 }; | 332 }; |
| 333 | 333 |
| 334 | 334 |
| 335 } } // namespace v8::internal | 335 } } // namespace v8::internal |
| 336 | 336 |
| 337 #endif // V8_GLOBAL_HANDLES_H_ | 337 #endif // V8_GLOBAL_HANDLES_H_ |
| OLD | NEW |