[ES6] Implement Reflect.enumerate
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Jul 2015 06:01:34 +0000 (06:01 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Jul 2015 06:01:34 +0000 (06:01 +0000)
commit10ca2d2bc07c7020e19506de3c1900162e2ecaec
treeb86b0f2d9b3a049763a37b7866fe9f9dbec7e368
parentb410624f6b661e9d05ca5e3a8dd48148f6f3b0fe
[ES6] Implement Reflect.enumerate
https://bugs.webkit.org/show_bug.cgi?id=147347

Reviewed by Sam Weinig.

This patch implements Reflect.enumerate.
It returns the iterator that iterates the enumerable keys of the given object.
It follows the for-in's enumeration order.

To implement it, we write down the same logic to the for-in's enumeration code in C++.

* CMakeLists.txt:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::propertyNameIteratorStructure):
* runtime/JSPropertyNameIterator.cpp: Added.
(JSC::JSPropertyNameIterator::JSPropertyNameIterator):
(JSC::JSPropertyNameIterator::clone):
(JSC::JSPropertyNameIterator::create):
(JSC::JSPropertyNameIterator::finishCreation):
(JSC::JSPropertyNameIterator::visitChildren):
(JSC::JSPropertyNameIterator::next):
(JSC::propertyNameIteratorFuncNext):
* runtime/JSPropertyNameIterator.h: Added.
(JSC::JSPropertyNameIterator::createStructure):
* runtime/ReflectObject.cpp:
(JSC::reflectObjectEnumerate):
* tests/stress/reflect-enumerate.js: Added.
(shouldBe):
(shouldThrow):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@187483 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/JSGlobalObject.h
Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp [new file with mode: 0644]
Source/JavaScriptCore/runtime/JSPropertyNameIterator.h [new file with mode: 0644]
Source/JavaScriptCore/runtime/ReflectObject.cpp
Source/JavaScriptCore/tests/stress/reflect-enumerate.js [new file with mode: 0644]