Optimize charCodeAt/charAt on ropes
Categories
(Core :: JavaScript Engine: JIT, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox109 | --- | fixed |
People
(Reporter: jandem, Assigned: anba)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
This affects the crypto-sha1 test in JetStream 2 (test originally from SunSpider). We spend time in str_charCodeAt because the string here is a rope initially:
for(var i = 0; i < str.length * chrsz; i += chrsz) {
bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32);
}
This is probably quite common.
Reporter | ||
Comment 1•4 years ago
|
||
The crypto-md5 test has the same issue.
Assignee | ||
Comment 2•4 years ago
|
||
charCodeAt()
should normally flatten ropes - unless we're hitting bug 1382639 here?
Reporter | ||
Comment 3•4 years ago
|
||
(In reply to André Bargull [:anba] from comment #2)
charCodeAt()
should normally flatten ropes
But if we fail to inline charCodeAt
we attach a CallNative stub so we'll never try optimizing charCodeAt
again..
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 4•2 years ago
|
||
We can't inline String.prototype.charAt
and String.prototype.charCodeAt
in a
couple of JetStream tests because the input is a nested rope.
Before this change, we can observe the following number of non-inlined calls to
these functions:
crypto
String.prototype.charCodeAt 360'000
pdfjs
String.prototype.charCodeAt 21'910'000
typescript
String.prototype.charCodeAt 17'840'000
base64-SP
String.prototype.charCodeAt 39'300'000
crypto-md5-SP
String.prototype.charCodeAt 41'750'000
crypto-sha1-SP
String.prototype.charCodeAt 30'180'000
acorn-wtb
String.prototype.charCodeAt 3'370'000
jshint-wtb
String.prototype.charAt 2'450'000
String.prototype.charCodeAt 200'000
uglify-js-wtb
String.prototype.charAt 450'000
After this change, only the WBT sub-benchmarks still have non-inlined calls:
acorn-wtb
String.prototype.charCodeAt 1'150'000
jshint-wtb
String.prototype.charAt 2'450'000
String.prototype.charCodeAt 200'000
uglify-js-wtb
String.prototype.charAt 450'000
Depends on D162725
Updated•2 years ago
|
Comment 6•2 years ago
|
||
bugherder |
Description
•