objectProtoFuncToString creates and returns a JSString with the contents of "[object <object_type]" (e.g. "[object Number]"). This creates a new string each time possibly increasing memory and using CPU. This value should be created once and cached for each object.
Created attachment 138653 [details] Patch This fails the style checker due to using a PassRefPtr as a local, but reused pattern from JSStringBuilder.h.
Attachment 138653 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source..." exit_code: 1 Source/JavaScriptCore/runtime/ObjectPrototype.cpp:260: Local variables should never be PassRefPtr (see http://webkit.org/coding/RefPtr.html). [readability/pass_ptr] [5] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 138653 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=138653&action=review Patch looks good, but some minor changes needed here before committing. > Source/JavaScriptCore/runtime/ObjectPrototype.cpp:259 > + if (!thisObject->structure()->hasObjectToStringValue()) { Our typical style here is just to call objectToStringValue(): RefPtr<> toStringValue = thisObject->structure()->objectToStringValue(); if (!toStringValue) { ... toStringValue = ... } ... > Source/JavaScriptCore/runtime/ObjectPrototype.cpp:264 > + thisObject->structure()->setObjectToStringValue(exec->globalData(), thisObject, jsNontrivialString(exec, result)); The appropriate pattern is to make the local a RefPtr, to avoid accidentally dereferencing NULL, and then use .release() when passing it to setObjectToStringValue here. > Source/JavaScriptCore/runtime/Structure.cpp:797 > +#if 1 Please remove the #if.
Created attachment 138669 [details] Updated Patch with Suggested Fixes
Comment on attachment 138669 [details] Updated Patch with Suggested Fixes r=me
Comment on attachment 138669 [details] Updated Patch with Suggested Fixes Attachment 138669 [details] did not pass qt-wk2-ews (qt): Output: http://queues.webkit.org/results/12525366
Created attachment 138686 [details] Updated patch with speculative Qt fix
Committed r115151: <http://trac.webkit.org/changeset/115151>