| 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 "include/v8.h" | 8 #include "include/v8.h" |
| 9 #include "src/base/functional.h" | 9 #include "src/base/functional.h" |
| 10 #include "src/base/macros.h" | 10 #include "src/base/macros.h" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 286 |
| 287 Isolate* isolate() { return isolate_; } | 287 Isolate* isolate() { return isolate_; } |
| 288 | 288 |
| 289 // Limit for number of handles with --check-handle-count. This is | 289 // Limit for number of handles with --check-handle-count. This is |
| 290 // large enough to compile natives and pass unit tests with some | 290 // large enough to compile natives and pass unit tests with some |
| 291 // slack for future changes to natives. | 291 // slack for future changes to natives. |
| 292 static const int kCheckHandleThreshold = 30 * 1024; | 292 static const int kCheckHandleThreshold = 30 * 1024; |
| 293 | 293 |
| 294 private: | 294 private: |
| 295 // Prevent heap allocation or illegal handle scopes. | 295 // Prevent heap allocation or illegal handle scopes. |
| 296 HandleScope(const HandleScope&); | |
| 297 void operator=(const HandleScope&); | |
| 298 void* operator new(size_t size); | 296 void* operator new(size_t size); |
| 299 void operator delete(void* size_t); | 297 void operator delete(void* size_t); |
| 300 | 298 |
| 301 Isolate* isolate_; | 299 Isolate* isolate_; |
| 302 Object** prev_next_; | 300 Object** prev_next_; |
| 303 Object** prev_limit_; | 301 Object** prev_limit_; |
| 304 | 302 |
| 305 // Close the handle scope resetting limits to a previous state. | 303 // Close the handle scope resetting limits to a previous state. |
| 306 static inline void CloseScope(Isolate* isolate, | 304 static inline void CloseScope(Isolate* isolate, |
| 307 Object** prev_next, | 305 Object** prev_next, |
| 308 Object** prev_limit); | 306 Object** prev_limit); |
| 309 | 307 |
| 310 // Extend the handle scope making room for more handles. | 308 // Extend the handle scope making room for more handles. |
| 311 static Object** Extend(Isolate* isolate); | 309 static Object** Extend(Isolate* isolate); |
| 312 | 310 |
| 313 #ifdef ENABLE_HANDLE_ZAPPING | 311 #ifdef ENABLE_HANDLE_ZAPPING |
| 314 // Zaps the handles in the half-open interval [start, end). | 312 // Zaps the handles in the half-open interval [start, end). |
| 315 static void ZapRange(Object** start, Object** end); | 313 static void ZapRange(Object** start, Object** end); |
| 316 #endif | 314 #endif |
| 317 | 315 |
| 318 friend class v8::HandleScope; | 316 friend class v8::HandleScope; |
| 319 friend class DeferredHandles; | 317 friend class DeferredHandles; |
| 320 friend class DeferredHandleScope; | 318 friend class DeferredHandleScope; |
| 321 friend class HandleScopeImplementer; | 319 friend class HandleScopeImplementer; |
| 322 friend class Isolate; | 320 friend class Isolate; |
| 321 |
| 322 DISALLOW_COPY_AND_ASSIGN(HandleScope); |
| 323 }; | 323 }; |
| 324 | 324 |
| 325 | 325 |
| 326 // Forward declarations for CanonicalHandleScope. | 326 // Forward declarations for CanonicalHandleScope. |
| 327 template <typename V> | 327 template <typename V> |
| 328 class IdentityMap; | 328 class IdentityMap; |
| 329 class RootIndexMap; | 329 class RootIndexMap; |
| 330 | 330 |
| 331 | 331 |
| 332 // A CanonicalHandleScope does not open a new HandleScope. It changes the | 332 // A CanonicalHandleScope does not open a new HandleScope. It changes the |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 next = limit = NULL; | 407 next = limit = NULL; |
| 408 sealed_level = level = 0; | 408 sealed_level = level = 0; |
| 409 canonical_scope = NULL; | 409 canonical_scope = NULL; |
| 410 } | 410 } |
| 411 }; | 411 }; |
| 412 | 412 |
| 413 } // namespace internal | 413 } // namespace internal |
| 414 } // namespace v8 | 414 } // namespace v8 |
| 415 | 415 |
| 416 #endif // V8_HANDLES_H_ | 416 #endif // V8_HANDLES_H_ |
| OLD | NEW |