nsJSContext::GetGlobalObject is slow

RESOLVED FIXED

Status

()

Core
DOM
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: smaug, Assigned: mrbkap)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

6 years ago
The method is called a lot (it is called when contextstack::Push is called),
yet it does few QIs. Could we cache the return value?
(Assignee)

Comment 1

6 years ago
Created attachment 525743 [details] [diff] [review]
Proposed fix

I'm about to send this through the try server.
Assignee: nobody → mrbkap
Status: NEW → ASSIGNED
Attachment #525743 - Flags: review?(peterv)
(Assignee)

Comment 2

6 years ago
That patch passed try.
Comment on attachment 525743 [details] [diff] [review]
Proposed fix

Minussing, bkap is going to attach a new patch that removes some code that we don't need anymore.
Attachment #525743 - Flags: review?(peterv) → review-
(Assignee)

Comment 4

6 years ago
Created attachment 533600 [details] [diff] [review]
Better patch
Attachment #525743 - Attachment is obsolete: true
Attachment #533600 - Flags: review?(peterv)
Comment on attachment 533600 [details] [diff] [review]
Better patch

Review of attachment 533600 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/base/nsJSEnvironment.cpp
@@ +2185,5 @@
> +#ifdef DEBUG
> +  {
> +    JSObject *inner = global;
> +    OBJ_TO_INNER_OBJECT(mContext, inner);
> +    NS_ASSERTION(inner == global, "unexpected innerization is possible");

I don't really understand this comment.

@@ +2211,5 @@
>    } else {
>      sgo = do_QueryInterface(priv);
>    }
>  
> +  return sgo;

Seems like the removed comment would still be valid?
Attachment #533600 - Flags: review?(peterv) → review+
(Assignee)

Comment 6

6 years ago
http://hg.mozilla.org/tracemonkey/rev/3b1ffc6d282f
Whiteboard: fixed-in-tracemonkey
cdleary-bot mozilla-central merge info:
http://hg.mozilla.org/mozilla-central/rev/3b1ffc6d282f
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.