From e7fa1c9c80defe4bc1538e9c67beeb1ac94bab62 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Mon, 18 Nov 2019 16:12:48 +0000 Subject: [PATCH] Bug 1595476 part 1 - Add clearAndCompact method to InlineMap/InlineSet. r=tcampbell Differential Revision: https://phabricator.services.mozilla.com/D52633 --HG-- extra : moz-landing-system : lando --- js/src/ds/InlineTable.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/src/ds/InlineTable.h b/js/src/ds/InlineTable.h index b1b7f136f419..874efd537052 100644 --- a/js/src/ds/InlineTable.h +++ b/js/src/ds/InlineTable.h @@ -218,6 +218,11 @@ class InlineTable : private AllocPolicy { inlCount_ = 0; } + void clearAndCompact() { + clear(); + table_.clearAndCompact(); + } + MOZ_ALWAYS_INLINE Ptr lookup(const Lookup& l) { MOZ_ASSERT(keyNonZero(l)); @@ -475,6 +480,8 @@ class InlineMap { void clear() { impl_.clear(); } + void clearAndCompact() { impl_.clearAndCompact(); } + Range all() const { return impl_.all(); } MOZ_ALWAYS_INLINE @@ -579,6 +586,8 @@ class InlineSet { void clear() { impl_.clear(); } + void clearAndCompact() { impl_.clearAndCompact(); } + Range all() const { return impl_.all(); } MOZ_ALWAYS_INLINE