@@ -71,9 +71,16 @@ ScriptCompiler::CachedData* CodeSerializer::Serialize(
71
71
72
72
// Serialize code object.
73
73
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
+
74
80
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 ()));
77
84
DisallowGarbageCollection no_gc;
78
85
cs.reference_map ()->AddAttachedReference (*source);
79
86
AlignedCachedData* cached_data = cs.SerializeSharedFunctionInfo (info);
@@ -429,11 +436,17 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
429
436
430
437
HandleScope scope (isolate);
431
438
439
+ Handle <FixedArray> wrapped_arguments;
440
+ if (!script_details.wrapped_arguments .is_null ()) {
441
+ wrapped_arguments = script_details.wrapped_arguments .ToHandleChecked ();
442
+ }
443
+
432
444
SerializedCodeSanityCheckResult sanity_check_result =
433
445
SerializedCodeSanityCheckResult::kSuccess ;
434
446
const SerializedCodeData scd = SerializedCodeData::FromCachedData (
435
447
cached_data,
436
- SerializedCodeData::SourceHash (source, script_details.origin_options ),
448
+ SerializedCodeData::SourceHash (source, wrapped_arguments,
449
+ script_details.origin_options ),
437
450
&sanity_check_result);
438
451
if (sanity_check_result != SerializedCodeSanityCheckResult::kSuccess ) {
439
452
if (v8_flags.profile_deserialization )
@@ -542,6 +555,11 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::FinishOffThreadDeserialize(
542
555
543
556
HandleScope scope (isolate);
544
557
558
+ Handle <FixedArray> wrapped_arguments;
559
+ if (!script_details.wrapped_arguments .is_null ()) {
560
+ wrapped_arguments = script_details.wrapped_arguments .ToHandleChecked ();
561
+ }
562
+
545
563
// Do a source sanity check now that we have the source. It's important for
546
564
// FromPartiallySanityCheckedCachedData call that the sanity_check_result
547
565
// holds the result of the off-thread sanity check.
@@ -550,7 +568,8 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::FinishOffThreadDeserialize(
550
568
const SerializedCodeData scd =
551
569
SerializedCodeData::FromPartiallySanityCheckedCachedData (
552
570
cached_data,
553
- SerializedCodeData::SourceHash (source, script_details.origin_options ),
571
+ SerializedCodeData::SourceHash (source, wrapped_arguments,
572
+ script_details.origin_options ),
554
573
&sanity_check_result);
555
574
if (sanity_check_result != SerializedCodeSanityCheckResult::kSuccess ) {
556
575
// The only case where the deserialization result could exist despite a
@@ -708,15 +727,17 @@ SerializedCodeSanityCheckResult SerializedCodeData::SanityCheckWithoutSource()
708
727
return SerializedCodeSanityCheckResult::kSuccess ;
709
728
}
710
729
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) {
713
733
const uint32_t source_length = source->length ();
734
+ const uint32_t has_wrapped_arguments = !wrapped_arguments.is_null ();
714
735
715
736
static constexpr uint32_t kModuleFlagMask = (1 << 31 );
716
737
const uint32_t is_module = origin_options.IsModule () ? kModuleFlagMask : 0 ;
717
738
DCHECK_EQ (0 , source_length & kModuleFlagMask );
718
739
719
- return source_length | is_module;
740
+ return source_length | is_module | has_wrapped_arguments << 1 ;
720
741
}
721
742
722
743
// Return ScriptData object and relinquish ownership over it to the caller.
0 commit comments