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

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

Issue 976623002: Serializer: correctly deal with internal references. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixed ports, disabled context specialization for serializer 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
« src/compiler.cc ('K') | « src/x87/assembler-x87-inl.h ('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 3a2d6f26d97db3356a207bf98db69a20b072696d..2b5b1ebc6d2eae6b3e14fa98e37e1473753dc647 100644
--- a/test/cctest/test-serialize.cc
+++ b/test/cctest/test-serialize.cc
@@ -1503,3 +1503,52 @@ TEST(SerializeWithHarmonyScoping) {
}
isolate2->Dispose();
}
+
+
+TEST(SerializeInternalReference) {
+ // Disable experimental natives that are loaded after deserialization.
+ FLAG_harmony_shipping = false;
+ FLAG_turbo_asm = true;
+ FLAG_turbo_deoptimization = false;
+ FLAG_context_specialization = false;
+ FLAG_allow_natives_syntax = true;
+ FlagList::EnforceFlagImplications();
+
+ const char* source =
+ "var foo = (function(stdlib, foreign, heap) {"
+ " 'use asm';"
Michael Starzinger 2015/03/04 13:43:50 As discussed offline: I don't think we want to tri
+ " function foo(i) {"
+ " i = i|0;"
+ " var j = 0;"
+ " switch (i) {"
+ " case 0:"
+ " case 1: j = 1; break;"
+ " case 2:"
+ " case 3: j = 2; break;"
+ " case 4:"
+ " case 5: j = 3; break;"
+ " default: j = 0; break;"
+ " }"
+ " return j|0;"
+ " }"
+ " return { foo: foo };"
+ "})(this, {}, undefined).foo;"
+ "foo(1);"
+ "%DebugPrint(foo);";
+
+ v8::StartupData data = v8::V8::CreateSnapshotDataBlob(source);
+ CHECK(data.data);
+
+ v8::Isolate::CreateParams params;
+ params.snapshot_blob = &data;
+ v8::Isolate* isolate = v8::Isolate::New(params);
+ {
+ v8::Isolate::Scope i_scope(isolate);
+ v8::HandleScope h_scope(isolate);
+ v8::Local<v8::Context> context = v8::Context::New(isolate);
+ delete[] data.data; // We can dispose of the snapshot blob now.
+ v8::Context::Scope c_scope(context);
+ CHECK_EQ(3, CompileRun("foo(4)")->ToInt32(isolate)->Int32Value());
+ }
+ isolate->Dispose();
+}
« src/compiler.cc ('K') | « src/x87/assembler-x87-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698