Closed
Bug 1338834
Opened 8 years ago
Closed 8 years ago
Optimize compartment check in JSContext::currentScript
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla54
Tracking | Status | |
---|---|---|
firefox54 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
Attachments
(1 file)
1.58 KB,
patch
|
bhackett1024
:
review+
|
Details | Diff | Splinter Review |
I looked at an Instruments profile for the Google Docs test in bug 1338802 comment 0.
One curious thing I noticed is a CCW call to obj_construct where we then do a slow script/pc lookup by calling currentScript. That's silly because currentScript will discard the script/pc if the compartment doesn't match (currentScript's allowCrossCompartment argument defaults to false), but we can easily do the compartment check *before* we do the relatively slow script/pc lookup.
According to Instruments we spend a few % here so this simple patch should be a decent speedup.
Attachment #8836413 -
Flags: review?(bhackett1024)
Assignee | ||
Comment 1•8 years ago
|
||
(In reply to Jan de Mooij [:jandem] from comment #0)
> a CCW call to obj_construct
Bad wording on my part, there are ton of these calls actually. Some logging confirms this patch speeds up at least 300,000 currentScript calls where we returned nullptr but did the slow GetPcScript call for no good reason.
Comment 2•8 years ago
|
||
Comment on attachment 8836413 [details] [diff] [review]
Patch
Review of attachment 8836413 [details] [diff] [review]:
-----------------------------------------------------------------
Sorry for the delay.
Attachment #8836413 -
Flags: review?(bhackett1024) → review+
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/62d0c9083f4b
Speed up JSContext::currentScript by doing the compartment check first. r=bhackett
Comment 4•8 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox54:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in
before you can comment on or make changes to this bug.
Description
•