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

Unified Diff: test/cctest/test-global-handles.cc

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/global-handles.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-global-handles.cc
diff --git a/test/cctest/test-global-handles.cc b/test/cctest/test-global-handles.cc
index 8fdb46a3e4d53cf2970791c2dd94f3135674242d..06e7466dc68fa7727d9379fae24cfd60b135b570 100644
--- a/test/cctest/test-global-handles.cc
+++ b/test/cctest/test-global-handles.cc
@@ -450,3 +450,22 @@ TEST(FinalizerWeakness) {
CHECK_EQ(identity, o->GetIdentityHash());
CHECK(o->Has(isolate->GetCurrentContext(), v8_str("finalizer")).FromJust());
}
+
+TEST(PhatomHandlesWithoutCallbacks) {
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+
+ v8::Global<v8::Object> g1, g2;
+ {
+ v8::HandleScope scope(isolate);
+ g1.Reset(isolate, v8::Object::New(isolate));
+ g1.SetWeak();
+ g2.Reset(isolate, v8::Object::New(isolate));
+ g2.SetWeak();
+ }
+
+ CHECK_EQ(0, isolate->NumberOfPhantomHandleResetsSinceLastCall());
+ CcTest::i_isolate()->heap()->CollectAllAvailableGarbage();
+ CHECK_EQ(2, isolate->NumberOfPhantomHandleResetsSinceLastCall());
+ CHECK_EQ(0, isolate->NumberOfPhantomHandleResetsSinceLastCall());
+}
« no previous file with comments | « src/global-handles.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698