summaryrefslogtreecommitdiff
path: root/deps/v8/test/unittests/heap/heap-unittest.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2019-03-12 09:01:49 +0100
committerMichaël Zasso <targos@protonmail.com>2019-03-14 18:49:21 +0100
commit7b48713334469818661fe276cf571de9c7899f2d (patch)
tree4dbda49ac88db76ce09dc330a0cb587e68e139ba /deps/v8/test/unittests/heap/heap-unittest.cc
parent8549ac09b256666cf5275224ec58fab9939ff32e (diff)
downloadnode-new-7b48713334469818661fe276cf571de9c7899f2d.tar.gz
deps: update V8 to 7.3.492.25
PR-URL: https://github.com/nodejs/node/pull/25852 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Diffstat (limited to 'deps/v8/test/unittests/heap/heap-unittest.cc')
-rw-r--r--deps/v8/test/unittests/heap/heap-unittest.cc36
1 files changed, 34 insertions, 2 deletions
diff --git a/deps/v8/test/unittests/heap/heap-unittest.cc b/deps/v8/test/unittests/heap/heap-unittest.cc
index dd14e22d54..53954d8178 100644
--- a/deps/v8/test/unittests/heap/heap-unittest.cc
+++ b/deps/v8/test/unittests/heap/heap-unittest.cc
@@ -20,6 +20,7 @@ namespace v8 {
namespace internal {
typedef TestWithIsolate HeapTest;
+typedef TestWithIsolateAndPointerCompression HeapWithPointerCompressionTest;
TEST(Heap, SemiSpaceSize) {
const size_t KB = static_cast<size_t>(i::KB);
@@ -61,15 +62,46 @@ TEST_F(HeapTest, ASLR) {
TEST_F(HeapTest, ExternalLimitDefault) {
Heap* heap = i_isolate()->heap();
- EXPECT_EQ(kExternalAllocationSoftLimit, heap->external_memory_limit_);
+ EXPECT_EQ(kExternalAllocationSoftLimit,
+ heap->isolate()->isolate_data()->external_memory_limit_);
}
TEST_F(HeapTest, ExternalLimitStaysAboveDefaultForExplicitHandling) {
v8_isolate()->AdjustAmountOfExternalAllocatedMemory(+10 * MB);
v8_isolate()->AdjustAmountOfExternalAllocatedMemory(-10 * MB);
Heap* heap = i_isolate()->heap();
- EXPECT_GE(heap->external_memory_limit_, kExternalAllocationSoftLimit);
+ EXPECT_GE(heap->isolate()->isolate_data()->external_memory_limit_,
+ kExternalAllocationSoftLimit);
}
+#if V8_TARGET_ARCH_64_BIT
+TEST_F(HeapWithPointerCompressionTest, HeapLayout) {
+ // Produce some garbage.
+ RunJS(
+ "let ar = [];"
+ "for (let i = 0; i < 100; i++) {"
+ " ar.push(Array(i));"
+ "}"
+ "ar.push(Array(32 * 1024 * 1024));");
+
+ Address isolate_root = i_isolate()->isolate_root();
+ EXPECT_TRUE(IsAligned(isolate_root, size_t{4} * GB));
+
+ // Check that all memory chunks belong this region.
+ base::AddressRegion heap_reservation(isolate_root - size_t{2} * GB,
+ size_t{4} * GB);
+
+ OldGenerationMemoryChunkIterator iter(i_isolate()->heap());
+ for (;;) {
+ MemoryChunk* chunk = iter.next();
+ if (chunk == nullptr) break;
+
+ Address address = chunk->address();
+ size_t size = chunk->area_end() - address;
+ EXPECT_TRUE(heap_reservation.contains(address, size));
+ }
+}
+#endif // V8_TARGET_ARCH_64_BIT
+
} // namespace internal
} // namespace v8