本文整理汇总了C++中JSPropertyNameIterator类的典型用法代码示例。如果您正苦于以下问题:C++ JSPropertyNameIterator类的具体用法?C++ JSPropertyNameIterator怎么用?C++ JSPropertyNameIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JSPropertyNameIterator类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: new
JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, Structure* structure, JSObject* iteratedObject, JSPropertyNameEnumerator* enumerator)
{
VM& vm = exec->vm();
JSPropertyNameIterator* instance = new (NotNull, allocateCell<JSPropertyNameIterator>(vm.heap)) JSPropertyNameIterator(vm, structure, iteratedObject, enumerator);
instance->finishCreation(vm, structure->globalObject());
return instance;
}
示例2: ASSERT
JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSObject* o)
{
ASSERT(!o->structure()->enumerationCache() ||
o->structure()->enumerationCache()->cachedStructure() != o->structure() ||
o->structure()->enumerationCache()->cachedPrototypeChain() != o->structure()->prototypeChain(exec));
PropertyNameArray propertyNames(exec);
o->getPropertyNames(exec, propertyNames);
size_t numCacheableSlots = 0;
if (!o->structure()->hasNonEnumerableProperties() && !o->structure()->hasAnonymousSlots() &&
!o->structure()->isUncacheableDictionary() && !o->structure()->typeInfo().overridesGetPropertyNames())
numCacheableSlots = o->structure()->propertyStorageSize();
JSPropertyNameIterator* jsPropertyNameIterator = new (exec) JSPropertyNameIterator(exec, propertyNames.data(), numCacheableSlots);
if (o->structure()->isDictionary())
return jsPropertyNameIterator;
if (o->structure()->typeInfo().overridesGetPropertyNames())
return jsPropertyNameIterator;
size_t count = normalizePrototypeChain(exec, o);
StructureChain* structureChain = o->structure()->prototypeChain(exec);
RefPtr<Structure>* structure = structureChain->head();
for (size_t i = 0; i < count; ++i) {
if (structure[i]->typeInfo().overridesGetPropertyNames())
return jsPropertyNameIterator;
}
jsPropertyNameIterator->setCachedPrototypeChain(structureChain);
jsPropertyNameIterator->setCachedStructure(o->structure());
o->structure()->setEnumerationCache(jsPropertyNameIterator);
return jsPropertyNameIterator;
}
示例3: visitChildren
void JSPropertyNameIterator::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
JSPropertyNameIterator* thisObject = jsCast<JSPropertyNameIterator*>(cell);
ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
visitor.appendValues(thisObject->m_jsStrings.get(), thisObject->m_jsStringsSize);
visitor.append(&thisObject->m_cachedPrototypeChain);
}
示例4: propertyNameIteratorFuncNext
EncodedJSValue JSC_HOST_CALL propertyNameIteratorFuncNext(ExecState* exec)
{
VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
JSPropertyNameIterator* iterator = jsDynamicCast<JSPropertyNameIterator*>(exec->thisValue());
if (!iterator)
return JSValue::encode(throwTypeError(exec, scope, ASCIILiteral("Cannot call PropertyNameIterator.next() on a non-PropertyNameIterator object")));
JSValue result;
if (iterator->next(exec, result))
return JSValue::encode(createIteratorResultObject(exec, result, false));
return JSValue::encode(createIteratorResultObject(exec, jsUndefined(), true));
}