diff options
Diffstat (limited to 'deps/v8/test/cctest/test-serialize.cc')
-rw-r--r-- | deps/v8/test/cctest/test-serialize.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/deps/v8/test/cctest/test-serialize.cc b/deps/v8/test/cctest/test-serialize.cc index 453cb10881..c26a7e7348 100644 --- a/deps/v8/test/cctest/test-serialize.cc +++ b/deps/v8/test/cctest/test-serialize.cc @@ -2640,6 +2640,47 @@ TEST(SnapshotCreatorNoExternalReferencesDefault) { delete[] blob.data; } +v8::StartupData CreateCustomSnapshotArrayJoinWithKeep() { + v8::SnapshotCreator creator; + v8::Isolate* isolate = creator.GetIsolate(); + { + v8::HandleScope handle_scope(isolate); + { + v8::Local<v8::Context> context = v8::Context::New(isolate); + v8::Context::Scope context_scope(context); + CompileRun( + "[].join('');\n" + "function g() { return String([1,2,3]); }\n"); + ExpectString("g()", "1,2,3"); + creator.SetDefaultContext(context); + } + } + return creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kKeep); +} + +TEST(SnapshotCreatorArrayJoinWithKeep) { + DisableAlwaysOpt(); + v8::StartupData blob = CreateCustomSnapshotArrayJoinWithKeep(); + + // Deserialize with an incomplete list of external references. + { + v8::Isolate::CreateParams params; + params.snapshot_blob = &blob; + params.array_buffer_allocator = CcTest::array_buffer_allocator(); + // Test-appropriate equivalent of v8::Isolate::New. + v8::Isolate* isolate = TestIsolate::New(params); + { + v8::Isolate::Scope isolate_scope(isolate); + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = v8::Context::New(isolate); + v8::Context::Scope context_scope(context); + ExpectString("g()", "1,2,3"); + } + isolate->Dispose(); + } + delete[] blob.data; +} + TEST(SnapshotCreatorNoExternalReferencesCustomFail1) { DisableAlwaysOpt(); v8::StartupData blob = CreateSnapshotWithDefaultAndCustom(); |