@@ -71,9 +71,16 @@ ScriptCompiler::CachedData* CodeSerializer::Serialize(
7171
7272 // Serialize code object.
7373 Handle<String> source (String::cast (script->source ()), isolate);
74+ Handle<FixedArray> wrapped_arguments;
75+ if (script->is_wrapped ()) {
76+ wrapped_arguments =
77+ Handle<FixedArray>(script->wrapped_arguments (), isolate);
78+ }
79+
7480 HandleScope scope (isolate);
75- CodeSerializer cs (isolate, SerializedCodeData::SourceHash (
76- source, script->origin_options ()));
81+ CodeSerializer cs (isolate,
82+ SerializedCodeData::SourceHash (source, wrapped_arguments,
83+ script->origin_options ()));
7784 DisallowGarbageCollection no_gc;
7885 cs.reference_map ()->AddAttachedReference (*source);
7986 AlignedCachedData* cached_data = cs.SerializeSharedFunctionInfo (info);
@@ -429,11 +436,17 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
429436
430437 HandleScope scope (isolate);
431438
439+ Handle<FixedArray> wrapped_arguments;
440+ if (!script_details.wrapped_arguments .is_null ()) {
441+ wrapped_arguments = script_details.wrapped_arguments .ToHandleChecked ();
442+ }
443+
432444 SerializedCodeSanityCheckResult sanity_check_result =
433445 SerializedCodeSanityCheckResult::kSuccess ;
434446 const SerializedCodeData scd = SerializedCodeData::FromCachedData (
435447 cached_data,
436- SerializedCodeData::SourceHash (source, script_details.origin_options ),
448+ SerializedCodeData::SourceHash (source, wrapped_arguments,
449+ script_details.origin_options ),
437450 &sanity_check_result);
438451 if (sanity_check_result != SerializedCodeSanityCheckResult::kSuccess ) {
439452 if (v8_flags.profile_deserialization )
@@ -542,6 +555,11 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::FinishOffThreadDeserialize(
542555
543556 HandleScope scope (isolate);
544557
558+ Handle<FixedArray> wrapped_arguments;
559+ if (!script_details.wrapped_arguments .is_null ()) {
560+ wrapped_arguments = script_details.wrapped_arguments .ToHandleChecked ();
561+ }
562+
545563 // Do a source sanity check now that we have the source. It's important for
546564 // FromPartiallySanityCheckedCachedData call that the sanity_check_result
547565 // holds the result of the off-thread sanity check.
@@ -550,7 +568,8 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::FinishOffThreadDeserialize(
550568 const SerializedCodeData scd =
551569 SerializedCodeData::FromPartiallySanityCheckedCachedData (
552570 cached_data,
553- SerializedCodeData::SourceHash (source, script_details.origin_options ),
571+ SerializedCodeData::SourceHash (source, wrapped_arguments,
572+ script_details.origin_options ),
554573 &sanity_check_result);
555574 if (sanity_check_result != SerializedCodeSanityCheckResult::kSuccess ) {
556575 // The only case where the deserialization result could exist despite a
@@ -708,15 +727,17 @@ SerializedCodeSanityCheckResult SerializedCodeData::SanityCheckWithoutSource()
708727 return SerializedCodeSanityCheckResult::kSuccess ;
709728}
710729
711- uint32_t SerializedCodeData::SourceHash (Handle<String> source,
712- ScriptOriginOptions origin_options) {
730+ uint32_t SerializedCodeData::SourceHash (
731+ Handle<String> source, Handle<FixedArray> wrapped_arguments,
732+ ScriptOriginOptions origin_options) {
713733 const uint32_t source_length = source->length ();
734+ const uint32_t has_wrapped_arguments = !wrapped_arguments.is_null ();
714735
715736 static constexpr uint32_t kModuleFlagMask = (1 << 31 );
716737 const uint32_t is_module = origin_options.IsModule () ? kModuleFlagMask : 0 ;
717738 DCHECK_EQ (0 , source_length & kModuleFlagMask );
718739
719- return source_length | is_module;
740+ return source_length | is_module | has_wrapped_arguments << 1 ;
720741}
721742
722743// Return ScriptData object and relinquish ownership over it to the caller.
0 commit comments