RESOLVED FIXED 179899
Allow for more efficient use of GenericTypedArrayView
https://bugs.webkit.org/show_bug.cgi?id=179899
Summary Allow for more efficient use of GenericTypedArrayView
Simon Fraser (smfr)
Reported 2017-11-20 15:06:03 PST
A few fixes to GenericTypedArrayView to make callers faster: * add setNative(unsigned index, typename Adaptor::Type value) to avoid uint_8 -> double -> uint_8 conversions * add getRange() to read a range of bytes, akin to setRange * avoid getRange and setRange using the virtual byteLength
Attachments
Patch (6.50 KB, patch)
2017-11-20 15:09 PST, Simon Fraser (smfr)
no flags
Patch (6.57 KB, patch)
2017-11-20 15:19 PST, Simon Fraser (smfr)
no flags
Simon Fraser (smfr)
Comment 1 2017-11-20 15:09:51 PST
EWS Watchlist
Comment 2 2017-11-20 15:12:20 PST
Attachment 327376 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/runtime/ArrayBufferView.h:178: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/JavaScriptCore/runtime/ArrayBufferView.h:179: Tab found; better to use spaces [whitespace/tab] [1] ERROR: Source/JavaScriptCore/runtime/ArrayBufferView.h:180: When wrapping a line, only indent 4 spaces. [whitespace/indent] [3] ERROR: Source/JavaScriptCore/runtime/ArrayBufferView.h:184: Tab found; better to use spaces [whitespace/tab] [1] ERROR: Source/JavaScriptCore/runtime/ArrayBufferView.h:186: Tab found; better to use spaces [whitespace/tab] [1] ERROR: Source/JavaScriptCore/runtime/ArrayBufferView.h:193: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/JavaScriptCore/runtime/GenericTypedArrayView.h:94: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] Total errors found: 7 in 3 files If any of these errors are false positives, please file a bug against check-webkit-style.
Simon Fraser (smfr)
Comment 3 2017-11-20 15:19:18 PST
EWS Watchlist
Comment 4 2017-11-20 15:20:29 PST
Attachment 327378 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/runtime/ArrayBufferView.h:178: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/JavaScriptCore/runtime/ArrayBufferView.h:193: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/JavaScriptCore/runtime/GenericTypedArrayView.h:94: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] Total errors found: 3 in 3 files If any of these errors are false positives, please file a bug against check-webkit-style.
Simon Fraser (smfr)
Comment 5 2017-11-20 19:34:34 PST
(In reply to Build Bot from comment #4) > Attachment 327378 [details] did not pass style-queue: > > > ERROR: Source/JavaScriptCore/runtime/ArrayBufferView.h:178: Please replace > ASSERT_WITH_SECURITY_IMPLICATION() with > RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] Nope; the assertion runs a virtual function.
WebKit Commit Bot
Comment 6 2017-11-21 09:16:34 PST
Comment on attachment 327378 [details] Patch Clearing flags on attachment: 327378 Committed r225084: <https://trac.webkit.org/changeset/225084>
WebKit Commit Bot
Comment 7 2017-11-21 09:16:36 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 8 2017-11-21 09:17:22 PST
Darin Adler
Comment 9 2017-11-22 10:45:27 PST
Comment on attachment 327378 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=327378&action=review > Source/JavaScriptCore/runtime/ArrayBufferView.h:122 > + inline bool setRangeImpl(const char* data, size_t dataByteLength, unsigned byteOffset, unsigned bufferByteLength); > + inline bool getRangeImpl(char* destination, size_t dataByteLength, unsigned byteOffset, unsigned bufferByteLength); The "inline" on all these functions are not needed. Should these be void* instead of char*? Or maybe uint8_t*?
Simon Fraser (smfr)
Comment 10 2017-11-22 22:48:40 PST
Simon Fraser (smfr)
Comment 11 2017-11-22 23:07:48 PST
(In reply to Darin Adler from comment #9) > Comment on attachment 327378 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=327378&action=review > > > Source/JavaScriptCore/runtime/ArrayBufferView.h:122 > > + inline bool setRangeImpl(const char* data, size_t dataByteLength, unsigned byteOffset, unsigned bufferByteLength); > > + inline bool getRangeImpl(char* destination, size_t dataByteLength, unsigned byteOffset, unsigned bufferByteLength); > > The "inline" on all these functions are not needed. Without them I get duplicate symbol errors at link time. > Should these be void* instead of char*? Or maybe uint8_t*? void*, yes. Will fix in a followup.
Simon Fraser (smfr)
Comment 12 2017-11-22 23:29:29 PST
More cleanup in aisle, er bug 179966
Darin Adler
Comment 13 2017-11-23 09:28:56 PST
Comment on attachment 327378 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=327378&action=review >>> Source/JavaScriptCore/runtime/ArrayBufferView.h:122 >>> + inline bool getRangeImpl(char* destination, size_t dataByteLength, unsigned byteOffset, unsigned bufferByteLength); >> >> The "inline" on all these functions are not needed. >> >> Should these be void* instead of char*? Or maybe uint8_t*? > > Without them I get duplicate symbol errors at link time. What I meant is that the inline should be on the function definitions, not here in the class. Not removing them entirely. But maybe I am wrong about that. Maybe we should be moving toward doing it this way consistently instead, moving the "inline" keywords from the function definitions to the function declarations in the class above. There is at least one benefit to that, I think. The compiler can produce a warning or error if you call the function and it doesn’t have the function definition in the compilation unit, moving what would be a linker error to compile time.
Note You need to log in before you can comment on or make changes to this bug.