Ignore:
Timestamp:
Jul 1, 2010, 11:31:27 PM (15 years ago)
Author:
[email protected]
Message:

2010-07-01 Oliver Hunt <[email protected]>

Reviewed by Maciej Stachowiak.

Add a FixedArray template to encapsulate fixed length arrays
https://bugs.webkit.org/show_bug.cgi?id=41506

This new type is used in place of fixed length C arrays so
that debug builds can guard against attempts to go beyond
the end of the array.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • bytecode/Opcode.cpp: (JSC::OpcodeStats::~OpcodeStats):
  • pcre/pcre_compile.cpp: (calculateCompiledPatternLength):
  • runtime/Collector.cpp: (JSC::Heap::allocateBlock): (JSC::Heap::allocate):
  • runtime/Collector.h: (JSC::CollectorBitmap::clearAll):
  • runtime/CollectorHeapIterator.h: (JSC::CollectorHeapIterator::operator*):
  • runtime/DateInstanceCache.h:
  • runtime/JSString.cpp: (JSC::JSString::replaceCharacter):
  • runtime/JSString.h: (JSC::RopeBuilder::JSStringFinalizerStruct::):
  • runtime/NumericStrings.h:
  • runtime/RegExpCache.h:
  • runtime/SmallStrings.h: (JSC::SmallStrings::singleCharacterStrings):
  • wtf/AVLTree.h:
  • wtf/FixedArray.h: Added. (WTF::FixedArray::operator[]): (WTF::FixedArray::data):

2010-07-01 Oliver Hunt <[email protected]>

Reviewed by Maciej Stachowiak.

Add a FixedArray template to encapsulate fixed length arrays
https://bugs.webkit.org/show_bug.cgi?id=41506

Add forwarding header.

  • ForwardingHeaders/wtf/FixedArray.h: Added.

2010-07-01 Oliver Hunt <[email protected]>

Reviewed by Maciej Stachowiak.

Add a FixedArray template to encapsulate fixed length arrays
https://bugs.webkit.org/show_bug.cgi?id=41506

Add forwarding header, and replace a few fixed length arrays
with the new FixedArray type.

  • ForwardingHeaders/wtf/FixedArray.h: Added.
  • dom/Document.h:
  • platform/graphics/GlyphMetricsMap.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/Collector.h

    r60323 r62367  
    2525#include <stddef.h>
    2626#include <string.h>
     27#include <wtf/FixedArray.h>
    2728#include <wtf/HashCountedSet.h>
    2829#include <wtf/HashSet.h>
     
    216217
    217218    struct CollectorBitmap {
    218         uint32_t bits[BITMAP_WORDS];
     219        FixedArray<uint32_t, BITMAP_WORDS> bits;
    219220        bool get(size_t n) const { return !!(bits[n >> 5] & (1 << (n & 0x1F))); }
    220221        void set(size_t n) { bits[n >> 5] |= (1 << (n & 0x1F)); }
    221222        void clear(size_t n) { bits[n >> 5] &= ~(1 << (n & 0x1F)); }
    222         void clearAll() { memset(bits, 0, sizeof(bits)); }
     223        void clearAll() { memset(bits.data(), 0, sizeof(bits)); }
    223224        ALWAYS_INLINE void advanceToNextPossibleFreeCell(size_t& startCell)
    224225        {
     
    249250 
    250251    struct CollectorCell {
    251         double memory[CELL_ARRAY_LENGTH];
     252        FixedArray<double, CELL_ARRAY_LENGTH> memory;
    252253    };
    253254
    254255    class CollectorBlock {
    255256    public:
    256         CollectorCell cells[CELLS_PER_BLOCK];
     257        FixedArray<CollectorCell, CELLS_PER_BLOCK> cells;
    257258        CollectorBitmap marked;
    258259        Heap* heap;
Note: See TracChangeset for help on using the changeset viewer.