Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 0fcf13ff77de7ace052790d96bba962383c7b315..62e27c482381197d3d13054a49241559d79f2d7a 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -2475,6 +2475,7 @@ Handle<String> String::SlowFlatten(Handle<ConsString> cons, |
bool String::MakeExternal(v8::String::ExternalStringResource* resource) { |
+ DisallowHeapAllocation no_allocation; |
// Externalizing twice leaks the external resource, so it's |
// prohibited by the API. |
DCHECK(!this->IsExternalString()); |
@@ -2497,7 +2498,9 @@ bool String::MakeExternal(v8::String::ExternalStringResource* resource) { |
bool is_one_byte = this->IsOneByteRepresentation(); |
bool is_internalized = this->IsInternalizedString(); |
bool has_pointers = StringShape(this).IsIndirect(); |
- |
+ if (has_pointers) { |
+ heap->NotifyObjectLayoutChange(this, no_allocation); |
+ } |
// Morph the string to an external string by replacing the map and |
// reinitializing the fields. This won't work if the space the existing |
// string occupies is too small for a regular external string. |
@@ -2543,6 +2546,7 @@ bool String::MakeExternal(v8::String::ExternalStringResource* resource) { |
bool String::MakeExternal(v8::String::ExternalOneByteStringResource* resource) { |
+ DisallowHeapAllocation no_allocation; |
// Externalizing twice leaks the external resource, so it's |
// prohibited by the API. |
DCHECK(!this->IsExternalString()); |
@@ -2570,6 +2574,10 @@ bool String::MakeExternal(v8::String::ExternalOneByteStringResource* resource) { |
bool is_internalized = this->IsInternalizedString(); |
bool has_pointers = StringShape(this).IsIndirect(); |
+ if (has_pointers) { |
+ heap->NotifyObjectLayoutChange(this, no_allocation); |
+ } |
+ |
// Morph the string to an external string by replacing the map and |
// reinitializing the fields. This won't work if the space the existing |
// string occupies is too small for a regular external string. |
@@ -17392,6 +17400,7 @@ void MakeStringThin(String* string, String* internalized, Isolate* isolate) { |
if (!string->IsInternalizedString()) { |
DisallowHeapAllocation no_gc; |
+ isolate->heap()->NotifyObjectLayoutChange(string, no_gc); |
bool one_byte = internalized->IsOneByteRepresentation(); |
Handle<Map> map = one_byte ? isolate->factory()->thin_one_byte_string_map() |
: isolate->factory()->thin_string_map(); |