Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (205653 => 205654)
--- trunk/Source/_javascript_Core/ChangeLog 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-09-08 18:59:02 UTC (rev 205654)
@@ -1,3 +1,36 @@
+2016-09-08 Filip Pizlo <[email protected]>
+
+ Move JSMap/JSSet over to Auxiliary MarkedSpace
+ https://bugs.webkit.org/show_bug.cgi?id=161744
+
+ Reviewed by Saam Barati.
+
+ This moves the buffer out of CopiedSpace and into Auxiliary MarkedSpace.
+
+ Also removes MapData.h/MapDataInlines.h since they are not used anywhere, but they still
+ speak of CopiedSpace.
+
+ This is a purely mechanical change.
+
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * heap/CopyToken.h:
+ * runtime/HashMapImpl.cpp:
+ (JSC::HashMapImpl<HashMapBucket>::visitChildren):
+ (JSC::HashMapImpl<HashMapBucket>::copyBackingStore): Deleted.
+ * runtime/HashMapImpl.h:
+ (JSC::HashMapBuffer::create):
+ * runtime/JSMapIterator.cpp:
+ * runtime/JSMapIterator.h:
+ * runtime/JSSetIterator.cpp:
+ * runtime/JSSetIterator.h:
+ * runtime/MapBase.cpp:
+ * runtime/MapData.h: Removed.
+ * runtime/MapDataInlines.h: Removed.
+ * runtime/MapPrototype.cpp:
+ * runtime/SetConstructor.cpp:
+ * runtime/SetPrototype.cpp:
+ * runtime/VM.cpp:
+
2016-09-06 Filip Pizlo <[email protected]>
Typed arrays should use MarkedSpace instead of CopiedSpace
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (205653 => 205654)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2016-09-08 18:59:02 UTC (rev 205654)
@@ -77,7 +77,6 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
- 0A6441519420A6C61AD1882E /* MapDataInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 593D43CCA0BBE06D89C59707 /* MapDataInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F0123321944EA1B00843A0C /* DFGValueStrength.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F0123301944EA1B00843A0C /* DFGValueStrength.cpp */; };
0F0123331944EA1B00843A0C /* DFGValueStrength.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0123311944EA1B00843A0C /* DFGValueStrength.h */; };
0F0332C018ADFAE1005F979A /* ExitingJITType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F0332BF18ADFAE1005F979A /* ExitingJITType.cpp */; };
@@ -1769,7 +1768,6 @@
A77F1825164192C700640A47 /* ParserModes.h in Headers */ = {isa = PBXBuildFile; fileRef = A77F18241641925400640A47 /* ParserModes.h */; settings = {ATTRIBUTES = (Private, ); }; };
A784A26111D16622005776AC /* ASTBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A7EE7411B98B8D0065A14F /* ASTBuilder.h */; };
A784A26411D16622005776AC /* SyntaxChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A7EE7711B98B8D0065A14F /* SyntaxChecker.h */; settings = {ATTRIBUTES = (Private, ); }; };
- A78507D717CBC6FD0011F6E7 /* MapData.h in Headers */ = {isa = PBXBuildFile; fileRef = A78507D517CBC6FD0011F6E7 /* MapData.h */; settings = {ATTRIBUTES = (Private, ); }; };
A785F6BC18C553FE00F10626 /* SpillRegistersMode.h in Headers */ = {isa = PBXBuildFile; fileRef = A7FF647A18C52E8500B55307 /* SpillRegistersMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
A78A9774179738B8009DF744 /* DFGFailedFinalizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A78A976C179738B8009DF744 /* DFGFailedFinalizer.cpp */; };
A78A9775179738B8009DF744 /* DFGFailedFinalizer.h in Headers */ = {isa = PBXBuildFile; fileRef = A78A976D179738B8009DF744 /* DFGFailedFinalizer.h */; };
@@ -3445,7 +3443,6 @@
53FA2AE21CF380390022711D /* LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp; sourceTree = "<group>"; };
53FD04D11D7AB187003287D3 /* WASMCallingConvention.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WASMCallingConvention.cpp; sourceTree = "<group>"; };
53FD04D21D7AB187003287D3 /* WASMCallingConvention.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WASMCallingConvention.h; sourceTree = "<group>"; };
- 593D43CCA0BBE06D89C59707 /* MapDataInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapDataInlines.h; sourceTree = "<group>"; };
5D5D8AD00E0D0EBE00F9C692 /* libedit.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libedit.dylib; path = /usr/lib/libedit.dylib; sourceTree = "<absolute>"; };
5DAFD6CB146B686300FBEFB4 /* JSC.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = JSC.xcconfig; sourceTree = "<group>"; };
5DDDF44614FEE72200B4FB4D /* LLIntDesiredOffsets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLIntDesiredOffsets.h; path = LLIntOffsets/LLIntDesiredOffsets.h; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -4060,7 +4057,6 @@
A77F181F164088B200640A47 /* CodeCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CodeCache.cpp; sourceTree = "<group>"; };
A77F1820164088B200640A47 /* CodeCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeCache.h; sourceTree = "<group>"; };
A77F18241641925400640A47 /* ParserModes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ParserModes.h; sourceTree = "<group>"; };
- A78507D517CBC6FD0011F6E7 /* MapData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapData.h; sourceTree = "<group>"; };
A78A976C179738B8009DF744 /* DFGFailedFinalizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGFailedFinalizer.cpp; path = dfg/DFGFailedFinalizer.cpp; sourceTree = "<group>"; };
A78A976D179738B8009DF744 /* DFGFailedFinalizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGFailedFinalizer.h; path = dfg/DFGFailedFinalizer.h; sourceTree = "<group>"; };
A78A976E179738B8009DF744 /* DFGFinalizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGFinalizer.cpp; path = dfg/DFGFinalizer.cpp; sourceTree = "<group>"; };
@@ -6065,8 +6061,6 @@
795B19961D78BE3500262FA0 /* MapBase.h */,
A700873717CBE85300C3E643 /* MapConstructor.cpp */,
A700873817CBE85300C3E643 /* MapConstructor.h */,
- A78507D517CBC6FD0011F6E7 /* MapData.h */,
- 593D43CCA0BBE06D89C59707 /* MapDataInlines.h */,
A74DEF8D182D991400522C22 /* MapIteratorPrototype.cpp */,
A74DEF8E182D991400522C22 /* MapIteratorPrototype.h */,
A700873B17CBE8D300C3E643 /* MapPrototype.cpp */,
@@ -8108,9 +8102,7 @@
860161E50F3A83C100F84710 /* MacroAssemblerX86_64.h in Headers */,
860161E60F3A83C100F84710 /* MacroAssemblerX86Common.h in Headers */,
A700873A17CBE85300C3E643 /* MapConstructor.h in Headers */,
- A78507D717CBC6FD0011F6E7 /* MapData.h in Headers */,
0F37308F1C0CD68500052BFA /* DisallowMacroScratchRegisterUsage.h in Headers */,
- 0A6441519420A6C61AD1882E /* MapDataInlines.h in Headers */,
A74DEF94182D991400522C22 /* MapIteratorPrototype.h in Headers */,
A700873E17CBE8D300C3E643 /* MapPrototype.h in Headers */,
C2B916C214DA014E00CBAC86 /* MarkedAllocator.h in Headers */,
Modified: trunk/Source/_javascript_Core/heap/CopyToken.h (205653 => 205654)
--- trunk/Source/_javascript_Core/heap/CopyToken.h 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/_javascript_Core/heap/CopyToken.h 2016-09-08 18:59:02 UTC (rev 205654)
@@ -29,7 +29,6 @@
namespace JSC {
enum CopyToken {
- MapBackingStoreCopyToken,
DirectArgumentsOverridesCopyToken
};
Modified: trunk/Source/_javascript_Core/runtime/HashMapImpl.cpp (205653 => 205654)
--- trunk/Source/_javascript_Core/runtime/HashMapImpl.cpp 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/_javascript_Core/runtime/HashMapImpl.cpp 2016-09-08 18:59:02 UTC (rev 205654)
@@ -26,8 +26,7 @@
#include "config.h"
#include "HashMapImpl.h"
-#include "CopiedBlockInlines.h"
-#include "CopyVisitorInlines.h"
+#include "JSCInlines.h"
namespace JSC {
@@ -70,24 +69,9 @@
visitor.append(&thisObject->m_head);
visitor.append(&thisObject->m_tail);
-
- visitor.copyLater(thisObject, MapBackingStoreCopyToken, thisObject->m_buffer.get(), thisObject->bufferSizeInBytes());
+
+ if (thisObject->m_buffer)
+ visitor.markAuxiliary(thisObject->m_buffer.get());
}
-template <typename HashMapBucket>
-void HashMapImpl<HashMapBucket>::copyBackingStore(JSCell* cell, CopyVisitor& visitor, CopyToken token)
-{
- Base::copyBackingStore(cell, visitor, token);
-
- HashMapImpl* thisObject = jsCast<HashMapImpl*>(cell);
- if (token == MapBackingStoreCopyToken && visitor.checkIfShouldCopy(thisObject->m_buffer.get())) {
- HashMapBufferType* oldBuffer = thisObject->m_buffer.get();
- size_t bufferSizeInBytes = thisObject->bufferSizeInBytes();
- HashMapBufferType* newBuffer = static_cast<HashMapBufferType*>(visitor.allocateNewSpace(bufferSizeInBytes));
- memcpy(newBuffer, oldBuffer, bufferSizeInBytes);
- thisObject->m_buffer.setWithoutBarrier(newBuffer);
- visitor.didCopy(oldBuffer, bufferSizeInBytes);
- }
-}
-
} // namespace JSC
Modified: trunk/Source/_javascript_Core/runtime/HashMapImpl.h (205653 => 205654)
--- trunk/Source/_javascript_Core/runtime/HashMapImpl.h 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/_javascript_Core/runtime/HashMapImpl.h 2016-09-08 18:59:02 UTC (rev 205654)
@@ -25,7 +25,7 @@
#pragma once
-#include "JSCInlines.h"
+#include "ExceptionHelpers.h"
#include "JSObject.h"
namespace JSC {
@@ -151,9 +151,8 @@
{
auto scope = DECLARE_THROW_SCOPE(vm);
size_t allocationSize = HashMapBuffer::allocationSize(capacity);
- void* data = ""
- DeferGCForAWhile defer(vm.heap);
- if (!vm.heap.tryAllocateStorage(owner, allocationSize, &data)) {
+ void* data = "" allocationSize);
+ if (!data) {
throwOutOfMemoryError(exec, scope);
return nullptr;
}
@@ -259,7 +258,6 @@
}
static void visitChildren(JSCell*, SlotVisitor&);
- static void copyBackingStore(JSCell*, CopyVisitor&, CopyToken);
HashMapImpl(VM& vm, Structure* structure)
: Base(vm, structure)
@@ -515,7 +513,7 @@
WriteBarrier<HashMapBucketType> m_head;
WriteBarrier<HashMapBucketType> m_tail;
- CopyBarrier<HashMapBufferType> m_buffer;
+ AuxiliaryBarrier<HashMapBufferType*> m_buffer;
uint32_t m_size;
uint32_t m_deleteCount;
uint32_t m_capacity;
Modified: trunk/Source/_javascript_Core/runtime/JSMapIterator.cpp (205653 => 205654)
--- trunk/Source/_javascript_Core/runtime/JSMapIterator.cpp 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/_javascript_Core/runtime/JSMapIterator.cpp 2016-09-08 18:59:02 UTC (rev 205654)
@@ -28,7 +28,6 @@
#include "JSCInlines.h"
#include "JSMap.h"
-#include "MapDataInlines.h"
namespace JSC {
Modified: trunk/Source/_javascript_Core/runtime/JSMapIterator.h (205653 => 205654)
--- trunk/Source/_javascript_Core/runtime/JSMapIterator.h 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/_javascript_Core/runtime/JSMapIterator.h 2016-09-08 18:59:02 UTC (rev 205654)
@@ -29,7 +29,6 @@
#include "IterationKind.h"
#include "JSMap.h"
#include "JSObject.h"
-#include "MapData.h"
namespace JSC {
Modified: trunk/Source/_javascript_Core/runtime/JSSetIterator.cpp (205653 => 205654)
--- trunk/Source/_javascript_Core/runtime/JSSetIterator.cpp 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/_javascript_Core/runtime/JSSetIterator.cpp 2016-09-08 18:59:02 UTC (rev 205654)
@@ -28,7 +28,6 @@
#include "JSCInlines.h"
#include "JSSet.h"
-#include "MapDataInlines.h"
namespace JSC {
Modified: trunk/Source/_javascript_Core/runtime/JSSetIterator.h (205653 => 205654)
--- trunk/Source/_javascript_Core/runtime/JSSetIterator.h 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/_javascript_Core/runtime/JSSetIterator.h 2016-09-08 18:59:02 UTC (rev 205654)
@@ -30,8 +30,6 @@
#include "JSObject.h"
#include "JSSet.h"
-#include "MapData.h"
-
namespace JSC {
class JSSetIterator : public JSNonFinalObject {
Modified: trunk/Source/_javascript_Core/runtime/MapBase.cpp (205653 => 205654)
--- trunk/Source/_javascript_Core/runtime/MapBase.cpp 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/_javascript_Core/runtime/MapBase.cpp 2016-09-08 18:59:02 UTC (rev 205654)
@@ -26,7 +26,7 @@
#include "config.h"
#include "MapBase.h"
-#include "SlotVisitorInlines.h"
+#include "JSCInlines.h"
namespace JSC {
Deleted: trunk/Source/_javascript_Core/runtime/MapData.h (205653 => 205654)
--- trunk/Source/_javascript_Core/runtime/MapData.h 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/_javascript_Core/runtime/MapData.h 2016-09-08 18:59:02 UTC (rev 205654)
@@ -1,215 +0,0 @@
-/*
- * Copyright (C) 2013, 2015-2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef MapData_h
-#define MapData_h
-
-#include "CopyBarrier.h"
-#include "JSCell.h"
-#include "WeakGCMapInlines.h"
-#include <wtf/HashFunctions.h>
-#include <wtf/HashMap.h>
-#include <wtf/MathExtras.h>
-#include <wtf/RefPtr.h>
-
-namespace JSC {
-
-class ExecState;
-class VM;
-
-template<typename Entry, typename JSIterator>
-class MapDataImpl {
-public:
- enum : int32_t {
- minimumMapSize = 8
- };
-
- class IteratorData {
- public:
- friend class MapDataImpl;
-
- IteratorData(const MapDataImpl*);
- bool next(WTF::KeyValuePair<JSValue, JSValue>&);
-
- // This function is called while packing a map's backing store. The
- // passed-in index is the new index the entry would have after packing.
- void didRemoveEntry(int32_t packedIndex)
- {
- if (isFinished())
- return;
-
- if (m_index <= packedIndex)
- return;
-
- --m_index;
- }
-
- void didRemoveAllEntries()
- {
- if (isFinished())
- return;
- m_index = 0;
- }
-
- void finish()
- {
- m_index = -1;
- }
-
- private:
- bool ensureSlot() const;
- bool isFinished() const { return m_index == -1; }
- int32_t refreshCursor() const;
-
- const MapDataImpl* m_mapData;
- mutable int32_t m_index;
- };
- STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(IteratorData);
-
- struct KeyType {
- ALWAYS_INLINE KeyType() { }
- KeyType(JSValue);
- JSValue value;
- };
-
- MapDataImpl(VM&, JSCell* owner);
-
- void set(ExecState*, JSCell* owner, KeyType, JSValue);
- JSValue get(ExecState*, KeyType);
- bool remove(ExecState*, KeyType);
- bool contains(ExecState*, KeyType);
- size_t size(ExecState*) const { return m_size - m_deletedCount; }
-
- IteratorData createIteratorData(JSIterator*);
-
- void clear();
-
- void visitChildren(JSCell* owner, SlotVisitor&);
- void copyBackingStore(CopyVisitor&, CopyToken);
-
- size_t capacityInBytes() const { return m_capacity * sizeof(Entry); }
-
-private:
- typedef WTF::UnsignedWithZeroKeyHashTraits<int32_t> IndexTraits;
-
- typedef HashMap<JSCell*, int32_t, typename WTF::DefaultHash<JSCell*>::Hash, WTF::HashTraits<JSCell*>, IndexTraits> CellKeyedMap;
- typedef HashMap<EncodedJSValue, int32_t, EncodedJSValueHash, EncodedJSValueHashTraits, IndexTraits> ValueKeyedMap;
- typedef HashMap<StringImpl*, int32_t, typename WTF::DefaultHash<StringImpl*>::Hash, WTF::HashTraits<StringImpl*>, IndexTraits> StringKeyedMap;
-
- ALWAYS_INLINE Entry* find(ExecState*, KeyType);
- ALWAYS_INLINE Entry* add(ExecState*, JSCell* owner, KeyType);
- template <typename Map, typename Key> ALWAYS_INLINE Entry* add(ExecState*, JSCell* owner, Map&, Key, KeyType);
-
- ALWAYS_INLINE bool shouldPack() const { return m_deletedCount; }
- CheckedBoolean ensureSpaceForAppend(ExecState*, JSCell* owner);
-
- ALWAYS_INLINE void replaceAndPackBackingStore(Entry* destination, int32_t newSize);
- ALWAYS_INLINE void replaceBackingStore(Entry* destination, int32_t newSize);
-
- CellKeyedMap m_cellKeyedTable;
- ValueKeyedMap m_valueKeyedTable;
- StringKeyedMap m_stringKeyedTable;
- int32_t m_capacity;
- int32_t m_size;
- int32_t m_deletedCount;
- JSCell* m_owner;
- CopyBarrier<Entry> m_entries;
- WeakGCMap<JSIterator*, JSIterator> m_iterators;
-};
-
-template<typename Entry, typename JSIterator>
-ALWAYS_INLINE MapDataImpl<Entry, JSIterator>::MapDataImpl(VM& vm, JSCell* owner)
- : m_capacity(0)
- , m_size(0)
- , m_deletedCount(0)
- , m_owner(owner)
- , m_iterators(vm)
-{
-}
-
-template<typename Entry, typename JSIterator>
-ALWAYS_INLINE MapDataImpl<Entry, JSIterator>::KeyType::KeyType(JSValue v)
-{
- if (!v.isDouble()) {
- value = v;
- return;
- }
- double d = v.asDouble();
- if (std::isnan(d)) {
- value = v;
- return;
- }
-
- int i = static_cast<int>(v.asDouble());
- if (i != d)
- value = v;
- else
- value = jsNumber(i);
-}
-
-template<typename Entry, typename JSIterator>
-ALWAYS_INLINE MapDataImpl<Entry, JSIterator>::IteratorData::IteratorData(const MapDataImpl<Entry, JSIterator>* mapData)
- : m_mapData(mapData)
- , m_index(0)
-{
-}
-
-template<typename Entry, typename JSIterator>
-ALWAYS_INLINE bool MapDataImpl<Entry, JSIterator>::IteratorData::next(WTF::KeyValuePair<JSValue, JSValue>& pair)
-{
- if (!ensureSlot())
- return false;
- Entry* entry = &m_mapData->m_entries.get()[m_index];
- pair = WTF::KeyValuePair<JSValue, JSValue>(entry->key().get(), entry->value().get());
- m_index += 1;
- return true;
-}
-
-// This is a bit gnarly. We use an index of -1 to indicate the
-// finished state. By casting to unsigned we can immediately
-// test if both iterators are at the end of their iteration.
-template<typename Entry, typename JSIterator>
-ALWAYS_INLINE bool MapDataImpl<Entry, JSIterator>::IteratorData::ensureSlot() const
-{
- int32_t index = refreshCursor();
- return static_cast<size_t>(index) < static_cast<size_t>(m_mapData->m_size);
-}
-
-template<typename Entry, typename JSIterator>
-ALWAYS_INLINE int32_t MapDataImpl<Entry, JSIterator>::IteratorData::refreshCursor() const
-{
- if (isFinished())
- return m_index;
-
- Entry* entries = m_mapData->m_entries.get();
- size_t end = m_mapData->m_size;
- while (static_cast<size_t>(m_index) < end && !entries[m_index].key())
- m_index++;
- return m_index;
-}
-
-}
-
-#endif /* !defined(MapData_h) */
Deleted: trunk/Source/_javascript_Core/runtime/MapDataInlines.h (205653 => 205654)
--- trunk/Source/_javascript_Core/runtime/MapDataInlines.h 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/_javascript_Core/runtime/MapDataInlines.h 2016-09-08 18:59:02 UTC (rev 205654)
@@ -1,270 +0,0 @@
-/*
- * Copyright (C) 2013, 2016 Apple Inc. All rights reserved.
- * Copyright (C) 2015 Yusuke Suzuki <[email protected]>.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "CopiedAllocator.h"
-#include "CopyVisitorInlines.h"
-#include "ExceptionHelpers.h"
-#include "JSCJSValueInlines.h"
-#include "MapData.h"
-#include "SlotVisitorInlines.h"
-
-namespace JSC {
-
-template<typename Entry, typename JSIterator>
-inline void MapDataImpl<Entry, JSIterator>::clear()
-{
- m_cellKeyedTable.clear();
- m_valueKeyedTable.clear();
- m_stringKeyedTable.clear();
- m_capacity = 0;
- m_size = 0;
- m_deletedCount = 0;
- m_entries.clear();
- m_iterators.forEach([](JSIterator* iterator, JSIterator*) {
- iterator->iteratorData()->didRemoveAllEntries();
- });
-}
-
-template<typename Entry, typename JSIterator>
-inline Entry* MapDataImpl<Entry, JSIterator>::find(ExecState* exec, KeyType key)
-{
- if (key.value.isString()) {
- auto iter = m_stringKeyedTable.find(asString(key.value)->value(exec).impl());
- if (iter == m_stringKeyedTable.end())
- return 0;
- return &m_entries.get()[iter->value];
- }
- if (key.value.isCell()) {
- auto iter = m_cellKeyedTable.find(key.value.asCell());
- if (iter == m_cellKeyedTable.end())
- return 0;
- return &m_entries.get()[iter->value];
- }
-
- auto iter = m_valueKeyedTable.find(JSValue::encode(key.value));
- if (iter == m_valueKeyedTable.end())
- return 0;
- return &m_entries.get()[iter->value];
-}
-
-template<typename Entry, typename JSIterator>
-inline bool MapDataImpl<Entry, JSIterator>::contains(ExecState* exec, KeyType key)
-{
- return find(exec, key);
-}
-
-template<typename Entry, typename JSIterator>
-template <typename Map, typename Key>
-inline Entry* MapDataImpl<Entry, JSIterator>::add(ExecState* exec, JSCell* owner, Map& map, Key key, KeyType keyValue)
-{
- typename Map::iterator location = map.find(key);
- if (location != map.end())
- return &m_entries.get()[location->value];
-
- if (!ensureSpaceForAppend(exec, owner))
- return 0;
-
- auto result = map.add(key, m_size);
- RELEASE_ASSERT(result.isNewEntry);
- Entry* entry = &m_entries.get()[m_size++];
- new (entry) Entry();
- entry->setKey(exec->vm(), owner, keyValue.value);
- return entry;
-}
-
-template<typename Entry, typename JSIterator>
-inline void MapDataImpl<Entry, JSIterator>::set(ExecState* exec, JSCell* owner, KeyType key, JSValue value)
-{
- Entry* location = add(exec, owner, key);
- if (!location)
- return;
- location->setValue(exec->vm(), owner, value);
-}
-
-template<typename Entry, typename JSIterator>
-inline Entry* MapDataImpl<Entry, JSIterator>::add(ExecState* exec, JSCell* owner, KeyType key)
-{
- if (key.value.isString())
- return add(exec, owner, m_stringKeyedTable, asString(key.value)->value(exec).impl(), key);
- if (key.value.isCell())
- return add(exec, owner, m_cellKeyedTable, key.value.asCell(), key);
- return add(exec, owner, m_valueKeyedTable, JSValue::encode(key.value), key);
-}
-
-template<typename Entry, typename JSIterator>
-inline JSValue MapDataImpl<Entry, JSIterator>::get(ExecState* exec, KeyType key)
-{
- if (Entry* entry = find(exec, key))
- return entry->value().get();
- return JSValue();
-}
-
-template<typename Entry, typename JSIterator>
-inline bool MapDataImpl<Entry, JSIterator>::remove(ExecState* exec, KeyType key)
-{
- int32_t location;
- if (key.value.isString()) {
- auto iter = m_stringKeyedTable.find(asString(key.value)->value(exec).impl());
- if (iter == m_stringKeyedTable.end())
- return false;
- location = iter->value;
- m_stringKeyedTable.remove(iter);
- } else if (key.value.isCell()) {
- auto iter = m_cellKeyedTable.find(key.value.asCell());
- if (iter == m_cellKeyedTable.end())
- return false;
- location = iter->value;
- m_cellKeyedTable.remove(iter);
- } else {
- auto iter = m_valueKeyedTable.find(JSValue::encode(key.value));
- if (iter == m_valueKeyedTable.end())
- return false;
- location = iter->value;
- m_valueKeyedTable.remove(iter);
- }
- m_entries.get()[location].clear();
- m_deletedCount++;
- return true;
-}
-
-template<typename Entry, typename JSIterator>
-inline void MapDataImpl<Entry, JSIterator>::replaceAndPackBackingStore(Entry* destination, int32_t newCapacity)
-{
- ASSERT(shouldPack());
- int32_t newEnd = 0;
- RELEASE_ASSERT(newCapacity > 0);
- for (int32_t i = 0; i < m_size; i++) {
- Entry& entry = m_entries.get()[i];
- if (!entry.key()) {
- m_iterators.forEach([newEnd](JSIterator* iterator, JSIterator*) {
- iterator->iteratorData()->didRemoveEntry(newEnd);
- });
- continue;
- }
- ASSERT(newEnd < newCapacity);
- destination[newEnd] = entry;
-
- // We overwrite the old entry with a forwarding index for the new entry,
- // so that we can fix up our hash tables below without doing additional
- // hash lookups
- entry.setKeyWithoutWriteBarrier(jsNumber(newEnd));
- newEnd++;
- }
-
- // Fixup for the hashmaps
- for (auto ptr = m_valueKeyedTable.begin(); ptr != m_valueKeyedTable.end(); ++ptr)
- ptr->value = m_entries.get()[ptr->value].key().get().asInt32();
- for (auto ptr = m_cellKeyedTable.begin(); ptr != m_cellKeyedTable.end(); ++ptr)
- ptr->value = m_entries.get()[ptr->value].key().get().asInt32();
- for (auto ptr = m_stringKeyedTable.begin(); ptr != m_stringKeyedTable.end(); ++ptr)
- ptr->value = m_entries.get()[ptr->value].key().get().asInt32();
-
- ASSERT((m_size - newEnd) == m_deletedCount);
- m_deletedCount = 0;
-
- m_capacity = newCapacity;
- m_size = newEnd;
- m_entries.setWithoutBarrier(destination);
-}
-
-template<typename Entry, typename JSIterator>
-inline void MapDataImpl<Entry, JSIterator>::replaceBackingStore(Entry* destination, int32_t newCapacity)
-{
- ASSERT(!shouldPack());
- RELEASE_ASSERT(newCapacity > 0);
- ASSERT(newCapacity >= m_capacity);
- memcpy(destination, m_entries.get(), sizeof(Entry) * m_size);
- m_capacity = newCapacity;
- m_entries.setWithoutBarrier(destination);
-}
-
-template<typename Entry, typename JSIterator>
-inline CheckedBoolean MapDataImpl<Entry, JSIterator>::ensureSpaceForAppend(ExecState* exec, JSCell* owner)
-{
- VM& vm = exec->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (m_capacity > m_size)
- return true;
-
- size_t requiredSize = std::max(m_capacity + (m_capacity / 2) + 1, static_cast<int32_t>(minimumMapSize));
- void* newStorage = nullptr;
- DeferGC defer(*exec->heap());
- if (!exec->heap()->tryAllocateStorage(owner, requiredSize * sizeof(Entry), &newStorage)) {
- throwOutOfMemoryError(exec, scope);
- return false;
- }
- Entry* newEntries = static_cast<Entry*>(newStorage);
- if (shouldPack())
- replaceAndPackBackingStore(newEntries, requiredSize);
- else
- replaceBackingStore(newEntries, requiredSize);
- exec->heap()->writeBarrier(owner);
- return true;
-}
-
-template<typename Entry, typename JSIterator>
-inline void MapDataImpl<Entry, JSIterator>::visitChildren(JSCell* owner, SlotVisitor& visitor)
-{
- Entry* entries = m_entries.get();
- if (!entries)
- return;
- if (m_deletedCount) {
- for (int32_t i = 0; i < m_size; i++) {
- if (!entries[i].key())
- continue;
- entries[i].visitChildren(visitor);
- }
- } else {
- // Guaranteed that all fields of Entry type is WriteBarrier<Unknown>.
- visitor.appendValues(reinterpret_cast<WriteBarrier<Unknown>*>(&entries[0]), m_size * (sizeof(Entry) / sizeof(WriteBarrier<Unknown>)));
- }
-
- visitor.copyLater(owner, MapBackingStoreCopyToken, m_entries.get(), capacityInBytes());
-}
-
-template<typename Entry, typename JSIterator>
-inline void MapDataImpl<Entry, JSIterator>::copyBackingStore(CopyVisitor& visitor, CopyToken token)
-{
- if (token == MapBackingStoreCopyToken && visitor.checkIfShouldCopy(m_entries.get())) {
- Entry* oldEntries = m_entries.get();
- Entry* newEntries = static_cast<Entry*>(visitor.allocateNewSpace(capacityInBytes()));
- if (shouldPack())
- replaceAndPackBackingStore(newEntries, m_capacity);
- else
- replaceBackingStore(newEntries, m_capacity);
- visitor.didCopy(oldEntries, capacityInBytes());
- }
-}
-
-template<typename Entry, typename JSIterator>
-inline auto MapDataImpl<Entry, JSIterator>::createIteratorData(JSIterator* iterator) -> IteratorData
-{
- m_iterators.set(iterator, iterator);
- return IteratorData(this);
-}
-
-}
Modified: trunk/Source/_javascript_Core/runtime/MapPrototype.cpp (205653 => 205654)
--- trunk/Source/_javascript_Core/runtime/MapPrototype.cpp 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/_javascript_Core/runtime/MapPrototype.cpp 2016-09-08 18:59:02 UTC (rev 205654)
@@ -35,7 +35,6 @@
#include "JSMap.h"
#include "JSMapIterator.h"
#include "Lookup.h"
-#include "MapDataInlines.h"
#include "MapPrototype.lut.h"
Modified: trunk/Source/_javascript_Core/runtime/SetConstructor.cpp (205653 => 205654)
--- trunk/Source/_javascript_Core/runtime/SetConstructor.cpp 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/_javascript_Core/runtime/SetConstructor.cpp 2016-09-08 18:59:02 UTC (rev 205654)
@@ -33,7 +33,6 @@
#include "JSGlobalObject.h"
#include "JSObjectInlines.h"
#include "JSSet.h"
-#include "MapData.h"
#include "SetPrototype.h"
namespace JSC {
Modified: trunk/Source/_javascript_Core/runtime/SetPrototype.cpp (205653 => 205654)
--- trunk/Source/_javascript_Core/runtime/SetPrototype.cpp 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/_javascript_Core/runtime/SetPrototype.cpp 2016-09-08 18:59:02 UTC (rev 205654)
@@ -35,7 +35,6 @@
#include "JSSet.h"
#include "JSSetIterator.h"
#include "Lookup.h"
-#include "MapDataInlines.h"
#include "SetPrototype.lut.h"
Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (205653 => 205654)
--- trunk/Source/_javascript_Core/runtime/VM.cpp 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp 2016-09-08 18:59:02 UTC (rev 205654)
@@ -73,7 +73,6 @@
#include "LLIntData.h"
#include "Lexer.h"
#include "Lookup.h"
-#include "MapData.h"
#include "NativeStdFunctionCell.h"
#include "Nodes.h"
#include "Parser.h"
Modified: trunk/Source/WebCore/ChangeLog (205653 => 205654)
--- trunk/Source/WebCore/ChangeLog 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/WebCore/ChangeLog 2016-09-08 18:59:02 UTC (rev 205654)
@@ -1,3 +1,14 @@
+2016-09-08 Filip Pizlo <[email protected]>
+
+ Move JSMap/JSSet over to Auxiliary MarkedSpace
+ https://bugs.webkit.org/show_bug.cgi?id=161744
+
+ Reviewed by Saam Barati.
+
+ No new tests because no change in behavior.
+
+ * bindings/js/SerializedScriptValue.cpp:
+
2016-09-08 Commit Queue <[email protected]>
Unreviewed, rolling out r205652.
Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (205653 => 205654)
--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2016-09-08 18:48:15 UTC (rev 205653)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2016-09-08 18:59:02 UTC (rev 205654)
@@ -70,8 +70,6 @@
#include <runtime/JSSet.h>
#include <runtime/JSSetIterator.h>
#include <runtime/JSTypedArrays.h>
-#include <runtime/MapData.h>
-#include <runtime/MapDataInlines.h>
#include <runtime/ObjectConstructor.h>
#include <runtime/PropertyNameArray.h>
#include <runtime/RegExp.h>