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 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1880 } | 1880 } |
1881 | 1881 |
1882 | 1882 |
1883 bool DescriptorArray::IsEmpty() { | 1883 bool DescriptorArray::IsEmpty() { |
1884 ASSERT(length() >= kFirstIndex || | 1884 ASSERT(length() >= kFirstIndex || |
1885 this == HEAP->empty_descriptor_array()); | 1885 this == HEAP->empty_descriptor_array()); |
1886 return length() < kFirstIndex; | 1886 return length() < kFirstIndex; |
1887 } | 1887 } |
1888 | 1888 |
1889 | 1889 |
1890 void DescriptorArray::NoIncrementalWriteBarrierSwap(FixedArray* array, | |
1891 int first, | |
1892 int second) { | |
1893 Object* tmp = array->get(first); | |
1894 NoIncrementalWriteBarrierSet(array, first, array->get(second)); | |
1895 NoIncrementalWriteBarrierSet(array, second, tmp); | |
1896 } | |
1897 | |
1898 | |
1899 // Perform a binary search in a fixed array. Low and high are entry indices. If | 1890 // Perform a binary search in a fixed array. Low and high are entry indices. If |
1900 // there are three entries in this array it should be called with low=0 and | 1891 // there are three entries in this array it should be called with low=0 and |
1901 // high=2. | 1892 // high=2. |
1902 template<typename T> | 1893 template<typename T> |
1903 int BinarySearch(T* array, String* name, int low, int high) { | 1894 int BinarySearch(T* array, String* name, int low, int high) { |
1904 uint32_t hash = name->Hash(); | 1895 uint32_t hash = name->Hash(); |
1905 int limit = high; | 1896 int limit = high; |
1906 | 1897 |
1907 ASSERT(low <= high); | 1898 ASSERT(low <= high); |
1908 | 1899 |
1909 while (low != high) { | 1900 while (low != high) { |
1910 int mid = (low + high) / 2; | 1901 int mid = (low + high) / 2; |
1911 String* mid_name = array->GetKey(mid); | 1902 String* mid_name = array->GetSortedKey(mid); |
1912 uint32_t mid_hash = mid_name->Hash(); | 1903 uint32_t mid_hash = mid_name->Hash(); |
1913 | 1904 |
1914 if (mid_hash >= hash) { | 1905 if (mid_hash >= hash) { |
1915 high = mid; | 1906 high = mid; |
1916 } else { | 1907 } else { |
1917 low = mid + 1; | 1908 low = mid + 1; |
1918 } | 1909 } |
1919 } | 1910 } |
1920 | 1911 |
1921 for (; low <= limit && array->GetKey(low)->Hash() == hash; ++low) { | 1912 for (; low <= limit; ++low) { |
1922 if (array->GetKey(low)->Equals(name)) return low; | 1913 int sort_index = array->GetSortedKeyIndex(low); |
| 1914 String* entry = array->GetKey(sort_index); |
| 1915 if (entry->Hash() != hash) break; |
| 1916 if (entry->Equals(name)) return sort_index; |
1923 } | 1917 } |
1924 | 1918 |
1925 return T::kNotFound; | 1919 return T::kNotFound; |
1926 } | 1920 } |
1927 | 1921 |
1928 | |
1929 // Perform a linear search in this fixed array. len is the number of entry | 1922 // Perform a linear search in this fixed array. len is the number of entry |
1930 // indices that are valid. | 1923 // indices that are valid. |
1931 template<typename T> | 1924 template<typename T> |
1932 int LinearSearch(T* array, String* name, int len) { | 1925 int LinearSearch(T* array, String* name, int len) { |
1933 uint32_t hash = name->Hash(); | 1926 uint32_t hash = name->Hash(); |
1934 for (int number = 0; number < len; number++) { | 1927 for (int number = 0; number < len; number++) { |
1935 String* entry = array->GetKey(number); | 1928 int sorted_index = array->GetSortedKeyIndex(number); |
| 1929 String* entry = array->GetKey(sorted_index); |
1936 uint32_t current_hash = entry->Hash(); | 1930 uint32_t current_hash = entry->Hash(); |
1937 if (current_hash > hash) break; | 1931 if (current_hash > hash) break; |
1938 if (current_hash == hash && name->Equals(entry)) return number; | 1932 if (current_hash == hash && entry->Equals(name)) return sorted_index; |
1939 } | 1933 } |
1940 return T::kNotFound; | 1934 return T::kNotFound; |
1941 } | 1935 } |
1942 | 1936 |
1943 | 1937 |
1944 template<typename T> | 1938 template<typename T> |
1945 int Search(T* array, String* name) { | 1939 int Search(T* array, String* name) { |
1946 SLOW_ASSERT(array->IsSortedNoDuplicates()); | 1940 SLOW_ASSERT(array->IsSortedNoDuplicates()); |
1947 | 1941 |
1948 // Check for empty descriptor array. | |
1949 int nof = array->number_of_entries(); | 1942 int nof = array->number_of_entries(); |
1950 if (nof == 0) return T::kNotFound; | 1943 if (nof == 0) return T::kNotFound; |
1951 | 1944 |
1952 // Fast case: do linear search for small arrays. | 1945 // Fast case: do linear search for small arrays. |
1953 const int kMaxElementsForLinearSearch = 8; | 1946 const int kMaxElementsForLinearSearch = 8; |
1954 if (StringShape(name).IsSymbol() && nof < kMaxElementsForLinearSearch) { | 1947 if (nof < kMaxElementsForLinearSearch) { |
1955 return LinearSearch(array, name, nof); | 1948 return LinearSearch(array, name, nof); |
1956 } | 1949 } |
1957 | 1950 |
1958 // Slow case: perform binary search. | 1951 // Slow case: perform binary search. |
1959 return BinarySearch(array, name, 0, nof - 1); | 1952 return BinarySearch(array, name, 0, nof - 1); |
1960 } | 1953 } |
1961 | 1954 |
1962 | 1955 |
1963 int DescriptorArray::Search(String* name) { | 1956 int DescriptorArray::Search(String* name) { |
1964 return internal::Search(this, name); | 1957 return internal::Search(this, name); |
1965 } | 1958 } |
1966 | 1959 |
1967 | 1960 |
1968 int DescriptorArray::SearchWithCache(String* name) { | 1961 int DescriptorArray::SearchWithCache(String* name) { |
| 1962 if (number_of_descriptors() == 0) return kNotFound; |
| 1963 |
1969 DescriptorLookupCache* cache = GetIsolate()->descriptor_lookup_cache(); | 1964 DescriptorLookupCache* cache = GetIsolate()->descriptor_lookup_cache(); |
1970 int number = cache->Lookup(this, name); | 1965 int number = cache->Lookup(this, name); |
| 1966 |
1971 if (number == DescriptorLookupCache::kAbsent) { | 1967 if (number == DescriptorLookupCache::kAbsent) { |
1972 number = internal::Search(this, name); | 1968 number = Search(name); |
1973 cache->Update(this, name, number); | 1969 cache->Update(this, name, number); |
1974 } | 1970 } |
| 1971 |
1975 return number; | 1972 return number; |
1976 } | 1973 } |
1977 | 1974 |
1978 | 1975 |
| 1976 void Map::LookupDescriptor(JSObject* holder, |
| 1977 String* name, |
| 1978 LookupResult* result) { |
| 1979 DescriptorArray* descriptors = this->instance_descriptors(); |
| 1980 int number = descriptors->SearchWithCache(name); |
| 1981 if (number == DescriptorArray::kNotFound) return result->NotFound(); |
| 1982 result->DescriptorResult(holder, descriptors->GetDetails(number), number); |
| 1983 } |
| 1984 |
| 1985 |
| 1986 void Map::LookupTransition(JSObject* holder, |
| 1987 String* name, |
| 1988 LookupResult* result) { |
| 1989 if (HasTransitionArray()) { |
| 1990 TransitionArray* transition_array = transitions(); |
| 1991 int number = transition_array->Search(name); |
| 1992 if (number != TransitionArray::kNotFound) { |
| 1993 return result->TransitionResult(holder, number); |
| 1994 } |
| 1995 } |
| 1996 result->NotFound(); |
| 1997 } |
| 1998 |
| 1999 |
1979 Object** DescriptorArray::GetKeySlot(int descriptor_number) { | 2000 Object** DescriptorArray::GetKeySlot(int descriptor_number) { |
1980 ASSERT(descriptor_number < number_of_descriptors()); | 2001 ASSERT(descriptor_number < number_of_descriptors()); |
1981 return HeapObject::RawField( | 2002 return HeapObject::RawField( |
1982 reinterpret_cast<HeapObject*>(this), | 2003 reinterpret_cast<HeapObject*>(this), |
1983 OffsetOfElementAt(ToKeyIndex(descriptor_number))); | 2004 OffsetOfElementAt(ToKeyIndex(descriptor_number))); |
1984 } | 2005 } |
1985 | 2006 |
1986 | 2007 |
1987 String* DescriptorArray::GetKey(int descriptor_number) { | 2008 String* DescriptorArray::GetKey(int descriptor_number) { |
1988 ASSERT(descriptor_number < number_of_descriptors()); | 2009 ASSERT(descriptor_number < number_of_descriptors()); |
1989 return String::cast(get(ToKeyIndex(descriptor_number))); | 2010 return String::cast(get(ToKeyIndex(descriptor_number))); |
1990 } | 2011 } |
1991 | 2012 |
1992 | 2013 |
| 2014 int DescriptorArray::GetSortedKeyIndex(int descriptor_number) { |
| 2015 return GetDetails(descriptor_number).pointer(); |
| 2016 } |
| 2017 |
| 2018 |
| 2019 String* DescriptorArray::GetSortedKey(int descriptor_number) { |
| 2020 return GetKey(GetSortedKeyIndex(descriptor_number)); |
| 2021 } |
| 2022 |
| 2023 |
| 2024 void DescriptorArray::SetSortedKey(int pointer, int descriptor_number) { |
| 2025 int details_index = ToDetailsIndex(pointer); |
| 2026 PropertyDetails details = PropertyDetails(Smi::cast(get(details_index))); |
| 2027 set_unchecked(details_index, details.set_pointer(descriptor_number).AsSmi()); |
| 2028 } |
| 2029 |
| 2030 |
1993 Object** DescriptorArray::GetValueSlot(int descriptor_number) { | 2031 Object** DescriptorArray::GetValueSlot(int descriptor_number) { |
1994 ASSERT(descriptor_number < number_of_descriptors()); | 2032 ASSERT(descriptor_number < number_of_descriptors()); |
1995 return HeapObject::RawField( | 2033 return HeapObject::RawField( |
1996 reinterpret_cast<HeapObject*>(this), | 2034 reinterpret_cast<HeapObject*>(this), |
1997 OffsetOfElementAt(ToValueIndex(descriptor_number))); | 2035 OffsetOfElementAt(ToValueIndex(descriptor_number))); |
1998 } | 2036 } |
1999 | 2037 |
2000 | 2038 |
2001 Object* DescriptorArray::GetValue(int descriptor_number) { | 2039 Object* DescriptorArray::GetValue(int descriptor_number) { |
2002 ASSERT(descriptor_number < number_of_descriptors()); | 2040 ASSERT(descriptor_number < number_of_descriptors()); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2044 GetValue(descriptor_number), | 2082 GetValue(descriptor_number), |
2045 GetDetails(descriptor_number)); | 2083 GetDetails(descriptor_number)); |
2046 } | 2084 } |
2047 | 2085 |
2048 | 2086 |
2049 void DescriptorArray::Set(int descriptor_number, | 2087 void DescriptorArray::Set(int descriptor_number, |
2050 Descriptor* desc, | 2088 Descriptor* desc, |
2051 const WhitenessWitness&) { | 2089 const WhitenessWitness&) { |
2052 // Range check. | 2090 // Range check. |
2053 ASSERT(descriptor_number < number_of_descriptors()); | 2091 ASSERT(descriptor_number < number_of_descriptors()); |
2054 ASSERT(desc->GetDetails().index() <= number_of_descriptors()); | 2092 ASSERT(desc->GetDetails().descriptor_index() <= |
2055 ASSERT(desc->GetDetails().index() > 0); | 2093 number_of_descriptors()); |
| 2094 ASSERT(desc->GetDetails().descriptor_index() > 0); |
2056 | 2095 |
2057 NoIncrementalWriteBarrierSet(this, | 2096 NoIncrementalWriteBarrierSet(this, |
2058 ToKeyIndex(descriptor_number), | 2097 ToKeyIndex(descriptor_number), |
2059 desc->GetKey()); | 2098 desc->GetKey()); |
2060 NoIncrementalWriteBarrierSet(this, | 2099 NoIncrementalWriteBarrierSet(this, |
2061 ToValueIndex(descriptor_number), | 2100 ToValueIndex(descriptor_number), |
2062 desc->GetValue()); | 2101 desc->GetValue()); |
2063 NoIncrementalWriteBarrierSet(this, | 2102 NoIncrementalWriteBarrierSet(this, |
2064 ToDetailsIndex(descriptor_number), | 2103 ToDetailsIndex(descriptor_number), |
2065 desc->GetDetails().AsSmi()); | 2104 desc->GetDetails().AsSmi()); |
2066 } | 2105 } |
2067 | 2106 |
2068 | 2107 |
2069 int DescriptorArray::Append(Descriptor* desc, | 2108 void DescriptorArray::Append(Descriptor* desc, |
2070 const WhitenessWitness& witness, | 2109 const WhitenessWitness& witness, |
2071 int number_of_set_descriptors) { | 2110 int number_of_set_descriptors) { |
2072 int descriptor_number = number_of_set_descriptors; | 2111 int enumeration_index = number_of_set_descriptors + 1; |
2073 int enumeration_index = descriptor_number + 1; | |
2074 desc->SetEnumerationIndex(enumeration_index); | 2112 desc->SetEnumerationIndex(enumeration_index); |
| 2113 Set(number_of_set_descriptors, desc, witness); |
2075 | 2114 |
2076 uint32_t hash = desc->GetKey()->Hash(); | 2115 uint32_t hash = desc->GetKey()->Hash(); |
2077 | 2116 |
2078 for (; descriptor_number > 0; --descriptor_number) { | 2117 int insertion; |
2079 String* key = GetKey(descriptor_number - 1); | 2118 |
| 2119 for (insertion = number_of_set_descriptors; insertion > 0; --insertion) { |
| 2120 String* key = GetSortedKey(insertion - 1); |
2080 if (key->Hash() <= hash) break; | 2121 if (key->Hash() <= hash) break; |
2081 Object* value = GetValue(descriptor_number - 1); | 2122 SetSortedKey(insertion, GetSortedKeyIndex(insertion - 1)); |
2082 PropertyDetails details = GetDetails(descriptor_number - 1); | |
2083 Descriptor moved_descriptor(key, value, details); | |
2084 Set(descriptor_number, &moved_descriptor, witness); | |
2085 } | 2123 } |
2086 | 2124 |
2087 Set(descriptor_number, desc, witness); | 2125 SetSortedKey(insertion, number_of_set_descriptors); |
2088 return descriptor_number; | |
2089 } | 2126 } |
2090 | 2127 |
2091 | 2128 |
2092 void DescriptorArray::NoIncrementalWriteBarrierSwapDescriptors( | 2129 void DescriptorArray::SwapSortedKeys(int first, int second) { |
2093 int first, int second) { | 2130 int first_key = GetSortedKeyIndex(first); |
2094 NoIncrementalWriteBarrierSwap(this, ToKeyIndex(first), ToKeyIndex(second)); | 2131 SetSortedKey(first, GetSortedKeyIndex(second)); |
2095 NoIncrementalWriteBarrierSwap(this, | 2132 SetSortedKey(second, first_key); |
2096 ToValueIndex(first), | |
2097 ToValueIndex(second)); | |
2098 NoIncrementalWriteBarrierSwap(this, | |
2099 ToDetailsIndex(first), | |
2100 ToDetailsIndex(second)); | |
2101 } | 2133 } |
2102 | 2134 |
2103 | 2135 |
2104 FixedArray::WhitenessWitness::WhitenessWitness(FixedArray* array) | 2136 FixedArray::WhitenessWitness::WhitenessWitness(FixedArray* array) |
2105 : marking_(array->GetHeap()->incremental_marking()) { | 2137 : marking_(array->GetHeap()->incremental_marking()) { |
2106 marking_->EnterNoMarkingScope(); | 2138 marking_->EnterNoMarkingScope(); |
2107 ASSERT(Marking::Color(array) == Marking::WHITE_OBJECT); | 2139 ASSERT(Marking::Color(array) == Marking::WHITE_OBJECT); |
2108 } | 2140 } |
2109 | 2141 |
2110 | 2142 |
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3448 ASSERT(!is_shared()); | 3480 ASSERT(!is_shared()); |
3449 MaybeObject* maybe_failure = EnsureHasTransitionArray(this); | 3481 MaybeObject* maybe_failure = EnsureHasTransitionArray(this); |
3450 if (maybe_failure->IsFailure()) return maybe_failure; | 3482 if (maybe_failure->IsFailure()) return maybe_failure; |
3451 | 3483 |
3452 transitions()->set_descriptors(value, mode); | 3484 transitions()->set_descriptors(value, mode); |
3453 return this; | 3485 return this; |
3454 } | 3486 } |
3455 | 3487 |
3456 | 3488 |
3457 MaybeObject* Map::InitializeDescriptors(DescriptorArray* descriptors) { | 3489 MaybeObject* Map::InitializeDescriptors(DescriptorArray* descriptors) { |
| 3490 #ifdef DEBUG |
3458 int len = descriptors->number_of_descriptors(); | 3491 int len = descriptors->number_of_descriptors(); |
3459 ASSERT(len <= DescriptorArray::kMaxNumberOfDescriptors); | 3492 ASSERT(len <= DescriptorArray::kMaxNumberOfDescriptors); |
3460 SLOW_ASSERT(descriptors->IsSortedNoDuplicates()); | 3493 SLOW_ASSERT(descriptors->IsSortedNoDuplicates()); |
3461 | 3494 |
3462 #ifdef DEBUG | |
3463 bool used_indices[DescriptorArray::kMaxNumberOfDescriptors]; | 3495 bool used_indices[DescriptorArray::kMaxNumberOfDescriptors]; |
3464 for (int i = 0; i < len; ++i) used_indices[i] = false; | 3496 for (int i = 0; i < len; ++i) used_indices[i] = false; |
3465 | 3497 |
3466 // Ensure that all enumeration indexes between 1 and length occur uniquely in | 3498 // Ensure that all enumeration indexes between 1 and length occur uniquely in |
3467 // the descriptor array. | 3499 // the descriptor array. |
3468 for (int i = 0; i < len; ++i) { | 3500 for (int i = 0; i < len; ++i) { |
3469 int enum_index = descriptors->GetDetails(i).index() - | 3501 int enum_index = descriptors->GetDetails(i).descriptor_index() - |
3470 PropertyDetails::kInitialIndex; | 3502 PropertyDetails::kInitialIndex; |
3471 ASSERT(0 <= enum_index && enum_index < len); | 3503 ASSERT(0 <= enum_index && enum_index < len); |
3472 ASSERT(!used_indices[enum_index]); | 3504 ASSERT(!used_indices[enum_index]); |
3473 used_indices[enum_index] = true; | 3505 used_indices[enum_index] = true; |
3474 } | 3506 } |
3475 #endif | 3507 #endif |
3476 | 3508 |
3477 MaybeObject* maybe_failure = SetDescriptors(descriptors); | 3509 MaybeObject* maybe_failure = SetDescriptors(descriptors); |
3478 if (maybe_failure->IsFailure()) return maybe_failure; | 3510 if (maybe_failure->IsFailure()) return maybe_failure; |
3479 | 3511 |
3480 for (int i = 0; i < len; ++i) { | 3512 SetNumberOfOwnDescriptors(descriptors->number_of_descriptors()); |
3481 if (descriptors->GetDetails(i).index() == len) { | |
3482 SetLastAdded(i); | |
3483 return this; | |
3484 } | |
3485 } | |
3486 | 3513 |
3487 ASSERT(len == 0 && LastAdded() == kNoneAdded); | |
3488 return this; | 3514 return this; |
3489 } | 3515 } |
3490 | 3516 |
3491 | 3517 |
3492 SMI_ACCESSORS(Map, bit_field3, kBitField3Offset) | 3518 SMI_ACCESSORS(Map, bit_field3, kBitField3Offset) |
3493 | 3519 |
3494 | 3520 |
3495 void Map::ClearTransitions(Heap* heap, WriteBarrierMode mode) { | 3521 void Map::ClearTransitions(Heap* heap, WriteBarrierMode mode) { |
3496 Object* back_pointer = GetBackPointer(); | 3522 Object* back_pointer = GetBackPointer(); |
3497 #ifdef DEBUG | 3523 #ifdef DEBUG |
3498 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); | 3524 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); |
3499 if (object->IsTransitionArray()) { | 3525 if (object->IsTransitionArray()) { |
3500 ZapTransitions(); | 3526 ZapTransitions(); |
3501 } else { | 3527 } else { |
3502 ASSERT(object->IsMap() || object->IsUndefined()); | 3528 ASSERT(object->IsMap() || object->IsUndefined()); |
3503 } | 3529 } |
3504 #endif | 3530 #endif |
3505 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, back_pointer); | 3531 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, back_pointer); |
3506 CONDITIONAL_WRITE_BARRIER( | 3532 CONDITIONAL_WRITE_BARRIER( |
3507 heap, this, kTransitionsOrBackPointerOffset, back_pointer, mode); | 3533 heap, this, kTransitionsOrBackPointerOffset, back_pointer, mode); |
3508 } | 3534 } |
3509 | 3535 |
3510 | 3536 |
3511 void Map::AppendDescriptor(Descriptor* desc, | 3537 void Map::AppendDescriptor(Descriptor* desc, |
3512 const DescriptorArray::WhitenessWitness& witness) { | 3538 const DescriptorArray::WhitenessWitness& witness) { |
3513 DescriptorArray* descriptors = instance_descriptors(); | 3539 DescriptorArray* descriptors = instance_descriptors(); |
3514 int set_descriptors = NumberOfSetDescriptors(); | 3540 int number_of_own_descriptors = NumberOfOwnDescriptors(); |
3515 int new_last_added = descriptors->Append(desc, witness, set_descriptors); | 3541 ASSERT(number_of_own_descriptors < descriptors->number_of_descriptors()); |
3516 SetLastAdded(new_last_added); | 3542 descriptors->Append(desc, witness, number_of_own_descriptors); |
| 3543 SetNumberOfOwnDescriptors(number_of_own_descriptors + 1); |
3517 } | 3544 } |
3518 | 3545 |
3519 | 3546 |
3520 Object* Map::GetBackPointer() { | 3547 Object* Map::GetBackPointer() { |
3521 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); | 3548 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); |
3522 if (object->IsDescriptorArray()) { | 3549 if (object->IsDescriptorArray()) { |
3523 return TransitionArray::cast(object)->back_pointer_storage(); | 3550 return TransitionArray::cast(object)->back_pointer_storage(); |
3524 } else { | 3551 } else { |
3525 ASSERT(object->IsMap() || object->IsUndefined()); | 3552 ASSERT(object->IsMap() || object->IsUndefined()); |
3526 return object; | 3553 return object; |
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4994 Object* value) { | 5021 Object* value) { |
4995 SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0))); | 5022 SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0))); |
4996 } | 5023 } |
4997 | 5024 |
4998 | 5025 |
4999 template<typename Shape, typename Key> | 5026 template<typename Shape, typename Key> |
5000 void Dictionary<Shape, Key>::SetEntry(int entry, | 5027 void Dictionary<Shape, Key>::SetEntry(int entry, |
5001 Object* key, | 5028 Object* key, |
5002 Object* value, | 5029 Object* value, |
5003 PropertyDetails details) { | 5030 PropertyDetails details) { |
5004 ASSERT(!key->IsString() || details.IsDeleted() || details.index() > 0); | 5031 ASSERT(!key->IsString() || |
| 5032 details.IsDeleted() || |
| 5033 details.dictionary_index() > 0); |
5005 int index = HashTable<Shape, Key>::EntryToIndex(entry); | 5034 int index = HashTable<Shape, Key>::EntryToIndex(entry); |
5006 AssertNoAllocation no_gc; | 5035 AssertNoAllocation no_gc; |
5007 WriteBarrierMode mode = FixedArray::GetWriteBarrierMode(no_gc); | 5036 WriteBarrierMode mode = FixedArray::GetWriteBarrierMode(no_gc); |
5008 FixedArray::set(index, key, mode); | 5037 FixedArray::set(index, key, mode); |
5009 FixedArray::set(index+1, value, mode); | 5038 FixedArray::set(index+1, value, mode); |
5010 FixedArray::set(index+2, details.AsSmi()); | 5039 FixedArray::set(index+2, details.AsSmi()); |
5011 } | 5040 } |
5012 | 5041 |
5013 | 5042 |
5014 bool NumberDictionaryShape::IsMatch(uint32_t key, Object* other) { | 5043 bool NumberDictionaryShape::IsMatch(uint32_t key, Object* other) { |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5312 #undef WRITE_UINT32_FIELD | 5341 #undef WRITE_UINT32_FIELD |
5313 #undef READ_SHORT_FIELD | 5342 #undef READ_SHORT_FIELD |
5314 #undef WRITE_SHORT_FIELD | 5343 #undef WRITE_SHORT_FIELD |
5315 #undef READ_BYTE_FIELD | 5344 #undef READ_BYTE_FIELD |
5316 #undef WRITE_BYTE_FIELD | 5345 #undef WRITE_BYTE_FIELD |
5317 | 5346 |
5318 | 5347 |
5319 } } // namespace v8::internal | 5348 } } // namespace v8::internal |
5320 | 5349 |
5321 #endif // V8_OBJECTS_INL_H_ | 5350 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |