Commit 71ad48fb authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[api] Mark MarkIndependent as soon deprecated

Persistent handles are always independent these days. Users should mark
weak handles as active using MarkActive if they want to keep weak
handles that are otherwise unreachable alive across scavenges.

Bug: chromium:780749
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I116e984ce14a035d1cef491d49f11a388fa8169d
Reviewed-on: https://chromium-review.googlesource.com/759794
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49456}
parent 16943d2d
......@@ -579,7 +579,10 @@ template <class T> class PersistentBase {
* independent handle should not assume that it will be preceded by a global
* GC prologue callback or followed by a global GC epilogue callback.
*/
V8_INLINE void MarkIndependent();
V8_DEPRECATE_SOON(
"Objects are always considered independent. "
"Use MarkActive to avoid collecting otherwise dead weak handles.",
V8_INLINE void MarkIndependent());
/**
* Marks the reference to this object as active. The scavenge garbage
......@@ -590,7 +593,8 @@ template <class T> class PersistentBase {
*/
V8_INLINE void MarkActive();
V8_INLINE bool IsIndependent() const;
V8_DEPRECATE_SOON("See MarkIndependent.",
V8_INLINE bool IsIndependent() const);
/** Checks if the handle holds the only reference to an object. */
V8_INLINE bool IsNearDeath() const;
......
......@@ -2281,7 +2281,6 @@ void Shell::ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& args) {
data->handle.Reset(isolate, buffer);
data->handle.SetWeak(data, ReadBufferWeakCallback,
v8::WeakCallbackType::kParameter);
data->handle.MarkIndependent();
isolate->AdjustAmountOfExternalAllocatedMemory(length);
args.GetReturnValue().Set(buffer);
......
......@@ -7652,9 +7652,6 @@ void InternalFieldCallback(bool global_gc) {
handle.SetWeak<v8::Persistent<v8::Object>>(
&handle, CheckInternalFields, v8::WeakCallbackType::kInternalFields);
if (!global_gc) {
handle.MarkIndependent();
}
}
if (global_gc) {
CcTest::CollectAllGarbage();
......
......@@ -408,8 +408,6 @@ TEST(FinalizerKeepsPhantomAliveOnScavenge) {
TestFinalizerKeepsPhantomAlive(
CcTest::isolate(),
[](v8::Global<v8::Object>* g1, v8::Global<v8::Object>* g2) {
g1->MarkIndependent();
g2->MarkIndependent();
CcTest::CollectGarbage(i::NEW_SPACE);
});
}
......@@ -471,7 +469,6 @@ TEST(GCFromWeakCallbacks) {
fp.flag = false;
fp.handle.SetWeak(&fp, gc_forcing_callback[inner_gc],
v8::WeakCallbackType::kParameter);
fp.handle.MarkIndependent();
invoke_gc[outer_gc]();
EmptyMessageQueues(isolate);
CHECK(fp.flag);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment