当前位置: 首页>>代码示例>>C++>>正文


C++ HandleArrayObject::getDenseInitializedLength方法代码示例

本文整理汇总了C++中HandleArrayObject::getDenseInitializedLength方法的典型用法代码示例。如果您正苦于以下问题:C++ HandleArrayObject::getDenseInitializedLength方法的具体用法?C++ HandleArrayObject::getDenseInitializedLength怎么用?C++ HandleArrayObject::getDenseInitializedLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HandleArrayObject的用法示例。


在下文中一共展示了HandleArrayObject::getDenseInitializedLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MapIteratorObjectRange

bool
MapIteratorObject::next(JSContext* cx, Handle<MapIteratorObject*> mapIterator,
                        HandleArrayObject resultPairObj)
{
    MOZ_ASSERT(resultPairObj->getDenseInitializedLength() == 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;
}
开发者ID:paulmadore,项目名称:luckyde,代码行数:30,代码来源:MapObject.cpp

示例2: 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;
}
开发者ID:cstipkovic,项目名称:gecko-dev,代码行数:38,代码来源:MapObject.cpp

示例3: 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;
}
开发者ID:bitwiseworks,项目名称:mozilla-os2,代码行数:24,代码来源:MapObject.cpp


注:本文中的HandleArrayObject::getDenseInitializedLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。