| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 521b629 commit 30801b8
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,7 +37,7 @@ | |||
| 37 | 37 | ||
| 38 | 38 | # Reset this number to 0 on major V8 upgrades. | |
| 39 | 39 | # Increment by one for each non-official patch applied to deps/v8. | |
| 40 | - 'v8_embedder_string': '-node.9', | ||
| 40 | + 'v8_embedder_string': '-node.10', | ||
| 41 | 41 | ||
| 42 | 42 | ##### V8 defaults for Node.js ##### | |
| 43 | 43 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1720,10 +1720,8 @@ BackgroundCompileTask::BackgroundCompileTask( | |||
| 1720 | 1720 | ||
| 1721 | 1721 | BackgroundCompileTask::~BackgroundCompileTask() = default; | |
| 1722 | 1722 | ||
| 1723 | - namespace { | ||
| 1724 | - | ||
| 1725 | 1723 | void SetScriptFieldsFromDetails(Isolate* isolate, Tagged<Script> script, | |
| 1726 | - ScriptDetails script_details, | ||
| 1724 | + const ScriptDetails& script_details, | ||
| 1727 | 1725 | DisallowGarbageCollection* no_gc) { | |
| 1728 | 1726 | Handle<Object> script_name; | |
| 1729 | 1727 | if (script_details.name_obj.ToHandle(&script_name)) { | |
@@ -1749,6 +1747,8 @@ void SetScriptFieldsFromDetails(Isolate* isolate, Tagged<Script> script, | |||
| 1749 | 1747 | } | |
| 1750 | 1748 | } | |
| 1751 | 1749 | ||
| 1750 | + namespace { | ||
| 1751 | + | ||
| 1752 | 1752 | #ifdef ENABLE_SLOW_DCHECKS | |
| 1753 | 1753 | ||
| 1754 | 1754 | // A class which traverses the object graph for a newly compiled Script and | |
@@ -2459,10 +2459,10 @@ void BackgroundDeserializeTask::MergeWithExistingScript() { | |||
| 2459 | 2459 | ||
| 2460 | 2460 | MaybeHandle<SharedFunctionInfo> BackgroundDeserializeTask::Finish( | |
| 2461 | 2461 | Isolate* isolate, Handle<String> source, | |
| 2462 | - ScriptOriginOptions origin_options) { | ||
| 2462 | + const ScriptDetails& script_details) { | ||
| 2463 | 2463 | return CodeSerializer::FinishOffThreadDeserialize( | |
| 2464 | 2464 | isolate, std::move(off_thread_data_), &cached_data_, source, | |
| 2465 | - origin_options, &background_merge_task_); | ||
| 2465 | + script_details, &background_merge_task_); | ||
| 2466 | 2466 | } | |
| 2467 | 2467 | ||
| 2468 | 2468 | // ---------------------------------------------------------------------------- | |
@@ -3639,8 +3639,8 @@ MaybeHandle<SharedFunctionInfo> GetSharedFunctionInfoForScriptImpl( | |||
| 3639 | 3639 | "V8.CompileDeserialize"); | |
| 3640 | 3640 | if (deserialize_task) { | |
| 3641 | 3641 | // If there's a cache consume task, finish it. | |
| 3642 | - maybe_result = deserialize_task->Finish(isolate, source, | ||
| 3643 | - script_details.origin_options); | ||
| 3642 | + maybe_result = | ||
| 3643 | + deserialize_task->Finish(isolate, source, script_details); | ||
| 3644 | 3644 | // It is possible at this point that there is a Script object for this | |
| 3645 | 3645 | // script in the compilation cache (held in the variable maybe_script), | |
| 3646 | 3646 | // which does not match maybe_result->script(). This could happen any of | |
@@ -3661,8 +3661,7 @@ MaybeHandle<SharedFunctionInfo> GetSharedFunctionInfoForScriptImpl( | |||
| 3661 | 3661 | // would be non-trivial. | |
| 3662 | 3662 | } else { | |
| 3663 | 3663 | maybe_result = CodeSerializer::Deserialize( | |
| 3664 | - isolate, cached_data, source, script_details.origin_options, | ||
| 3665 | - maybe_script); | ||
| 3664 | + isolate, cached_data, source, script_details, maybe_script); | ||
| 3666 | 3665 | } | |
| 3667 | 3666 | ||
| 3668 | 3667 | bool consuming_code_cache_succeeded = false; | |
@@ -3838,7 +3837,7 @@ MaybeHandle<JSFunction> Compiler::GetWrappedFunction( | |||
| 3838 | 3837 | TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | |
| 3839 | 3838 | "V8.CompileDeserialize"); | |
| 3840 | 3839 | maybe_result = CodeSerializer::Deserialize(isolate, cached_data, source, | |
| 3841 | - script_details.origin_options); | ||
| 3840 | + script_details); | ||
| 3842 | 3841 | bool consuming_code_cache_succeeded = false; | |
| 3843 | 3842 | if (maybe_result.ToHandle(&result)) { | |
| 3844 | 3843 | is_compiled_scope = result->is_compiled_scope(isolate); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -682,7 +682,7 @@ class V8_EXPORT_PRIVATE BackgroundDeserializeTask { | |||
| 682 | 682 | ||
| 683 | 683 | MaybeHandle<SharedFunctionInfo> Finish(Isolate* isolate, | |
| 684 | 684 | Handle<String> source, | |
| 685 | - ScriptOriginOptions origin_options); | ||
| 685 | + const ScriptDetails& script_details); | ||
| 686 | 686 | ||
| 687 | 687 | bool rejected() const { return cached_data_.rejected(); } | |
| 688 | 688 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,6 +35,9 @@ struct ScriptDetails { | |||
| 35 | 35 | const ScriptOriginOptions origin_options; | |
| 36 | 36 | }; | |
| 37 | 37 | ||
| 38 | + void SetScriptFieldsFromDetails(Isolate* isolate, Tagged<Script> script, | ||
| 39 | + const ScriptDetails& script_details, | ||
| 40 | + DisallowGarbageCollection* no_gc); | ||
| 38 | 41 | } // namespace internal | |
| 39 | 42 | } // namespace v8 | |
| 40 | 43 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -313,12 +313,12 @@ class StressOffThreadDeserializeThread final : public base::Thread { | |||
| 313 | 313 | CodeSerializer::StartDeserializeOffThread(&local_isolate, cached_data_); | |
| 314 | 314 | } | |
| 315 | 315 | ||
| 316 | - MaybeHandle<SharedFunctionInfo> Finalize(Isolate* isolate, | ||
| 317 | - Handle<String> source, | ||
| 318 | - ScriptOriginOptions origin_options) { | ||
| 316 | + MaybeHandle<SharedFunctionInfo> Finalize( | ||
| 317 | + Isolate* isolate, Handle<String> source, | ||
| 318 | + const ScriptDetails& script_details) { | ||
| 319 | 319 | return CodeSerializer::FinishOffThreadDeserialize( | |
| 320 | 320 | isolate, std::move(off_thread_data_), cached_data_, source, | |
| 321 | - origin_options); | ||
| 321 | + script_details); | ||
| 322 | 322 | } | |
| 323 | 323 | ||
| 324 | 324 | private: | |
@@ -329,7 +329,8 @@ class StressOffThreadDeserializeThread final : public base::Thread { | |||
| 329 | 329 | ||
| 330 | 330 | void FinalizeDeserialization(Isolate* isolate, | |
| 331 | 331 | Handle<SharedFunctionInfo> result, | |
| 332 | - const base::ElapsedTimer& timer) { | ||
| 332 | + const base::ElapsedTimer& timer, | ||
| 333 | + const ScriptDetails& script_details) { | ||
| 333 | 334 | // Devtools can report time in this function as profiler overhead, since none | |
| 334 | 335 | // of the following tasks would need to happen normally. | |
| 335 | 336 | TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | |
@@ -342,10 +343,16 @@ void FinalizeDeserialization(Isolate* isolate, | |||
| 342 | 343 | log_code_creation); | |
| 343 | 344 | } | |
| 344 | 345 | ||
| 346 | + Handle<Script> script(Script::cast(result->script()), isolate); | ||
| 347 | + // Reset the script details, including host-defined options. | ||
| 348 | + { | ||
| 349 | + DisallowGarbageCollection no_gc; | ||
| 350 | + SetScriptFieldsFromDetails(isolate, *script, script_details, &no_gc); | ||
| 351 | + } | ||
| 352 | + | ||
| 345 | 353 | bool needs_source_positions = isolate->NeedsSourcePositions(); | |
| 346 | 354 | if (!log_code_creation && !needs_source_positions) return; | |
| 347 | 355 | ||
| 348 | - Handle<Script> script(Script::cast(result->script()), isolate); | ||
| 349 | 356 | if (needs_source_positions) { | |
| 350 | 357 | Script::InitLineEnds(isolate, script); | |
| 351 | 358 | } | |
@@ -429,13 +436,13 @@ const char* ToString(SerializedCodeSanityCheckResult result) { | |||
| 429 | 436 | ||
| 430 | 437 | MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize( | |
| 431 | 438 | Isolate* isolate, AlignedCachedData* cached_data, Handle<String> source, | |
| 432 | - ScriptOriginOptions origin_options, | ||
| 439 | + const ScriptDetails& script_details, | ||
| 433 | 440 | MaybeHandle<Script> maybe_cached_script) { | |
| 434 | 441 | if (v8_flags.stress_background_compile) { | |
| 435 | 442 | StressOffThreadDeserializeThread thread(isolate, cached_data); | |
| 436 | 443 | CHECK(thread.Start()); | |
| 437 | 444 | thread.Join(); | |
| 438 | - return thread.Finalize(isolate, source, origin_options); | ||
| 445 | + return thread.Finalize(isolate, source, script_details); | ||
| 439 | 446 | // TODO(leszeks): Compare off-thread deserialized data to on-thread. | |
| 440 | 447 | } | |
| 441 | 448 | ||
@@ -450,7 +457,7 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize( | |||
| 450 | 457 | SerializedCodeSanityCheckResult::kSuccess; | |
| 451 | 458 | const SerializedCodeData scd = SerializedCodeData::FromCachedData( | |
| 452 | 459 | isolate, cached_data, | |
| 453 | - SerializedCodeData::SourceHash(source, origin_options), | ||
| 460 | + SerializedCodeData::SourceHash(source, script_details.origin_options), | ||
| 454 | 461 | &sanity_check_result); | |
| 455 | 462 | if (sanity_check_result != SerializedCodeSanityCheckResult::kSuccess) { | |
| 456 | 463 | if (v8_flags.profile_deserialization) { | |
@@ -497,7 +504,7 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize( | |||
| 497 | 504 | PrintF("[Deserializing from %d bytes took %0.3f ms]\n", length, ms); | |
| 498 | 505 | } | |
| 499 | 506 | ||
| 500 | - FinalizeDeserialization(isolate, result, timer); | ||
| 507 | + FinalizeDeserialization(isolate, result, timer, script_details); | ||
| 501 | 508 | ||
| 502 | 509 | return scope.CloseAndEscape(result); | |
| 503 | 510 | } | |
@@ -552,7 +559,7 @@ CodeSerializer::StartDeserializeOffThread(LocalIsolate* local_isolate, | |||
| 552 | 559 | MaybeHandle<SharedFunctionInfo> CodeSerializer::FinishOffThreadDeserialize( | |
| 553 | 560 | Isolate* isolate, OffThreadDeserializeData&& data, | |
| 554 | 561 | AlignedCachedData* cached_data, Handle<String> source, | |
| 555 | - ScriptOriginOptions origin_options, | ||
| 562 | + const ScriptDetails& script_details, | ||
| 556 | 563 | BackgroundMergeTask* background_merge_task) { | |
| 557 | 564 | base::ElapsedTimer timer; | |
| 558 | 565 | if (v8_flags.profile_deserialization || v8_flags.log_function_events) { | |
@@ -568,7 +575,8 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::FinishOffThreadDeserialize( | |||
| 568 | 575 | data.sanity_check_result; | |
| 569 | 576 | const SerializedCodeData scd = | |
| 570 | 577 | SerializedCodeData::FromPartiallySanityCheckedCachedData( | |
| 571 | - cached_data, SerializedCodeData::SourceHash(source, origin_options), | ||
| 578 | + cached_data, | ||
| 579 | + SerializedCodeData::SourceHash(source, script_details.origin_options), | ||
| 572 | 580 | &sanity_check_result); | |
| 573 | 581 | if (sanity_check_result != SerializedCodeSanityCheckResult::kSuccess) { | |
| 574 | 582 | // The only case where the deserialization result could exist despite a | |
@@ -641,7 +649,7 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::FinishOffThreadDeserialize( | |||
| 641 | 649 | length, ms); | |
| 642 | 650 | } | |
| 643 | 651 | ||
| 644 | - FinalizeDeserialization(isolate, result, timer); | ||
| 652 | + FinalizeDeserialization(isolate, result, timer, script_details); | ||
| 645 | 653 | ||
| 646 | 654 | DCHECK(!background_merge_task || | |
| 647 | 655 | !background_merge_task->HasPendingForegroundWork()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,7 @@ | |||
| 6 | 6 | #define V8_SNAPSHOT_CODE_SERIALIZER_H_ | |
| 7 | 7 | ||
| 8 | 8 | #include "src/base/macros.h" | |
| 9 | + #include "src/codegen/script-details.h" | ||
| 9 | 10 | #include "src/snapshot/serializer.h" | |
| 10 | 11 | #include "src/snapshot/snapshot-data.h" | |
| 11 | 12 | ||
@@ -81,7 +82,7 @@ class CodeSerializer : public Serializer { | |||
| 81 | 82 | ||
| 82 | 83 | V8_WARN_UNUSED_RESULT static MaybeHandle<SharedFunctionInfo> Deserialize( | |
| 83 | 84 | Isolate* isolate, AlignedCachedData* cached_data, Handle<String> source, | |
| 84 | - ScriptOriginOptions origin_options, | ||
| 85 | + const ScriptDetails& script_details, | ||
| 85 | 86 | MaybeHandle<Script> maybe_cached_script = {}); | |
| 86 | 87 | ||
| 87 | 88 | V8_WARN_UNUSED_RESULT static OffThreadDeserializeData | |
@@ -92,7 +93,7 @@ class CodeSerializer : public Serializer { | |||
| 92 | 93 | FinishOffThreadDeserialize( | |
| 93 | 94 | Isolate* isolate, OffThreadDeserializeData&& data, | |
| 94 | 95 | AlignedCachedData* cached_data, Handle<String> source, | |
| 95 | - ScriptOriginOptions origin_options, | ||
| 96 | + const ScriptDetails& script_details, | ||
| 96 | 97 | BackgroundMergeTask* background_merge_task = nullptr); | |
| 97 | 98 | ||
| 98 | 99 | uint32_t source_hash() const { return source_hash_; } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments