Bug 925397 - Add JSObject::initDenseElementsUnbarriered() for use from PJS r=terrence

This commit is contained in:
Jon Coppeard 2013-10-14 10:15:47 +01:00
parent 8439220a83
commit 04f091e6f9
2 changed files with 12 additions and 2 deletions

View File

@ -566,7 +566,7 @@ jit::InitRestParameterPar(ForkJoinSlice *slice, uint32_t length, Value *rest,
res->ensureDenseElementsPreservePackedFlag(slice, 0, length);
if (edr != JSObject::ED_OK)
return nullptr;
res->initDenseElements(0, rest, length);
res->initDenseElementsUnbarriered(0, rest, length);
res->as<ArrayObject>().setLengthInt32(length);
}

View File

@ -667,7 +667,17 @@ class JSObject : public js::ObjectImpl
void initDenseElements(uint32_t dstStart, const js::Value *src, uint32_t count) {
JS_ASSERT(dstStart + count <= getDenseCapacity());
memcpy(&elements[dstStart], src, count * sizeof(js::HeapSlot));
DenseRangeWriteBarrierPost(runtimeFromAnyThread(), this, dstStart, count);
DenseRangeWriteBarrierPost(runtimeFromMainThread(), this, dstStart, count);
}
void initDenseElementsUnbarriered(uint32_t dstStart, const js::Value *src, uint32_t count) {
/*
* For use by parallel threads, which since they cannot see nursery
* things do not require a barrier.
*/
JS_ASSERT(!js::CurrentThreadCanAccessRuntime(runtimeFromAnyThread()));
JS_ASSERT(dstStart + count <= getDenseCapacity());
memcpy(&elements[dstStart], src, count * sizeof(js::HeapSlot));
}
void moveDenseElements(uint32_t dstStart, uint32_t srcStart, uint32_t count) {