Open
Bug 1448965
Opened 7 years ago
Updated 8 months ago
Support non-Latin1 characters in CodeGenerator::visitFromCharCode()?
Categories
(Core :: JavaScript Engine: JIT, enhancement, P3)
Core
JavaScript Engine: JIT
Tracking
()
NEW
Tracking | Status | |
---|---|---|
firefox61 | --- | affected |
People
(Reporter: anba, Unassigned)
References
(Blocks 1 open bug)
Details
CodeGenerator::visitFromCharCode() currently calls into the VM when the input code unit is larger than 0xff (StaticStrings::UNIT_STATIC_LIMIT), which means |String.fromCharCode|, |String.prototype.charAt|, and indexed string accesses all call into the VM for non-Latin1 code units. CodeGenerator::visitFromCodePoint() supports non-Latin1 code points, we should measure if there are any negative side-effects to extend CodeGenerator::visitFromCharCode() to support non-Latin1 code units, too.
|stringCodePoint| is 30-40% faster in this µ-benchmark when compared to |stringIndexed|, because String.fromCodePoint() supports non-Latin1 code points:
---
function stringIndexed() {
var s = "abcdefg\u0100";
var q = 0;
var t = dateNow();
for (var i = 0; i < 5000000; ++i) {
for (var j = 0; j < s.length; ++j) {
q += s[j].length;
}
}
return [dateNow() - t, q];
}
function stringCodePoint() {
var s = "abcdefg\u0100";
var q = 0;
var t = dateNow();
for (var i = 0; i < 5000000; ++i) {
for (var j = 0; j < s.length; ++j) {
q += String.fromCodePoint(s.charCodeAt(j)).length;
}
}
return [dateNow() - t, q];
}
---
Updated•7 years ago
|
Priority: -- → P3
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•