Closed Bug 997081 Opened 10 years ago Closed 10 years ago

Optimize StoreElementHole OOL VM call

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: jandem, Assigned: jandem)

References

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
StoreElementHole's OOL path has a VM call to SetObjectElement if the index is OOB and we can't bump the length inline. This is painfully slow though as SetObjectElement is the most generic "we don't know anything about the object" path.

Ion already determined we have a native object without indexed properties etc so we can call a different VM function that's much more efficient. The attached patch does this.

For the micro-benchmark below I get:

before: 1580 ms
after:   614 ms

Also wins at least 15% on Kraken crypto-aes and a few hundred points on Octane-crypto.

function f() {
    for (var i=0; i<10000000; i++) {
	var a = [];
	for (var j=0; j<10; j++)
	    a[j] = j;
    }
}
var t = new Date;
f();
print(new Date - t);
Attachment #8407416 - Flags: review?(bhackett1024)
Attachment #8407416 - Flags: review?(bhackett1024) → review+
Comment on attachment 8407416 [details] [diff] [review]
Patch

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

::: js/src/jit/VMFunctions.cpp
@@ +1069,5 @@
> +    } while (false);
> +
> +    if (result == JSObject::ED_FAILED)
> +        return false;
> +    JS_ASSERT(result == JSObject::ED_SPARSE);

nit: MOZ_ASSERT, to be consistent?
https://hg.mozilla.org/integration/mozilla-inbound/rev/7cfba1345851

Linux x64 Try: https://tbpl.mozilla.org/?tree=Try&rev=6d9a39afa8a7

(In reply to Benjamin Bouvier [:bbouvier] from comment #1)
> nit: MOZ_ASSERT, to be consistent?

Done.
https://hg.mozilla.org/mozilla-central/rev/7cfba1345851
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.