Ignore:
Timestamp:
Mar 13, 2011, 6:16:15 PM (14 years ago)
Author:
[email protected]
Message:

2011-03-13 Geoffrey Garen <[email protected]>

Reviewed by Oliver Hunt.

Removed another case of DeprecatedPtr (ConservativeSet)
https://bugs.webkit.org/show_bug.cgi?id=56281


The ConservativeSet is an internal data structure used during marking,
so direct pointers are fine.

  • runtime/ConservativeSet.cpp: (JSC::ConservativeSet::grow):
  • runtime/ConservativeSet.h: Added some accessors, for use by MarkStack::append. (JSC::ConservativeSet::~ConservativeSet): Fixed a typo where we calculated the size of the set based on sizeof(DeprecatedPtr<T>*) instead of sizeof(DeprecatedPtr<T>). I'm not sure if this had real-world implications or not. (JSC::ConservativeSet::size): (JSC::ConservativeSet::set): Use direct pointers, as stated above.
  • runtime/Heap.cpp: (JSC::Heap::markRoots):
  • runtime/MarkStack.h: (JSC::MarkStack::append): Created a special case of append for ConservativeSet. I didn't want to add back a generic "append JSCell*" function, since other class might start using that wrong. (In the end, this function might go away, since the Heap will want to do something slightly more interesting with the conservative set, but this is OK for now.)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/ConservativeSet.h

    r77151 r80985  
    2727#define ConservativeSet_h
    2828
    29 #include "Heap.h"
    30 #include "MarkStack.h"
     29#include <wtf/OSAllocator.h>
    3130#include <wtf/Vector.h>
    3231
     
    3433
    3534class JSCell;
     35class Heap;
     36
     37// May contain duplicates.
    3638
    3739class ConservativeSet {
     
    4143
    4244    void add(void* begin, void* end);
    43     void mark(MarkStack&);
     45   
     46    size_t size();
     47    JSCell** set();
    4448
    4549private:
     
    5054
    5155    Heap* m_heap;
    52     DeprecatedPtr<JSCell>* m_set;
     56    JSCell** m_set;
    5357    size_t m_size;
    5458    size_t m_capacity;
    55     DeprecatedPtr<JSCell> m_inlineSet[inlineCapacity];
     59    JSCell* m_inlineSet[inlineCapacity];
    5660};
    5761
     
    6771{
    6872    if (m_set != m_inlineSet)
    69         OSAllocator::decommitAndRelease(m_set, m_capacity * sizeof(DeprecatedPtr<JSCell>*));
     73        OSAllocator::decommitAndRelease(m_set, m_capacity * sizeof(JSCell*));
    7074}
    7175
    72 inline void ConservativeSet::mark(MarkStack& markStack)
     76inline size_t ConservativeSet::size()
    7377{
    74     for (size_t i = 0; i < m_size; ++i)
    75         markStack.append(&m_set[i]);
     78    return m_size;
     79}
     80
     81inline JSCell** ConservativeSet::set()
     82{
     83    return m_set;
    7684}
    7785
Note: See TracChangeset for help on using the changeset viewer.