Skip to content

Commit

Permalink
Re-sync with internal repository (facebook#791)
Browse files Browse the repository at this point in the history
Co-authored-by: Facebook Community Bot <[email protected]>
  • Loading branch information
facebook-github-bot and facebook-github-bot authored Aug 2, 2022
1 parent 8984dc9 commit 5b6255a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/VM/detail/IdentifierHashTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ void IdentifierHashTable::remove(const StringPrimitive *str) {
}

void IdentifierHashTable::growAndRehash(uint32_t newCapacity) {
// Guard against potential overflow in the calculation of new capacity.
if (LLVM_UNLIKELY(newCapacity <= capacity())) {
hermes_fatal("too many identifiers created");
}
assert(llvh::isPowerOf2_32(newCapacity) && "capacity must be power of 2");
CompactTable tmpTable(newCapacity, table_.getCurrentScale());
tmpTable.swap(table_);
Expand Down

0 comments on commit 5b6255a

Please sign in to comment.