[Webkit-unassigned] [Bug 147602] [INTL] Implement Intl.NumberFormat.prototype.resolvedOptions ()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Dec 20 13:03:39 PST 2015


https://bugs.webkit.org/show_bug.cgi?id=147602

Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #267624|review?                     |review+
              Flags|                            |

--- Comment #18 from Darin Adler <darin at apple.com> ---
Comment on attachment 267624
  --> https://bugs.webkit.org/attachment.cgi?id=267624
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=267624&action=review

> Source/JavaScriptCore/runtime/IntlNumberFormat.cpp:92
> +    Vector<String> keyLocaleData({

Seems unfortunate to re-create this vector every time the function is called. Might consider changing the function’s interface to return a const& unless it can involve computing a unique value and using a static NeverDestroyed for this particular case.

> Source/JavaScriptCore/runtime/IntlNumberFormat.cpp:158
> +    for (const auto& currencyMinorUnit : currencyMinorUnits) {

This list might be long enough that's binary search would be faster than a linear one.

> Source/JavaScriptCore/runtime/IntlNumberFormat.cpp:159
> +        if (currency == currencyMinorUnit.first)

Is it correct that this is a case sensitive check?

> Source/JavaScriptCore/runtime/IntlObject.cpp:239
> +        if (std::isnan(doubleValue) || doubleValue < static_cast<double>(minimum) || doubleValue > static_cast<double>(maximum)) {

There is a way to write this without an explicit check for NaN.

    If (!(x >= min && x <= max))

> Source/JavaScriptCore/runtime/IntlObject.cpp:245
> +        return static_cast<unsigned>(doubleValue);

This has peculiar behavior for max + 0.1; do we have test cases that cover values just slightly under min and slightly over max?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20151220/4a0bdaff/attachment.html>


More information about the webkit-unassigned mailing list