diff --git a/common.gypi b/common.gypi index 4e645cf50671d4..65720283c54109 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.10', + 'v8_embedder_string': '-node.11', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/codegen/compiler.cc b/deps/v8/src/codegen/compiler.cc index 22f743a4a4ba15..31c5acceebc4f1 100644 --- a/deps/v8/src/codegen/compiler.cc +++ b/deps/v8/src/codegen/compiler.cc @@ -3686,7 +3686,7 @@ MaybeHandle Compiler::GetWrappedFunction( // functions fully non-lazy instead thus preventing source positions from // being omitted. flags.set_collect_source_positions(true); - // flags.set_eager(compile_options == ScriptCompiler::kEagerCompile); + flags.set_is_eager(compile_options == ScriptCompiler::kEagerCompile); UnoptimizedCompileState compile_state; ReusableUnoptimizedCompileState reusable_state(isolate); diff --git a/deps/v8/test/cctest/test-serialize.cc b/deps/v8/test/cctest/test-serialize.cc index eb4a9db6314981..ee9cb5493bee07 100644 --- a/deps/v8/test/cctest/test-serialize.cc +++ b/deps/v8/test/cctest/test-serialize.cc @@ -4979,6 +4979,37 @@ TEST(CachedCompileFunction) { } } +TEST(CachedCompileFunctionRespectsEager) { + DisableAlwaysOpt(); + LocalContext env; + Isolate* isolate = CcTest::i_isolate(); + isolate->compilation_cache() + ->DisableScriptAndEval(); // Disable same-isolate code cache. + + v8::HandleScope scope(CcTest::isolate()); + + v8::Local source = v8_str("return function() { return 42; }"); + v8::ScriptCompiler::Source script_source(source); + + for (bool eager_compile : {false, true}) { + v8::ScriptCompiler::CompileOptions options = + eager_compile ? v8::ScriptCompiler::kEagerCompile + : v8::ScriptCompiler::kNoCompileOptions; + v8::Local fun = + v8::ScriptCompiler::CompileFunction(env.local(), &script_source, 0, + nullptr, 0, nullptr, options) + .ToLocalChecked() + .As() + ->Call(env.local(), v8::Undefined(CcTest::isolate()), 0, nullptr) + .ToLocalChecked(); + + auto i_fun = i::Handle::cast(Utils::OpenHandle(*fun)); + + // Function should be compiled iff kEagerCompile was used. + CHECK_EQ(i_fun->shared().is_compiled(), eager_compile); + } +} + UNINITIALIZED_TEST(SnapshotCreatorAnonClassWithKeep) { DisableAlwaysOpt(); v8::SnapshotCreator creator; diff --git a/test/fixtures/errors/force_colors.snapshot b/test/fixtures/errors/force_colors.snapshot index daef7905a6be19..e5c6d7efc4f075 100644 --- a/test/fixtures/errors/force_colors.snapshot +++ b/test/fixtures/errors/force_colors.snapshot @@ -5,9 +5,9 @@ throw new Error('Should include grayed stack trace') Error: Should include grayed stack trace at Object. (/test*force_colors.js:1:7)  at Module._compile (node:internal*modules*cjs*loader:1233:14) - at Module._extensions..js (node:internal*modules*cjs*loader:1287:10) + at Object..js (node:internal*modules*cjs*loader:1287:10)  at Module.load (node:internal*modules*cjs*loader:1091:32) - at Module._load (node:internal*modules*cjs*loader:938:12) + at Function._load (node:internal*modules*cjs*loader:938:12)  at Function.executeUserEntryPoint [as runMain] (node:internal*modules*run_main:83:12)  at node:internal*main*run_main_module:23:47