1. 10 Nov, 2013 1 commit
    • oliver@apple.com's avatar
      Add Map Iterators · 2d11c160
      oliver@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124109
      
      Reviewed by Andreas Kling.
      
      Source/JavaScriptCore:
      
      Added new Map iterator implementation.  This is a mostly boilerplate patch
      however there's a a little bit of additional logic added to the MapData iterator
      to deal with the possibility of map mutation between creation of the iterator
      and use of it.  We'll be able to improve the performance of this substantially
      by using intrinsics, however I'm pondering coming up with a better way to define
      these thunks without requiring so much duplicated logic.
      
      * CMakeLists.txt:
      * GNUmakefile.list.am:
      * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
      * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * runtime/CommonIdentifiers.h:
      * runtime/JSGlobalObject.cpp:
      * runtime/JSGlobalObject.h:
      * runtime/JSMapIterator.cpp: Added.
      (JSC::JSMapIterator::finishCreation):
      (JSC::JSMapIterator::visitChildren):
      (JSC::JSMapIterator::createPair):
      * runtime/JSMapIterator.h: Added.
      (JSC::JSMapIterator::createStructure):
      (JSC::JSMapIterator::create):
      (JSC::JSMapIterator::next):
      (JSC::JSMapIterator::JSMapIterator):
      * runtime/MapData.h:
      (JSC::MapData::const_iterator::ensureSlot):
      * runtime/MapIteratorConstructor.cpp: Added.
      (JSC::MapIteratorConstructor::finishCreation):
      * runtime/MapIteratorConstructor.h: Added.
      (JSC::MapIteratorConstructor::create):
      (JSC::MapIteratorConstructor::createStructure):
      (JSC::MapIteratorConstructor::MapIteratorConstructor):
      * runtime/MapIteratorPrototype.cpp: Added.
      (JSC::MapIteratorPrototype::finishCreation):
      (JSC::MapIteratorPrototypeFuncIterator):
      (JSC::MapIteratorPrototypeFuncNext):
      * runtime/MapIteratorPrototype.h: Added.
      (JSC::MapIteratorPrototype::create):
      (JSC::MapIteratorPrototype::createStructure):
      (JSC::MapIteratorPrototype::MapIteratorPrototype):
      * runtime/MapPrototype.cpp:
      (JSC::MapPrototype::finishCreation):
      (JSC::mapProtoFuncValues):
      (JSC::mapProtoFuncEntries):
      (JSC::mapProtoFuncKeys):
      
      LayoutTests:
      
      Moved map tests to a more sensible location, and added new iteration tests.
      
      * js/basic-map-expected.txt: Renamed from LayoutTests/js/dom/basic-map-expected.txt.
      * js/basic-map.html: Renamed from LayoutTests/js/dom/basic-map.html.
      * js/script-tests/basic-map.js: Renamed from LayoutTests/js/dom/script-tests/basic-map.js.
      (set shouldBe):
      (set var):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      2d11c160
  2. 02 Oct, 2013 1 commit
    • oliver@apple.com's avatar
      Implement Array key, value and entries iterators · 9719b8c9
      oliver@apple.com authored
      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: http://svn.webkit.org/repository/webkit/trunk@156791 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      9719b8c9