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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); | 133 static void SetWrapperClassId(Object** location, uint16_t class_id); |
134 static uint16_t GetWrapperClassId(Object** location); | 134 static uint16_t GetWrapperClassId(Object** location); |
135 | 135 |
136 // Returns the current number of weak handles. | 136 // Returns the current number of weak handles. |
137 int NumberOfWeakHandles() { return number_of_weak_handles_; } | 137 int NumberOfWeakHandles(); |
138 | 138 |
139 void RecordStats(HeapStats* stats); | 139 void RecordStats(HeapStats* stats); |
140 | 140 |
141 // Returns the current number of weak handles to global objects. | 141 // Returns the current number of weak handles to global objects. |
142 // These handles are also included in NumberOfWeakHandles(). | 142 // These handles are also included in NumberOfWeakHandles(). |
143 int NumberOfGlobalObjectWeakHandles() { | 143 int NumberOfGlobalObjectWeakHandles(); |
144 return number_of_global_object_weak_handles_; | |
145 } | |
146 | 144 |
147 // Returns the current number of handles to global objects. | 145 // Returns the current number of handles to global objects. |
148 int NumberOfGlobalHandles() { | 146 int NumberOfGlobalHandles() { |
149 return number_of_global_handles_; | 147 return number_of_global_handles_; |
150 } | 148 } |
151 | 149 |
152 // Clear the weakness of a global handle. | 150 // Clear the weakness of a global handle. |
153 void ClearWeakness(Object** location); | 151 void ClearWeakness(Object** location); |
154 | 152 |
155 // Clear the weakness of a global handle. | 153 // Clear the weakness of a global handle. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 private: | 249 private: |
252 explicit GlobalHandles(Isolate* isolate); | 250 explicit GlobalHandles(Isolate* isolate); |
253 | 251 |
254 // Internal node structures. | 252 // Internal node structures. |
255 class Node; | 253 class Node; |
256 class NodeBlock; | 254 class NodeBlock; |
257 class NodeIterator; | 255 class NodeIterator; |
258 | 256 |
259 Isolate* isolate_; | 257 Isolate* isolate_; |
260 | 258 |
261 // Field always containing the number of weak and near-death handles. | |
262 int number_of_weak_handles_; | |
263 | |
264 // Field always containing the number of weak and near-death handles | |
265 // to global objects. These objects are also included in | |
266 // number_of_weak_handles_. | |
267 int number_of_global_object_weak_handles_; | |
268 | |
269 // Field always containing the number of handles to global objects. | 259 // Field always containing the number of handles to global objects. |
270 int number_of_global_handles_; | 260 int number_of_global_handles_; |
271 | 261 |
272 // List of all allocated node blocks. | 262 // List of all allocated node blocks. |
273 NodeBlock* first_block_; | 263 NodeBlock* first_block_; |
274 | 264 |
275 // List of node blocks with used nodes. | 265 // List of node blocks with used nodes. |
276 NodeBlock* first_used_block_; | 266 NodeBlock* first_used_block_; |
277 | 267 |
278 // Free list of nodes. | 268 // Free list of nodes. |
(...skipping 10 matching lines...) Expand all Loading... |
289 | 279 |
290 friend class Isolate; | 280 friend class Isolate; |
291 | 281 |
292 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); | 282 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); |
293 }; | 283 }; |
294 | 284 |
295 | 285 |
296 } } // namespace v8::internal | 286 } } // namespace v8::internal |
297 | 287 |
298 #endif // V8_GLOBAL_HANDLES_H_ | 288 #endif // V8_GLOBAL_HANDLES_H_ |
OLD | NEW |