summaryrefslogtreecommitdiff
path: root/deps/v8/src/global-handles.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/global-handles.h')
-rw-r--r--deps/v8/src/global-handles.h29
1 files changed, 18 insertions, 11 deletions
diff --git a/deps/v8/src/global-handles.h b/deps/v8/src/global-handles.h
index 767989c77e..cb5619ffbe 100644
--- a/deps/v8/src/global-handles.h
+++ b/deps/v8/src/global-handles.h
@@ -100,12 +100,11 @@ struct ObjectGroupRetainerInfo {
enum WeaknessType {
NORMAL_WEAK, // Embedder gets a handle to the dying object.
// In the following cases, the embedder gets the parameter they passed in
- // earlier, and the 0, 1 or 2 first internal fields. Note that the internal
+ // earlier, and 0 or 2 first internal fields. Note that the internal
// fields must contain aligned non-V8 pointers. Getting pointers to V8
// objects through this interface would be GC unsafe so in that case the
// embedder gets a null pointer instead.
- PHANTOM_WEAK_0_INTERNAL_FIELDS,
- PHANTOM_WEAK_1_INTERNAL_FIELDS,
+ PHANTOM_WEAK,
PHANTOM_WEAK_2_INTERNAL_FIELDS
};
@@ -145,9 +144,9 @@ class GlobalHandles {
// It would be nice to template this one, but it's really hard to get
// the template instantiator to work right if you do.
- static void MakePhantom(Object** location, void* parameter,
- int number_of_internal_fields,
- PhantomCallbackData<void>::Callback weak_callback);
+ static void MakeWeak(Object** location, void* parameter,
+ WeakCallbackInfo<void>::Callback weak_callback,
+ v8::WeakCallbackType type);
void RecordStats(HeapStats* stats);
@@ -349,18 +348,26 @@ class GlobalHandles {
class GlobalHandles::PendingPhantomCallback {
public:
- typedef PhantomCallbackData<void> Data;
- PendingPhantomCallback(Node* node, Data data, Data::Callback callback)
- : node_(node), data_(data), callback_(callback) {}
+ typedef v8::WeakCallbackInfo<void> Data;
+ PendingPhantomCallback(
+ Node* node, Data::Callback callback, void* parameter,
+ void* internal_fields[v8::kInternalFieldsInWeakCallback])
+ : node_(node), callback_(callback), parameter_(parameter) {
+ for (int i = 0; i < v8::kInternalFieldsInWeakCallback; ++i) {
+ internal_fields_[i] = internal_fields[i];
+ }
+ }
- void invoke();
+ void Invoke(Isolate* isolate);
Node* node() { return node_; }
+ Data::Callback callback() { return callback_; }
private:
Node* node_;
- Data data_;
Data::Callback callback_;
+ void* parameter_;
+ void* internal_fields_[v8::kInternalFieldsInWeakCallback];
};