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()); |
+} |