http://codereview.chromium.org/6173004/diff/2001/src/array.js
File src/array.js (right):
http://codereview.chromium.org/6173004/diff/2001/src/array.js#newcode121
src/array.js:121: return convert(e);
On 2011/01/10 10:51:44, Lasse Reichstein wrote:
How about checking against undefined after the IS_STRING test?
Or does it happen so rarely that it doesn't matter anyway?
Doesn't matter.
http://codereview.chromium.org/6173004/diff/2001/src/array.js#newcode132
src/array.js:132: if (!(e == null)) {
On 2011/01/10 10:51:44, Lasse Reichstein wrote:
Use IS_NULL_OR_UNDEFINED (which reduces to this but better explains
the type
coercion).
I changed this back to IS_UNDEFINED after all.
http://codereview.chromium.org/6173004/diff/2001/src/array.js#newcode157
src/array.js:157: }
On 2011/01/10 10:51:44, Lasse Reichstein wrote:
How about:
if (IS_NUMBER(e)) {
e = %_NumberToString(e);
} else if (!IS_STRING(e)) {
e = convert(e);
}
elements[i] = e;
or
if (!IS_STRING(e)) {
if (IS_NUMBER(e)) {
e = %_NumberToString(e);
} else if (IS_NULL_OR_UNDEFINED(e)) {
e = ''
} else {
e = convert(e);
}
}
elements[i] = e;
I want the expected path (IS_NUMBER) to be as fast as possible. With
these rewrites I'll have two assignments instead of one in that case. I
tried running alternative one and it is a bit slower (1%).
http://codereview.chromium.org/6173004/
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev