Merge pull request #5078 from nnethercote/Ref-toString

Optimize Ref_toString().
This commit is contained in:
Yury Delendik 2014-07-25 10:10:10 -05:00
commit 2aea7d7047

View File

@ -220,7 +220,13 @@ var Ref = (function RefClosure() {
Ref.prototype = {
toString: function Ref_toString() {
return 'R' + this.num + '.' + this.gen;
// This function is hot, so we make the string as compact as possible.
// |this.gen| is almost always zero, so we treat that case specially.
var str = this.num + 'R';
if (this.gen !== 0) {
str += this.gen;
}
return str;
}
};