Closed Bug 891980 Opened 7 years ago Closed 7 years ago

Calling a DOM getter function with .call() is slightly slower than doing the get normally

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: bzbarsky, Assigned: efaust)

Details

Attachments

(3 files)

Attached file Testcase
See attached testcase.  Note that you will need a patch to turn off loop-hoisting and specialized DOM getters as well (which I will also attach).
Oh, and you might want to have the patch for bug 891585 to reduce the noise.
Attached patch FixSplinter Review
With this patch I am seeing the .call back within noise of the getter (about the same, sometimes faster, sometimes slower) per iteration. The problem was that we were emitting a property cache lookup to get the .call function at the CALLPROP site.
Assignee: general → efaustbmo
Status: NEW → ASSIGNED
Attachment #779529 - Flags: review?(jwalden+bmo)
Comment on attachment 779529 [details] [diff] [review]
Fix

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

Interestingly there's also JSObject::hasIdempotentProtoChain which serves a somewhat-similar purpose to the method you're modifying.  It'd be good to unify these two effectlessness tests at some point, somehow or other.

::: js/src/jsfun.h
@@ +385,5 @@
>  fun_toStringHelper(JSContext *cx, js::HandleObject obj, unsigned indent);
>  
> +extern JSBool
> +fun_resolve(JSContext *cx, js::HandleObject obj, js::HandleId id,
> +            unsigned flags, js::MutableHandleObject objp);

Put this inside namespace js.
Attachment #779529 - Flags: review?(jwalden+bmo) → review+
https://hg.mozilla.org/mozilla-central/rev/fdf50d79ce02
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.