| Index: src/objects-inl.h
|
| diff --git a/src/objects-inl.h b/src/objects-inl.h
|
| index 51e8f3f2f3e8de2a18020382e271dc3ee22b1cb1..0fe0f6d5c56d295f6dc680807ae34651f64484fc 100644
|
| --- a/src/objects-inl.h
|
| +++ b/src/objects-inl.h
|
| @@ -2072,23 +2072,28 @@ int HashTable<Shape, Key>::FindEntry(Isolate* isolate, Key key) {
|
| }
|
|
|
|
|
| -bool NumberDictionary::requires_slow_elements() {
|
| - Object* max_index_object = get(kMaxNumberKeyIndex);
|
| +bool NumberDictionaryBase::requires_slow_elements() {
|
| + Object* max_index_object = as_dict()->get(
|
| + NumberDictionary::kMaxNumberKeyIndex);
|
| if (!max_index_object->IsSmi()) return false;
|
| return 0 !=
|
| - (Smi::cast(max_index_object)->value() & kRequiresSlowElementsMask);
|
| + (Smi::cast(max_index_object)->value() &
|
| + NumberDictionary::kRequiresSlowElementsMask);
|
| }
|
|
|
| -uint32_t NumberDictionary::max_number_key() {
|
| +uint32_t NumberDictionaryBase::max_number_key() {
|
| ASSERT(!requires_slow_elements());
|
| - Object* max_index_object = get(kMaxNumberKeyIndex);
|
| + Object* max_index_object = as_dict()->get(
|
| + NumberDictionary::kMaxNumberKeyIndex);
|
| if (!max_index_object->IsSmi()) return 0;
|
| uint32_t value = static_cast<uint32_t>(Smi::cast(max_index_object)->value());
|
| - return value >> kRequiresSlowElementsTagSize;
|
| + return value >> NumberDictionary::kRequiresSlowElementsTagSize;
|
| }
|
|
|
| -void NumberDictionary::set_requires_slow_elements() {
|
| - set(kMaxNumberKeyIndex, Smi::FromInt(kRequiresSlowElementsMask));
|
| +void NumberDictionaryBase::set_requires_slow_elements() {
|
| + as_dict()->set(
|
| + NumberDictionary::kMaxNumberKeyIndex,
|
| + Smi::FromInt(NumberDictionary::kRequiresSlowElementsMask));
|
| }
|
|
|
|
|
| @@ -4532,37 +4537,44 @@ void Dictionary<Shape, Key>::SetEntry(int entry,
|
| }
|
|
|
|
|
| -bool NumberDictionaryShape::IsMatch(uint32_t key, Object* other) {
|
| +template <NumberDictionaryKind kind>
|
| +bool NumberDictionaryShape<kind>::IsMatch(uint32_t key, Object* other) {
|
| ASSERT(other->IsNumber());
|
| return key == static_cast<uint32_t>(other->Number());
|
| }
|
|
|
|
|
| -uint32_t NumberDictionaryShape::Hash(uint32_t key) {
|
| - // This function is unreachable, since shape has UsesSeed=true flag.
|
| - UNREACHABLE();
|
| - return 0;
|
| +template <NumberDictionaryKind kind>
|
| +uint32_t NumberDictionaryShape<kind>::Hash(uint32_t key) {
|
| + return ComputeIntegerHash(key, 0);
|
| }
|
|
|
|
|
| -uint32_t NumberDictionaryShape::HashForObject(uint32_t key, Object* other) {
|
| - // This function is unreachable, since shape has UsesSeed=true flag.
|
| - UNREACHABLE();
|
| - return 0;
|
| +template <NumberDictionaryKind kind>
|
| +uint32_t NumberDictionaryShape<kind>::HashForObject(uint32_t key,
|
| + Object* other) {
|
| + ASSERT(other->IsNumber());
|
| + return ComputeIntegerHash(static_cast<uint32_t>(other->Number()), 0);
|
| }
|
|
|
| -uint32_t NumberDictionaryShape::SeededHash(uint32_t key, uint32_t seed) {
|
| +
|
| +template <NumberDictionaryKind kind>
|
| +uint32_t NumberDictionaryShape<kind>::SeededHash(uint32_t key, uint32_t seed) {
|
| return ComputeIntegerHash(key, seed);
|
| }
|
|
|
| -uint32_t NumberDictionaryShape::SeededHashForObject(uint32_t key,
|
| - uint32_t seed,
|
| - Object* other) {
|
| +
|
| +template <NumberDictionaryKind kind>
|
| +uint32_t NumberDictionaryShape<kind>::SeededHashForObject(uint32_t key,
|
| + uint32_t seed,
|
| + Object* other) {
|
| ASSERT(other->IsNumber());
|
| return ComputeIntegerHash(static_cast<uint32_t>(other->Number()), seed);
|
| }
|
|
|
| -MaybeObject* NumberDictionaryShape::AsObject(uint32_t key) {
|
| +
|
| +template <NumberDictionaryKind kind>
|
| +MaybeObject* NumberDictionaryShape<kind>::AsObject(uint32_t key) {
|
| return Isolate::Current()->heap()->NumberFromUint32(key);
|
| }
|
|
|
|
|