Commit 3d82e557 authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

Resize identity map by doubling instead of quadrupling.

Perf-sheriffs please revert if this causes any performance regressions.

BUG=

Change-Id: I9ead7148e1e0146ece3614df49fd031dd1e357fe
Reviewed-on: https://chromium-review.googlesource.com/445159
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Reviewed-by: 's avatarJochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44143}
parent 80879b8c
...@@ -11,7 +11,7 @@ namespace v8 { ...@@ -11,7 +11,7 @@ namespace v8 {
namespace internal { namespace internal {
static const int kInitialIdentityMapSize = 4; static const int kInitialIdentityMapSize = 4;
static const int kResizeFactor = 4; static const int kResizeFactor = 2;
IdentityMapBase::~IdentityMapBase() { IdentityMapBase::~IdentityMapBase() {
// Clear must be called by the subclass to avoid calling the virtual // Clear must be called by the subclass to avoid calling the virtual
...@@ -86,7 +86,8 @@ void* IdentityMapBase::DeleteIndex(int index) { ...@@ -86,7 +86,8 @@ void* IdentityMapBase::DeleteIndex(int index) {
size_--; size_--;
DCHECK_GE(size_, 0); DCHECK_GE(size_, 0);
if (size_ * kResizeFactor < capacity_ / kResizeFactor) { if (capacity_ > kInitialIdentityMapSize &&
size_ * kResizeFactor < capacity_ / kResizeFactor) {
Resize(capacity_ / kResizeFactor); Resize(capacity_ / kResizeFactor);
return ret_value; // No need to fix collisions as resize reinserts keys. return ret_value; // No need to fix collisions as resize reinserts keys.
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment