| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 132 |
| 133 static void SetWrapperClassId(Object** location, uint16_t class_id); | |
| 134 static uint16_t GetWrapperClassId(Object** location); | |
| 135 | |
| 136 // Returns the current number of weak handles. | 133 // Returns the current number of weak handles. |
| 137 int NumberOfWeakHandles() { return number_of_weak_handles_; } | 134 int NumberOfWeakHandles() { return number_of_weak_handles_; } |
| 138 | 135 |
| 139 void RecordStats(HeapStats* stats); | 136 void RecordStats(HeapStats* stats); |
| 140 | 137 |
| 141 // Returns the current number of weak handles to global objects. | 138 // Returns the current number of weak handles to global objects. |
| 142 // These handles are also included in NumberOfWeakHandles(). | 139 // These handles are also included in NumberOfWeakHandles(). |
| 143 int NumberOfGlobalObjectWeakHandles() { | 140 int NumberOfGlobalObjectWeakHandles() { |
| 144 return number_of_global_object_weak_handles_; | 141 return number_of_global_object_weak_handles_; |
| 145 } | 142 } |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 286 |
| 290 friend class Isolate; | 287 friend class Isolate; |
| 291 | 288 |
| 292 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); | 289 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); |
| 293 }; | 290 }; |
| 294 | 291 |
| 295 | 292 |
| 296 } } // namespace v8::internal | 293 } } // namespace v8::internal |
| 297 | 294 |
| 298 #endif // V8_GLOBAL_HANDLES_H_ | 295 #endif // V8_GLOBAL_HANDLES_H_ |
| OLD | NEW |