Commit fe7d0a2a authored by Dominik Inführ's avatar Dominik Inführ Committed by V8 LUCI CQ

[heap] Do not invalidate SharedFunctionInfo in ClearPreparseData

Slots don't need to be invalidated in the object. The object is trimmed
to its supertype, so all possibly recorded slots remain valid.

Bug: v8:12578, chromium:1316289
Change-Id: I859b3ec843a2c2c9863cdb3bbc1c3158364aaa5b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3622917Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80333}
parent 99e90c55
...@@ -825,20 +825,23 @@ void SharedFunctionInfo::ClearPreparseData() { ...@@ -825,20 +825,23 @@ void SharedFunctionInfo::ClearPreparseData() {
DisallowGarbageCollection no_gc; DisallowGarbageCollection no_gc;
Heap* heap = GetHeapFromWritableObject(data); Heap* heap = GetHeapFromWritableObject(data);
// Swap the map. // We are basically trimming that object to its supertype, so recorded slots
heap->NotifyObjectLayoutChange(data, no_gc); // within the object don't need to be invalidated.
heap->NotifyObjectLayoutChange(data, no_gc, InvalidateRecordedSlots::kNo);
STATIC_ASSERT(UncompiledDataWithoutPreparseData::kSize < STATIC_ASSERT(UncompiledDataWithoutPreparseData::kSize <
UncompiledDataWithPreparseData::kSize); UncompiledDataWithPreparseData::kSize);
STATIC_ASSERT(UncompiledDataWithoutPreparseData::kSize == STATIC_ASSERT(UncompiledDataWithoutPreparseData::kSize ==
UncompiledData::kHeaderSize); UncompiledData::kHeaderSize);
data.set_map(GetReadOnlyRoots().uncompiled_data_without_preparse_data_map(),
kReleaseStore);
// Fill the remaining space with filler. // Fill the remaining space with filler and clear slots in the trimmed area.
heap->NotifyObjectSizeChange(data, UncompiledDataWithPreparseData::kSize, heap->NotifyObjectSizeChange(data, UncompiledDataWithPreparseData::kSize,
UncompiledDataWithoutPreparseData::kSize, UncompiledDataWithoutPreparseData::kSize,
ClearRecordedSlots::kYes); ClearRecordedSlots::kYes);
// Swap the map.
data.set_map(GetReadOnlyRoots().uncompiled_data_without_preparse_data_map(),
kReleaseStore);
// Ensure that the clear was successful. // Ensure that the clear was successful.
DCHECK(HasUncompiledDataWithoutPreparseData()); DCHECK(HasUncompiledDataWithoutPreparseData());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment