Index: test/cctest/test-serialize.cc |
diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc |
index c59dc3b355e0a24519cb43b9abbffe5e75867266..cd349f9d735160753e691473f4b50a4165de434e 100644 |
--- a/test/cctest/test-serialize.cc |
+++ b/test/cctest/test-serialize.cc |
@@ -854,6 +854,36 @@ TEST(CustomSnapshotDataBlobWithWarmup) { |
isolate->Dispose(); |
} |
+TEST(CustomSnapshotDataBlobImmortalImmovableRoots) { |
+ DisableTurbofan(); |
+ // Flood the startup snapshot with shared function infos. If they are |
+ // serialized before the immortal immovable root, the root will no longer end |
+ // up on the first page. |
+ Vector<const uint8_t> source = |
+ ConstructSource(STATIC_CHAR_VECTOR("var a = [];"), |
+ STATIC_CHAR_VECTOR("a.push(function() {return 7});"), |
+ STATIC_CHAR_VECTOR("\0"), 10000); |
+ |
+ v8::StartupData data = v8::V8::CreateSnapshotDataBlob( |
+ reinterpret_cast<const char*>(source.start())); |
+ |
+ v8::Isolate::CreateParams params; |
+ params.snapshot_blob = &data; |
+ params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
+ |
+ v8::Isolate* isolate = v8::Isolate::New(params); |
+ { |
+ v8::Isolate::Scope i_scope(isolate); |
+ v8::HandleScope h_scope(isolate); |
+ v8::Local<v8::Context> context = v8::Context::New(isolate); |
+ delete[] data.data; // We can dispose of the snapshot blob now. |
+ v8::Context::Scope c_scope(context); |
+ CHECK_EQ(7, CompileRun("a[0]()")->Int32Value(context).FromJust()); |
+ } |
+ isolate->Dispose(); |
+ source.Dispose(); |
+} |
+ |
TEST(TestThatAlwaysSucceeds) { |
} |