Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Unified Diff: test/cctest/test-serialize.cc

Issue 962963007: Use locker when creating snapshot if necessary. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix assertion instead Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-serialize.cc
diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc
index 592a9ff1192c35ff0d6cc186619b6e9868e7fc06..3a2d6f26d97db3356a207bf98db69a20b072696d 100644
--- a/test/cctest/test-serialize.cc
+++ b/test/cctest/test-serialize.cc
@@ -748,6 +748,42 @@ TEST(PerIsolateSnapshotBlobs) {
}
+TEST(PerIsolateSnapshotBlobsWithLocker) {
+ // Disable experimental natives that are loaded after deserialization.
+ FLAG_harmony_shipping = false;
+ FlagList::EnforceFlagImplications();
+
+ v8::Isolate* isolate0 = v8::Isolate::New();
+ {
+ v8::Locker locker(isolate0);
+ v8::Isolate::Scope i_scope(isolate0);
+ v8::HandleScope h_scope(isolate0);
+ v8::Local<v8::Context> context = v8::Context::New(isolate0);
+ v8::Context::Scope c_scope(context);
+ CHECK_EQ(1, CompileRun("Math.cos(0)")->ToInt32(isolate0)->Int32Value());
+ }
+ isolate0->Dispose();
+
+ const char* source1 = "function f() { return 42; }";
+
+ v8::StartupData data1 = v8::V8::CreateSnapshotDataBlob(source1);
+
+ v8::Isolate::CreateParams params1;
+ params1.snapshot_blob = &data1;
+ v8::Isolate* isolate1 = v8::Isolate::New(params1);
+ {
+ v8::Locker locker(isolate1);
+ v8::Isolate::Scope i_scope(isolate1);
+ v8::HandleScope h_scope(isolate1);
+ v8::Local<v8::Context> context = v8::Context::New(isolate1);
+ delete[] data1.data; // We can dispose of the snapshot blob now.
+ v8::Context::Scope c_scope(context);
+ CHECK_EQ(42, CompileRun("f()")->ToInt32(isolate1)->Int32Value());
+ }
+ isolate1->Dispose();
+}
+
+
TEST(TestThatAlwaysSucceeds) {
}
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698