[webkit-reviews] review denied: [Bug 31330] Expose dtoa() for ECMA-262 : [Attachment 42923] Proposed patch (rev.2)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Nov 11 16:06:57 PST 2009


Darin Adler <darin at apple.com> has denied TAMURA, Kent <tkent at chromium.org>'s
request for review:
Bug 31330: Expose dtoa() for ECMA-262
https://bugs.webkit.org/show_bug.cgi?id=31330

Attachment 42923: Proposed patch (rev.2)
https://bugs.webkit.org/attachment.cgi?id=42923&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
>  UString UString::from(double d)
>  {
> +    return UString(ecma262dtoa(d));
>  }

The above change will slow down JavaScriptCore, because it makes an extra copy
of the buffer. The old version translated directly from a char buffer to a
UChar buffer. The new code instead goes from a char buffer to a UChar buffer
and then copies the buffer again to put it into the UString. I don't see an
obvious way to avoid this as long as the dtoa function returns a char buffer
and the ecma262dtoa function returns a UChar buffer. But it's unacceptable to
slow things down without doing performance tests to prove this is not a
significant slowdown for JavaScript execution.

We should investigate other solutions that don't require allocating memory and
copying the string an extra time.

If we can figure out a hard limit for the longest a double could be, then we
could make the function put its result into a C-style array so there is no
extra memory allocation.

> +static ALWAYS_INLINE void appendAscii(const char* src, unsigned size,
Vector<UChar, 80>& dst)

Since ASCII is an acronym, we should always capitalize it as ASCII.

I’d like to see a typedef for the vector type here at the top of the file so
the magic number 80 isn’t in three different places.


More information about the webkit-reviews mailing list