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

Unified Diff: test/cctest/test-heap.cc

Issue 1213203007: Create a internal, global native context used only for generated code stubs (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 5 years, 5 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
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index 6229670da848efbbf75c6d50e3605d0e052180a7..fed5b30825b722579f72ddf5e7561d0c6de2789a 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -1559,7 +1559,7 @@ TEST(TestInternalWeakLists) {
v8::Handle<v8::Context> ctx[kNumTestContexts];
if (!isolate->use_crankshaft()) return;
- CHECK_EQ(0, CountNativeContexts());
+ CHECK_EQ(1, CountNativeContexts());
Michael Starzinger 2015/07/10 13:26:30 Same comment as in test-api.cc applies for CountNa
danno 2015/07/13 09:43:37 Done
// Create a number of global contests which gets linked together.
for (int i = 0; i < kNumTestContexts; i++) {
@@ -1570,7 +1570,7 @@ TEST(TestInternalWeakLists) {
isolate->compilation_cache()->Clear();
heap->CollectAllGarbage();
- CHECK_EQ(i + 1, CountNativeContexts());
+ CHECK_EQ(i + 2, CountNativeContexts());
ctx[i]->Enter();
@@ -1636,15 +1636,15 @@ TEST(TestInternalWeakLists) {
// Scavenge treats these references as strong.
for (int j = 0; j < 10; j++) {
CcTest::heap()->CollectGarbage(i::NEW_SPACE);
- CHECK_EQ(kNumTestContexts - i, CountNativeContexts());
+ CHECK_EQ(kNumTestContexts - i + 1, CountNativeContexts());
}
// Mark compact handles the weak references.
CcTest::heap()->CollectAllGarbage();
- CHECK_EQ(kNumTestContexts - i - 1, CountNativeContexts());
+ CHECK_EQ(kNumTestContexts - i, CountNativeContexts());
}
- CHECK_EQ(0, CountNativeContexts());
+ CHECK_EQ(1, CountNativeContexts());
}
@@ -1699,14 +1699,14 @@ TEST(TestInternalWeakListsTraverseWithGC) {
v8::Handle<v8::Context> ctx[kNumTestContexts];
if (!isolate->use_crankshaft()) return;
- CHECK_EQ(0, CountNativeContexts());
+ CHECK_EQ(1, CountNativeContexts());
// Create an number of contexts and check the length of the weak list both
// with and without GCs while iterating the list.
for (int i = 0; i < kNumTestContexts; i++) {
ctx[i] = v8::Context::New(CcTest::isolate());
- CHECK_EQ(i + 1, CountNativeContexts());
- CHECK_EQ(i + 1, CountNativeContextsWithGC(isolate, i / 2 + 1));
+ CHECK_EQ(i + 2, CountNativeContexts());
+ CHECK_EQ(i + 2, CountNativeContextsWithGC(isolate, i / 2 + 1));
}
ctx[0]->Enter();
@@ -2250,6 +2250,10 @@ TEST(LeakNativeContextViaMap) {
v8::HandleScope outer_scope(isolate);
v8::Persistent<v8::Context> ctx1p;
v8::Persistent<v8::Context> ctx2p;
+
+ CcTest::heap()->CollectAllAvailableGarbage();
+ CHECK_EQ(2, NumberOfGlobalObjects());
+
{
v8::HandleScope scope(isolate);
ctx1p.Reset(isolate, v8::Context::New(isolate));
@@ -2258,7 +2262,7 @@ TEST(LeakNativeContextViaMap) {
}
CcTest::heap()->CollectAllAvailableGarbage();
- CHECK_EQ(4, NumberOfGlobalObjects());
+ CHECK_EQ(6, NumberOfGlobalObjects());
{
v8::HandleScope inner_scope(isolate);
@@ -2281,10 +2285,11 @@ TEST(LeakNativeContextViaMap) {
isolate->ContextDisposedNotification();
}
CcTest::heap()->CollectAllAvailableGarbage();
- CHECK_EQ(2, NumberOfGlobalObjects());
+ CHECK_EQ(4, NumberOfGlobalObjects());
ctx2p.Reset();
CcTest::heap()->CollectAllAvailableGarbage();
- CHECK_EQ(0, NumberOfGlobalObjects());
+ // Code stub context is still left over
+ CHECK_EQ(2, NumberOfGlobalObjects());
}
@@ -2304,7 +2309,7 @@ TEST(LeakNativeContextViaFunction) {
}
CcTest::heap()->CollectAllAvailableGarbage();
- CHECK_EQ(4, NumberOfGlobalObjects());
+ CHECK_EQ(6, NumberOfGlobalObjects());
{
v8::HandleScope inner_scope(isolate);
@@ -2327,10 +2332,10 @@ TEST(LeakNativeContextViaFunction) {
isolate->ContextDisposedNotification();
}
CcTest::heap()->CollectAllAvailableGarbage();
- CHECK_EQ(2, NumberOfGlobalObjects());
+ CHECK_EQ(4, NumberOfGlobalObjects());
ctx2p.Reset();
CcTest::heap()->CollectAllAvailableGarbage();
- CHECK_EQ(0, NumberOfGlobalObjects());
+ CHECK_EQ(2, NumberOfGlobalObjects());
}
@@ -2348,7 +2353,7 @@ TEST(LeakNativeContextViaMapKeyed) {
}
CcTest::heap()->CollectAllAvailableGarbage();
- CHECK_EQ(4, NumberOfGlobalObjects());
+ CHECK_EQ(6, NumberOfGlobalObjects());
{
v8::HandleScope inner_scope(isolate);
@@ -2371,10 +2376,10 @@ TEST(LeakNativeContextViaMapKeyed) {
isolate->ContextDisposedNotification();
}
CcTest::heap()->CollectAllAvailableGarbage();
- CHECK_EQ(2, NumberOfGlobalObjects());
+ CHECK_EQ(4, NumberOfGlobalObjects());
ctx2p.Reset();
CcTest::heap()->CollectAllAvailableGarbage();
- CHECK_EQ(0, NumberOfGlobalObjects());
+ CHECK_EQ(2, NumberOfGlobalObjects());
}
@@ -2392,7 +2397,7 @@ TEST(LeakNativeContextViaMapProto) {
}
CcTest::heap()->CollectAllAvailableGarbage();
- CHECK_EQ(4, NumberOfGlobalObjects());
+ CHECK_EQ(6, NumberOfGlobalObjects());
{
v8::HandleScope inner_scope(isolate);
@@ -2419,10 +2424,10 @@ TEST(LeakNativeContextViaMapProto) {
isolate->ContextDisposedNotification();
}
CcTest::heap()->CollectAllAvailableGarbage();
- CHECK_EQ(2, NumberOfGlobalObjects());
+ CHECK_EQ(4, NumberOfGlobalObjects());
ctx2p.Reset();
CcTest::heap()->CollectAllAvailableGarbage();
- CHECK_EQ(0, NumberOfGlobalObjects());
+ CHECK_EQ(2, NumberOfGlobalObjects());
}

Powered by Google App Engine
This is Rietveld 408576698