Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Unified Diff: include/v8.h

Issue 998253006: two pass phantom collection (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/v8-util.h » ('j') | src/global-handles.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 1b1ab19c74d203e45474f0eb3a37242246722994..9827909552b63cdf231f9cd337c588f468f3e0be 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -479,11 +479,13 @@ class WeakCallbackInfo {
public:
typedef void (*Callback)(const WeakCallbackInfo<T>& data);
- WeakCallbackInfo(Isolate* isolate, T* parameter, void* internal_field1,
- void* internal_field2)
- : isolate_(isolate), parameter_(parameter) {
- internal_fields_[0] = internal_field1;
- internal_fields_[1] = internal_field2;
+ WeakCallbackInfo(Isolate* isolate, T* parameter,
+ void* internal_fields[kInternalFieldsInWeakCallback],
+ Callback* callback)
+ : isolate_(isolate), parameter_(parameter), callback_(callback) {
+ for (int i = 0; i < kInternalFieldsInWeakCallback; ++i) {
+ internal_fields_[i] = internal_fields[i];
+ }
}
V8_INLINE Isolate* GetIsolate() const { return isolate_; }
@@ -499,10 +501,17 @@ class WeakCallbackInfo {
return internal_fields_[1];
}
+ bool IsFirstPass() const { return callback_ != nullptr; }
+ // If needed, set the callback for the second pass, even if it's the same one.
+ // Setting this to nullptr is unecessary and means there will be no second
+ // pass. Setting this on the second pass will crash.
+ void SetSecondPassCallback(Callback callback) const { *callback_ = callback; }
+
private:
Isolate* isolate_;
T* parameter_;
- void* internal_fields_[2];
+ Callback* callback_;
+ void* internal_fields_[kInternalFieldsInWeakCallback];
};
« no previous file with comments | « no previous file | include/v8-util.h » ('j') | src/global-handles.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698