OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HANDLES_H_ | 5 #ifndef V8_HANDLES_H_ |
6 #define V8_HANDLES_H_ | 6 #define V8_HANDLES_H_ |
7 | 7 |
8 #include "src/objects.h" | 8 #include "src/objects.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 } | 167 } |
168 | 168 |
169 | 169 |
170 // Convenience wrapper. | 170 // Convenience wrapper. |
171 template<class T> | 171 template<class T> |
172 inline Handle<T> handle(T* t) { | 172 inline Handle<T> handle(T* t) { |
173 return Handle<T>(t, t->GetIsolate()); | 173 return Handle<T>(t, t->GetIsolate()); |
174 } | 174 } |
175 | 175 |
176 | 176 |
177 // Key comparison function for Map handles. | |
178 inline bool operator<(const Handle<Map>& lhs, const Handle<Map>& rhs) { | |
179 // This is safe because maps don't move. | |
180 return *lhs < *rhs; | |
181 } | |
182 | |
183 | |
184 class DeferredHandles; | 177 class DeferredHandles; |
185 class HandleScopeImplementer; | 178 class HandleScopeImplementer; |
186 | 179 |
187 | 180 |
188 // A stack-allocated class that governs a number of local handles. | 181 // A stack-allocated class that governs a number of local handles. |
189 // After a handle scope has been created, all local handles will be | 182 // After a handle scope has been created, all local handles will be |
190 // allocated within that handle scope until either the handle scope is | 183 // allocated within that handle scope until either the handle scope is |
191 // deleted or another handle scope is created. If there is already a | 184 // deleted or another handle scope is created. If there is already a |
192 // handle scope and a new one is created, all allocations will take | 185 // handle scope and a new one is created, all allocations will take |
193 // place in the new handle scope until it is deleted. After that, | 186 // place in the new handle scope until it is deleted. After that, |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 305 |
313 void Initialize() { | 306 void Initialize() { |
314 next = limit = NULL; | 307 next = limit = NULL; |
315 level = 0; | 308 level = 0; |
316 } | 309 } |
317 }; | 310 }; |
318 | 311 |
319 } } // namespace v8::internal | 312 } } // namespace v8::internal |
320 | 313 |
321 #endif // V8_HANDLES_H_ | 314 #endif // V8_HANDLES_H_ |
OLD | NEW |