本文整理汇总了C++中HandleArrayObject::getDenseCapacity方法的典型用法代码示例。如果您正苦于以下问题:C++ HandleArrayObject::getDenseCapacity方法的具体用法?C++ HandleArrayObject::getDenseCapacity怎么用?C++ HandleArrayObject::getDenseCapacity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HandleArrayObject
的用法示例。
在下文中一共展示了HandleArrayObject::getDenseCapacity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MapIteratorObjectRange
bool
MapIteratorObject::next(JSContext* cx, Handle<MapIteratorObject*> mapIterator,
HandleArrayObject resultPairObj)
{
// Check invariants for inlined _GetNextMapEntryForIterator.
// The array should be tenured, so that post-barrier can be done simply.
MOZ_ASSERT(resultPairObj->isTenured());
// The array elements should be fixed.
MOZ_ASSERT(resultPairObj->hasFixedElements());
MOZ_ASSERT(resultPairObj->getDenseInitializedLength() == 2);
MOZ_ASSERT(resultPairObj->getDenseCapacity() >= 2);
ValueMap::Range* range = MapIteratorObjectRange(mapIterator);
if (!range || range->empty()) {
js_delete(range);
mapIterator->setReservedSlot(RangeSlot, PrivateValue(nullptr));
return true;
}
switch (mapIterator->kind()) {
case MapObject::Keys:
resultPairObj->setDenseElementWithType(cx, 0, range->front().key.get());
break;
case MapObject::Values:
resultPairObj->setDenseElementWithType(cx, 1, range->front().value);
break;
case MapObject::Entries: {
resultPairObj->setDenseElementWithType(cx, 0, range->front().key.get());
resultPairObj->setDenseElementWithType(cx, 1, range->front().value);
break;
}
}
range->popFront();
return false;
}
示例2: SetIteratorObjectRange
bool
SetIteratorObject::next(Handle<SetIteratorObject*> setIterator, HandleArrayObject resultObj,
JSContext* cx)
{
// Check invariants for inlined _GetNextSetEntryForIterator.
// The array should be tenured, so that post-barrier can be done simply.
MOZ_ASSERT(resultObj->isTenured());
// The array elements should be fixed.
MOZ_ASSERT(resultObj->hasFixedElements());
MOZ_ASSERT(resultObj->getDenseInitializedLength() == 1);
MOZ_ASSERT(resultObj->getDenseCapacity() >= 1);
ValueSet::Range* range = SetIteratorObjectRange(setIterator);
if (!range || range->empty()) {
js_delete(range);
setIterator->setReservedSlot(RangeSlot, PrivateValue(nullptr));
return true;
}
resultObj->setDenseElementWithType(cx, 0, range->front().get());
range->popFront();
return false;
}