Closed Bug 1175511 Opened 9 years ago Closed 9 years ago

Use template objects for arguments object allocation

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached patch Patch (deleted) — Splinter Review
Right now in ArgumentsObject::create, we have to do two lookups for the initial shape and the ObjectGroup. This is slow.

This patch stores a weak pointer to a template object for normal and strict arguments objects in JSCompartment. Then when we allocate an arguments object we can avoid the shape/group lookup if the compartment has a template object.

It improves the micro-benchmark in bug 1175466 from 172 ms to 98 ms (on top of the patch in that bug).
Attachment #8623659 - Flags: review?(bhackett1024)
Comment on attachment 8623659 [details] [diff] [review]
Patch

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

::: js/src/vm/ArgumentsObject.cpp
@@ +184,5 @@
> +
> +ArgumentsObject*
> +JSCompartment::getOrCreateArgumentsTemplateObject(JSContext* cx, bool strict)
> +{
> +    ArgumentsObject* obj = strict ? strictArgumentsTemplate_ : normalArgumentsTemplate_;

If this was a ReadBarriered<ArgumentsObject*>& you could avoid the second branch on |strict| below I think.
Attachment #8623659 - Flags: review?(bhackett1024) → review+
https://hg.mozilla.org/mozilla-central/rev/bdbeef387598
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: