Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(716)

Unified Diff: src/objects-inl.h

Issue 1134573002: Give ComputeCapacityForSerialization a minimum capacity (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 1abe0c1dd4c219e63e01ca131b582e4df8c731de..cc264f6aef251d4680e4bb4b1621353a74f18483 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -3260,15 +3260,14 @@ DescriptorArray::WhitenessWitness::~WhitenessWitness() {
int HashTableBase::ComputeCapacity(int at_least_space_for) {
const int kMinCapacity = 4;
int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2);
- if (capacity < kMinCapacity) {
- capacity = kMinCapacity; // Guarantee min capacity.
- }
- return capacity;
+ return Max(capacity, kMinCapacity);
}
int HashTableBase::ComputeCapacityForSerialization(int at_least_space_for) {
- return base::bits::RoundUpToPowerOfTwo32(at_least_space_for);
+ const int kMinCapacity = 1;
+ int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for);
+ return Max(capacity, kMinCapacity);
}
« no previous file with comments | « src/heap/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698