Bug 260913 - WasmSectionParser should use tryReserveInitialCapacity instead of tryReserveCapacity.
Summary: WasmSectionParser should use tryReserveInitialCapacity instead of tryReserveC...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-08-30 10:31 PDT by Mark Lam
Modified: 2023-08-30 16:07 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2023-08-30 10:31:36 PDT
We already enforced ordered section parsing, which also enforces that a section type can only be parsed once (with CustomSection being the only exception).  For each of these sections, there are many cases where capacity for their vector stores can be allocated with Vector::tryReserveInitialCapacity instead of Vector::tryReserveCapacity.  Vector::tryReserveInitialCapacity will be more efficient.

Added some RELEASE_ASSERTs to enforce the invariant that these section types are only parsed once.
Added Vector::growCapacityBy and Vector::tryGrowCapacityBy to more concisely express the idea that we're growing the capacity by some increment.

rdar://114175821
Comment 1 Mark Lam 2023-08-30 10:51:53 PDT
Pull request: https://github.com/WebKit/WebKit/pull/17237
Comment 2 EWS 2023-08-30 16:06:58 PDT
Committed 267469@main (78ca85d1db78): <https://commits.webkit.org/267469@main>

Reviewed commits have been landed. Closing PR #17237 and removing active labels.