diff options
Diffstat (limited to 'src/3rdparty/v8/test/cctest/test-heap.cc')
-rw-r--r-- | src/3rdparty/v8/test/cctest/test-heap.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/3rdparty/v8/test/cctest/test-heap.cc b/src/3rdparty/v8/test/cctest/test-heap.cc index 2bb3af6..0d72ff7 100644 --- a/src/3rdparty/v8/test/cctest/test-heap.cc +++ b/src/3rdparty/v8/test/cctest/test-heap.cc @@ -11,6 +11,7 @@ #include "global-handles.h" #include "stub-cache.h" #include "cctest.h" +#include "snapshot.h" using namespace v8::internal; @@ -1577,13 +1578,14 @@ static int NumberOfGlobalObjects() { // optimized code. TEST(LeakNativeContextViaMap) { i::FLAG_allow_natives_syntax = true; + bool snapshot_enabled = i::Snapshot::IsEnabled(); v8::HandleScope outer_scope; v8::Persistent<v8::Context> ctx1 = v8::Context::New(); v8::Persistent<v8::Context> ctx2 = v8::Context::New(); ctx1->Enter(); HEAP->CollectAllAvailableGarbage(); - CHECK_EQ(4, NumberOfGlobalObjects()); + CHECK_EQ((snapshot_enabled ? 6 : 4), NumberOfGlobalObjects()); { v8::HandleScope inner_scope; @@ -1604,7 +1606,7 @@ TEST(LeakNativeContextViaMap) { v8::V8::ContextDisposedNotification(); } HEAP->CollectAllAvailableGarbage(); - CHECK_EQ(2, NumberOfGlobalObjects()); + CHECK_EQ((snapshot_enabled ? 3 : 2), NumberOfGlobalObjects()); ctx2.Dispose(); HEAP->CollectAllAvailableGarbage(); CHECK_EQ(0, NumberOfGlobalObjects()); @@ -1615,13 +1617,14 @@ TEST(LeakNativeContextViaMap) { // optimized code. TEST(LeakNativeContextViaFunction) { i::FLAG_allow_natives_syntax = true; + bool snapshot_enabled = i::Snapshot::IsEnabled(); v8::HandleScope outer_scope; v8::Persistent<v8::Context> ctx1 = v8::Context::New(); v8::Persistent<v8::Context> ctx2 = v8::Context::New(); ctx1->Enter(); HEAP->CollectAllAvailableGarbage(); - CHECK_EQ(4, NumberOfGlobalObjects()); + CHECK_EQ((snapshot_enabled ? 6 : 4), NumberOfGlobalObjects()); { v8::HandleScope inner_scope; @@ -1642,7 +1645,7 @@ TEST(LeakNativeContextViaFunction) { v8::V8::ContextDisposedNotification(); } HEAP->CollectAllAvailableGarbage(); - CHECK_EQ(2, NumberOfGlobalObjects()); + CHECK_EQ((snapshot_enabled ? 3 : 2), NumberOfGlobalObjects()); ctx2.Dispose(); HEAP->CollectAllAvailableGarbage(); CHECK_EQ(0, NumberOfGlobalObjects()); @@ -1651,13 +1654,14 @@ TEST(LeakNativeContextViaFunction) { TEST(LeakNativeContextViaMapKeyed) { i::FLAG_allow_natives_syntax = true; + bool snapshot_enabled = i::Snapshot::IsEnabled(); v8::HandleScope outer_scope; v8::Persistent<v8::Context> ctx1 = v8::Context::New(); v8::Persistent<v8::Context> ctx2 = v8::Context::New(); ctx1->Enter(); HEAP->CollectAllAvailableGarbage(); - CHECK_EQ(4, NumberOfGlobalObjects()); + CHECK_EQ((snapshot_enabled ? 6 : 4), NumberOfGlobalObjects()); { v8::HandleScope inner_scope; @@ -1678,7 +1682,7 @@ TEST(LeakNativeContextViaMapKeyed) { v8::V8::ContextDisposedNotification(); } HEAP->CollectAllAvailableGarbage(); - CHECK_EQ(2, NumberOfGlobalObjects()); + CHECK_EQ((snapshot_enabled ? 3 : 2), NumberOfGlobalObjects()); ctx2.Dispose(); HEAP->CollectAllAvailableGarbage(); CHECK_EQ(0, NumberOfGlobalObjects()); @@ -1687,13 +1691,14 @@ TEST(LeakNativeContextViaMapKeyed) { TEST(LeakNativeContextViaMapProto) { i::FLAG_allow_natives_syntax = true; + bool snapshot_enabled = i::Snapshot::IsEnabled(); v8::HandleScope outer_scope; v8::Persistent<v8::Context> ctx1 = v8::Context::New(); v8::Persistent<v8::Context> ctx2 = v8::Context::New(); ctx1->Enter(); HEAP->CollectAllAvailableGarbage(); - CHECK_EQ(4, NumberOfGlobalObjects()); + CHECK_EQ((snapshot_enabled ? 6 : 4), NumberOfGlobalObjects()); { v8::HandleScope inner_scope; @@ -1718,7 +1723,7 @@ TEST(LeakNativeContextViaMapProto) { v8::V8::ContextDisposedNotification(); } HEAP->CollectAllAvailableGarbage(); - CHECK_EQ(2, NumberOfGlobalObjects()); + CHECK_EQ((snapshot_enabled ? 3 : 2), NumberOfGlobalObjects()); ctx2.Dispose(); HEAP->CollectAllAvailableGarbage(); CHECK_EQ(0, NumberOfGlobalObjects()); |