From 9ac48ef8319087fcb68d9021db0af9d5cb1080af Mon Sep 17 00:00:00 2001 From: trav90 Date: Sun, 12 Aug 2018 07:57:10 -0500 Subject: Simplify HeapSlot to make it trivially copyable This removes the constructors, which were never called since we allocate arrays of HeapSlot with pod_malloc. The destructor is only ever called explicitly since we free this memory with js_free so it has been renamed to destroy(). Also removed is an unused manual barrier. --- js/src/vm/NativeObject.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'js/src/vm/NativeObject.h') diff --git a/js/src/vm/NativeObject.h b/js/src/vm/NativeObject.h index f4199b4cf6..4dbc167ab6 100644 --- a/js/src/vm/NativeObject.h +++ b/js/src/vm/NativeObject.h @@ -876,7 +876,7 @@ class NativeObject : public ShapedObject MOZ_ASSERT(end <= getDenseInitializedLength()); MOZ_ASSERT(!denseElementsAreCopyOnWrite()); for (size_t i = start; i < end; i++) - elements_[i].HeapSlot::~HeapSlot(); + elements_[i].destroy(); } /* @@ -885,7 +885,7 @@ class NativeObject : public ShapedObject */ void prepareSlotRangeForOverwrite(size_t start, size_t end) { for (size_t i = start; i < end; i++) - getSlotAddressUnchecked(i)->HeapSlot::~HeapSlot(); + getSlotAddressUnchecked(i)->destroy(); } public: @@ -1130,8 +1130,7 @@ class NativeObject : public ShapedObject dst->set(this, HeapSlot::Element, dst - elements_, *src); } } else { - memmove(reinterpret_cast(elements_ + dstStart), elements_ + srcStart, - count * sizeof(Value)); + memmove(elements_ + dstStart, elements_ + srcStart, count * sizeof(HeapSlot)); elementsRangeWriteBarrierPost(dstStart, count); } } @@ -1144,8 +1143,7 @@ class NativeObject : public ShapedObject MOZ_ASSERT(!denseElementsAreCopyOnWrite()); MOZ_ASSERT(!denseElementsAreFrozen()); - memmove(reinterpret_cast(elements_ + dstStart), elements_ + srcStart, - count * sizeof(Value)); + memmove(elements_ + dstStart, elements_ + srcStart, count * sizeof(HeapSlot)); elementsRangeWriteBarrierPost(dstStart, count); } -- cgit v1.2.3