Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow starting isolate from snapshot bytes on the heap #5187

Merged
merged 2 commits into from
May 10, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Test loading from boxed snapshot
  • Loading branch information
mraerino committed May 9, 2020
commit 0a50e720212404a6bd2a70bbfe0a4593fa276a31
14 changes: 14 additions & 0 deletions core/isolate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,20 @@ pub mod tests {
let mut isolate2 = CoreIsolate::new(startup_data, false);
js_check(isolate2.execute("check.js", "if (a != 3) throw Error('x')"));
}

#[test]
fn test_from_boxed_snapshot() {
let snapshot = {
let mut isolate = CoreIsolate::new(StartupData::None, true);
js_check(isolate.execute("a.js", "a = 1 + 2"));
let snap: &[u8] = &*isolate.snapshot();
Vec::from(snap).into_boxed_slice()
};

let startup_data = StartupData::Snapshot(Snapshot::Boxed(snapshot));
let mut isolate2 = CoreIsolate::new(startup_data, false);
js_check(isolate2.execute("check.js", "if (a != 3) throw Error('x')"));
}
}

// TODO(piscisaureus): rusty_v8 should implement the Error trait on
Expand Down