Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bcb255d

Browse filesBrowse files
kvakilruyadorno
authored andcommitted
deps: V8: cherry-pick cb00db4dba6c
Original commit message: [compiler] fix CompileFunction ignoring kEagerCompile v8::ScriptCompiler::CompileFunction was ignoring kEagerCompile. Unlike the other functions in v8::ScriptCompiler, it was not actually propagating kEagerCompile to the parser. The newly updated test fails without this change. I did some archeology and found that this was commented out since the original CL in https://crrev.com/c/980944. As far as I know Node.js is the main consumer of this particular API. This CL speeds up Node.js's overall startup time by ~13%. Change-Id: Ifc3cd6653555194d46ca48db14f7ba7a4afe0053 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4571822 Commit-Queue: Marja Hölttä <marja@chromium.org> Reviewed-by: Marja Hölttä <marja@chromium.org> Cr-Commit-Position: refs/heads/main@{#87944} Refs: v8/v8@cb00db4 PR-URL: #48671 Refs: #48576 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 3f65598 commit bcb255d
Copy full SHA for bcb255d

File tree

Expand file treeCollapse file tree

2 files changed

+32
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+32
-1
lines changed
Open diff view settings
Collapse file

‎deps/v8/src/codegen/compiler.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/codegen/compiler.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3199,7 +3199,7 @@ MaybeHandle<JSFunction> Compiler::GetWrappedFunction(
31993199
// functions fully non-lazy instead thus preventing source positions from
32003200
// being omitted.
32013201
flags.set_collect_source_positions(true);
3202-
// flags.set_eager(compile_options == ScriptCompiler::kEagerCompile);
3202+
flags.set_is_eager(compile_options == ScriptCompiler::kEagerCompile);
32033203

32043204
UnoptimizedCompileState compile_state;
32053205
ReusableUnoptimizedCompileState reusable_state(isolate);
Collapse file

‎deps/v8/test/cctest/test-serialize.cc‎

Copy file name to clipboardExpand all lines: deps/v8/test/cctest/test-serialize.cc
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4937,6 +4937,37 @@ TEST(CachedCompileFunction) {
49374937
}
49384938
}
49394939

4940+
TEST(CachedCompileFunctionRespectsEager) {
4941+
DisableAlwaysOpt();
4942+
LocalContext env;
4943+
Isolate* isolate = CcTest::i_isolate();
4944+
isolate->compilation_cache()
4945+
->DisableScriptAndEval(); // Disable same-isolate code cache.
4946+
4947+
v8::HandleScope scope(CcTest::isolate());
4948+
4949+
v8::Local<v8::String> source = v8_str("return function() { return 42; }");
4950+
v8::ScriptCompiler::Source script_source(source);
4951+
4952+
for (bool eager_compile : {false, true}) {
4953+
v8::ScriptCompiler::CompileOptions options =
4954+
eager_compile ? v8::ScriptCompiler::kEagerCompile
4955+
: v8::ScriptCompiler::kNoCompileOptions;
4956+
v8::Local<v8::Value> fun =
4957+
v8::ScriptCompiler::CompileFunction(env.local(), &script_source, 0,
4958+
nullptr, 0, nullptr, options)
4959+
.ToLocalChecked()
4960+
.As<v8::Function>()
4961+
->Call(env.local(), v8::Undefined(CcTest::isolate()), 0, nullptr)
4962+
.ToLocalChecked();
4963+
4964+
auto i_fun = i::Handle<i::JSFunction>::cast(Utils::OpenHandle(*fun));
4965+
4966+
// Function should be compiled iff kEagerCompile was used.
4967+
CHECK_EQ(i_fun->shared().is_compiled(), eager_compile);
4968+
}
4969+
}
4970+
49404971
UNINITIALIZED_TEST(SnapshotCreatorAnonClassWithKeep) {
49414972
DisableAlwaysOpt();
49424973
v8::SnapshotCreator creator;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.