[webkit-dev] about referencing objects between JavaScriptCore and WebCore

ZHOU Xiao-bo zhxb.ustc at gmail.com
Mon Mar 23 02:26:07 PDT 2009

dear all:

    I have a question about the objects referencing between Javasciptcore
and WebCore:

    JSNode uses m_impl to reference a Node in WebCore. And when
KJS::Collector::collect() is called the function mark() of each JSNode is
invoked to keep the corresponding Node in WebCore alive in memory.

    The problem is: I want to seperate the memory managment of
each page. To do so, I allocate a large block of memory for eache page,
and delete it when loading the next page. ( I have commented out
'pagecache', 'backforwardlist' etc.)

    But, when it jumps back to a page which has been visited before, and a
block of
javascipt codes is excuted, it crashes when JSNode use m_impl to reference
a Node in WebCore. The reason is m_impl is pointing an empty memory block.

   I used gdb to examine the value of m_impl, and I found that it likely
contained an
address  of a Node created when this page was loaded the first time.

   My question is: how do JavaSciptCore maintain the JSNode(s) to make them
the old Nodes? And how can I force JSNode's m_impl reference the new Node?

   Do I make myself clear?
   Appreciate any clues!


ZHOU Xiao-bo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090323/3ac40dde/attachment.html>

More information about the webkit-dev mailing list