| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3d4c520 commit 83eb4f2
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 | |
@@ -2450,10 +2450,10 @@ void BackgroundDeserializeTask::MergeWithExistingScript() { | |||
| 2450 | 2450 | ||
| 2451 | 2451 | MaybeHandle<SharedFunctionInfo> BackgroundDeserializeTask::Finish( | |
| 2452 | 2452 | Isolate* isolate, Handle<String> source, | |
| 2453 | - ScriptOriginOptions origin_options) { | ||
| 2453 | + const ScriptDetails& script_details) { | ||
| 2454 | 2454 | return CodeSerializer::FinishOffThreadDeserialize( | |
| 2455 | 2455 | isolate, std::move(off_thread_data_), &cached_data_, source, | |
| 2456 | - origin_options, &background_merge_task_); | ||
| 2456 | + script_details, &background_merge_task_); | ||
| 2457 | 2457 | } | |
| 2458 | 2458 | ||
| 2459 | 2459 | // ---------------------------------------------------------------------------- | |
@@ -3630,8 +3630,8 @@ MaybeHandle<SharedFunctionInfo> GetSharedFunctionInfoForScriptImpl( | |||
| 3630 | 3630 | "V8.CompileDeserialize"); | |
| 3631 | 3631 | if (deserialize_task) { | |
| 3632 | 3632 | // If there's a cache consume task, finish it. | |
| 3633 | - maybe_result = deserialize_task->Finish(isolate, source, | ||
| 3634 | - script_details.origin_options); | ||
| 3633 | + maybe_result = | ||
| 3634 | + deserialize_task->Finish(isolate, source, script_details); | ||
| 3635 | 3635 | // It is possible at this point that there is a Script object for this | |
| 3636 | 3636 | // script in the compilation cache (held in the variable maybe_script), | |
| 3637 | 3637 | // which does not match maybe_result->script(). This could happen any of | |
@@ -3652,8 +3652,7 @@ MaybeHandle<SharedFunctionInfo> GetSharedFunctionInfoForScriptImpl( | |||
| 3652 | 3652 | // would be non-trivial. | |
| 3653 | 3653 | } else { | |
| 3654 | 3654 | maybe_result = CodeSerializer::Deserialize( | |
| 3655 | - isolate, cached_data, source, script_details.origin_options, | ||
| 3656 | - maybe_script); | ||
| 3655 | + isolate, cached_data, source, script_details, maybe_script); | ||
| 3657 | 3656 | } | |
| 3658 | 3657 | ||
| 3659 | 3658 | bool consuming_code_cache_succeeded = false; | |
@@ -3829,7 +3828,7 @@ MaybeHandle<JSFunction> Compiler::GetWrappedFunction( | |||
| 3829 | 3828 | TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | |
| 3830 | 3829 | "V8.CompileDeserialize"); | |
| 3831 | 3830 | maybe_result = CodeSerializer::Deserialize(isolate, cached_data, source, | |
| 3832 | - script_details.origin_options); | ||
| 3831 | + script_details); | ||
| 3833 | 3832 | bool consuming_code_cache_succeeded = false; | |
| 3834 | 3833 | if (maybe_result.ToHandle(&result)) { | |
| 3835 | 3834 | 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 | |
|---|---|---|---|
@@ -314,12 +314,12 @@ class StressOffThreadDeserializeThread final : public base::Thread { | |||
| 314 | 314 | CodeSerializer::StartDeserializeOffThread(&local_isolate, cached_data_); | |
| 315 | 315 | } | |
| 316 | 316 | ||
| 317 | - MaybeHandle<SharedFunctionInfo> Finalize(Isolate* isolate, | ||
| 318 | - Handle<String> source, | ||
| 319 | - ScriptOriginOptions origin_options) { | ||
| 317 | + MaybeHandle<SharedFunctionInfo> Finalize( | ||
| 318 | + Isolate* isolate, Handle<String> source, | ||
| 319 | + const ScriptDetails& script_details) { | ||
| 320 | 320 | return CodeSerializer::FinishOffThreadDeserialize( | |
| 321 | 321 | isolate, std::move(off_thread_data_), cached_data_, source, | |
| 322 | - origin_options); | ||
| 322 | + script_details); | ||
| 323 | 323 | } | |
| 324 | 324 | ||
| 325 | 325 | private: | |
@@ -330,7 +330,8 @@ class StressOffThreadDeserializeThread final : public base::Thread { | |||
| 330 | 330 | ||
| 331 | 331 | void FinalizeDeserialization(Isolate* isolate, | |
| 332 | 332 | Handle<SharedFunctionInfo> result, | |
| 333 | - const base::ElapsedTimer& timer) { | ||
| 333 | + const base::ElapsedTimer& timer, | ||
| 334 | + const ScriptDetails& script_details) { | ||
| 334 | 335 | // Devtools can report time in this function as profiler overhead, since none | |
| 335 | 336 | // of the following tasks would need to happen normally. | |
| 336 | 337 | TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | |
@@ -343,10 +344,16 @@ void FinalizeDeserialization(Isolate* isolate, | |||
| 343 | 344 | log_code_creation); | |
| 344 | 345 | } | |
| 345 | 346 | ||
| 347 | + Handle<Script> script(Script::cast(result->script()), isolate); | ||
| 348 | + // Reset the script details, including host-defined options. | ||
| 349 | + { | ||
| 350 | + DisallowGarbageCollection no_gc; | ||
| 351 | + SetScriptFieldsFromDetails(isolate, *script, script_details, &no_gc); | ||
| 352 | + } | ||
| 353 | + | ||
| 346 | 354 | bool needs_source_positions = isolate->NeedsSourcePositions(); | |
| 347 | 355 | if (!log_code_creation && !needs_source_positions) return; | |
| 348 | 356 | ||
| 349 | - Handle<Script> script(Script::cast(result->script()), isolate); | ||
| 350 | 357 | if (needs_source_positions) { | |
| 351 | 358 | Script::InitLineEnds(isolate, script); | |
| 352 | 359 | } | |
@@ -430,13 +437,13 @@ const char* ToString(SerializedCodeSanityCheckResult result) { | |||
| 430 | 437 | ||
| 431 | 438 | MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize( | |
| 432 | 439 | Isolate* isolate, AlignedCachedData* cached_data, Handle<String> source, | |
| 433 | - ScriptOriginOptions origin_options, | ||
| 440 | + const ScriptDetails& script_details, | ||
| 434 | 441 | MaybeHandle<Script> maybe_cached_script) { | |
| 435 | 442 | if (v8_flags.stress_background_compile) { | |
| 436 | 443 | StressOffThreadDeserializeThread thread(isolate, cached_data); | |
| 437 | 444 | CHECK(thread.Start()); | |
| 438 | 445 | thread.Join(); | |
| 439 | - return thread.Finalize(isolate, source, origin_options); | ||
| 446 | + return thread.Finalize(isolate, source, script_details); | ||
| 440 | 447 | // TODO(leszeks): Compare off-thread deserialized data to on-thread. | |
| 441 | 448 | } | |
| 442 | 449 | ||
@@ -451,7 +458,7 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize( | |||
| 451 | 458 | SerializedCodeSanityCheckResult::kSuccess; | |
| 452 | 459 | const SerializedCodeData scd = SerializedCodeData::FromCachedData( | |
| 453 | 460 | isolate, cached_data, | |
| 454 | - SerializedCodeData::SourceHash(source, origin_options), | ||
| 461 | + SerializedCodeData::SourceHash(source, script_details.origin_options), | ||
| 455 | 462 | &sanity_check_result); | |
| 456 | 463 | if (sanity_check_result != SerializedCodeSanityCheckResult::kSuccess) { | |
| 457 | 464 | if (v8_flags.profile_deserialization) { | |
@@ -498,7 +505,7 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize( | |||
| 498 | 505 | PrintF("[Deserializing from %d bytes took %0.3f ms]\n", length, ms); | |
| 499 | 506 | } | |
| 500 | 507 | ||
| 501 | - FinalizeDeserialization(isolate, result, timer); | ||
| 508 | + FinalizeDeserialization(isolate, result, timer, script_details); | ||
| 502 | 509 | ||
| 503 | 510 | return scope.CloseAndEscape(result); | |
| 504 | 511 | } | |
@@ -553,7 +560,7 @@ CodeSerializer::StartDeserializeOffThread(LocalIsolate* local_isolate, | |||
| 553 | 560 | MaybeHandle<SharedFunctionInfo> CodeSerializer::FinishOffThreadDeserialize( | |
| 554 | 561 | Isolate* isolate, OffThreadDeserializeData&& data, | |
| 555 | 562 | AlignedCachedData* cached_data, Handle<String> source, | |
| 556 | - ScriptOriginOptions origin_options, | ||
| 563 | + const ScriptDetails& script_details, | ||
| 557 | 564 | BackgroundMergeTask* background_merge_task) { | |
| 558 | 565 | base::ElapsedTimer timer; | |
| 559 | 566 | if (v8_flags.profile_deserialization || v8_flags.log_function_events) { | |
@@ -569,7 +576,8 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::FinishOffThreadDeserialize( | |||
| 569 | 576 | data.sanity_check_result; | |
| 570 | 577 | const SerializedCodeData scd = | |
| 571 | 578 | SerializedCodeData::FromPartiallySanityCheckedCachedData( | |
| 572 | - cached_data, SerializedCodeData::SourceHash(source, origin_options), | ||
| 579 | + cached_data, | ||
| 580 | + SerializedCodeData::SourceHash(source, script_details.origin_options), | ||
| 573 | 581 | &sanity_check_result); | |
| 574 | 582 | if (sanity_check_result != SerializedCodeSanityCheckResult::kSuccess) { | |
| 575 | 583 | // The only case where the deserialization result could exist despite a | |
@@ -642,7 +650,7 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::FinishOffThreadDeserialize( | |||
| 642 | 650 | length, ms); | |
| 643 | 651 | } | |
| 644 | 652 | ||
| 645 | - FinalizeDeserialization(isolate, result, timer); | ||
| 653 | + FinalizeDeserialization(isolate, result, timer, script_details); | ||
| 646 | 654 | ||
| 647 | 655 | DCHECK(!background_merge_task || | |
| 648 | 656 | !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