1. 10 Nov, 2013 2 commits
    • oliver@apple.com's avatar
      Implement Set iterators · 96cafa31
      oliver@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124129
      
      Reviewed by Antti Koivisto.
      
      Source/JavaScriptCore:
      
      Add Set iterator classes and implementations
      
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * runtime/CommonIdentifiers.h:
      * runtime/JSGlobalObject.cpp:
      * runtime/JSGlobalObject.h:
      * runtime/JSSetIterator.cpp: Added.
      (JSC::JSSetIterator::finishCreation):
      (JSC::JSSetIterator::visitChildren):
      (JSC::JSSetIterator::createPair):
      * runtime/JSSetIterator.h: Added.
      (JSC::JSSetIterator::createStructure):
      (JSC::JSSetIterator::create):
      (JSC::JSSetIterator::next):
      (JSC::JSSetIterator::JSSetIterator):
      * runtime/SetIteratorConstructor.cpp: Added.
      (JSC::SetIteratorConstructor::finishCreation):
      * runtime/SetIteratorConstructor.h: Added.
      (JSC::SetIteratorConstructor::create):
      (JSC::SetIteratorConstructor::createStructure):
      (JSC::SetIteratorConstructor::SetIteratorConstructor):
      * runtime/SetIteratorPrototype.cpp: Added.
      (JSC::SetIteratorPrototype::finishCreation):
      (JSC::SetIteratorPrototypeFuncIterator):
      (JSC::SetIteratorPrototypeFuncNext):
      * runtime/SetIteratorPrototype.h: Added.
      (JSC::SetIteratorPrototype::create):
      (JSC::SetIteratorPrototype::createStructure):
      (JSC::SetIteratorPrototype::SetIteratorPrototype):
      * runtime/SetPrototype.cpp:
      (JSC::SetPrototype::finishCreation):
      (JSC::setProtoFuncValues):
      (JSC::setProtoFuncEntries):
      (JSC::setProtoFuncKeys):
      
      LayoutTests:
      
      Move Set tests to more sensible location and add iterator tests
      
      * js/basic-set-expected.txt: Renamed from LayoutTests/js/dom/basic-set-expected.txt.
      * js/basic-set.html: Renamed from LayoutTests/js/dom/basic-set.html.
      * js/script-tests/basic-set.js: Renamed from LayoutTests/js/dom/script-tests/basic-set.js.
      (set new):
      (otherString.string_appeared_here.set add):
      (try.set forEach):
      (set forEach):
      (set gc):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159031 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      96cafa31
    • 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. 29 Sep, 2013 1 commit
  3. 10 Sep, 2013 1 commit
    • oliver@apple.com's avatar
      Support WeakMap · bfcc048e
      oliver@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=120912
      
      Reviewed by Geoffrey Garen.
      
      Source/JavaScriptCore:
      
      Add support for ES6 WeakMap.  Add the cluster of boilerplate
      classes around the core WeakMapData class.
      
      WeakMapData is a simple object->value hash table that uses a
      combo of WeakReferenceHarvester to conditionally keep the weak
      value reference live, and UnconditionalFinalizer to clean the
      dead keys from the table post-GC.
      
      * CMakeLists.txt:
      * GNUmakefile.list.am:
      * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
      * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * Target.pri:
      * runtime/CommonIdentifiers.h:
      * runtime/JSGlobalObject.cpp:
      * runtime/JSGlobalObject.h:
      (JSC::JSGlobalObject::weakMapDataStructure):
      * runtime/JSWeakMap.cpp: Added.
      (JSC::JSWeakMap::finishCreation):
      (JSC::JSWeakMap::visitChildren):
      * runtime/JSWeakMap.h: Added.
      (JSC::JSWeakMap::createStructure):
      (JSC::JSWeakMap::create):
      (JSC::JSWeakMap::weakMapData):
      (JSC::JSWeakMap::JSWeakMap):
      * runtime/WeakMapConstructor.cpp: Added.
      (JSC::WeakMapConstructor::finishCreation):
      (JSC::constructWeakMap):
      (JSC::WeakMapConstructor::getConstructData):
      (JSC::WeakMapConstructor::getCallData):
      * runtime/WeakMapConstructor.h: Added.
      (JSC::WeakMapConstructor::create):
      (JSC::WeakMapConstructor::createStructure):
      (JSC::WeakMapConstructor::WeakMapConstructor):
      * runtime/WeakMapData.cpp: Added.
      (JSC::WeakMapData::WeakMapData):
      (JSC::WeakMapData::finishCreation):
      (JSC::WeakMapData::destroy):
      (JSC::WeakMapData::visitChildren):
      (JSC::WeakMapData::set):
      (JSC::WeakMapData::get):
      (JSC::WeakMapData::remove):
      (JSC::WeakMapData::contains):
      (JSC::WeakMapData::clear):
      (JSC::WeakMapData::DeadKeyCleaner::visitWeakReferences):
      (JSC::WeakMapData::DeadKeyCleaner::finalizeUnconditionally):
      * runtime/WeakMapData.h: Added.
      (JSC::WeakMapData::create):
      (JSC::WeakMapData::createStructure):
      (JSC::WeakMapData::DeadKeyCleaner::DeadKeyCleaner):
      * runtime/WeakMapPrototype.cpp: Added.
      (JSC::WeakMapPrototype::finishCreation):
      (JSC::getWeakMapData):
      (JSC::protoFuncWeakMapClear):
      (JSC::protoFuncWeakMapDelete):
      (JSC::protoFuncWeakMapGet):
      (JSC::protoFuncWeakMapHas):
      (JSC::protoFuncWeakMapSet):
      * runtime/WeakMapPrototype.h: Added.
      (JSC::WeakMapPrototype::create):
      (JSC::WeakMapPrototype::createStructure):
      (JSC::WeakMapPrototype::WeakMapPrototype):
      
      LayoutTests:
      
      Basic tests.
      
      * js/basic-weakmap-expected.txt: Added.
      * js/basic-weakmap.html: Added.
      * js/script-tests/basic-weakmap.js: Added.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155473 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      bfcc048e