Bug 36519 - JSGlobalContextRelease is unnecessarily slow
Summary: JSGlobalContextRelease is unnecessarily slow
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Gavin Barraclough
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-23 23:57 PDT by Gavin Barraclough
Modified: 2010-03-24 10:52 PDT (History)
1 user (show)

See Also:


Attachments
The patch (8.03 KB, patch)
2010-03-24 00:00 PDT, Gavin Barraclough
oliver: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gavin Barraclough 2010-03-23 23:57:03 PDT
Since [ http://trac.webkit.org/changeset/35917 ], calling JSGlobalContextRelease always triggers a GC heap collection (if not a full destroy).

As per 35917's changelog "This is only really necessary when the (JSGlobalObject's) last reference is released, but there is no way to determine that, and no harm in collecting slightly more often."

Well, we now know of cases of API clients who are harmed by the performance penalty of collecting too often, so it's time to add a way to determine whether a call to JSGlobalContextRelease is removing the last protect from it's global object.  If further protects are retaining the global object (likely from other JSGlobalContextRefs), then don't trigger a GC collection.
Comment 1 Gavin Barraclough 2010-03-24 00:00:24 PDT
Created attachment 51481 [details]
The patch
Comment 2 Oliver Hunt 2010-03-24 00:05:18 PDT
Comment on attachment 51481 [details]
The patch

r=me
Comment 3 Gavin Barraclough 2010-03-24 00:12:33 PDT
landed in r56435
Comment 4 Geoffrey Garen 2010-03-24 10:52:00 PDT
+    // * If there are more references remaining the the global object, then do nothing
+    //   (specifically that is more protects, which we assume come from other JSGlobalContextRefs).

Typo: "the the".