Replace use of WTF::FixedArray with std::array
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Dec 2013 01:28:05 +0000 (01:28 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Dec 2013 01:28:05 +0000 (01:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=125475

Reviewed by Anders Carlsson.

../JavaScriptCore:

* bytecode/CodeBlockHash.cpp:
(JSC::CodeBlockHash::dump):
* bytecode/Opcode.cpp:
(JSC::OpcodeStats::~OpcodeStats):
* dfg/DFGCSEPhase.cpp:
* ftl/FTLAbstractHeap.h:
* heap/MarkedSpace.h:
* parser/ParserArena.h:
* runtime/CodeCache.h:
* runtime/DateInstanceCache.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset):
* runtime/JSGlobalObject.h:
* runtime/JSString.h:
* runtime/LiteralParser.h:
* runtime/NumericStrings.h:
* runtime/RegExpCache.h:
* runtime/SmallStrings.h:

../WebCore:

* crypto/parameters/CryptoAlgorithmAesCbcParams.h:
* platform/graphics/GlyphMetricsMap.h:

../WTF:

* wtf/AVLTree.h:
* wtf/Bitmap.h:
* wtf/SixCharacterHash.cpp:
(WTF::integerToSixCharacterHashString):
* wtf/SixCharacterHash.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@160344 268f45cc-cd09-0410-ab3c-d52691b4dbfc

24 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/CodeBlockHash.cpp
Source/JavaScriptCore/bytecode/Opcode.cpp
Source/JavaScriptCore/dfg/DFGCSEPhase.cpp
Source/JavaScriptCore/ftl/FTLAbstractHeap.h
Source/JavaScriptCore/heap/MarkedSpace.h
Source/JavaScriptCore/parser/ParserArena.h
Source/JavaScriptCore/runtime/CodeCache.h
Source/JavaScriptCore/runtime/DateInstanceCache.h
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/JSGlobalObject.h
Source/JavaScriptCore/runtime/JSString.h
Source/JavaScriptCore/runtime/LiteralParser.h
Source/JavaScriptCore/runtime/NumericStrings.h
Source/JavaScriptCore/runtime/RegExpCache.h
Source/JavaScriptCore/runtime/SmallStrings.h
Source/WTF/ChangeLog
Source/WTF/wtf/AVLTree.h
Source/WTF/wtf/Bitmap.h
Source/WTF/wtf/SixCharacterHash.cpp
Source/WTF/wtf/SixCharacterHash.h
Source/WebCore/ChangeLog
Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h
Source/WebCore/platform/graphics/GlyphMetricsMap.h

index a18ace1..be87847 100644 (file)
@@ -1,3 +1,29 @@
+2013-12-09  Sam Weinig  <sam@webkit.org>
+
+        Replace use of WTF::FixedArray with std::array
+        https://bugs.webkit.org/show_bug.cgi?id=125475
+
+        Reviewed by Anders Carlsson.
+
+        * bytecode/CodeBlockHash.cpp:
+        (JSC::CodeBlockHash::dump):
+        * bytecode/Opcode.cpp:
+        (JSC::OpcodeStats::~OpcodeStats):
+        * dfg/DFGCSEPhase.cpp:
+        * ftl/FTLAbstractHeap.h:
+        * heap/MarkedSpace.h:
+        * parser/ParserArena.h:
+        * runtime/CodeCache.h:
+        * runtime/DateInstanceCache.h:
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::reset):
+        * runtime/JSGlobalObject.h:
+        * runtime/JSString.h:
+        * runtime/LiteralParser.h:
+        * runtime/NumericStrings.h:
+        * runtime/RegExpCache.h:
+        * runtime/SmallStrings.h:
+
 2013-12-09  Joseph Pecoraro  <pecoraro@apple.com>
 
         Remove miscellaneous unnecessary build statements
