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

Side by Side Diff: src/objects-inl.h

Issue 1847183004: [elements] Avoid using IsKey in loops (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressing comments Created 4 years, 8 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/objects.h ('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 2980 matching lines...) Expand 10 before | Expand all | Expand 10 after
2991 } 2991 }
2992 2992
2993 2993
2994 // static 2994 // static
2995 int HashTableBase::ComputeCapacity(int at_least_space_for) { 2995 int HashTableBase::ComputeCapacity(int at_least_space_for) {
2996 const int kMinCapacity = 4; 2996 const int kMinCapacity = 4;
2997 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2); 2997 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2);
2998 return Max(capacity, kMinCapacity); 2998 return Max(capacity, kMinCapacity);
2999 } 2999 }
3000 3000
3001 bool HashTableBase::IsKey(Heap* heap, Object* k) {
3002 return k != heap->the_hole_value() && k != heap->undefined_value();
3003 }
3001 3004
3002 bool HashTableBase::IsKey(Object* k) { 3005 bool HashTableBase::IsKey(Object* k) {
3003 return !k->IsTheHole() && !k->IsUndefined(); 3006 return !k->IsTheHole() && !k->IsUndefined();
3004 } 3007 }
3005 3008
3006 3009
3007 void HashTableBase::SetNumberOfElements(int nof) { 3010 void HashTableBase::SetNumberOfElements(int nof) {
3008 set(kNumberOfElementsIndex, Smi::FromInt(nof)); 3011 set(kNumberOfElementsIndex, Smi::FromInt(nof));
3009 } 3012 }
3010 3013
(...skipping 4824 matching lines...) Expand 10 before | Expand all | Expand 10 after
7835 #undef WRITE_INT64_FIELD 7838 #undef WRITE_INT64_FIELD
7836 #undef READ_BYTE_FIELD 7839 #undef READ_BYTE_FIELD
7837 #undef WRITE_BYTE_FIELD 7840 #undef WRITE_BYTE_FIELD
7838 #undef NOBARRIER_READ_BYTE_FIELD 7841 #undef NOBARRIER_READ_BYTE_FIELD
7839 #undef NOBARRIER_WRITE_BYTE_FIELD 7842 #undef NOBARRIER_WRITE_BYTE_FIELD
7840 7843
7841 } // namespace internal 7844 } // namespace internal
7842 } // namespace v8 7845 } // namespace v8
7843 7846
7844 #endif // V8_OBJECTS_INL_H_ 7847 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698