Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 7315496981c600dc910c6ec0b3a844db6a61e929..3bd1e38184a6624fcf8e072dfc51f2299b62e241 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -16992,8 +16992,15 @@ Handle<JSArrayBuffer> JSTypedArray::MaterializeArrayBuffer( |
fixed_typed_array->length(), typed_array->type(), |
static_cast<uint8_t*>(buffer->backing_store())); |
- buffer->set_weak_first_view(*typed_array); |
- DCHECK(typed_array->weak_next() == isolate->heap()->undefined_value()); |
+ Heap* heap = isolate->heap(); |
+ if (heap->InNewSpace(*typed_array)) { |
+ DCHECK(typed_array->weak_next() == isolate->heap()->undefined_value()); |
+ typed_array->set_weak_next(heap->new_array_buffer_views_list()); |
+ heap->set_new_array_buffer_views_list(*typed_array); |
+ } else { |
+ buffer->set_weak_first_view(*typed_array); |
+ DCHECK(typed_array->weak_next() == isolate->heap()->undefined_value()); |
+ } |
typed_array->set_buffer(*buffer); |
JSObject::SetMapAndElements(typed_array, new_map, new_elements); |