Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 // Remove bags, this should only happen after GC. | 120 // Remove bags, this should only happen after GC. |
| 121 static void RemoveObjectGroups(); | 121 static void RemoveObjectGroups(); |
| 122 | 122 |
| 123 // Tear down the global handle structure. | 123 // Tear down the global handle structure. |
| 124 static void TearDown(); | 124 static void TearDown(); |
| 125 | 125 |
| 126 #ifdef DEBUG | 126 #ifdef DEBUG |
| 127 static void PrintStats(); | 127 static void PrintStats(); |
| 128 static void Print(); | 128 static void Print(); |
| 129 #endif | 129 #endif |
| 130 class Pool; | |
| 130 private: | 131 private: |
| 131 // Internal node structure, one for each global handle. | 132 // Internal node structure, one for each global handle. |
| 132 class Node; | 133 class Node; |
| 133 | 134 |
| 134 // Field always containing the number of weak and near-death handles. | 135 // Field always containing the number of weak and near-death handles. |
| 135 static int number_of_weak_handles_; | 136 static int number_of_weak_handles_; |
| 136 | 137 |
| 137 // Field always containing the number of weak and near-death handles | 138 // Field always containing the number of weak and near-death handles |
| 138 // to global objects. These objects are also included in | 139 // to global objects. These objects are also included in |
| 139 // number_of_weak_handles_. | 140 // number_of_weak_handles_. |
| 140 static int number_of_global_object_weak_handles_; | 141 static int number_of_global_object_weak_handles_; |
| 141 | 142 |
| 142 // Global handles are kept in a single linked list pointed to by head_. | 143 // Global handles are kept in a single linked list pointed to by head_. |
| 143 static Node* head_; | 144 static Node* head_; |
| 144 static Node* head() { return head_; } | 145 static Node* head() { return head_; } |
| 145 static void set_head(Node* value) { head_ = value; } | 146 static void set_head(Node* value) { head_ = value; } |
| 146 | 147 |
| 147 // Free list for DESTROYED global handles not yet deallocated. | 148 // Free list for DESTROYED global handles not yet deallocated. |
| 148 static Node* first_free_; | 149 static Node* first_free_; |
| 149 static Node* first_free() { return first_free_; } | 150 static Node* first_free() { return first_free_; } |
| 150 static void set_first_free(Node* value) { first_free_ = value; } | 151 static void set_first_free(Node* value) { first_free_ = value; } |
| 152 | |
| 153 // List of deallocated nodes. | |
| 154 // Deallocated nodes form a prefix of all the nodes and | |
| 155 // |first_deallocated| points to last deallocated node before | |
| 156 // |head|. Those deallocated nodes are additionally linked | |
| 157 // ny |next_free|: | |
|
Mads Ager (chromium)
2009/10/26 06:44:53
ny -> by
antonm
2009/10/26 11:53:35
Done.
| |
| 158 // 1st deallocated head | |
| 159 // | | | |
| 160 // V V | |
| 161 // node node ... node node | |
| 162 // .next -> .next -> .next -> | |
| 163 // <- .next_free <- .next_free <- .next_free | |
| 164 static Node* first_deallocated_; | |
| 165 static Node* first_deallocated() { return first_deallocated_; } | |
| 166 static void set_first_deallocated(Node* value) { | |
| 167 first_deallocated_ = value; | |
| 168 } | |
| 151 }; | 169 }; |
| 152 | 170 |
| 153 | 171 |
| 154 } } // namespace v8::internal | 172 } } // namespace v8::internal |
| 155 | 173 |
| 156 #endif // V8_GLOBAL_HANDLES_H_ | 174 #endif // V8_GLOBAL_HANDLES_H_ |
| OLD | NEW |