// Copyright 2011 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_HANDLES_LOCAL_HANDLES_H_ #define V8_HANDLES_LOCAL_HANDLES_H_ #include "include/v8-internal.h" #include "src/base/functional.h" #include "src/base/macros.h" #include "src/handles/handles.h" #include "src/heap/local-heap.h" namespace v8 { namespace internal { class RootVisitor; class LocalHandles { public: LocalHandles(); ~LocalHandles(); void Iterate(RootVisitor* visitor); #ifdef DEBUG bool Contains(Address* location); #endif private: HandleScopeData scope_; std::vector
blocks_; V8_EXPORT_PRIVATE Address* AddBlock(); V8_EXPORT_PRIVATE void RemoveUnusedBlocks(); #ifdef ENABLE_HANDLE_ZAPPING V8_EXPORT_PRIVATE static void ZapRange(Address* start, Address* end); #endif friend class LocalHandleScope; }; class LocalHandleScope { public: explicit inline LocalHandleScope(LocalIsolate* local_isolate); explicit inline LocalHandleScope(LocalHeap* local_heap); inline ~LocalHandleScope(); template