RESOLVED INVALID 99639
V8StringResource's low-number cache should either be pushed into WTF or removed if it's no longer needed
https://bugs.webkit.org/show_bug.cgi?id=99639
Summary V8StringResource's low-number cache should either be pushed into WTF or remov...
Eric Seidel (no email)
Reported 2012-10-17 14:04:35 PDT
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).
Attachments
Note You need to log in before you can comment on or make changes to this bug.