GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — deps: cherry-pick 22116dd from upstream V8 · nodejs/node@212e6bb

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • common.gypi
  • deps/v8
    • src
      • api.cc
      • snapshot
        • partial-serializer.cc
    • test/cctest
      • test-serialize.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
# Reset this number to 0 on major V8 upgrades.
3131
# Increment by one for each non-official patch applied to deps/v8.
32-
'v8_embedder_string': '-node.25',
32+
'v8_embedder_string': '-node.26',
3333

3434
# Enable disassembler for `--print-code` v8 options
3535
'v8_enable_disassembler': 1,
Collapse file

‎deps/v8/src/api.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/api.cc
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,8 +766,11 @@ StartupData SnapshotCreator::CreateBlob(
766766
// Complete in-object slack tracking for all functions.
767767
fun->CompleteInobjectSlackTrackingIfActive();
768768

769-
// Also, clear out feedback vectors.
770-
fun->feedback_cell()->set_value(isolate->heap()->undefined_value());
769+
// Also, clear out feedback vectors, or any optimized code.
770+
if (fun->has_feedback_vector()) {
771+
fun->feedback_cell()->set_value(isolate->heap()->undefined_value());
772+
fun->set_code(isolate->builtins()->builtin(i::Builtins::kCompileLazy));
773+
}
771774
}
772775

773776
// Clear out re-compilable data from all shared function infos. Any
Collapse file

‎deps/v8/src/snapshot/partial-serializer.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/snapshot/partial-serializer.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void PartialSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
105105
// Unconditionally reset the JSFunction to its SFI's code, since we can't
106106
// serialize optimized code anyway.
107107
JSFunction* closure = JSFunction::cast(obj);
108-
closure->set_code(closure->shared()->GetCode());
108+
if (closure->is_compiled()) closure->set_code(closure->shared()->GetCode());
109109
}
110110

111111
CheckRehashability(obj);
Collapse file

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

Copy file name to clipboardExpand all lines: deps/v8/test/cctest/test-serialize.cc
+41Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2640,6 +2640,47 @@ TEST(SnapshotCreatorNoExternalReferencesDefault) {
26402640
delete[] blob.data;
26412641
}
26422642

2643+
v8::StartupData CreateCustomSnapshotArrayJoinWithKeep() {
2644+
v8::SnapshotCreator creator;
2645+
v8::Isolate* isolate = creator.GetIsolate();
2646+
{
2647+
v8::HandleScope handle_scope(isolate);
2648+
{
2649+
v8::Local<v8::Context> context = v8::Context::New(isolate);
2650+
v8::Context::Scope context_scope(context);
2651+
CompileRun(
2652+
"[].join('');\n"
2653+
"function g() { return String([1,2,3]); }\n");
2654+
ExpectString("g()", "1,2,3");
2655+
creator.SetDefaultContext(context);
2656+
}
2657+
}
2658+
return creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kKeep);
2659+
}
2660+
2661+
TEST(SnapshotCreatorArrayJoinWithKeep) {
2662+
DisableAlwaysOpt();
2663+
v8::StartupData blob = CreateCustomSnapshotArrayJoinWithKeep();
2664+
2665+
// Deserialize with an incomplete list of external references.
2666+
{
2667+
v8::Isolate::CreateParams params;
2668+
params.snapshot_blob = &blob;
2669+
params.array_buffer_allocator = CcTest::array_buffer_allocator();
2670+
// Test-appropriate equivalent of v8::Isolate::New.
2671+
v8::Isolate* isolate = TestIsolate::New(params);
2672+
{
2673+
v8::Isolate::Scope isolate_scope(isolate);
2674+
v8::HandleScope handle_scope(isolate);
2675+
v8::Local<v8::Context> context = v8::Context::New(isolate);
2676+
v8::Context::Scope context_scope(context);
2677+
ExpectString("g()", "1,2,3");
2678+
}
2679+
isolate->Dispose();
2680+
}
2681+
delete[] blob.data;
2682+
}
2683+
26432684
TEST(SnapshotCreatorNoExternalReferencesCustomFail1) {
26442685
DisableAlwaysOpt();
26452686
v8::StartupData blob = CreateSnapshotWithDefaultAndCustom();

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.