Ignore:
Timestamp:
Jan 13, 2015, 9:46:40 AM (11 years ago)
Author:
[email protected]
Message:

Local JSArray* "keys" in objectConstructorKeys() is not marked during garbage collection
https://bugs.webkit.org/show_bug.cgi?id=140348

Reviewed by Mark Lam.

We used to read registers in MachineThreads::gatherFromCurrentThread(), but that is too late
because those registers may have been spilled on the stack and replaced with other values by
the time we call down to gatherFromCurrentThread().

Now we get the register contents at the same place that we demarcate the current top of
stack using the address of a local variable, in Heap::markRoots(). The register contents
buffer is passed along with the demarcation pointer. These need to be done at this level
in the call tree and no lower, as markRoots() calls various functions that visit object
pointers that may be latter proven dead. Any of those pointers that are left on the
stack or in registers could be incorrectly marked as live if we scan the stack contents
from a called function or one of its callees. The stack demarcation pointer and register
saving need to be done in the same function so that we have a consistent stack, active
and spilled registers.

Because we don't want to make unnecessary calls to get the register contents, we use
a macro to allocated, and possibly align, the register structure and get the actual
register contents.

  • heap/Heap.cpp:

(JSC::Heap::markRoots):
(JSC::Heap::gatherStackRoots):

  • heap/Heap.h:
  • heap/MachineStackMarker.cpp:

(JSC::MachineThreads::gatherFromCurrentThread):
(JSC::MachineThreads::gatherConservativeRoots):

  • heap/MachineStackMarker.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r178313 r178364  
     12015-01-12  Michael Saboff  <[email protected]>
     2
     3        Local JSArray* "keys" in objectConstructorKeys() is not marked during garbage collection
     4        https://bugs.webkit.org/show_bug.cgi?id=140348
     5
     6        Reviewed by Mark Lam.
     7
     8        We used to read registers in MachineThreads::gatherFromCurrentThread(), but that is too late
     9        because those registers may have been spilled on the stack and replaced with other values by
     10        the time we call down to gatherFromCurrentThread().
     11
     12        Now we get the register contents at the same place that we demarcate the current top of
     13        stack using the address of a local variable, in Heap::markRoots().  The register contents
     14        buffer is passed along with the demarcation pointer.  These need to be done at this level
     15        in the call tree and no lower, as markRoots() calls various functions that visit object
     16        pointers that may be latter proven dead.  Any of those pointers that are left on the
     17        stack or in registers could be incorrectly marked as live if we scan the stack contents
     18        from a called function or one of its callees.  The stack demarcation pointer and register
     19        saving need to be done in the same function so that we have a consistent stack, active
     20        and spilled registers.
     21
     22        Because we don't want to make unnecessary calls to get the register contents, we use
     23        a macro to allocated, and possibly align, the register structure and get the actual
     24        register contents.
     25
     26
     27        * heap/Heap.cpp:
     28        (JSC::Heap::markRoots):
     29        (JSC::Heap::gatherStackRoots):
     30        * heap/Heap.h:
     31        * heap/MachineStackMarker.cpp:
     32        (JSC::MachineThreads::gatherFromCurrentThread):
     33        (JSC::MachineThreads::gatherConservativeRoots):
     34        * heap/MachineStackMarker.h:
     35
    1362015-01-12  Benjamin Poulain  <[email protected]>
    237
Note: See TracChangeset for help on using the changeset viewer.