RESOLVED FIXED 21321
speed up JavaScriptCore by inlining Heap in JSGlobalData
https://bugs.webkit.org/show_bug.cgi?id=21321
Summary speed up JavaScriptCore by inlining Heap in JSGlobalData
Darin Adler
Reported 2008-10-02 16:16:47 PDT
There's no reason that JSGlobalData should have a Heap* -- instead it should just contain the heap.
Attachments
patch (25.70 KB, patch)
2008-10-02 16:22 PDT, Darin Adler
ggaren: review-
patch, with better destruction (27.66 KB, patch)
2008-10-02 16:39 PDT, Darin Adler
ggaren: review+
Darin Adler
Comment 1 2008-10-02 16:22:12 PDT
Geoffrey Garen
Comment 2 2008-10-02 16:32:38 PDT
Comment on attachment 24032 [details] patch Gotta destroy the heap before any other JSGlobalData tear-down happens.
Darin Adler
Comment 3 2008-10-02 16:39:33 PDT
Created attachment 24033 [details] patch, with better destruction
Geoffrey Garen
Comment 4 2008-10-02 16:43:10 PDT
Comment on attachment 24033 [details] patch, with better destruction - RefPtr<JSGlobalData> protect(m_globalData); Put this back and r=me.
Darin Adler
Comment 5 2008-10-02 16:49:53 PDT
Alexey Proskuryakov
Comment 6 2008-10-02 23:01:49 PDT
The JSGlobalData destructor calls Heap::destroy(), which in turn ref's JSGlobalData. Normally, this should cause an assertion in RefPtr::ref(), due to referencing an object that is being destroyed. This doesn't happen because (1) WebCore never destroys its global data and (2) API clients first destroy the heap in JSGlobalContextRelease(), so Heap::destroy() becomes a no-op. This is safe in practice and a pre-existing issue (the code already did call Heap destructor from JSGlobalData destructor). I think that the contract should be that clients should destroy the heap before releasing the last JSGlobalData reference.
Note You need to log in before you can comment on or make changes to this bug.