[WTF] Set canInitializeWithMemset = true if T is an integral type
Created attachment 335071 [details] Patch
Comment on attachment 335071 [details] Patch Attachment 335071 [details] did not pass win-ews (win): Output: http://webkit-queues.webkit.org/results/6822587 New failing tests: http/tests/preload/download_resources.html
Created attachment 335079 [details] Archive of layout-test-results from ews206 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews206 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Created attachment 335098 [details] Patch
Comment on attachment 335098 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=335098&action=review > Source/WTF/wtf/Vector.h:71 > + static void initializeIfNecessary(T*, T*) { } I am not sure what "if necessary" means here. I think a C++ expert would call this initializeUnlessConstructorIsTrivial or initializeIfConstructorIsNonTrivial. > Source/WTF/wtf/VectorTraits.h:52 > + static const bool canInitializeWithMemset = std::is_integral<T>::value; Why can’t we just set this to true? Are there types that return true for is_pod and can’t be initialized with memset?
Comment on attachment 335098 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=335098&action=review >> Source/WTF/wtf/Vector.h:71 >> + static void initializeIfNecessary(T*, T*) { } > > I am not sure what "if necessary" means here. I think a C++ expert would call this initializeUnlessConstructorIsTrivial or initializeIfConstructorIsNonTrivial. Our Vector<> intentionally does not initialize backing store if T is POD (this is described in Vector.h constructor). This `initializeIfNecessary()` does that: do not initialize if T is POD. `initializeIfNonPOD` would be fine I think. changed. >> Source/WTF/wtf/VectorTraits.h:52 >> + static const bool canInitializeWithMemset = std::is_integral<T>::value; > > Why can’t we just set this to true? Are there types that return true for is_pod and can’t be initialized with memset? I think it is OK: even `double` can be initialized with 0. Changed.
Committed r229397: <https://trac.webkit.org/changeset/229397>
<rdar://problem/38266004>
<rdar://problem/38266005>