Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 38deeb825d4b291c707d5e76c1f3cffbf4f1b94a..72b184a568ee83672162094fce0364f26ad6534a 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -2003,6 +2003,7 @@ bool String::MakeExternal(v8::String::ExternalStringResource* resource) { |
Heap* heap = GetHeap(); |
bool is_one_byte = this->IsOneByteRepresentation(); |
bool is_internalized = this->IsInternalizedString(); |
+ bool has_pointers = this->IsConsString() || this->IsSlicedString(); |
// Morph the string to an external string by replacing the map and |
// reinitializing the fields. This won't work if the space the existing |
@@ -2031,6 +2032,9 @@ bool String::MakeExternal(v8::String::ExternalStringResource* resource) { |
int new_size = this->SizeFromMap(new_map); |
heap->CreateFillerObjectAt(this->address() + new_size, size - new_size, |
ClearRecordedSlots::kNo); |
+ if (has_pointers) { |
+ heap->ClearRecordedSlotRange(this->address(), this->address() + new_size); |
+ } |
// We are storing the new map using release store after creating a filler for |
// the left-over space to avoid races with the sweeper thread. |
@@ -2071,6 +2075,7 @@ bool String::MakeExternal(v8::String::ExternalOneByteStringResource* resource) { |
if (size < ExternalString::kShortSize) return false; |
Heap* heap = GetHeap(); |
bool is_internalized = this->IsInternalizedString(); |
+ bool has_pointers = this->IsConsString() || this->IsSlicedString(); |
// Morph the string to an external string by replacing the map and |
// reinitializing the fields. This won't work if the space the existing |
@@ -2093,6 +2098,9 @@ bool String::MakeExternal(v8::String::ExternalOneByteStringResource* resource) { |
int new_size = this->SizeFromMap(new_map); |
heap->CreateFillerObjectAt(this->address() + new_size, size - new_size, |
ClearRecordedSlots::kNo); |
+ if (has_pointers) { |
+ heap->ClearRecordedSlotRange(this->address(), this->address() + new_size); |
+ } |
// We are storing the new map using release store after creating a filler for |
// the left-over space to avoid races with the sweeper thread. |