Bug 134635

Summary: Fast path for jsStringWithCache() when asked for the same string repeatedly.
Product: WebKit Reporter: Andreas Kling <kling>
Component: JavaScriptCoreAssignee: Andreas Kling <kling>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, ggaren, kling, koivisto, rniwa, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2
none
Patch darin: review+

Description Andreas Kling 2014-07-04 10:24:17 PDT
Something I talked about with Geoff a while ago, that other JS engines already do, that we could save some easy cycles with..
Comment 1 Andreas Kling 2014-07-04 10:28:09 PDT
Created attachment 234414 [details]
Patch
Comment 2 Darin Adler 2014-07-04 12:15:45 PDT
Comment on attachment 234414 [details]
Patch

Windows export issue:

     1>WebKit.exp : error LNK2001: unresolved external symbol "class JSC::JSValue __cdecl WebCore::jsStringWithCache(class JSC::ExecState *,class WTF::String const &)" (?jsStringWithCache@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@ABVString@WTF@@@Z)
Comment 3 Build Bot 2014-07-04 12:51:18 PDT
Comment on attachment 234414 [details]
Patch

Attachment 234414 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/6239582064476160

New failing tests:
media/W3C/video/networkState/networkState_during_loadstart.html
Comment 4 Build Bot 2014-07-04 12:51:21 PDT
Created attachment 234417 [details]
Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-09  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5
Comment 5 Andreas Kling 2014-07-04 15:33:57 PDT
Created attachment 234423 [details]
Patch

Try to fix Windows build.
Comment 6 Andreas Kling 2014-07-04 20:37:04 PDT
Committed r170818: <http://trac.webkit.org/changeset/170818>
Comment 7 Geoffrey Garen 2014-07-07 11:21:23 PDT
Comment on attachment 234423 [details]
Patch

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

> Source/JavaScriptCore/runtime/JSString.cpp:383
> +    vm.lastCachedString = addResult.iterator->value.get();
> +    return vm.lastCachedString.get();

Weak<T>::get() is non-trivial, so it is better to put the value in a local variable and return the local variable. The compiler can't optimize away this get().