Closed Bug 566077 Opened 14 years ago Closed 14 years ago

Fix some small things Shark pointed out

Categories

(Core :: XPConnect, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mrbkap, Assigned: mrbkap)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(4 files)

Attached file testcase
I sharked this testcase for a while aiming to remove anything XPC*.cpp. It turns out that XPCWrappedNative::GetWrappedNativeOfJSObject is pretty slow, especially in cases that we know for a fact that we have a wrapped native. Also: XPCWrappedNativeScope::FindInJSObjectScope is slow (it does a linear search through the list of scopes?!).

Most of the winnings from this testcase should come from another fix I'll look for later: setting window.x should call XPC_XOW_SetProperty -> nsWindowSH::SetProperty -> set a normal slot. Right now: we go XPC_XOW_SetProperty -> nsWindowSH::SetProperty -> nsWindowSH::SetProperty (via the JS engine, which takes a very non-trivial amount of time) -> nsEventReceiverSH::SetProperty.

Also note: we don't trace this testcase at all: setting window.x knocks us off trace anyway because the global object is special. This is a separate problem from security wrappers.
nsXPConnect::GetWrapperForObject is way overkill when we're wrapping the global object for its own scope.
Assignee: nobody → mrbkap
Status: NEW → ASSIGNED
Attachment #445507 - Flags: review?(jst)
CallContexts should only be needed when we're calling directly into C++ ourselves. Otherwise, we'll go into the engine, which will have to go through XPConnect anyway, which will create its own callcontext when it's needed.
Attachment #445508 - Flags: review?(jst)
PCWrappedNative::GetWrappedNativeOfJSObject is slow. If we already have a wrapped native (especially in hooks like {inner,outer}Object) we should just get the wrapped native directly.
Attachment #445509 - Flags: review?(jst)
Version: 1.9.1 Branch → Trunk
Attachment #445507 - Flags: review?(jst) → review+
Attachment #445508 - Flags: review?(jst) → review+
Attachment #445509 - Flags: review?(jst) → review+
could you land these on the TM tree?
The original title of this bug was way too grandiose (and wanted to be a tracking bug). I'll tackle other stuff in other bugs.
Summary: Get security wrappers out of hot paths → Fix some small things Shark pointed out
Whiteboard: fixed-in-tracemonkey
This got pushed to m-c some time ago.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: