Commit d441100b authored by ulan's avatar ulan Committed by Commit bot

Deprecate PersistentBase::MarkPartiallyDependent.

It is already effectively disabled by --scavenge_reclaim_unmodified_objects.

BUG=

Review-Url: https://codereview.chromium.org/1944793002
Cr-Commit-Position: refs/heads/master@{#36018}
parent 7551eca9
......@@ -623,7 +623,9 @@ template <class T> class PersistentBase {
* external dependencies. This mark is automatically cleared after each
* garbage collection.
*/
V8_INLINE void MarkPartiallyDependent();
V8_INLINE V8_DEPRECATED(
"deprecated optimization, do not use partially dependent groups",
void MarkPartiallyDependent());
/**
* Marks the reference to this object as active. The scavenge garbage
......
......@@ -4687,126 +4687,6 @@ THREADED_TEST(ApiObjectGroupsCycle) {
}
// TODO(mstarzinger): This should be a THREADED_TEST but causes failures
// on the buildbots, so was made non-threaded for the time being.
TEST(ApiObjectGroupsCycleForScavenger) {
i::FLAG_stress_compaction = false;
i::FLAG_gc_global = false;
LocalContext env;
v8::Isolate* iso = env->GetIsolate();
HandleScope scope(iso);
WeakCallCounter counter(1234);
WeakCallCounterAndPersistent<Value> g1s1(&counter);
WeakCallCounterAndPersistent<Value> g1s2(&counter);
WeakCallCounterAndPersistent<Value> g2s1(&counter);
WeakCallCounterAndPersistent<Value> g2s2(&counter);
WeakCallCounterAndPersistent<Value> g3s1(&counter);
WeakCallCounterAndPersistent<Value> g3s2(&counter);
{
HandleScope scope(iso);
g1s1.handle.Reset(iso, Object::New(iso));
g1s2.handle.Reset(iso, Object::New(iso));
g1s1.handle.SetWeak(&g1s1, &WeakPointerCallback,
v8::WeakCallbackType::kParameter);
g1s2.handle.SetWeak(&g1s2, &WeakPointerCallback,
v8::WeakCallbackType::kParameter);
g2s1.handle.Reset(iso, Object::New(iso));
g2s2.handle.Reset(iso, Object::New(iso));
g2s1.handle.SetWeak(&g2s1, &WeakPointerCallback,
v8::WeakCallbackType::kParameter);
g2s2.handle.SetWeak(&g2s2, &WeakPointerCallback,
v8::WeakCallbackType::kParameter);
g3s1.handle.Reset(iso, Object::New(iso));
g3s2.handle.Reset(iso, Object::New(iso));
g3s1.handle.SetWeak(&g3s1, &WeakPointerCallback,
v8::WeakCallbackType::kParameter);
g3s2.handle.SetWeak(&g3s2, &WeakPointerCallback,
v8::WeakCallbackType::kParameter);
}
// Make a root.
WeakCallCounterAndPersistent<Value> root(&counter);
root.handle.Reset(iso, g1s1.handle);
root.handle.MarkPartiallyDependent();
// Connect groups. We're building the following cycle:
// G1: { g1s1, g2s1 }, g1s1 implicitly references g2s1, ditto for other
// groups.
{
HandleScope handle_scope(iso);
g1s1.handle.MarkPartiallyDependent();
g1s2.handle.MarkPartiallyDependent();
g2s1.handle.MarkPartiallyDependent();
g2s2.handle.MarkPartiallyDependent();
g3s1.handle.MarkPartiallyDependent();
g3s2.handle.MarkPartiallyDependent();
iso->SetObjectGroupId(g1s1.handle, UniqueId(1));
iso->SetObjectGroupId(g1s2.handle, UniqueId(1));
Local<Object>::New(iso, g1s1.handle.As<Object>())
->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g2s1.handle))
.FromJust();
iso->SetObjectGroupId(g2s1.handle, UniqueId(2));
iso->SetObjectGroupId(g2s2.handle, UniqueId(2));
Local<Object>::New(iso, g2s1.handle.As<Object>())
->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g3s1.handle))
.FromJust();
iso->SetObjectGroupId(g3s1.handle, UniqueId(3));
iso->SetObjectGroupId(g3s2.handle, UniqueId(3));
Local<Object>::New(iso, g3s1.handle.As<Object>())
->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g1s1.handle))
.FromJust();
}
v8::internal::Heap* heap =
reinterpret_cast<v8::internal::Isolate*>(iso)->heap();
heap->CollectAllGarbage();
// All objects should be alive.
CHECK_EQ(0, counter.NumberOfWeakCalls());
// Weaken the root.
root.handle.SetWeak(&root, &WeakPointerCallback,
v8::WeakCallbackType::kParameter);
root.handle.MarkPartiallyDependent();
// Groups are deleted, rebuild groups.
{
HandleScope handle_scope(iso);
g1s1.handle.MarkPartiallyDependent();
g1s2.handle.MarkPartiallyDependent();
g2s1.handle.MarkPartiallyDependent();
g2s2.handle.MarkPartiallyDependent();
g3s1.handle.MarkPartiallyDependent();
g3s2.handle.MarkPartiallyDependent();
iso->SetObjectGroupId(g1s1.handle, UniqueId(1));
iso->SetObjectGroupId(g1s2.handle, UniqueId(1));
Local<Object>::New(iso, g1s1.handle.As<Object>())
->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g2s1.handle))
.FromJust();
iso->SetObjectGroupId(g2s1.handle, UniqueId(2));
iso->SetObjectGroupId(g2s2.handle, UniqueId(2));
Local<Object>::New(iso, g2s1.handle.As<Object>())
->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g3s1.handle))
.FromJust();
iso->SetObjectGroupId(g3s1.handle, UniqueId(3));
iso->SetObjectGroupId(g3s2.handle, UniqueId(3));
Local<Object>::New(iso, g3s1.handle.As<Object>())
->Set(env.local(), v8_str("x"), Local<Value>::New(iso, g1s1.handle))
.FromJust();
}
heap->CollectAllGarbage();
// All objects should be gone. 7 global handles in total.
CHECK_EQ(7, counter.NumberOfWeakCalls());
}
THREADED_TEST(ScriptException) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
......
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