In this patch, the HandleScopeImplementer creates a
DeferredHandleScope, which has a 'Detach()' method that returns a
DeferredHandles object.  The Handles created after the creation of the
DeferredHandleScope have their lifetime tied to the lifetime of the
DeferredHandles object -- they die when the DeferredHandles object is
destroyed.

Client code looks like this (CompilationHandleScope, for instance):

{
// Remember the next and limit pointers in the currently active
// HandleScopeData using a regular HandleScope.
HandleScope scope;

DeferredHandleScope* dhs =
handle_scope_implementer->CreateDeferredHandleScope();

// Create a bunch of handles

DeferredHandles* dh = dhs->Detach();
delete dhs; // Not needed anymore.

// Old limit and next restored here.
}

// ...
// Once we no longer need the Handles we created ...

delete dh;

http://codereview.chromium.org/10640012/

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to