index 4d59fab..662d885 100644 (file)
@@ -54,7 +54,7 @@ CodeBlockHash::CodeBlockHash(const SourceCode& sourceCode, CodeSpecializationKin
 
 void CodeBlockHash::dump(PrintStream& out) const
 {
-    FixedArray<char, 7> buffer = integerToSixCharacterHashString(m_hash);
+    std::array<char, 7> buffer = integerToSixCharacterHashString(m_hash);
     
 #if !ASSERT_DISABLED
     CodeBlockHash recompute(buffer.data());
index 4560ac7..92ce8bb 100644 (file)
@@ -31,8 +31,8 @@
 #include "Opcode.h"
 
 #if ENABLE(OPCODE_STATS)
+#include <array>
 #include <wtf/DataLog.h>
-#include <wtf/FixedArray.h>
 #endif
 
 using namespace std;
@@ -102,7 +102,7 @@ OpcodeStats::~OpcodeStats()
         for (int j = 0; j < numOpcodeIDs; ++j)
             totalInstructionPairs += opcodePairCounts[i][j];
 
-    FixedArray<int, numOpcodeIDs> sortedIndices;
+    std::array<int, numOpcodeIDs> sortedIndices;
     for (int i = 0; i < numOpcodeIDs; ++i)
         sortedIndices[i] = i;
     qsort(sortedIndices.data(), numOpcodeIDs, sizeof(int), compareOpcodeIndices);
index 9effa26..28ecf30 100644 (file)
@@ -32,6 +32,7 @@
 #include "DFGGraph.h"
 #include "DFGPhase.h"
 #include "JSCellInlines.h"
+#include <array>
 #include <wtf/FastBitVector.h>
 
 namespace JSC { namespace DFG {
@@ -1410,7 +1411,7 @@ private:
     BasicBlock* m_currentBlock;
     Node* m_currentNode;
     unsigned m_indexInBlock;
-    FixedArray<unsigned, LastNodeType> m_lastSeen;
+    std::array<unsigned, LastNodeType> m_lastSeen;
     bool m_changed; // Only tracks changes that have a substantive effect on other optimizations.
 };
 
index 7dea9e5..e92a2fc 100644 (file)
@@ -32,8 +32,8 @@
 
 #include "FTLAbbreviations.h"
 #include "JSCJSValue.h"
+#include <array>
 #include <wtf/FastMalloc.h>
-#include <wtf/FixedArray.h>
 #include <wtf/HashMap.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/OwnPtr.h>
@@ -171,7 +171,7 @@ private:
     size_t m_elementSize;
     LValue m_scaleTerm;
     bool m_canShift;
-    FixedArray<AbstractField, 16> m_smallIndices;
+    std::array<AbstractField, 16> m_smallIndices;
     
     struct WithoutZeroOrOneHashTraits : WTF::GenericHashTraits<ptrdiff_t> {
         static void constructDeletedValue(ptrdiff_t& slot) { slot = 1; }
index 2cfad77..9680670 100644 (file)
 #include "MarkedAllocator.h"
 #include "MarkedBlock.h"
 #include "MarkedBlockSet.h"
+#include <array>
 #include <wtf/PageAllocationAligned.h>
 #include <wtf/Bitmap.h>
 #include <wtf/DoublyLinkedList.h>
-#include <wtf/FixedArray.h>
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/Vector.h>
@@ -137,8 +137,8 @@ private:
     static const size_t impreciseCount = impreciseCutoff / impreciseStep;
 
     struct Subspace {
-        FixedArray<MarkedAllocator, preciseCount> preciseAllocators;
-        FixedArray<MarkedAllocator, impreciseCount> impreciseAllocators;
+        std::array<MarkedAllocator, preciseCount> preciseAllocators;
+        std::array<MarkedAllocator, impreciseCount> impreciseAllocators;
         MarkedAllocator largeAllocator;
     };
 
index 4f1352d..e806d45 100644 (file)
@@ -27,6 +27,7 @@
 #define ParserArena_h
 
 #include "Identifier.h"
+#include <array>
 #include <wtf/SegmentedVector.h>
 
 namespace JSC {
@@ -64,8 +65,8 @@ namespace JSC {
 
     private:
         IdentifierVector m_identifiers;
-        FixedArray<Identifier*, MaximumCachableCharacter> m_shortIdentifiers;
-        FixedArray<Identifier*, MaximumCachableCharacter> m_recentIdentifiers;
+        std::array<Identifier*, MaximumCachableCharacter> m_shortIdentifiers;
+        std::array<Identifier*, MaximumCachableCharacter> m_recentIdentifiers;
     };
 
     template <typename T>
index 1628e5e..f3ff747 100644 (file)
@@ -32,7 +32,6 @@
 #include "Strong.h"
 #include "WeakRandom.h"
 #include <wtf/CurrentTime.h>
-#include <wtf/FixedArray.h>
 #include <wtf/Forward.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/RandomNumber.h>
index 7aa23f2..1c8c011 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "JSCJSValue.h"
 #include "JSDateMath.h"
-#include <wtf/FixedArray.h>
+#include <array>
 #include <wtf/HashFunctions.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
@@ -86,7 +86,7 @@ namespace JSC {
 
         CacheEntry& lookup(double d) { return m_cache[WTF::FloatHash<double>::hash(d) & (cacheSize - 1)]; }
 
-        FixedArray<CacheEntry, cacheSize> m_cache;
+        std::array<CacheEntry, cacheSize> m_cache;
     };
 
 } // namespace JSC
index b337a7e..3c025c1 100644 (file)
@@ -428,7 +428,7 @@ void JSGlobalObject::reset(JSValue prototype)
     putDirectWithoutTransition(vm, vm.propertyNames->JSON, JSONObject::create(vm, JSONObject::createStructure(vm, this, m_objectPrototype.get())), DontEnum);
     putDirectWithoutTransition(vm, vm.propertyNames->Math, MathObject::create(vm, this, MathObject::createStructure(vm, this, m_objectPrototype.get())), DontEnum);
     
-    FixedArray<InternalFunction*, NUMBER_OF_TYPED_ARRAY_TYPES> typedArrayConstructors;
+    std::array<InternalFunction*, NUMBER_OF_TYPED_ARRAY_TYPES> typedArrayConstructors;
     typedArrayConstructors[toIndex(TypeInt8)] = JSInt8ArrayConstructor::create(vm, JSInt8ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt8)].prototype.get(), "Int8Array");
     typedArrayConstructors[toIndex(TypeInt16)] = JSInt16ArrayConstructor::create(vm, JSInt16ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt16)].prototype.get(), "Int16Array");
     typedArrayConstructors[toIndex(TypeInt32)] = JSInt32ArrayConstructor::create(vm, JSInt32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt32)].prototype.get(), "Int32Array");
