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

Unified Diff: src/objects.h

Issue 2028333002: Revert of Extend HasProperty stub with dictionary-mode and double-elements objects support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/globals.h ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 8ff688e507182da9a376467103b2145fce2d8846..631615a50d72333387e15b60f2cd6ed013c52d17 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -3189,8 +3189,6 @@
template <typename Derived, typename Shape, typename Key>
class HashTable : public HashTableBase {
public:
- typedef Shape ShapeT;
-
// Wrapper methods
inline uint32_t Hash(Key key) {
if (Shape::UsesSeed) {
@@ -3477,9 +3475,6 @@
static Handle<Derived> EnsureCapacity(Handle<Derived> obj, int n, Key key);
#ifdef OBJECT_PRINT
- // For our gdb macros, we should perhaps change these in the future.
- void Print();
-
void Print(std::ostream& os); // NOLINT
#endif
// Returns the key (slow).
@@ -8575,10 +8570,6 @@
// Array index strings this short can keep their index in the hash field.
static const int kMaxCachedArrayIndexLength = 7;
- // Maximum number of characters to consider when trying to convert a string
- // value into an array index.
- static const int kMaxArrayIndexSize = 10;
-
// For strings which are array indexes the hash value has the string length
// mixed into the hash, mainly to avoid a hash value of zero which would be
// the case for the string '0'. 24 bits are used for the array index value.
@@ -8586,8 +8577,7 @@
static const int kArrayIndexLengthBits =
kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields;
- STATIC_ASSERT(kArrayIndexLengthBits > 0);
- STATIC_ASSERT(kMaxArrayIndexSize < (1 << kArrayIndexLengthBits));
+ STATIC_ASSERT((kArrayIndexLengthBits > 0));
class ArrayIndexValueBits : public BitField<unsigned int, kNofHashBitFields,
kArrayIndexValueBits> {}; // NOLINT
@@ -8676,6 +8666,34 @@
class String: public Name {
public:
enum Encoding { ONE_BYTE_ENCODING, TWO_BYTE_ENCODING };
+
+ // Array index strings this short can keep their index in the hash field.
+ static const int kMaxCachedArrayIndexLength = 7;
+
+ // For strings which are array indexes the hash value has the string length
+ // mixed into the hash, mainly to avoid a hash value of zero which would be
+ // the case for the string '0'. 24 bits are used for the array index value.
+ static const int kArrayIndexValueBits = 24;
+ static const int kArrayIndexLengthBits =
+ kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields;
+
+ STATIC_ASSERT((kArrayIndexLengthBits > 0));
+
+ class ArrayIndexValueBits : public BitField<unsigned int, kNofHashBitFields,
+ kArrayIndexValueBits> {}; // NOLINT
+ class ArrayIndexLengthBits : public BitField<unsigned int,
+ kNofHashBitFields + kArrayIndexValueBits,
+ kArrayIndexLengthBits> {}; // NOLINT
+
+ // Check that kMaxCachedArrayIndexLength + 1 is a power of two so we
+ // could use a mask to test if the length of string is less than or equal to
+ // kMaxCachedArrayIndexLength.
+ STATIC_ASSERT(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1));
+
+ static const unsigned int kContainsCachedArrayIndexMask =
+ (~static_cast<unsigned>(kMaxCachedArrayIndexLength)
+ << ArrayIndexLengthBits::kShift) |
+ kIsNotArrayIndexMask;
class SubStringRange {
public:
@@ -8887,6 +8905,11 @@
// Layout description.
static const int kLengthOffset = Name::kSize;
static const int kSize = kLengthOffset + kPointerSize;
+
+ // Maximum number of characters to consider when trying to convert a string
+ // value into an array index.
+ static const int kMaxArrayIndexSize = 10;
+ STATIC_ASSERT(kMaxArrayIndexSize < (1 << kArrayIndexLengthBits));
// Max char codes.
static const int32_t kMaxOneByteCharCode = unibrow::Latin1::kMaxChar;
« no previous file with comments | « src/globals.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698