| Index: src/global-handles.h
|
| diff --git a/src/global-handles.h b/src/global-handles.h
|
| index aacdcbc072d0ae26af7ce6264767d8366ee17f7a..7d70173e85b74f2e861df97375a5749fcd9a37ee 100644
|
| --- a/src/global-handles.h
|
| +++ b/src/global-handles.h
|
| @@ -97,6 +97,24 @@ struct ObjectGroupRetainerInfo {
|
| };
|
|
|
|
|
| +class PendingPhantomCallback {
|
| + public:
|
| + typedef PhantomCallbackData<void>::Callback Callback;
|
| + typedef PhantomCallbackData<void> Data;
|
| + PendingPhantomCallback(Data data, Callback callback)
|
| + : data_(data),
|
| + callback_(callback) { }
|
| +
|
| + void invoke() {
|
| + callback_(data_);
|
| + }
|
| +
|
| + private:
|
| + PhantomCallbackData<void>::Callback callback_;
|
| + PhantomCallbackData<void> data_;
|
| +};
|
| +
|
| +
|
| class GlobalHandles {
|
| public:
|
| ~GlobalHandles();
|
| @@ -111,6 +129,7 @@ class GlobalHandles {
|
| static void Destroy(Object** location);
|
|
|
| typedef WeakCallbackData<v8::Value, void>::Callback WeakCallback;
|
| + typedef PhantomCallbackData<void>::Callback PhantomCallback;
|
|
|
| // For a phantom weak reference, the callback does not have access to the
|
| // dying object. Phantom weak references are preferred because they allow
|
| @@ -127,9 +146,14 @@ class GlobalHandles {
|
| // GC. For a phantom weak handle the handle is cleared (set to a Smi)
|
| // before the callback is invoked, but the handle can still be identified
|
| // in the callback by using the location() of the handle.
|
| - static void MakeWeak(Object** location, void* parameter,
|
| - WeakCallback weak_callback,
|
| - PhantomState phantom = Nonphantom);
|
| + static void MakeWeak(
|
| + Object** location, void* parameter, WeakCallback weak_callback);
|
| +
|
| + static void MakePhantom(
|
| + Object** location, void* parameter,
|
| + PhantomCallback weak_callback,
|
| + int16_t internal_field_index1 = v8::Object::kNoInternalFieldIndex,
|
| + int16_t internal_field_index2 = v8::Object::kNoInternalFieldIndex);
|
|
|
| void RecordStats(HeapStats* stats);
|
|
|
| @@ -145,6 +169,10 @@ class GlobalHandles {
|
| return number_of_global_handles_;
|
| }
|
|
|
| + // Collect up data for the weak handle callbacks after GC has completed, but
|
| + // before memory is reclaimed.
|
| + void CollectPhantomCallbackData();
|
| +
|
| // Clear the weakness of a global handle.
|
| static void* ClearWeakness(Object** location);
|
|
|
| @@ -270,6 +298,12 @@ class GlobalHandles {
|
| // don't assign any initial capacity.
|
| static const int kObjectGroupConnectionsCapacity = 20;
|
|
|
| + // Helpers for PostGarbageCollectionProcessing.
|
| + int PostScavengeProcessing(int initial_post_gc_processing_count);
|
| + int PostMarkSweepProcessing(int initial_post_gc_processing_count);
|
| + int DispatchPendingPhantomCallbacks();
|
| + void UpdateListOfNewSpaceNodes();
|
| +
|
| // Internal node structures.
|
| class Node;
|
| class NodeBlock;
|
| @@ -306,6 +340,8 @@ class GlobalHandles {
|
| List<ObjectGroupRetainerInfo> retainer_infos_;
|
| List<ObjectGroupConnection> implicit_ref_connections_;
|
|
|
| + List<PendingPhantomCallback> pending_phantom_callbacks_;
|
| +
|
| friend class Isolate;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(GlobalHandles);
|
|
|