| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 static 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); | |
| 145 | 144 |
| 146 void RecordStats(HeapStats* stats); | 145 void RecordStats(HeapStats* stats); |
| 147 | 146 |
| 148 // Returns the current number of weak handles. | 147 // Returns the current number of weak handles. |
| 149 int NumberOfWeakHandles(); | 148 int NumberOfWeakHandles(); |
| 150 | 149 |
| 151 // Returns the current number of weak handles to global objects. | 150 // Returns the current number of weak handles to global objects. |
| 152 // These handles are also included in NumberOfWeakHandles(). | 151 // These handles are also included in NumberOfWeakHandles(). |
| 153 int NumberOfGlobalObjectWeakHandles(); | 152 int NumberOfGlobalObjectWeakHandles(); |
| 154 | 153 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 327 |
| 329 friend class Isolate; | 328 friend class Isolate; |
| 330 | 329 |
| 331 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); | 330 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); |
| 332 }; | 331 }; |
| 333 | 332 |
| 334 | 333 |
| 335 } } // namespace v8::internal | 334 } } // namespace v8::internal |
| 336 | 335 |
| 337 #endif // V8_GLOBAL_HANDLES_H_ | 336 #endif // V8_GLOBAL_HANDLES_H_ |
| OLD | NEW |