aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/test-serialize.cc
diff options
context:
space:
mode:
authorMyles Borins <mylesborins@google.com>2019-09-24 11:56:38 -0400
committerMyles Borins <myles.borins@gmail.com>2019-10-07 03:19:23 -0400
commitf7f6c928c1c9c136b7926f892b8a2fda11d8b4b2 (patch)
treef5edbccb3ffda2573d70a6e291e7157f290e0ae0 /deps/v8/test/cctest/test-serialize.cc
parentffd22e81983056d09c064c59343a0e488236272d (diff)
downloadandroid-node-v8-f7f6c928c1c9c136b7926f892b8a2fda11d8b4b2.tar.gz
android-node-v8-f7f6c928c1c9c136b7926f892b8a2fda11d8b4b2.tar.bz2
android-node-v8-f7f6c928c1c9c136b7926f892b8a2fda11d8b4b2.zip
deps: update V8 to 7.8.279.9
PR-URL: https://github.com/nodejs/node/pull/29694 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Diffstat (limited to 'deps/v8/test/cctest/test-serialize.cc')
-rw-r--r--deps/v8/test/cctest/test-serialize.cc46
1 files changed, 46 insertions, 0 deletions
diff --git a/deps/v8/test/cctest/test-serialize.cc b/deps/v8/test/cctest/test-serialize.cc
index 1ed1547b34..407437c4b1 100644
--- a/deps/v8/test/cctest/test-serialize.cc
+++ b/deps/v8/test/cctest/test-serialize.cc
@@ -1516,6 +1516,50 @@ static Handle<SharedFunctionInfo> CompileScriptAndProduceCache(
return sfi;
}
+TEST(CodeSerializerWithProfiler) {
+ FLAG_enable_lazy_source_positions = true;
+ FLAG_stress_lazy_source_positions = false;
+
+ LocalContext context;
+ Isolate* isolate = CcTest::i_isolate();
+ isolate->compilation_cache()->Disable(); // Disable same-isolate code cache.
+
+ v8::HandleScope scope(CcTest::isolate());
+
+ const char* source = "1 + 1";
+
+ Handle<String> orig_source = isolate->factory()
+ ->NewStringFromUtf8(CStrVector(source))
+ .ToHandleChecked();
+ Handle<String> copy_source = isolate->factory()
+ ->NewStringFromUtf8(CStrVector(source))
+ .ToHandleChecked();
+ CHECK(!orig_source.is_identical_to(copy_source));
+ CHECK(orig_source->Equals(*copy_source));
+
+ ScriptData* cache = nullptr;
+
+ Handle<SharedFunctionInfo> orig = CompileScriptAndProduceCache(
+ isolate, orig_source, Handle<String>(), &cache,
+ v8::ScriptCompiler::kNoCompileOptions);
+
+ CHECK(!orig->GetBytecodeArray().HasSourcePositionTable());
+
+ isolate->set_is_profiling(true);
+
+ // This does not assert that no compilation can happen as source position
+ // collection could trigger it.
+ Handle<SharedFunctionInfo> copy =
+ CompileScript(isolate, copy_source, Handle<String>(), cache,
+ v8::ScriptCompiler::kConsumeCodeCache);
+
+ // Since the profiler is now enabled, source positions should be collected
+ // after deserialization.
+ CHECK(copy->GetBytecodeArray().HasSourcePositionTable());
+
+ delete cache;
+}
+
void TestCodeSerializerOnePlusOneImpl(bool verify_builtins_count = true) {
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
@@ -3565,6 +3609,7 @@ UNINITIALIZED_TEST(SnapshotCreatorIncludeGlobalProxy) {
base::make_unique<v8::Extension>("new extension",
"function i() { return 24; }"
"function j() { return 25; }"
+ "let a = 26;"
"try {"
" if (o.p == 7) o.p++;"
"} catch {}");
@@ -3582,6 +3627,7 @@ UNINITIALIZED_TEST(SnapshotCreatorIncludeGlobalProxy) {
ExpectInt32("i()", 24);
ExpectInt32("j()", 25);
ExpectInt32("o.p", 8);
+ ExpectInt32("a", 26);
v8::TryCatch try_catch(isolate);
CHECK(CompileRun("x").IsEmpty());
CHECK(try_catch.HasCaught());