X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/2d39b0e377c0896910ee49ae70082ba665faf986..refs/heads/master:/runtime/JSMap.cpp diff --git a/runtime/JSMap.cpp b/runtime/JSMap.cpp index 5500c56..352648b 100644 --- a/runtime/JSMap.cpp +++ b/runtime/JSMap.cpp @@ -27,26 +27,64 @@ #include "JSMap.h" #include "JSCJSValueInlines.h" -#include "MapData.h" +#include "JSMapIterator.h" +#include "MapDataInlines.h" #include "SlotVisitorInlines.h" #include "StructureInlines.h" namespace JSC { - -const ClassInfo JSMap::s_info = { "Map", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSMap) }; + +const ClassInfo JSMap::s_info = { "Map", &Base::s_info, 0, CREATE_METHOD_TABLE(JSMap) }; + +void JSMap::destroy(JSCell* cell) +{ + JSMap* thisObject = jsCast(cell); + thisObject->JSMap::~JSMap(); +} void JSMap::visitChildren(JSCell* cell, SlotVisitor& visitor) { Base::visitChildren(cell, visitor); - JSMap* thisObject = jsCast(cell); - visitor.append(&thisObject->m_mapData); + jsCast(cell)->m_mapData.visitChildren(cell, visitor); +} + +void JSMap::copyBackingStore(JSCell* cell, CopyVisitor& visitor, CopyToken token) +{ + Base::copyBackingStore(cell, visitor, token); + jsCast(cell)->m_mapData.copyBackingStore(visitor, token); +} + +bool JSMap::has(ExecState* exec, JSValue key) +{ + return m_mapData.contains(exec, key); } -void JSMap::finishCreation(VM& vm) +size_t JSMap::size(ExecState* exec) { - Base::finishCreation(vm); - m_mapData.set(vm, this, MapData::create(vm)); + return m_mapData.size(exec); } +JSValue JSMap::get(ExecState* exec, JSValue key) +{ + JSValue result = m_mapData.get(exec, key); + if (!result) + return jsUndefined(); + return result; +} + +void JSMap::set(ExecState* exec, JSValue key, JSValue value) +{ + m_mapData.set(exec, this, key, value); +} + +void JSMap::clear(ExecState*) +{ + m_mapData.clear(); +} + +bool JSMap::remove(ExecState* exec, JSValue key) +{ + return m_mapData.remove(exec, key); +} }