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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/heap/heap.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 3242 matching lines...) Expand 10 before | Expand all | Expand 10 after
3253 3253
3254 3254
3255 DescriptorArray::WhitenessWitness::~WhitenessWitness() { 3255 DescriptorArray::WhitenessWitness::~WhitenessWitness() {
3256 marking_->LeaveNoMarkingScope(); 3256 marking_->LeaveNoMarkingScope();
3257 } 3257 }
3258 3258
3259 3259
3260 int HashTableBase::ComputeCapacity(int at_least_space_for) { 3260 int HashTableBase::ComputeCapacity(int at_least_space_for) {
3261 const int kMinCapacity = 4; 3261 const int kMinCapacity = 4;
3262 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2); 3262 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2);
3263 if (capacity < kMinCapacity) { 3263 return Max(capacity, kMinCapacity);
3264 capacity = kMinCapacity; // Guarantee min capacity.
3265 }
3266 return capacity;
3267 } 3264 }
3268 3265
3269 3266
3270 int HashTableBase::ComputeCapacityForSerialization(int at_least_space_for) { 3267 int HashTableBase::ComputeCapacityForSerialization(int at_least_space_for) {
3271 return base::bits::RoundUpToPowerOfTwo32(at_least_space_for); 3268 const int kMinCapacity = 1;
3269 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for);
3270 return Max(capacity, kMinCapacity);
3272 } 3271 }
3273 3272
3274 3273
3275 template <typename Derived, typename Shape, typename Key> 3274 template <typename Derived, typename Shape, typename Key>
3276 int HashTable<Derived, Shape, Key>::FindEntry(Key key) { 3275 int HashTable<Derived, Shape, Key>::FindEntry(Key key) {
3277 return FindEntry(GetIsolate(), key); 3276 return FindEntry(GetIsolate(), key);
3278 } 3277 }
3279 3278
3280 3279
3281 // Find entry for key otherwise return kNotFound. 3280 // Find entry for key otherwise return kNotFound.
(...skipping 4317 matching lines...) Expand 10 before | Expand all | Expand 10 after
7599 #undef READ_SHORT_FIELD 7598 #undef READ_SHORT_FIELD
7600 #undef WRITE_SHORT_FIELD 7599 #undef WRITE_SHORT_FIELD
7601 #undef READ_BYTE_FIELD 7600 #undef READ_BYTE_FIELD
7602 #undef WRITE_BYTE_FIELD 7601 #undef WRITE_BYTE_FIELD
7603 #undef NOBARRIER_READ_BYTE_FIELD 7602 #undef NOBARRIER_READ_BYTE_FIELD
7604 #undef NOBARRIER_WRITE_BYTE_FIELD 7603 #undef NOBARRIER_WRITE_BYTE_FIELD
7605 7604
7606 } } // namespace v8::internal 7605 } } // namespace v8::internal
7607 7606
7608 #endif // V8_OBJECTS_INL_H_ 7607 #endif // V8_OBJECTS_INL_H_
OLDNEW
« 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