Ignore:
Timestamp:
Oct 2, 2013, 1:34:09 PM (12 years ago)
Author:
[email protected]
Message:

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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r155473 r156791  
    3030    macro(Array) \
    3131    macro(ArrayBuffer) \
     32    macro(ArrayIterator) \
    3233    macro(BYTES_PER_ELEMENT) \
    3334    macro(Boolean) \
     
    8182    macro(displayName) \
    8283    macro(document) \
     84    macro(done) \
    8385    macro(enumerable) \
    8486    macro(eval) \
     
    107109    macro(multiline) \
    108110    macro(name) \
     111    macro(next) \
    109112    macro(now) \
    110113    macro(numInlinedCalls) \
     
    209212        const Identifier thisIdentifier;
    210213        const Identifier useStrictIdentifier;
     214        const PrivateName iteratorPrivateName;
    211215
    212216       
Note: See TracChangeset for help on using the changeset viewer.