Changeset 214272 in webkit


Ignore:
Timestamp:
Mar 22, 2017 1:07:21 PM (7 years ago)
Author:
Yusuke Suzuki
Message:

[JSC] Use jsNontrivialString for Number toString operations
https://bugs.webkit.org/show_bug.cgi?id=169965

Reviewed by Mark Lam.

JSTests:

  • stress/to-string-int32.js: Added.

(shouldBe):
(toString10):
(expected):

Source/JavaScriptCore:

After single character check, produced string is always longer than 1.
Thus, we can use jsNontrivialString.

  • runtime/NumberPrototype.cpp:

(JSC::int32ToStringInternal):

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r214260 r214272  
     12017-03-22  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [JSC] Use jsNontrivialString for Number toString operations
     4        https://bugs.webkit.org/show_bug.cgi?id=169965
     5
     6        Reviewed by Mark Lam.
     7
     8        * stress/to-string-int32.js: Added.
     9        (shouldBe):
     10        (toString10):
     11        (expected):
     12
    1132017-03-22  JF Bastien  <jfbastien@apple.com>
    214
  • trunk/Source/JavaScriptCore/ChangeLog

    r214261 r214272  
     12017-03-22  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [JSC] Use jsNontrivialString for Number toString operations
     4        https://bugs.webkit.org/show_bug.cgi?id=169965
     5
     6        Reviewed by Mark Lam.
     7
     8        After single character check, produced string is always longer than 1.
     9        Thus, we can use jsNontrivialString.
     10
     11        * runtime/NumberPrototype.cpp:
     12        (JSC::int32ToStringInternal):
     13
    1142017-03-22  JF Bastien  <jfbastien@apple.com>
    215
  • trunk/Source/JavaScriptCore/runtime/NumberPrototype.cpp

    r214219 r214272  
    500500}
    501501
    502 static inline JSString* int32ToStringInternal(VM& vm, int32_t value, int32_t radix)
     502static ALWAYS_INLINE JSString* int32ToStringInternal(VM& vm, int32_t value, int32_t radix)
    503503{
    504504    ASSERT(!(radix < 2 || radix > 36));
     
    510510    }
    511511
    512     if (radix == 10) {
    513         return jsString(&vm, vm.numericStrings.add(value));
    514     }
    515 
    516     return jsString(&vm, toStringWithRadix(value, radix));
     512    if (radix == 10)
     513        return jsNontrivialString(&vm, vm.numericStrings.add(value));
     514
     515    return jsNontrivialString(&vm, toStringWithRadix(value, radix));
    517516
    518517}
Note: See TracChangeset for help on using the changeset viewer.