File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,13 @@ class WasmArrayObject : public WasmGcObject,
160160 return offsetToPointer<uint8_t >(offsetOfInlineStorage ());
161161 }
162162
163+ // Actual array data that follows DataHeader. The array data is a part of the
164+ // `inlineStorage`.
165+ template <typename T>
166+ T* inlineArrayElements () {
167+ return offsetToPointer<T>(offsetOfInlineArrayData ());
168+ }
169+
163170 // AllocKind for object creation
164171 static inline gc::AllocKind allocKindForOOL ();
165172 static inline gc::AllocKind allocKindForIL (uint32_t storageBytes);
@@ -507,9 +514,8 @@ class MOZ_RAII StableWasmArrayObjectElements {
507514 // elements.
508515 MOZ_CRASH ();
509516 }
510- std::copy (array->inlineStorage (),
511- array->inlineStorage () + array->numElements_ * sizeof (T),
512- ownElements_->begin ());
517+ const T* src = array->inlineArrayElements <T>();
518+ std::copy (src, src + array->numElements_ , ownElements_->begin ());
513519 elements_ = ownElements_->begin ();
514520 } else {
515521 elements_ = reinterpret_cast <T*>(array->data_ );
You can’t perform that action at this time.
0 commit comments