Implement Array key, value and entries iterators
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Oct 2013 20:34:09 +0000 (20:34 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Oct 2013 20:34:09 +0000 (20:34 +0000)
commit71a951151c9ee0fc993513b693e2c63527e8f453
tree14b7c0d87ace390bdd85f615b535c62cc333c76f
parentc571e2e5eaac37b7ff40262efa9b1e87ade6b121
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156791 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
LayoutTests/ChangeLog
LayoutTests/js/Object-getOwnPropertyNames-expected.txt
LayoutTests/js/array-iterators-expected.txt [new file with mode: 0644]
LayoutTests/js/array-iterators.html [new file with mode: 0644]
LayoutTests/js/script-tests/Object-getOwnPropertyNames.js
LayoutTests/js/script-tests/array-iterators.js [new file with mode: 0644]
Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/GNUmakefile.list.am
Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/runtime/ArrayIteratorConstructor.cpp [new file with mode: 0644]
Source/JavaScriptCore/runtime/ArrayIteratorConstructor.h [new file with mode: 0644]
Source/JavaScriptCore/runtime/ArrayIteratorPrototype.cpp [new file with mode: 0644]
Source/JavaScriptCore/runtime/ArrayIteratorPrototype.h [new file with mode: 0644]
Source/JavaScriptCore/runtime/ArrayPrototype.cpp
Source/JavaScriptCore/runtime/CommonIdentifiers.h
Source/JavaScriptCore/runtime/Identifier.h
Source/JavaScriptCore/runtime/JSArrayIterator.cpp [new file with mode: 0644]
Source/JavaScriptCore/runtime/JSArrayIterator.h [new file with mode: 0644]
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/JSGlobalObject.h