We can use Vector::uncheckedAppend() whenever the number of items that will be appended to a vector is equal to or less than its capacity. Many call sites that call Vector::reserveInitialCapacity() and then use Vector::append() can be written to use Vector::uncheckedAppend().
Created attachment 295187 [details] Patch
Comment on attachment 295187 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=295187&action=review > Source/WebCore/contentextensions/DFAMinimizer.cpp:90 > + m_sets.uncheckedAppend(SetDescriptor({ 0, size, 0 })); Peculiar that we reserve capacity for "size" elements, but here we do only a single uncheckedAppend. Did we reserve too much capacity? Syntax is peculiar; I think it should just be: m_sets.uncheckedAppend(SetDescriptor { 0, size, 0 }); No need to have both parentheses and braces.
(In reply to comment #2) > Comment on attachment 295187 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=295187&action=review > > > Source/WebCore/contentextensions/DFAMinimizer.cpp:90 > > + m_sets.uncheckedAppend(SetDescriptor({ 0, size, 0 })); > > Peculiar that we reserve capacity for "size" elements, but here we do only a > single uncheckedAppend. Did we reserve too much capacity? > We may have reserved too much though it is not immediately obvious from reading the code. I hope you do not mind that I defer proving the bound of m_set to bug #165472. > Syntax is peculiar; I think it should just be: > > m_sets.uncheckedAppend(SetDescriptor { 0, size, 0 }); > > No need to have both parentheses and braces. Will fix before landing.
Committed r209400: <http://trac.webkit.org/changeset/209400>