1. 11 Sep, 2013 1 commit
    • commit-queue@webkit.org's avatar
      MapData and WeakMapData don't need to be objects · b1511430
      commit-queue@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=121167
      
      Patch by Sam Weinig <sam@webkit.org> on 2013-09-11
      Reviewed by Geoffrey Garen.
      
      * runtime/JSGlobalObject.cpp:
      (JSC::JSGlobalObject::reset):
      (JSC::JSGlobalObject::visitChildren):
      * runtime/JSGlobalObject.h:
      (JSC::JSGlobalObject::mapStructure):
      Remove MapData and WeakMapData structures (they moved to VM with other non-object Structures).
      
      * runtime/JSMap.cpp:
      (JSC::JSMap::finishCreation):
      * runtime/JSMap.h:
      (JSC::JSMap::create):
      * runtime/JSSet.cpp:
      (JSC::JSSet::finishCreation):
      * runtime/JSSet.h:
      (JSC::JSSet::create):
      * runtime/JSWeakMap.cpp:
      (JSC::JSWeakMap::finishCreation):
      * runtime/JSWeakMap.h:
      (JSC::JSWeakMap::create):
      Update to not pass a global object to the MapData or WeakMapData Structure.
      
      * runtime/MapData.cpp:
      (JSC::MapData::MapData):
      * runtime/MapData.h:
      (JSC::MapData::create):
      (JSC::MapData::createStructure):
      * runtime/WeakMapData.cpp:
      (JSC::WeakMapData::WeakMapData):
      (JSC::WeakMapData::set): Change to take a VM rather than a CallFrame, as that it all it needs.
      * runtime/WeakMapData.h:
      (JSC::WeakMapData::create):
      (JSC::WeakMapData::createStructure):
      Instead of inheriting from JSDestructibleObject, inherit from JSCell and mark self as needing destruction
      and having an immortal structure.
      
      * runtime/VM.cpp:
      (JSC::VM::VM):
      * runtime/VM.h:
      Add MapData and WeakMapData Structures.
      
      * runtime/WeakMapPrototype.cpp:
      (JSC::protoFuncWeakMapSet):
      Pass a VM rather than an ExecState.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155558 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b1511430
  2. 10 Sep, 2013 1 commit
    • mhahnenberg@apple.com's avatar
      MapData has some issues · ff9e657e
      mhahnenberg@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=121118
      
      Reviewed by Geoffrey Garen.
      
      * heap/CopiedBlock.h: Added some debug-only consistency checking logic. We now make sure that
      m_liveBytes is consistent with another field, m_liveObjects. m_liveObjects is the number of
      "objects" that currently reside in the CopiedBlock. If we have zero live bytes then we should have
      zero live objects. The converse and the inverse should also be true.
      (JSC::CopiedBlock::CopiedBlock):
      (JSC::CopiedBlock::didSurviveGC):
      (JSC::CopiedBlock::didEvacuateBytes):
      (JSC::CopiedBlock::canBeRecycled):
      (JSC::CopiedBlock::shouldEvacuate):
      (JSC::CopiedBlock::liveBytes):
      (JSC::CopiedBlock::checkConsistency):
      * heap/CopiedBlockInlines.h:
      (JSC::CopiedBlock::reportLiveBytes):
      * heap/CopyVisitorInlines.h:
      (JSC::CopyVisitor::didCopy):
      * runtime/MapData.cpp:
      (JSC::MapData::replaceAndPackBackingStore): Renamed parameter to be consistent with its meaning.
      (JSC::MapData::replaceBackingStore): Ditto. Also removed an unnecessary local variable.
      (JSC::MapData::visitChildren): Before we passed the size of the MapData to copyLater(), which
      was wrong. Now we pass capacity * sizeof(Entry).
      (JSC::MapData::copyBackingStore): Before when we reassigned the newly copied backing store, we
      set the capacity (in elements) to the size (in bytes) of the backing store. This made us think
      we're way bigger than we actually are. Now we just pass the old capacity in.
      * runtime/MapData.h:
      (JSC::MapData::capacityInBytes): Helper function to calculate the size of the backing store.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155487 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      ff9e657e
  3. 03 Sep, 2013 1 commit
    • oliver@apple.com's avatar
      Support structured clone of Map and Set · 901740c2
      oliver@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=120654
      
      Reviewed by Simon Fraser.
      
      Source/JavaScriptCore:
      
      Make xcode copy the required headers, and add appropriate export attributes
      
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * runtime/JSMap.h:
      * runtime/JSSet.h:
      * runtime/MapData.h:
      
      Source/WebCore:
      
      Add support for cloning Map and Set.  Fairly self explanatory change.
      Needed to add Forwarding headers for the JSMap, JSSet and MapData classes.
      
      * ForwardingHeaders/runtime/JSMap.h: Added.
      * ForwardingHeaders/runtime/JSSet.h: Added.
      * ForwardingHeaders/runtime/MapData.h: Added.
      * bindings/js/SerializedScriptValue.cpp:
      (WebCore::CloneSerializer::isMap):
      (WebCore::CloneSerializer::isSet):
      (WebCore::CloneSerializer::startSet):
      (WebCore::CloneSerializer::startMap):
      (WebCore::CloneSerializer::serialize):
      (WebCore::CloneDeserializer::consumeMapDataTerminationIfPossible):
      (WebCore::CloneDeserializer::deserialize):
      
      LayoutTests:
      
      Tests!
      
      * fast/dom/Window/script-tests/postmessage-clone.js:
      (set new):
      (set add.set add):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      901740c2
  4. 29 Aug, 2013 3 commits
    • ryuan.choi@samsung.com's avatar
      Fix build break after r154861 · 639d4f6b
      ryuan.choi@samsung.com authored
      https://bugs.webkit.org/show_bug.cgi?id=120503
      
      Reviewed by Geoffrey Garen.
      
      Unreviewed build fix attempt for GTK, Qt Windows and CMake based ports.
      
      * CMakeLists.txt:
      * GNUmakefile.list.am:
      * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
      * Target.pri:
      * runtime/MapData.h:
      (JSC::MapData::KeyType::KeyType):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154864 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      639d4f6b
    • oliver@apple.com's avatar
    • oliver@apple.com's avatar
      Implement ES6 Map object · 005f9e8f
      oliver@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=120333
      
      Reviewed by Geoffrey Garen.
      
      Source/JavaScriptCore:
      
      Implement support for the ES6 Map type and related classes.
      
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * heap/CopyToken.h: Add a new token to track copying the backing store
      * runtime/CommonIdentifiers.h: Add new identifiers
      * runtime/JSGlobalObject.cpp:
      * runtime/JSGlobalObject.h:
          Add new structures and prototypes
      
      * runtime/JSMap.cpp: Added.
      * runtime/JSMap.h: Added.
          New JSMap class to represent a Map instance
      
      * runtime/MapConstructor.cpp: Added.
      * runtime/MapConstructor.h: Added.
          The Map constructor
      
      * runtime/MapData.cpp: Added.
      * runtime/MapData.h: Added.
          The most interesting data structure.  The roughly corresponds
          to the ES6 notion of MapData.  It provides the core JSValue->JSValue
          map implementation.  We implement it using 2 hashtables and a flat
          table.  Due to the different semantics of string comparisons vs.
          all others we need have one map keyed by String and the other by
          generic JSValue.  The actual table is represented more or less
          exactly as described in the ES6 draft - a single contiguous list of
          key/value pairs.  The entire map could be achieved with just this
          table, however we need the HashMaps in order to maintain O(1) lookup.
      
          Deleted values are simply cleared as the draft says, however the
          implementation compacts the storage on copy as long as the are no
          active iterators.
      
      * runtime/MapPrototype.cpp: Added.
      * runtime/MapPrototype.h: Added.
          Implement Map prototype functions
      
      * runtime/VM.cpp:
          Add new structures.
      
      LayoutTests:
      
      Tests
      
      * fast/js/basic-map-expected.txt: Added.
      * fast/js/basic-map.html: Added.
      * fast/js/script-tests/basic-map.js: Added.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      005f9e8f