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 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 int DescriptorArray::SearchWithCache(String* name) { | 1918 int DescriptorArray::SearchWithCache(String* name) { |
1919 int number = GetIsolate()->descriptor_lookup_cache()->Lookup(this, name); | 1919 int number = GetIsolate()->descriptor_lookup_cache()->Lookup(this, name); |
1920 if (number == DescriptorLookupCache::kAbsent) { | 1920 if (number == DescriptorLookupCache::kAbsent) { |
1921 number = Search(name); | 1921 number = Search(name); |
1922 GetIsolate()->descriptor_lookup_cache()->Update(this, name, number); | 1922 GetIsolate()->descriptor_lookup_cache()->Update(this, name, number); |
1923 } | 1923 } |
1924 return number; | 1924 return number; |
1925 } | 1925 } |
1926 | 1926 |
1927 | 1927 |
| 1928 Object** DescriptorArray::GetKeySlot(int descriptor_number) { |
| 1929 ASSERT(descriptor_number < number_of_descriptors()); |
| 1930 return HeapObject::RawField( |
| 1931 reinterpret_cast<HeapObject*>(this), |
| 1932 OffsetOfElementAt(ToKeyIndex(descriptor_number))); |
| 1933 } |
| 1934 |
| 1935 |
1928 String* DescriptorArray::GetKey(int descriptor_number) { | 1936 String* DescriptorArray::GetKey(int descriptor_number) { |
1929 ASSERT(descriptor_number < number_of_descriptors()); | 1937 ASSERT(descriptor_number < number_of_descriptors()); |
1930 return String::cast(get(ToKeyIndex(descriptor_number))); | 1938 return String::cast(get(ToKeyIndex(descriptor_number))); |
1931 } | 1939 } |
1932 | 1940 |
1933 | 1941 |
1934 Object** DescriptorArray::GetValueSlot(int descriptor_number) { | 1942 Object** DescriptorArray::GetValueSlot(int descriptor_number) { |
1935 ASSERT(descriptor_number < number_of_descriptors()); | 1943 ASSERT(descriptor_number < number_of_descriptors()); |
1936 return GetContentArray()->data_start() + ToValueIndex(descriptor_number); | 1944 return HeapObject::RawField( |
| 1945 reinterpret_cast<HeapObject*>(this), |
| 1946 OffsetOfElementAt(ToValueIndex(descriptor_number))); |
1937 } | 1947 } |
1938 | 1948 |
1939 | 1949 |
1940 Object* DescriptorArray::GetValue(int descriptor_number) { | 1950 Object* DescriptorArray::GetValue(int descriptor_number) { |
1941 ASSERT(descriptor_number < number_of_descriptors()); | 1951 ASSERT(descriptor_number < number_of_descriptors()); |
1942 return GetContentArray()->get(ToValueIndex(descriptor_number)); | 1952 return get(ToValueIndex(descriptor_number)); |
1943 } | 1953 } |
1944 | 1954 |
1945 | 1955 |
1946 void DescriptorArray::SetNullValueUnchecked(int descriptor_number, Heap* heap) { | 1956 void DescriptorArray::SetNullValueUnchecked(int descriptor_number, Heap* heap) { |
1947 ASSERT(descriptor_number < number_of_descriptors()); | 1957 ASSERT(descriptor_number < number_of_descriptors()); |
1948 GetContentArray()->set_null_unchecked(heap, ToValueIndex(descriptor_number)); | 1958 set_null_unchecked(heap, ToValueIndex(descriptor_number)); |
1949 } | 1959 } |
1950 | 1960 |
1951 | 1961 |
1952 PropertyDetails DescriptorArray::GetDetails(int descriptor_number) { | 1962 PropertyDetails DescriptorArray::GetDetails(int descriptor_number) { |
1953 ASSERT(descriptor_number < number_of_descriptors()); | 1963 ASSERT(descriptor_number < number_of_descriptors()); |
1954 Object* details = GetContentArray()->get(ToDetailsIndex(descriptor_number)); | 1964 Object* details = get(ToDetailsIndex(descriptor_number)); |
1955 return PropertyDetails(Smi::cast(details)); | 1965 return PropertyDetails(Smi::cast(details)); |
1956 } | 1966 } |
1957 | 1967 |
1958 | 1968 |
1959 void DescriptorArray::SetDetailsUnchecked(int descriptor_number, Smi* value) { | 1969 void DescriptorArray::SetDetailsUnchecked(int descriptor_number, Smi* value) { |
1960 ASSERT(descriptor_number < number_of_descriptors()); | 1970 ASSERT(descriptor_number < number_of_descriptors()); |
1961 GetContentArray()->set_unchecked(ToDetailsIndex(descriptor_number), value); | 1971 set_unchecked(ToDetailsIndex(descriptor_number), value); |
1962 } | 1972 } |
1963 | 1973 |
1964 | 1974 |
1965 PropertyType DescriptorArray::GetType(int descriptor_number) { | 1975 PropertyType DescriptorArray::GetType(int descriptor_number) { |
1966 return GetDetails(descriptor_number).type(); | 1976 return GetDetails(descriptor_number).type(); |
1967 } | 1977 } |
1968 | 1978 |
1969 | 1979 |
1970 int DescriptorArray::GetFieldIndex(int descriptor_number) { | 1980 int DescriptorArray::GetFieldIndex(int descriptor_number) { |
1971 return Descriptor::IndexFromValue(GetValue(descriptor_number)); | 1981 return Descriptor::IndexFromValue(GetValue(descriptor_number)); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2035 | 2045 |
2036 void DescriptorArray::Set(int descriptor_number, | 2046 void DescriptorArray::Set(int descriptor_number, |
2037 Descriptor* desc, | 2047 Descriptor* desc, |
2038 const WhitenessWitness&) { | 2048 const WhitenessWitness&) { |
2039 // Range check. | 2049 // Range check. |
2040 ASSERT(descriptor_number < number_of_descriptors()); | 2050 ASSERT(descriptor_number < number_of_descriptors()); |
2041 | 2051 |
2042 NoIncrementalWriteBarrierSet(this, | 2052 NoIncrementalWriteBarrierSet(this, |
2043 ToKeyIndex(descriptor_number), | 2053 ToKeyIndex(descriptor_number), |
2044 desc->GetKey()); | 2054 desc->GetKey()); |
2045 FixedArray* content_array = GetContentArray(); | 2055 NoIncrementalWriteBarrierSet(this, |
2046 NoIncrementalWriteBarrierSet(content_array, | |
2047 ToValueIndex(descriptor_number), | 2056 ToValueIndex(descriptor_number), |
2048 desc->GetValue()); | 2057 desc->GetValue()); |
2049 NoIncrementalWriteBarrierSet(content_array, | 2058 NoIncrementalWriteBarrierSet(this, |
2050 ToDetailsIndex(descriptor_number), | 2059 ToDetailsIndex(descriptor_number), |
2051 desc->GetDetails().AsSmi()); | 2060 desc->GetDetails().AsSmi()); |
2052 } | 2061 } |
2053 | 2062 |
2054 | 2063 |
2055 void DescriptorArray::NoIncrementalWriteBarrierSwapDescriptors( | 2064 void DescriptorArray::NoIncrementalWriteBarrierSwapDescriptors( |
2056 int first, int second) { | 2065 int first, int second) { |
2057 NoIncrementalWriteBarrierSwap(this, ToKeyIndex(first), ToKeyIndex(second)); | 2066 NoIncrementalWriteBarrierSwap(this, ToKeyIndex(first), ToKeyIndex(second)); |
2058 FixedArray* content_array = GetContentArray(); | 2067 NoIncrementalWriteBarrierSwap(this, |
2059 NoIncrementalWriteBarrierSwap(content_array, | |
2060 ToValueIndex(first), | 2068 ToValueIndex(first), |
2061 ToValueIndex(second)); | 2069 ToValueIndex(second)); |
2062 NoIncrementalWriteBarrierSwap(content_array, | 2070 NoIncrementalWriteBarrierSwap(this, |
2063 ToDetailsIndex(first), | 2071 ToDetailsIndex(first), |
2064 ToDetailsIndex(second)); | 2072 ToDetailsIndex(second)); |
2065 } | 2073 } |
2066 | 2074 |
2067 | 2075 |
2068 DescriptorArray::WhitenessWitness::WhitenessWitness(DescriptorArray* array) | 2076 DescriptorArray::WhitenessWitness::WhitenessWitness(DescriptorArray* array) |
2069 : marking_(array->GetHeap()->incremental_marking()) { | 2077 : marking_(array->GetHeap()->incremental_marking()) { |
2070 marking_->EnterNoMarkingScope(); | 2078 marking_->EnterNoMarkingScope(); |
2071 if (array->number_of_descriptors() > 0) { | 2079 if (array->number_of_descriptors() > 0) { |
2072 ASSERT(Marking::Color(array) == Marking::WHITE_OBJECT); | 2080 ASSERT(Marking::Color(array) == Marking::WHITE_OBJECT); |
2073 ASSERT(Marking::Color(array->GetContentArray()) == Marking::WHITE_OBJECT); | |
2074 } | 2081 } |
2075 } | 2082 } |
2076 | 2083 |
2077 | 2084 |
2078 DescriptorArray::WhitenessWitness::~WhitenessWitness() { | 2085 DescriptorArray::WhitenessWitness::~WhitenessWitness() { |
2079 marking_->LeaveNoMarkingScope(); | 2086 marking_->LeaveNoMarkingScope(); |
2080 } | 2087 } |
2081 | 2088 |
2082 | 2089 |
2083 template<typename Shape, typename Key> | 2090 template<typename Shape, typename Key> |
(...skipping 2971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5055 #undef WRITE_UINT32_FIELD | 5062 #undef WRITE_UINT32_FIELD |
5056 #undef READ_SHORT_FIELD | 5063 #undef READ_SHORT_FIELD |
5057 #undef WRITE_SHORT_FIELD | 5064 #undef WRITE_SHORT_FIELD |
5058 #undef READ_BYTE_FIELD | 5065 #undef READ_BYTE_FIELD |
5059 #undef WRITE_BYTE_FIELD | 5066 #undef WRITE_BYTE_FIELD |
5060 | 5067 |
5061 | 5068 |
5062 } } // namespace v8::internal | 5069 } } // namespace v8::internal |
5063 | 5070 |
5064 #endif // V8_OBJECTS_INL_H_ | 5071 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |