RESOLVED FIXED 97964
Web Inspector: NMI make String* instrumentation non intrusive
https://bugs.webkit.org/show_bug.cgi?id=97964
Summary Web Inspector: NMI make String* instrumentation non intrusive
Ilya Tikhonovsky
Reported 2012-09-29 07:22:52 PDT
EOM
Attachments
Patch (22.15 KB, patch)
2012-09-29 07:27 PDT, Ilya Tikhonovsky
no flags
Patch (23.19 KB, patch)
2012-09-29 08:03 PDT, Ilya Tikhonovsky
no flags
fix for KURL (23.65 KB, patch)
2012-09-29 08:21 PDT, Ilya Tikhonovsky
no flags
comments addressed (25.86 KB, patch)
2012-10-01 02:57 PDT, Ilya Tikhonovsky
no flags
comments addressed (26.97 KB, patch)
2012-10-01 07:07 PDT, Ilya Tikhonovsky
no flags
usesInternalBuffer was renamed to hasInternalBuffer. hasOwnedBuffer was added. (26.92 KB, patch)
2012-10-01 08:19 PDT, Ilya Tikhonovsky
no flags
rebaselined. (27.25 KB, patch)
2012-10-01 09:00 PDT, Ilya Tikhonovsky
yurys: review+
Ilya Tikhonovsky
Comment 1 2012-09-29 07:27:41 PDT
Gyuyoung Kim
Comment 2 2012-09-29 07:40:02 PDT
Early Warning System Bot
Comment 3 2012-09-29 07:45:15 PDT
Early Warning System Bot
Comment 4 2012-09-29 07:49:52 PDT
Build Bot
Comment 5 2012-09-29 07:56:04 PDT
Build Bot
Comment 6 2012-09-29 07:56:32 PDT
Ilya Tikhonovsky
Comment 7 2012-09-29 08:03:07 PDT
Ilya Tikhonovsky
Comment 8 2012-09-29 08:21:42 PDT
Created attachment 166364 [details] fix for KURL
Early Warning System Bot
Comment 9 2012-09-29 09:09:23 PDT
Comment on attachment 166364 [details] fix for KURL Attachment 166364 [details] did not pass qt-ews (qt): Output: http://queues.webkit.org/results/14088219
Gyuyoung Kim
Comment 10 2012-09-29 09:14:06 PDT
Comment on attachment 166364 [details] fix for KURL Attachment 166364 [details] did not pass efl-ews (efl): Output: http://queues.webkit.org/results/14081247
Early Warning System Bot
Comment 11 2012-09-29 09:28:52 PDT
Comment on attachment 166364 [details] fix for KURL Attachment 166364 [details] did not pass qt-wk2-ews (qt): Output: http://queues.webkit.org/results/14089236
Gyuyoung Kim
Comment 12 2012-09-29 09:49:44 PDT
Comment on attachment 166364 [details] fix for KURL Attachment 166364 [details] did not pass efl-ews (efl): Output: http://queues.webkit.org/results/14089246
Build Bot
Comment 13 2012-09-29 13:39:54 PDT
Comment on attachment 166364 [details] fix for KURL Attachment 166364 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/14078352 New failing tests: svg/animations/smil-leak-dynamically-added-element-instances.svg
Yury Semikhatsky
Comment 14 2012-09-30 01:38:10 PDT
Comment on attachment 166364 [details] fix for KURL View in context: https://bugs.webkit.org/attachment.cgi?id=166364&action=review > Source/WTF/wtf/MemoryInstrumentation.h:34 > +#include <stdio.h> Remove this. > Source/WTF/wtf/MemoryInstrumentation.h:340 > +void reportMemoryUsage(const String* const&, MemoryObjectInfo*); Please update comment at line 335 > Source/WTF/wtf/text/StringImpl.h:456 > + bool usesInternalBuffer() const { return bufferOwnership() == BufferInternal && !hasTerminatingNullCharacter(); } Why do you need !hasTerminatingNullCharacter() ?
Yury Semikhatsky
Comment 15 2012-09-30 23:57:49 PDT
Comment on attachment 166364 [details] fix for KURL View in context: https://bugs.webkit.org/attachment.cgi?id=166364&action=review > Source/WTF/wtf/MemoryInstrumentationString.h:46 > + if (stringImpl->usesInternalBuffer() && !stringImpl->hasTerminatingNullCharacter()) It doesn't seem to work for BufferOwned type of character buffer ownership(everything created with StringImpl::adopt). Please fix that and provide a test for that case. > Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp:277 > } Pleas add a test for substring and for a regular string without shadow.
Ilya Tikhonovsky
Comment 16 2012-10-01 02:57:49 PDT
Created attachment 166437 [details] comments addressed
Yury Semikhatsky
Comment 17 2012-10-01 05:41:24 PDT
Comment on attachment 166437 [details] comments addressed View in context: https://bugs.webkit.org/attachment.cgi?id=166437&action=review > Source/WTF/wtf/MemoryInstrumentationString.h:46 > + if (stringImpl->usesInternalBuffer() && !stringImpl->hasTerminatingNullCharacter()) BufferOwned case is still missing as well as test for that case, r- for that.
Ilya Tikhonovsky
Comment 18 2012-10-01 07:07:24 PDT
Created attachment 166470 [details] comments addressed
Yury Semikhatsky
Comment 19 2012-10-01 07:41:37 PDT
Comment on attachment 166470 [details] comments addressed View in context: https://bugs.webkit.org/attachment.cgi?id=166470&action=review > Source/WTF/wtf/text/StringImpl.h:456 > + bool usesInternalBuffer() const { return bufferOwnership() == BufferInternal && !hasTerminatingNullCharacter(); } hasInternalBuffer ?
Ilya Tikhonovsky
Comment 20 2012-10-01 08:19:26 PDT
Created attachment 166477 [details] usesInternalBuffer was renamed to hasInternalBuffer. hasOwnedBuffer was added.
Ilya Tikhonovsky
Comment 21 2012-10-01 09:00:59 PDT
Created attachment 166488 [details] rebaselined.
Ilya Tikhonovsky
Comment 22 2012-10-02 00:44:40 PDT
WebKit Review Bot
Comment 23 2012-10-02 01:22:25 PDT
Re-opened since this is blocked by bug 98125
Ilya Tikhonovsky
Comment 24 2012-10-02 02:43:30 PDT
Benjamin Poulain
Comment 25 2012-10-04 17:49:45 PDT
Comment on attachment 166488 [details] rebaselined. View in context: https://bugs.webkit.org/attachment.cgi?id=166488&action=review > Source/WTF/wtf/MemoryInstrumentationString.h:47 > + if (stringImpl->hasInternalBuffer()) This looks incorrect. StringImpl::createWithTerminatingNullCharacter() create strings with the same conditions as hasInternalBuffer(). > Source/WTF/wtf/MemoryInstrumentationString.h:59 > + info.addRawBuffer(stringImpl->characters16(), stringImpl->length() * 2); * 2, really?
Ilya Tikhonovsky
Comment 26 2012-10-04 22:34:37 PDT
Comment on attachment 166488 [details] rebaselined. View in context: https://bugs.webkit.org/attachment.cgi?id=166488&action=review >> Source/WTF/wtf/MemoryInstrumentationString.h:47 >> + if (stringImpl->hasInternalBuffer()) > > This looks incorrect. StringImpl::createWithTerminatingNullCharacter() create strings with the same conditions as hasInternalBuffer(). Good point. Looks like in these two cases, construct from literal and create with terminating null character, we can't decide is the string uses internal buffer or not, and can't report correct physical size of the memory object. The only way is to check that the buffer address equal to stringimpl address + sizeof(StringImpl). >> Source/WTF/wtf/MemoryInstrumentationString.h:59 >> + info.addRawBuffer(stringImpl->characters16(), stringImpl->length() * 2); > > * 2, really? why not? we are calculating the size of buffer in bytes and this is 16-bit per symbol string.
Benjamin Poulain
Comment 27 2012-10-04 22:39:33 PDT
> The only way is to check that the buffer address equal to stringimpl address + sizeof(StringImpl). Exactly (and that's cheaper to compute too) :) > >> + info.addRawBuffer(stringImpl->characters16(), stringImpl->length() * 2); > > > > * 2, really? > > why not? we are calculating the size of buffer in bytes and this is 16-bit per symbol string. Typically in WebKit, we don't use magic numbers. In this case, one would use sizeof(UChar).
Ilya Tikhonovsky
Comment 28 2012-10-05 00:18:58 PDT
(In reply to comment #27) > > The only way is to check that the buffer address equal to stringimpl address + sizeof(StringImpl). > > Exactly (and that's cheaper to compute too) :) > > > >> + info.addRawBuffer(stringImpl->characters16(), stringImpl->length() * 2); > > > > > > * 2, really? > > > > why not? we are calculating the size of buffer in bytes and this is 16-bit per symbol string. > > Typically in WebKit, we don't use magic numbers. In this case, one would use sizeof(UChar). yep. my fault.
Note You need to log in before you can comment on or make changes to this bug.