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

Side by Side Diff: src/objects.h

Issue 777233003: Revert of Optimize add/set/delete operations for string keys in Maps and Sets (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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/hydrogen-instructions.h ('k') | src/runtime/runtime.h » ('j') | 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 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 3897 matching lines...) Expand 10 before | Expand all | Expand 10 after
3908 3908
3909 static const int kNumberOfBucketsIndex = 0; 3909 static const int kNumberOfBucketsIndex = 0;
3910 static const int kNumberOfElementsIndex = kNumberOfBucketsIndex + 1; 3910 static const int kNumberOfElementsIndex = kNumberOfBucketsIndex + 1;
3911 static const int kNumberOfDeletedElementsIndex = kNumberOfElementsIndex + 1; 3911 static const int kNumberOfDeletedElementsIndex = kNumberOfElementsIndex + 1;
3912 static const int kHashTableStartIndex = kNumberOfDeletedElementsIndex + 1; 3912 static const int kHashTableStartIndex = kNumberOfDeletedElementsIndex + 1;
3913 3913
3914 static const int kNumberOfBucketsOffset = 3914 static const int kNumberOfBucketsOffset =
3915 kHeaderSize + kNumberOfBucketsIndex * kPointerSize; 3915 kHeaderSize + kNumberOfBucketsIndex * kPointerSize;
3916 static const int kNumberOfElementsOffset = 3916 static const int kNumberOfElementsOffset =
3917 kHeaderSize + kNumberOfElementsIndex * kPointerSize; 3917 kHeaderSize + kNumberOfElementsIndex * kPointerSize;
3918 static const int kNumberOfDeletedElementsOffset =
3919 kHeaderSize + kNumberOfDeletedElementsIndex * kPointerSize;
3920 3918
3921 static const int kEntrySize = entrysize + 1; 3919 static const int kEntrySize = entrysize + 1;
3922 static const int kChainOffset = entrysize; 3920 static const int kChainOffset = entrysize;
3923 3921
3924 static const int kLoadFactor = 2;
3925
3926 private: 3922 private:
3927 static Handle<Derived> Rehash(Handle<Derived> table, int new_capacity); 3923 static Handle<Derived> Rehash(Handle<Derived> table, int new_capacity);
3928 3924
3929 void SetNumberOfBuckets(int num) { 3925 void SetNumberOfBuckets(int num) {
3930 set(kNumberOfBucketsIndex, Smi::FromInt(num)); 3926 set(kNumberOfBucketsIndex, Smi::FromInt(num));
3931 } 3927 }
3932 3928
3933 void SetNumberOfElements(int num) { 3929 void SetNumberOfElements(int num) {
3934 set(kNumberOfElementsIndex, Smi::FromInt(num)); 3930 set(kNumberOfElementsIndex, Smi::FromInt(num));
3935 } 3931 }
(...skipping 24 matching lines...) Expand all
3960 set(kNextTableIndex, next_table); 3956 set(kNextTableIndex, next_table);
3961 } 3957 }
3962 3958
3963 void SetRemovedIndexAt(int index, int removed_index) { 3959 void SetRemovedIndexAt(int index, int removed_index) {
3964 return set(kRemovedHolesIndex + index, Smi::FromInt(removed_index)); 3960 return set(kRemovedHolesIndex + index, Smi::FromInt(removed_index));
3965 } 3961 }
3966 3962
3967 static const int kNextTableIndex = kNumberOfElementsIndex; 3963 static const int kNextTableIndex = kNumberOfElementsIndex;
3968 static const int kRemovedHolesIndex = kHashTableStartIndex; 3964 static const int kRemovedHolesIndex = kHashTableStartIndex;
3969 3965
3966 static const int kLoadFactor = 2;
3970 static const int kMaxCapacity = 3967 static const int kMaxCapacity =
3971 (FixedArray::kMaxLength - kHashTableStartIndex) 3968 (FixedArray::kMaxLength - kHashTableStartIndex)
3972 / (1 + (kEntrySize * kLoadFactor)); 3969 / (1 + (kEntrySize * kLoadFactor));
3973 }; 3970 };
3974 3971
3975 3972
3976 class JSSetIterator; 3973 class JSSetIterator;
3977 3974
3978 3975
3979 class OrderedHashSet: public OrderedHashTable< 3976 class OrderedHashSet: public OrderedHashTable<
(...skipping 7028 matching lines...) Expand 10 before | Expand all | Expand 10 after
11008 } else { 11005 } else {
11009 value &= ~(1 << bit_position); 11006 value &= ~(1 << bit_position);
11010 } 11007 }
11011 return value; 11008 return value;
11012 } 11009 }
11013 }; 11010 };
11014 11011
11015 } } // namespace v8::internal 11012 } } // namespace v8::internal
11016 11013
11017 #endif // V8_OBJECTS_H_ 11014 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698