1. 29 Sep, 2013 1 commit
  2. 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