Source/WebCore/bindings/v8/V8Binding.cpp
String int32ToWebCoreStringFast(int value)
{
    // Caching of small strings below is not thread safe: newly constructed AtomicString
    // are not safely published.
    ASSERT(WTF::isMainThread());

    // Most numbers used are <= 100. Even if they aren't used there's very little cost in using the space.
    const int kLowNumbers = 100;
    DEFINE_STATIC_LOCAL(Vector<AtomicString>, lowNumbers, (kLowNumbers + 1));
    String webCoreString;
    if (0 <= value && value <= kLowNumbers) {
        webCoreString = lowNumbers[value];
        if (!webCoreString) {
            AtomicString valueString = AtomicString(String::number(value));
            lowNumbers[value] = valueString;
            webCoreString = valueString;
        }
    } else
        webCoreString = String::number(value);
    return webCoreString;
}
// Fast but non thread-safe version.
Fast but non thread-safe version.
Fast but non thread - safe version .
String int32ToWebCoreStringFast(int value)
{
    ASSERT(WTF::isMainThread());
    const int kLowNumbers = 100;
    DEFINE_STATIC_LOCAL(Vector<AtomicString>, lowNumbers, (kLowNumbers + 1));
    String webCoreString;
    if (0 <= value && value <= kLowNumbers) {
        webCoreString = lowNumbers[value];
        if (!webCoreString) {
            AtomicString valueString = AtomicString(String::number(value));
            lowNumbers[value] = valueString;
            webCoreString = valueString;
        }
    } else
        webCoreString = String::number(value);
    return webCoreString;
}
String int32ToWebCoreStringFast ( int value ) { ASSERT ( WTF :: isMainThread ( ) ) ; const int kLowNumbers = 100 ; DEFINE_STATIC_LOCAL ( Vector < AtomicString > , lowNumbers , ( kLowNumbers + 1 ) ) ; String webCoreString ; if ( 0 <= value && value <= kLowNumbers ) { webCoreString = lowNumbers [ value ] ; if ( ! webCoreString ) { AtomicString valueString = AtomicString ( String :: number ( value ) ) ; lowNumbers [ value ] = valueString ; webCoreString = valueString ; } } else webCoreString = String :: number ( value ) ; return webCoreString ; }
Fast but non thread-safe version.
Fast but non thread - safe version .
// Caching of small strings below is not thread safe: newly constructed AtomicString // are not safely published. // Most numbers used are <= 100. Even if they aren't used there's very little cost in using the space.