Commit 2b45e03f authored by ggaren@apple.com's avatar ggaren@apple.com

2011-03-15 Geoffrey Garen <ggaren@apple.com>

        Reviewed by Oliver Hunt.

        Removed some more deprecated / unsafe append
        https://bugs.webkit.org/show_bug.cgi?id=56428

        * collector/handles/HandleStack.cpp:
        (JSC::HandleStack::mark):
        * collector/handles/HandleStack.h: Mark the handle stack using a HeapRoot
        marker, since it's a heap root.
        
        * runtime/ArgList.cpp:
        (JSC::MarkedArgumentBuffer::markLists):
        (JSC::MarkedArgumentBuffer::slowAppend):
        * runtime/ArgList.h: Ditto.

        * runtime/Heap.cpp:
        (JSC::Heap::markRoots): Added a mark call for marking the handle stack.
        It seems like Oliver forgot this in his last patch. (!)

        * runtime/MarkStack.h: Removed appendSlots, since it would allow an
        object to embed JSValues directly instead of using WriteBarrier.

        (JSC::MarkStack::append): Added a private append for a list of values.

        (JSC::HeapRootMarker::mark): Access to the above.


git-svn-id: svn://svn.chromium.org/blink/trunk@81193 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 7815636a
2011-03-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Removed some more deprecated / unsafe append
https://bugs.webkit.org/show_bug.cgi?id=56428
* collector/handles/HandleStack.cpp:
(JSC::HandleStack::mark):
* collector/handles/HandleStack.h: Mark the handle stack using a HeapRoot
marker, since it's a heap root.
* runtime/ArgList.cpp:
(JSC::MarkedArgumentBuffer::markLists):
(JSC::MarkedArgumentBuffer::slowAppend):
* runtime/ArgList.h: Ditto.
* runtime/Heap.cpp:
(JSC::Heap::markRoots): Added a mark call for marking the handle stack.
It seems like Oliver forgot this in his last patch. (!)
* runtime/MarkStack.h: Removed appendSlots, since it would allow an
object to embed JSValues directly instead of using WriteBarrier.
(JSC::MarkStack::append): Added a private append for a list of values.
(JSC::HeapRootMarker::mark): Access to the above.
2011-03-15 Geoffrey Garen <ggaren@apple.com> 2011-03-15 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt. Reviewed by Oliver Hunt.
......
...@@ -39,7 +39,7 @@ HandleStack::HandleStack() ...@@ -39,7 +39,7 @@ HandleStack::HandleStack()
grow(); grow();
} }
void HandleStack::mark(MarkStack& markStack) void HandleStack::mark(HeapRootMarker& heapRootMarker)
{ {
const Vector<HandleSlot>& blocks = m_blockStack.blocks(); const Vector<HandleSlot>& blocks = m_blockStack.blocks();
size_t blockLength = m_blockStack.blockLength; size_t blockLength = m_blockStack.blockLength;
...@@ -47,10 +47,10 @@ void HandleStack::mark(MarkStack& markStack) ...@@ -47,10 +47,10 @@ void HandleStack::mark(MarkStack& markStack)
int end = blocks.size() - 1; int end = blocks.size() - 1;
for (int i = 0; i < end; ++i) { for (int i = 0; i < end; ++i) {
HandleSlot block = blocks[i]; HandleSlot block = blocks[i];
markStack.appendSlots(block, blockLength); heapRootMarker.mark(block, blockLength);
} }
HandleSlot block = blocks[end]; HandleSlot block = blocks[end];
markStack.appendSlots(block, m_frame.m_next - block); heapRootMarker.mark(block, m_frame.m_next - block);
} }
void HandleStack::grow() void HandleStack::grow()
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
namespace JSC { namespace JSC {
class LocalScope; class LocalScope;
class MarkStack; class HeapRootMarker;
class HandleStack { class HandleStack {
public: public:
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
HandleSlot push(); HandleSlot push();
void mark(MarkStack&); void mark(HeapRootMarker&);
private: private:
void grow(); void grow();
......
...@@ -39,12 +39,12 @@ void ArgList::getSlice(int startIndex, ArgList& result) const ...@@ -39,12 +39,12 @@ void ArgList::getSlice(int startIndex, ArgList& result) const
result = ArgList(m_args + startIndex, m_argCount - startIndex); result = ArgList(m_args + startIndex, m_argCount - startIndex);
} }
void MarkedArgumentBuffer::markLists(MarkStack& markStack, ListSet& markSet) void MarkedArgumentBuffer::markLists(HeapRootMarker& heapRootMarker, ListSet& markSet)
{ {
ListSet::iterator end = markSet.end(); ListSet::iterator end = markSet.end();
for (ListSet::iterator it = markSet.begin(); it != end; ++it) { for (ListSet::iterator it = markSet.begin(); it != end; ++it) {
MarkedArgumentBuffer* list = *it; MarkedArgumentBuffer* list = *it;
markStack.deprecatedAppendValues(list->m_buffer, list->m_size); heapRootMarker.mark(reinterpret_cast<JSValue*>(list->m_buffer), list->m_size);
} }
} }
...@@ -56,8 +56,8 @@ void MarkedArgumentBuffer::slowAppend(JSValue v) ...@@ -56,8 +56,8 @@ void MarkedArgumentBuffer::slowAppend(JSValue v)
// our Vector's inline capacity, though, our values move to the // our Vector's inline capacity, though, our values move to the
// heap, where they do need explicit marking. // heap, where they do need explicit marking.
if (!m_markSet) { if (!m_markSet) {
// We can only register for explicit marking once we know which heap // FIXME: Even if v is not a JSCell*, if previous values in the buffer
// is the current one, i.e., when a non-immediate value is appended. // are, then they won't be marked!
if (Heap* heap = Heap::heap(v)) { if (Heap* heap = Heap::heap(v)) {
ListSet& markSet = heap->markListSet(); ListSet& markSet = heap->markListSet();
markSet.add(this); markSet.add(this);
......
...@@ -141,7 +141,7 @@ namespace JSC { ...@@ -141,7 +141,7 @@ namespace JSC {
const_iterator begin() const { return m_buffer; } const_iterator begin() const { return m_buffer; }
const_iterator end() const { return m_buffer + m_size; } const_iterator end() const { return m_buffer + m_size; }
static void markLists(MarkStack&, ListSet&); static void markLists(HeapRootMarker&, ListSet&);
private: private:
void slowAppend(JSValue); void slowAppend(JSValue);
......
...@@ -227,12 +227,13 @@ void Heap::markRoots() ...@@ -227,12 +227,13 @@ void Heap::markRoots()
markStack.drain(); markStack.drain();
if (m_markListSet && m_markListSet->size()) if (m_markListSet && m_markListSet->size())
MarkedArgumentBuffer::markLists(markStack, *m_markListSet); MarkedArgumentBuffer::markLists(heapRootMarker, *m_markListSet);
if (m_globalData->exception) if (m_globalData->exception)
heapRootMarker.mark(&m_globalData->exception); heapRootMarker.mark(&m_globalData->exception);
markStack.drain(); markStack.drain();
m_handleHeap.markStrongHandles(markStack); m_handleHeap.markStrongHandles(markStack);
m_handleStack.mark(heapRootMarker);
// Mark the small strings cache last, since it will clear itself if nothing // Mark the small strings cache last, since it will clear itself if nothing
// else has marked it. // else has marked it.
......
...@@ -72,12 +72,6 @@ namespace JSC { ...@@ -72,12 +72,6 @@ namespace JSC {
m_markSets.append(MarkSet(values, values + count, properties)); m_markSets.append(MarkSet(values, values + count, properties));
} }
void appendSlots(HandleSlot values, size_t count, MarkSetProperties properties = NoNullValues)
{
if (count)
m_markSets.append(MarkSet(values, values + count, properties));
}
void append(ConservativeRoots& conservativeRoots) void append(ConservativeRoots& conservativeRoots)
{ {
JSCell** roots = conservativeRoots.roots(); JSCell** roots = conservativeRoots.roots();
...@@ -98,6 +92,7 @@ namespace JSC { ...@@ -98,6 +92,7 @@ namespace JSC {
private: private:
friend class HeapRootMarker; // Allowed to mark a JSValue* or JSCell** directly. friend class HeapRootMarker; // Allowed to mark a JSValue* or JSCell** directly.
void append(JSValue*); void append(JSValue*);
void append(JSValue*, size_t count);
void append(JSCell**); void append(JSCell**);
void internalAppend(JSCell*); void internalAppend(JSCell*);
...@@ -216,6 +211,13 @@ namespace JSC { ...@@ -216,6 +211,13 @@ namespace JSC {
#endif #endif
}; };
inline void MarkStack::append(JSValue* slot, size_t count)
{
if (!count)
return;
m_markSets.append(MarkSet(slot, slot + count, NoNullValues));
}
// Privileged class for marking JSValues directly. It is only safe to use // Privileged class for marking JSValues directly. It is only safe to use
// this class to mark direct heap roots that are marked during every GC pass. // this class to mark direct heap roots that are marked during every GC pass.
// All other references should be wrapped in WriteBarriers and marked through // All other references should be wrapped in WriteBarriers and marked through
...@@ -227,6 +229,7 @@ namespace JSC { ...@@ -227,6 +229,7 @@ namespace JSC {
public: public:
void mark(JSValue*); void mark(JSValue*);
void mark(JSValue*, size_t);
void mark(JSString**); void mark(JSString**);
void mark(JSCell**); void mark(JSCell**);
...@@ -244,6 +247,11 @@ namespace JSC { ...@@ -244,6 +247,11 @@ namespace JSC {
m_markStack.append(slot); m_markStack.append(slot);
} }
inline void HeapRootMarker::mark(JSValue* slot, size_t count)
{
m_markStack.append(slot, count);
}
inline void HeapRootMarker::mark(JSString** slot) inline void HeapRootMarker::mark(JSString** slot)
{ {
m_markStack.append(reinterpret_cast<JSCell**>(slot)); m_markStack.append(reinterpret_cast<JSCell**>(slot));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment