Index: src/identity-map.cc |
diff --git a/src/identity-map.cc b/src/identity-map.cc |
index 723cdfa2a6427d52ea20d9381c44360f0b85b050..2f5739dad99341031c4ade37182c82636dfe4c87 100644 |
--- a/src/identity-map.cc |
+++ b/src/identity-map.cc |
@@ -14,11 +14,18 @@ namespace internal { |
static const int kInitialIdentityMapSize = 4; |
static const int kResizeFactor = 4; |
-IdentityMapBase::~IdentityMapBase() { |
- if (keys_) heap_->UnregisterStrongRoots(keys_); |
+IdentityMapBase::~IdentityMapBase() { Clear(); } |
+ |
+void IdentityMapBase::Clear() { |
+ if (keys_) { |
+ heap_->UnregisterStrongRoots(keys_); |
+ keys_ = nullptr; |
+ values_ = nullptr; |
+ size_ = 0; |
+ mask_ = 0; |
+ } |
} |
- |
IdentityMapBase::RawEntry IdentityMapBase::Lookup(Object* key) { |
int index = LookupIndex(key); |
return index >= 0 ? &values_[index] : nullptr; |