Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialise BoundFunction arguments before construction
Summary: We currently construct the `ArrayStorage` containing arguments to a `BoundFunction` before constructing the `BoundFunction` itself, but only actually populate it after the `BoundFunction` has been constructed. In the presence of trimming, this ends up meaning that we need to call `ensureCapacity` after allocating the `BoundFunction`, and always update the `argStorage_` property of the newly constructed `BoundFunction` anyway. Instead, we can populate the `ArrayStorage` before constructing the `BoundFunction`. This has the following advantages: 1. The `argStorage_` property is only set once, so there is only one write barrier (and it is a cheaper type of barrier). 2. We don't have to worry about trimming or careful size management. 3. We don't have to worry about managing the exception returned by `ensureCapacity`. There is only one place that may throw. Reviewed By: mattbfb Differential Revision: D39454308 fbshipit-source-id: 19f8a31b529564342d69c69403cef7bf0f7c93d1
- Loading branch information