1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 15:24:46 -05:00

Fix snapshot bug. (#267)

This commit is contained in:
Ryan Dahl 2018-06-18 15:55:36 +02:00 committed by GitHub
parent e6f51fd458
commit 064d889af0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View file

@ -250,8 +250,10 @@ v8::StartupData MakeSnapshot(v8::StartupData* prev_natives_blob,
SerializeInternalFields, nullptr));
}
// Note that using kKeep here will cause segfaults. This is demoed in the
// "SnapshotBug" test case.
auto snapshot_blob =
creator->CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kKeep);
creator->CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear);
return snapshot_blob;
}

View file

@ -67,3 +67,11 @@ function DoubleSubFails() {
deno.sub((channel, msg) => assert(false));
deno.sub((channel, msg) => assert(false));
}
// The following join has caused SnapshotBug to segfault when using kKeep.
[].join("");
function SnapshotBug() {
assert("1,2,3" === String([1, 2, 3]));
}

View file

@ -90,6 +90,12 @@ TEST(MockRuntimeTest, TypedArraySnapshots) {
deno_delete(d);
}
TEST(MockRuntimeTest, SnapshotBug) {
Deno* d = deno_new(nullptr, nullptr);
EXPECT_TRUE(deno_execute(d, "a.js", "SnapshotBug()"));
deno_delete(d);
}
int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
deno_init();