index 3250d7c..a681a79 100644 (file)
@@ -37,6 +37,7 @@
 #include "VM.h"
 #include "Watchpoint.h"
 #include <JavaScriptCore/JSBase.h>
+#include <array>
 #include <wtf/HashSet.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassRefPtr.h>
@@ -227,7 +228,7 @@ protected:
         WriteBarrier<Structure> structure;
     };
     
-    FixedArray<TypedArrayData, NUMBER_OF_TYPED_ARRAY_TYPES> m_typedArrays;
+    std::array<TypedArrayData, NUMBER_OF_TYPED_ARRAY_TYPES> m_typedArrays;
         
     void* m_specialPointers[Special::TableSize]; // Special pointers used by the LLInt and JIT.
 
index e49e532..2b1cddd 100644 (file)
 
 #ifndef JSString_h
 #define JSString_h
+
 #include "CallFrame.h"
 #include "CommonIdentifiers.h"
 #include "Identifier.h"
 #include "PropertyDescriptor.h"
 #include "PropertySlot.h"
 #include "Structure.h"
+#include <array>
 
 namespace JSC {
 
@@ -322,7 +324,7 @@ namespace JSC {
             
         JS_EXPORT_PRIVATE JSString* getIndexSlowCase(ExecState*, unsigned);
 
-        mutable FixedArray<WriteBarrier<JSString>, s_maxInternalRopeLength> m_fibers;
+        mutable std::array<WriteBarrier<JSString>, s_maxInternalRopeLength> m_fibers;
     };
 
 
index fac9757..f05f032 100644 (file)
@@ -29,6 +29,7 @@
 #include "Identifier.h"
 #include "JSCJSValue.h"
 #include "JSGlobalObjectFunctions.h"
+#include <array>
 #include <wtf/text/WTFString.h>
 
 namespace JSC {
@@ -155,8 +156,8 @@ private:
     ParserMode m_mode;
     String m_parseErrorMessage;
     static unsigned const MaximumCachableCharacter = 128;
-    FixedArray<Identifier, MaximumCachableCharacter> m_shortIdentifiers;
-    FixedArray<Identifier, MaximumCachableCharacter> m_recentIdentifiers;
+    std::array<Identifier, MaximumCachableCharacter> m_shortIdentifiers;
+    std::array<Identifier, MaximumCachableCharacter> m_recentIdentifiers;
     ALWAYS_INLINE const Identifier makeIdentifier(const LChar* characters, size_t length);
     ALWAYS_INLINE const Identifier makeIdentifier(const UChar* characters, size_t length);
     };
index 4cd92fc..3bb5b91 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef NumericStrings_h
 #define NumericStrings_h
 
-#include <wtf/FixedArray.h>
+#include <array>
 #include <wtf/HashFunctions.h>
 #include <wtf/text/WTFString.h>
 
@@ -87,10 +87,10 @@ namespace JSC {
             return smallIntCache[i];
         }
 
-        FixedArray<CacheEntry<double>, cacheSize> doubleCache;
-        FixedArray<CacheEntry<int>, cacheSize> intCache;
-        FixedArray<CacheEntry<unsigned>, cacheSize> unsignedCache;
-        FixedArray<String, cacheSize> smallIntCache;
+        std::array<CacheEntry<double>, cacheSize> doubleCache;
+        std::array<CacheEntry<int>, cacheSize> intCache;
+        std::array<CacheEntry<unsigned>, cacheSize> unsignedCache;
+        std::array<String, cacheSize> smallIntCache;
     };
 
 } // namespace JSC
