OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 4101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4112 PropertyDetails details, | 4112 PropertyDetails details, |
4113 uint32_t hash); | 4113 uint32_t hash); |
4114 | 4114 |
4115 // Generate new enumeration indices to avoid enumeration index overflow. | 4115 // Generate new enumeration indices to avoid enumeration index overflow. |
4116 MUST_USE_RESULT MaybeObject* GenerateNewEnumerationIndices(); | 4116 MUST_USE_RESULT MaybeObject* GenerateNewEnumerationIndices(); |
4117 static const int kMaxNumberKeyIndex = DerivedHashTable::kPrefixStartIndex; | 4117 static const int kMaxNumberKeyIndex = DerivedHashTable::kPrefixStartIndex; |
4118 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1; | 4118 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1; |
4119 }; | 4119 }; |
4120 | 4120 |
4121 | 4121 |
4122 class NameDictionaryShape : public BaseShape<Name*> { | 4122 class NameDictionaryShape : public BaseShape<Handle<Name> > { |
4123 public: | 4123 public: |
4124 static inline bool IsMatch(Name* key, Object* other); | 4124 static inline bool IsMatch(Handle<Name> key, Object* other); |
4125 static inline uint32_t Hash(Name* key); | 4125 static inline uint32_t Hash(Handle<Name> key); |
4126 static inline uint32_t HashForObject(Name* key, Object* object); | 4126 static inline uint32_t HashForObject(Handle<Name> key, Object* object); |
4127 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap, | 4127 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap, |
4128 Name* key); | 4128 Handle<Name> key); |
4129 static inline Handle<Object> AsHandle(Isolate* isolate, Name* key); | 4129 static inline Handle<Object> AsHandle(Isolate* isolate, Handle<Name> key); |
4130 static const int kPrefixSize = 2; | 4130 static const int kPrefixSize = 2; |
4131 static const int kEntrySize = 3; | 4131 static const int kEntrySize = 3; |
4132 static const bool kIsEnumerable = true; | 4132 static const bool kIsEnumerable = true; |
4133 }; | 4133 }; |
4134 | 4134 |
4135 | 4135 |
4136 class NameDictionary: public Dictionary<NameDictionary, | 4136 class NameDictionary: public Dictionary<NameDictionary, |
4137 NameDictionaryShape, | 4137 NameDictionaryShape, |
4138 Name*> { | 4138 Handle<Name> > { |
4139 public: | 4139 public: |
4140 static inline NameDictionary* cast(Object* obj) { | 4140 static inline NameDictionary* cast(Object* obj) { |
4141 ASSERT(obj->IsDictionary()); | 4141 ASSERT(obj->IsDictionary()); |
4142 return reinterpret_cast<NameDictionary*>(obj); | 4142 return reinterpret_cast<NameDictionary*>(obj); |
4143 } | 4143 } |
4144 | 4144 |
4145 // Copies enumerable keys to preallocated fixed array. | 4145 // Copies enumerable keys to preallocated fixed array. |
4146 void CopyEnumKeysTo(FixedArray* storage); | 4146 void CopyEnumKeysTo(FixedArray* storage); |
4147 static void DoGenerateNewEnumerationIndices( | 4147 static void DoGenerateNewEnumerationIndices( |
4148 Handle<NameDictionary> dictionary); | 4148 Handle<NameDictionary> dictionary); |
4149 | 4149 |
4150 // Find entry for key, otherwise return kNotFound. Optimized version of | 4150 // Find entry for key, otherwise return kNotFound. Optimized version of |
4151 // HashTable::FindEntry. | 4151 // HashTable::FindEntry. |
| 4152 int FindEntry(Handle<Name> key); |
| 4153 |
| 4154 // TODO(ishell): Remove this when all the callers are handlified. |
4152 int FindEntry(Name* key); | 4155 int FindEntry(Name* key); |
4153 | 4156 |
4154 // TODO(mstarzinger): Temporary wrapper until handlified. | 4157 // TODO(mstarzinger): Temporary wrapper until handlified. |
4155 static Handle<NameDictionary> AddNameEntry(Handle<NameDictionary> dict, | 4158 static Handle<NameDictionary> AddNameEntry(Handle<NameDictionary> dict, |
4156 Handle<Name> name, | 4159 Handle<Name> name, |
4157 Handle<Object> value, | 4160 Handle<Object> value, |
4158 PropertyDetails details); | 4161 PropertyDetails details); |
4159 }; | 4162 }; |
4160 | 4163 |
4161 | 4164 |
(...skipping 7127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11289 } else { | 11292 } else { |
11290 value &= ~(1 << bit_position); | 11293 value &= ~(1 << bit_position); |
11291 } | 11294 } |
11292 return value; | 11295 return value; |
11293 } | 11296 } |
11294 }; | 11297 }; |
11295 | 11298 |
11296 } } // namespace v8::internal | 11299 } } // namespace v8::internal |
11297 | 11300 |
11298 #endif // V8_OBJECTS_H_ | 11301 #endif // V8_OBJECTS_H_ |
OLD | NEW |