diff --git a/src/objects/shared-function-info-inl.h b/src/objects/shared-function-info-inl.h index 824e04e87c..6023c3b828 100644 --- a/src/objects/shared-function-info-inl.h +++ b/src/objects/shared-function-info-inl.h @@ -627,7 +627,7 @@ void SharedFunctionInfo::ClearPreparseData() { data.address() + UncompiledDataWithoutPreparseData::kSize, UncompiledDataWithPreparseData::kSize - UncompiledDataWithoutPreparseData::kSize, - ClearRecordedSlots::kNo); + ClearRecordedSlots::kYes); // Ensure that the clear was successful. DCHECK(HasUncompiledDataWithoutPreparseData()); diff --git a/src/objects/string.cc b/src/objects/string.cc index d1981fd24d..41de3aef04 100644 --- a/src/objects/string.cc +++ b/src/objects/string.cc @@ -110,6 +110,8 @@ void String::MakeThin(Isolate* isolate, String internalized) { } } + bool has_pointers = StringShape(*this).IsIndirect(); + int old_size = this->Size(); isolate->heap()->NotifyObjectLayoutChange(*this, old_size, no_gc); bool one_byte = internalized.IsOneByteRepresentation(); @@ -123,7 +125,9 @@ void String::MakeThin(Isolate* isolate, String internalized) { int size_delta = old_size - ThinString::kSize; if (size_delta != 0) { Heap* heap = isolate->heap(); - heap->CreateFillerObjectAt(thin_end, size_delta, ClearRecordedSlots::kNo); + heap->CreateFillerObjectAt( + thin_end, size_delta, + has_pointers ? ClearRecordedSlots::kYes : ClearRecordedSlots::kNo); } } @@ -178,7 +182,8 @@ bool String::MakeExternal(v8::String::ExternalStringResource* resource) { // Byte size of the external String object. int new_size = this->SizeFromMap(new_map); isolate->heap()->CreateFillerObjectAt( - this->address() + new_size, size - new_size, ClearRecordedSlots::kNo); + this->address() + new_size, size - new_size, + has_pointers ? ClearRecordedSlots::kYes : ClearRecordedSlots::kNo); if (has_pointers) { isolate->heap()->ClearRecordedSlotRange(this->address(), this->address() + new_size); @@ -250,7 +255,8 @@ bool String::MakeExternal(v8::String::ExternalOneByteStringResource* resource) { // Byte size of the external String object. int new_size = this->SizeFromMap(new_map); isolate->heap()->CreateFillerObjectAt( - this->address() + new_size, size - new_size, ClearRecordedSlots::kNo); + this->address() + new_size, size - new_size, + has_pointers ? ClearRecordedSlots::kYes : ClearRecordedSlots::kNo); if (has_pointers) { isolate->heap()->ClearRecordedSlotRange(this->address(), this->address() + new_size);