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

Unified Diff: src/global-handles.h

Issue 1950963002: Introduce a new phantom weakness type without finalization callback. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: comment Created 4 years, 7 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 | « src/api.cc ('k') | src/global-handles.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/global-handles.h
diff --git a/src/global-handles.h b/src/global-handles.h
index b453bf4bb131d0dc4dfb458e0dfd3289b64036a4..24a2273e36d584e50043e7a4d8acc31a6efe51b6 100644
--- a/src/global-handles.h
+++ b/src/global-handles.h
@@ -97,6 +97,8 @@ struct ObjectGroupRetainerInfo {
};
enum WeaknessType {
+ // Embedder gets a handle to the dying object.
+ FINALIZER_WEAK,
// In the following cases, the embedder gets the parameter they passed in
// earlier, and 0 or 2 first internal fields. Note that the internal
// fields must contain aligned non-V8 pointers. Getting pointers to V8
@@ -104,8 +106,9 @@ enum WeaknessType {
// embedder gets a null pointer instead.
PHANTOM_WEAK,
PHANTOM_WEAK_2_INTERNAL_FIELDS,
- // Embedder gets a handle to the dying object.
- FINALIZER_WEAK,
+ // The handle is automatically reset by the garbage collector when
+ // the object is no longer reachable.
+ PHANTOM_WEAK_RESET_HANDLE
};
class GlobalHandles {
@@ -134,6 +137,8 @@ class GlobalHandles {
WeakCallbackInfo<void>::Callback weak_callback,
v8::WeakCallbackType type);
+ static void MakeWeak(Object*** location_addr);
+
void RecordStats(HeapStats* stats);
// Returns the current number of weak handles.
@@ -148,6 +153,14 @@ class GlobalHandles {
return number_of_global_handles_;
}
+ size_t NumberOfPhantomHandleResets() {
+ return number_of_phantom_handle_resets_;
+ }
+
+ void ResetNumberOfPhantomHandleResets() {
+ number_of_phantom_handle_resets_ = 0;
+ }
+
// Clear the weakness of a global handle.
static void* ClearWeakness(Object** location);
@@ -330,6 +343,8 @@ class GlobalHandles {
int post_gc_processing_count_;
+ size_t number_of_phantom_handle_resets_;
+
// Object groups and implicit references, public and more efficient
// representation.
List<ObjectGroup*> object_groups_;
« no previous file with comments | « src/api.cc ('k') | src/global-handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698