[Webkit-unassigned] [Bug 99639] New: V8StringResource's low-number cache should either be pushed into WTF or removed if it's no longer needed

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Oct 17 14:03:42 PDT 2012


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

           Summary: V8StringResource's low-number cache should either be
                    pushed into WTF or removed if it's no longer needed
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: New Bugs
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: eric at webkit.org
                CC: ggaren at apple.com, abarth at webkit.org,
                    haraken at chromium.org


V8StringResource's low-number cache should either be pushed into WTF or removed if it's no longer needed

http://trac.webkit.org/browser/trunk/Source/WebCore/bindings/v8/V8StringResource.cpp#L109

// Fast but non thread-safe version.
String int32ToWebCoreStringFast(int value)
{
    // Caching of small strings below is not thread safe: newly constructed AtomicString
    // are not safely published.
    ASSERT(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;
}

it seems silly to implement this at the v8 binding layer.  If this is a big win for a small memory hit, then all of WebCore should benefit from this.  But I'm not convinced it's a win (or at least I'd like to know how JSC avoids needing it).

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list