mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 23:34:47 -05:00
Fix snapshot bug. (#267)
This commit is contained in:
parent
e6f51fd458
commit
064d889af0
3 changed files with 17 additions and 1 deletions
|
@ -250,8 +250,10 @@ v8::StartupData MakeSnapshot(v8::StartupData* prev_natives_blob,
|
||||||
SerializeInternalFields, nullptr));
|
SerializeInternalFields, nullptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note that using kKeep here will cause segfaults. This is demoed in the
|
||||||
|
// "SnapshotBug" test case.
|
||||||
auto snapshot_blob =
|
auto snapshot_blob =
|
||||||
creator->CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kKeep);
|
creator->CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear);
|
||||||
|
|
||||||
return snapshot_blob;
|
return snapshot_blob;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,3 +67,11 @@ function DoubleSubFails() {
|
||||||
deno.sub((channel, msg) => assert(false));
|
deno.sub((channel, msg) => assert(false));
|
||||||
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]));
|
||||||
|
}
|
||||||
|
|
|
@ -90,6 +90,12 @@ TEST(MockRuntimeTest, TypedArraySnapshots) {
|
||||||
deno_delete(d);
|
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) {
|
int main(int argc, char** argv) {
|
||||||
testing::InitGoogleTest(&argc, argv);
|
testing::InitGoogleTest(&argc, argv);
|
||||||
deno_init();
|
deno_init();
|
||||||
|
|
Loading…
Reference in a new issue