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: Ben Titzer <titzer@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44143}
This commit is contained in:
Ross McIlroy 2017-03-27 12:08:44 +01:00 committed by Commit Bot
parent 80879b8c26
commit 3d82e557ae

View File

@ -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) {
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.
} }