index 5193ac6..267eb35 100644 (file)
@@ -30,7 +30,7 @@
 #include "Strong.h"
 #include "Weak.h"
 #include "WeakInlines.h"
-#include <wtf/FixedArray.h>
+#include <array>
 #include <wtf/HashMap.h>
 
 #ifndef RegExpCache_h
@@ -58,7 +58,7 @@ private:
     void addToStrongCache(RegExp*);
     RegExpCacheMap m_weakCache; // Holds all regular expressions currently live.
     int m_nextEntryInStrongCache;
-    WTF::FixedArray<Strong<RegExp>, maxStrongCacheableEntries> m_strongCache; // Holds a select few regular expressions that have compiled and executed
+    std::array<Strong<RegExp>, maxStrongCacheableEntries> m_strongCache; // Holds a select few regular expressions that have compiled and executed
     VM* m_vm;
 };
 
index aeb7bcc..0e8646a 100644 (file)
@@ -27,8 +27,6 @@
 #define SmallStrings_h
 
 #include "WriteBarrier.h"
-
-#include <wtf/FixedArray.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/OwnPtr.h>
 
index 7514840..f6839ae 100644 (file)
@@ -1,3 +1,16 @@
+2013-12-09  Sam Weinig  <sam@webkit.org>
+
+        Replace use of WTF::FixedArray with std::array
+        https://bugs.webkit.org/show_bug.cgi?id=125475
+
+        Reviewed by Anders Carlsson.
+
+        * wtf/AVLTree.h:
+        * wtf/Bitmap.h:
+        * wtf/SixCharacterHash.cpp:
+        (WTF::integerToSixCharacterHashString):
+        * wtf/SixCharacterHash.h:
+
 2013-12-06  Roger Fong <roger_fong@apple.com> and Brent Fulgham  <bfulgham@apple.com>
 
         [Win] Support compiling with VS2013
index bc3acad..61d76fb 100644 (file)
@@ -32,8 +32,8 @@
 #ifndef AVL_TREE_H_
 #define AVL_TREE_H_
 
+#include <array>
 #include <wtf/Assertions.h>
-#include <wtf/FixedArray.h>
 
 namespace WTF {
 
@@ -71,7 +71,7 @@ public:
     void reset() { for (unsigned i = 0; i < maxDepth; ++i) m_data[i] = false; }
 
 private:
-    FixedArray<bool, maxDepth> m_data;
+    std::array<bool, maxDepth> m_data;
 };
 
 // How to determine maxDepth:
index 492e0b8..936ccc2 100644 (file)
@@ -19,8 +19,8 @@
 #ifndef Bitmap_h
 #define Bitmap_h
 
+#include <array>
 #include <wtf/Atomics.h>
-#include <wtf/FixedArray.h>
 #include <wtf/StdLibExtras.h>
 #include <stdint.h>
 #include <string.h>
@@ -66,7 +66,7 @@ private:
     // a 64 bit unsigned int would give 0xffff8000
     static const WordType one = 1;
 
-    FixedArray<WordType, words> bits;
+    std::array<WordType, words> bits;
 };
 
 template<size_t size, BitmapAtomicMode atomicMode, typename WordType>
index cbfede4..a5c7367 100644 (file)
@@ -58,11 +58,11 @@ unsigned sixCharacterHashStringToInteger(const char* string)
     return hash;
 }
 
-FixedArray<char, 7> integerToSixCharacterHashString(unsigned hash)
+std::array<char, 7> integerToSixCharacterHashString(unsigned hash)
 {
-    ASSERT(strlen(TABLE) == 62);
-    
-    FixedArray<char, 7> buffer;
+    static_assert(WTF_ARRAY_LENGTH(TABLE) - 1 == 62, "Six character hash table is not 62 characters long.");
+
+    std::array<char, 7> buffer;
     unsigned accumulator = hash;
     for (unsigned i = 6; i--;) {
         buffer[i] = TABLE[accumulator % 62];
index ac340ba..c5287d8 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef SixCharacterHash_h
 #define SixCharacterHash_h
 
-#include <wtf/FixedArray.h>
+#include <array>
 
 namespace WTF {
 
@@ -37,7 +37,7 @@ WTF_EXPORT_PRIVATE unsigned sixCharacterHashStringToInteger(const char*);
 
 // Takes a 32-bit integer and constructs a six-character string that contains
 // the character hash.
-WTF_EXPORT_PRIVATE FixedArray<char, 7> integerToSixCharacterHashString(unsigned);
+WTF_EXPORT_PRIVATE std::array<char, 7> integerToSixCharacterHashString(unsigned);
 
 } // namespace WTF
 
index fc383e7..f4aa6ad 100644 (file)
@@ -1,3 +1,13 @@
+2013-12-09  Sam Weinig  <sam@webkit.org>
+
+        Replace use of WTF::FixedArray with std::array
+        https://bugs.webkit.org/show_bug.cgi?id=125475
+
+        Reviewed by Anders Carlsson.
+
+        * crypto/parameters/CryptoAlgorithmAesCbcParams.h:
+        * platform/graphics/GlyphMetricsMap.h:
+
 2013-12-09  Benjamin Poulain  <bpoulain@apple.com>
 
         Refactor the CFURLConnectionClient to be the synchronous implementation of an abstract network delegate
index 8aec52e..705d829 100644 (file)
@@ -27,7 +27,7 @@
 #define CryptoAlgorithmAesCbcParams_h
 
 #include "CryptoAlgorithmParameters.h"
-#include <wtf/FixedArray.h>
+#include <array>
 
 #if ENABLE(SUBTLE_CRYPTO)
 
@@ -36,7 +36,7 @@ namespace WebCore {
 class CryptoAlgorithmAesCbcParams FINAL : public CryptoAlgorithmParameters {
 public:
     // The initialization vector. MUST be 16 bytes.
-    FixedArray<char, 16> iv;
+    std::array<char, 16> iv;
 
     virtual Class parametersClass() const OVERRIDE { return Class::AesCbcParams; }
 };
index 217788b..61c5fb0 100644 (file)
@@ -30,7 +30,7 @@
 #define GlyphMetricsMap_h
 
 #include "Glyph.h"
-#include <wtf/FixedArray.h>
+#include <array>
 #include <wtf/HashMap.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
@@ -57,7 +57,7 @@ public:
 private:
     struct GlyphMetricsPage {
         static const size_t size = 256; // Usually covers Latin-1 in a single page.
-        FixedArray<T, size> m_metrics;
+        std::array<T, size> m_metrics;
 
         T metricsForGlyph(Glyph glyph) const { return m_metrics[glyph % size]; }
         void setMetricsForGlyph(Glyph glyph, const T& metrics)