Implement Array key, value and entries iterators
https://bugs.webkit.org/show_bug.cgi?id=122195
Reviewed by Filip Pizlo.
Source/JavaScriptCore:
Add implementation of ES6 Array iterators for keys(), values() and entries()
Fairly self explanatory as we just need a simple implementation so that we can
implement and test other features.
- JavaScriptCore.xcodeproj/project.pbxproj:
- runtime/ArrayIteratorConstructor.cpp: Added.
(JSC::ArrayIteratorConstructor::finishCreation):
- runtime/ArrayIteratorConstructor.h: Added.
(JSC::ArrayIteratorConstructor::create):
(JSC::ArrayIteratorConstructor::createStructure):
(JSC::ArrayIteratorConstructor::ArrayIteratorConstructor):
- runtime/ArrayIteratorPrototype.cpp: Added.
(JSC::ArrayIteratorPrototype::finishCreation):
(JSC::createIteratorResult):
(JSC::arrayIteratorPrototypeNext):
- runtime/ArrayIteratorPrototype.h: Added.
(JSC::ArrayIteratorPrototype::create):
(JSC::ArrayIteratorPrototype::createStructure):
(JSC::ArrayIteratorPrototype::ArrayIteratorPrototype):
- runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncValues):
(JSC::arrayProtoFuncEntries):
(JSC::arrayProtoFuncKeys):
- runtime/CommonIdentifiers.h:
- runtime/Identifier.h:
(JSC::Identifier::createEmptyUnique):
- runtime/JSArrayIterator.cpp: Added.
(JSC::JSArrayIterator::finishCreation):
- runtime/JSArrayIterator.h: Added.
(JSC::JSArrayIterator::createStructure):
(JSC::JSArrayIterator::create):
(JSC::JSArrayIterator::iterationKind):
(JSC::JSArrayIterator::iteratedObject):
(JSC::JSArrayIterator::nextIndex):
(JSC::JSArrayIterator::setNextIndex):
(JSC::JSArrayIterator::finish):
(JSC::JSArrayIterator::JSArrayIterator):
- runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset):
- runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::iteratorResultStructure):
LayoutTests:
Add tests
- js/Object-getOwnPropertyNames-expected.txt:
- js/array-iterators-expected.txt: Added.
- js/array-iterators.html: Added.
- js/script-tests/Object-getOwnPropertyNames.js:
- js/script-tests/array-iterators.js: Added.