| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f729549 commit 212e6bb
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,7 +29,7 @@ | |||
| 29 | 29 | ||
| 30 | 30 | # Reset this number to 0 on major V8 upgrades. | |
| 31 | 31 | # Increment by one for each non-official patch applied to deps/v8. | |
| 32 | - 'v8_embedder_string': '-node.25', | ||
| 32 | + 'v8_embedder_string': '-node.26', | ||
| 33 | 33 | ||
| 34 | 34 | # Enable disassembler for `--print-code` v8 options | |
| 35 | 35 | 'v8_enable_disassembler': 1, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -766,8 +766,11 @@ StartupData SnapshotCreator::CreateBlob( | |||
| 766 | 766 | // Complete in-object slack tracking for all functions. | |
| 767 | 767 | fun->CompleteInobjectSlackTrackingIfActive(); | |
| 768 | 768 | ||
| 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 | + } | ||
| 771 | 774 | } | |
| 772 | 775 | ||
| 773 | 776 | // Clear out re-compilable data from all shared function infos. Any | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -105,7 +105,7 @@ void PartialSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code, | |||
| 105 | 105 | // Unconditionally reset the JSFunction to its SFI's code, since we can't | |
| 106 | 106 | // serialize optimized code anyway. | |
| 107 | 107 | JSFunction* closure = JSFunction::cast(obj); | |
| 108 | - closure->set_code(closure->shared()->GetCode()); | ||
| 108 | + if (closure->is_compiled()) closure->set_code(closure->shared()->GetCode()); | ||
| 109 | 109 | } | |
| 110 | 110 | ||
| 111 | 111 | CheckRehashability(obj); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2640,6 +2640,47 @@ TEST(SnapshotCreatorNoExternalReferencesDefault) { | |||
| 2640 | 2640 | delete[] blob.data; | |
| 2641 | 2641 | } | |
| 2642 | 2642 | ||
| 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 | + | ||
| 2643 | 2684 | TEST(SnapshotCreatorNoExternalReferencesCustomFail1) { | |
| 2644 | 2685 | DisableAlwaysOpt(); | |
| 2645 | 2686 | v8::StartupData blob = CreateSnapshotWithDefaultAndCustom(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments