Changeset 34974 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jul 2, 2008, 11:48:01 PM (17 years ago)
Author:
[email protected]
Message:

2008-07-02 Geoffrey Garen <[email protected]>

Reviewed by Cameron Zwarich.


Fixed https://bugs.webkit.org/show_bug.cgi?id=19862
REGRESSION (r34907): Gmail crashes in JavaScriptCore code while editing drafts


I was never able to reproduce this issue, but Cameron could, and he says
that this patch fixes it.


The crash seems tied to a timer or event handler callback. In such a case,
the sole reference to the global object may be in the current call frame,
so we can't depend on the global object to mark the call frame area in
the register file.


The new GC marking rule is: the global object is not responsible for
marking the whole register file -- it's just responsible for the globals
section it's tied to. The heap is responsible for marking the call frame area.

Location:
trunk/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r34969 r34974  
     12008-07-02  Geoffrey Garen  <[email protected]>
     2
     3        Reviewed by Cameron Zwarich.
     4       
     5        Fixed https://bugs.webkit.org/show_bug.cgi?id=19862
     6        REGRESSION (r34907): Gmail crashes in JavaScriptCore code while editing drafts
     7       
     8        I was never able to reproduce this issue, but Cameron could, and he says
     9        that this patch fixes it.
     10       
     11        The crash seems tied to a timer or event handler callback. In such a case,
     12        the sole reference to the global object may be in the current call frame,
     13        so we can't depend on the global object to mark the call frame area in
     14        the register file.
     15       
     16        The new GC marking rule is: the global object is not responsible for
     17        marking the whole register file -- it's just responsible for the globals
     18        section it's tied to. The heap is responsible for marking the call frame area.
     19
    1202008-07-02  Mark Rowe  <[email protected]>
    221
  • trunk/JavaScriptCore/VM/RegisterFile.h

    r34966 r34974  
    165165
    166166        Register* lastGlobal() { return m_base - m_numGlobals; }
    167 
    168         void mark(Heap* heap)
    169         {
    170             heap->markConservatively(lastGlobal(), m_base + m_size);
    171         }
     167       
     168        void markGlobals(Heap* heap) { heap->markConservatively(lastGlobal(), m_base); }
     169        void markCallFrames(Heap* heap) { heap->markConservatively(m_base, m_base + m_size); }
    172170
    173171    private:
  • trunk/JavaScriptCore/kjs/JSGlobalData.cpp

    r34947 r34974  
    5959JSGlobalData::JSGlobalData(bool isShared)
    6060    : machine(new Machine)
    61     , heap(new Heap(isShared))
     61    , heap(new Heap(machine, isShared))
    6262#if USE(MULTIPLE_THREADS)
    6363    , arrayTable(new HashTable(KJS::arrayTable))
  • trunk/JavaScriptCore/kjs/JSGlobalObject.cpp

    r34950 r34974  
    351351    RegisterFile& registerFile = globalData()->machine->registerFile();
    352352    if (registerFile.globalObject() == this)
    353         registerFile.mark(globalData()->heap);
     353        registerFile.markGlobals(globalData()->heap);
    354354
    355355    markIfNeeded(d()->globalExec->exception());
  • trunk/JavaScriptCore/kjs/collector.cpp

    r34969 r34974  
    9393static void freeHeap(CollectorHeap*);
    9494
    95 Heap::Heap(bool isShared)
     95Heap::Heap(Machine* machine, bool isShared)
    9696    : m_markListSet(0)
    9797    , m_isShared(isShared)
     98    , m_machine(machine)
    9899{
    99100    memset(&primaryHeap, 0, sizeof(CollectorHeap));
     
    945946    if (m_markListSet && m_markListSet->size())
    946947        ArgList::markLists(*m_markListSet);
     948    m_machine->registerFile().markCallFrames(this);
    947949
    948950    JAVASCRIPTCORE_GC_MARKED();
  • trunk/JavaScriptCore/kjs/collector.h

    r34947 r34974  
    112112
    113113        friend class JSGlobalData;
    114         Heap(bool isShared);
     114        Heap(Machine*, bool isShared);
    115115        ~Heap();
    116116
     
    133133
    134134        bool m_isShared;
     135       
     136        Machine* m_machine;
    135137    };
    136138
Note: See TracChangeset for help on using the changeset viewer.