Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 8caa732ba6c39981dff49dcbe4f4c591ebd544dc..056d687049f18f079dbefaf66591dd650cc894a8 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -15942,15 +15942,14 @@ void JSArrayBuffer::Setup(Handle<JSArrayBuffer> array_buffer, Isolate* isolate, |
array_buffer->set_is_neuterable(shared == SharedFlag::kNotShared); |
array_buffer->set_is_shared(shared == SharedFlag::kShared); |
- if (data && !is_external) { |
- isolate->heap()->RegisterNewArrayBuffer( |
- isolate->heap()->InNewSpace(*array_buffer), data, allocated_length); |
- } |
- |
Handle<Object> byte_length = |
isolate->factory()->NewNumberFromSize(allocated_length); |
CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber()); |
array_buffer->set_byte_length(*byte_length); |
+ |
+ if (data && !is_external) { |
+ isolate->heap()->RegisterNewArrayBuffer(*array_buffer); |
+ } |
} |
@@ -15998,9 +15997,7 @@ Handle<JSArrayBuffer> JSTypedArray::MaterializeArrayBuffer( |
fixed_typed_array->DataSize()); |
buffer->set_backing_store(backing_store); |
buffer->set_is_external(false); |
- isolate->heap()->RegisterNewArrayBuffer(isolate->heap()->InNewSpace(*buffer), |
- backing_store, |
- fixed_typed_array->DataSize()); |
+ isolate->heap()->RegisterNewArrayBuffer(*buffer); |
memcpy(buffer->backing_store(), |
fixed_typed_array->DataPtr(), |
fixed_typed_array->DataSize()); |