Index: test/cctest/test-serialize.cc |
diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc |
index 8511b740859197f9bb97f5930562db4cc97436b7..71e5d82181d59183a4e53283b19977a2fddf61b3 100644 |
--- a/test/cctest/test-serialize.cc |
+++ b/test/cctest/test-serialize.cc |
@@ -819,6 +819,37 @@ TEST(SerializeToplevelOnePlusOne) { |
} |
+TEST(CodeCachePromotedToCompilationCache) { |
+ FLAG_serialize_toplevel = true; |
+ LocalContext context; |
+ Isolate* isolate = CcTest::i_isolate(); |
+ |
+ v8::HandleScope scope(CcTest::isolate()); |
+ |
+ const char* source = "1 + 1"; |
+ |
+ Handle<String> src = isolate->factory() |
+ ->NewStringFromUtf8(CStrVector(source)) |
+ .ToHandleChecked(); |
+ ScriptData* cache = NULL; |
+ |
+ CompileScript(isolate, src, src, &cache, |
+ v8::ScriptCompiler::kProduceCodeCache); |
+ |
+ DisallowCompilation no_compile_expected(isolate); |
+ Handle<SharedFunctionInfo> copy = CompileScript( |
+ isolate, src, src, &cache, v8::ScriptCompiler::kConsumeCodeCache); |
+ |
+ CHECK(isolate->compilation_cache() |
+ ->LookupScript(src, src, 0, 0, false, false, |
+ isolate->native_context(), SLOPPY) |
+ .ToHandleChecked() |
+ .is_identical_to(copy)); |
+ |
+ delete cache; |
+} |
+ |
+ |
TEST(SerializeToplevelInternalizedString) { |
FLAG_serialize_toplevel = true; |
LocalContext context; |