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(); |
+} |