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 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1916 int DescriptorArray::SearchWithCache(String* name) { | 1916 int DescriptorArray::SearchWithCache(String* name) { |
1917 int number = GetIsolate()->descriptor_lookup_cache()->Lookup(this, name); | 1917 int number = GetIsolate()->descriptor_lookup_cache()->Lookup(this, name); |
1918 if (number == DescriptorLookupCache::kAbsent) { | 1918 if (number == DescriptorLookupCache::kAbsent) { |
1919 number = Search(name); | 1919 number = Search(name); |
1920 GetIsolate()->descriptor_lookup_cache()->Update(this, name, number); | 1920 GetIsolate()->descriptor_lookup_cache()->Update(this, name, number); |
1921 } | 1921 } |
1922 return number; | 1922 return number; |
1923 } | 1923 } |
1924 | 1924 |
1925 | 1925 |
1926 Object** DescriptorArray::GetKeySlot(int descriptor_number) { | |
1927 ASSERT(descriptor_number < number_of_descriptors()); | |
1928 return HeapObject::RawField( | |
1929 reinterpret_cast<HeapObject*>(this), | |
1930 OffsetOfElementAt(ToKeyIndex(descriptor_number))); | |
1931 } | |
1932 | |
1926 String* DescriptorArray::GetKey(int descriptor_number) { | 1933 String* DescriptorArray::GetKey(int descriptor_number) { |
1927 ASSERT(descriptor_number < number_of_descriptors()); | 1934 ASSERT(descriptor_number < number_of_descriptors()); |
1928 return String::cast(get(ToKeyIndex(descriptor_number))); | 1935 return String::cast(get(ToKeyIndex(descriptor_number))); |
1929 } | 1936 } |
1930 | 1937 |
1938 Object** DescriptorArray::GetValueSlot(int descriptor_number) { | |
Florian Schneider
2012/05/22 16:53:09
Two empty lines between function definitions.
| |
1939 ASSERT(descriptor_number < number_of_descriptors()); | |
1940 return HeapObject::RawField( | |
1941 reinterpret_cast<HeapObject*>(this), | |
1942 OffsetOfElementAt(ToValueIndex(descriptor_number))); | |
1943 } | |
1931 | 1944 |
1932 Object* DescriptorArray::GetValue(int descriptor_number) { | 1945 Object* DescriptorArray::GetValue(int descriptor_number) { |
Florian Schneider
2012/05/22 16:53:09
Two empty lines between function definitions. Here
| |
1933 ASSERT(descriptor_number < number_of_descriptors()); | 1946 ASSERT(descriptor_number < number_of_descriptors()); |
1934 return GetContentArray()->get(ToValueIndex(descriptor_number)); | 1947 return get(ToValueIndex(descriptor_number)); |
1935 } | 1948 } |
1936 | 1949 |
1950 void DescriptorArray::SetNullValueUnchecked(int descriptor_number, Heap* heap) { | |
1951 ASSERT(descriptor_number < number_of_descriptors()); | |
1952 ASSERT(!HEAP->InNewSpace(heap->null_value())); | |
1953 set_null_unchecked(heap, ToValueIndex(descriptor_number)); | |
1954 } | |
1937 | 1955 |
1938 PropertyDetails DescriptorArray::GetDetails(int descriptor_number) { | 1956 PropertyDetails DescriptorArray::GetDetails(int descriptor_number) { |
1939 ASSERT(descriptor_number < number_of_descriptors()); | 1957 ASSERT(descriptor_number < number_of_descriptors()); |
1940 Object* details = GetContentArray()->get(ToDetailsIndex(descriptor_number)); | 1958 Object* details = get(ToDetailsIndex(descriptor_number)); |
1941 return PropertyDetails(Smi::cast(details)); | 1959 return PropertyDetails(Smi::cast(details)); |
1942 } | 1960 } |
1943 | 1961 |
1962 void DescriptorArray::SetDetailsUnchecked(int descriptor_number, Smi* value) { | |
1963 ASSERT(descriptor_number < number_of_descriptors()); | |
1964 set_unchecked(ToDetailsIndex(descriptor_number), value); | |
1965 } | |
1944 | 1966 |
1945 PropertyType DescriptorArray::GetType(int descriptor_number) { | 1967 PropertyType DescriptorArray::GetType(int descriptor_number) { |
1946 return GetDetails(descriptor_number).type(); | 1968 return GetDetails(descriptor_number).type(); |
1947 } | 1969 } |
1948 | 1970 |
1949 | 1971 |
1950 int DescriptorArray::GetFieldIndex(int descriptor_number) { | 1972 int DescriptorArray::GetFieldIndex(int descriptor_number) { |
1951 return Descriptor::IndexFromValue(GetValue(descriptor_number)); | 1973 return Descriptor::IndexFromValue(GetValue(descriptor_number)); |
1952 } | 1974 } |
1953 | 1975 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2015 | 2037 |
2016 void DescriptorArray::Set(int descriptor_number, | 2038 void DescriptorArray::Set(int descriptor_number, |
2017 Descriptor* desc, | 2039 Descriptor* desc, |
2018 const WhitenessWitness&) { | 2040 const WhitenessWitness&) { |
2019 // Range check. | 2041 // Range check. |
2020 ASSERT(descriptor_number < number_of_descriptors()); | 2042 ASSERT(descriptor_number < number_of_descriptors()); |
2021 | 2043 |
2022 NoIncrementalWriteBarrierSet(this, | 2044 NoIncrementalWriteBarrierSet(this, |
2023 ToKeyIndex(descriptor_number), | 2045 ToKeyIndex(descriptor_number), |
2024 desc->GetKey()); | 2046 desc->GetKey()); |
2025 FixedArray* content_array = GetContentArray(); | 2047 NoIncrementalWriteBarrierSet(this, |
2026 NoIncrementalWriteBarrierSet(content_array, | |
2027 ToValueIndex(descriptor_number), | 2048 ToValueIndex(descriptor_number), |
2028 desc->GetValue()); | 2049 desc->GetValue()); |
2029 NoIncrementalWriteBarrierSet(content_array, | 2050 NoIncrementalWriteBarrierSet(this, |
2030 ToDetailsIndex(descriptor_number), | 2051 ToDetailsIndex(descriptor_number), |
2031 desc->GetDetails().AsSmi()); | 2052 desc->GetDetails().AsSmi()); |
2032 } | 2053 } |
2033 | 2054 |
2034 | 2055 |
2035 void DescriptorArray::NoIncrementalWriteBarrierSwapDescriptors( | 2056 void DescriptorArray::NoIncrementalWriteBarrierSwapDescriptors( |
2036 int first, int second) { | 2057 int first, int second) { |
2037 NoIncrementalWriteBarrierSwap(this, ToKeyIndex(first), ToKeyIndex(second)); | 2058 NoIncrementalWriteBarrierSwap(this, ToKeyIndex(first), ToKeyIndex(second)); |
2038 FixedArray* content_array = GetContentArray(); | 2059 NoIncrementalWriteBarrierSwap(this, |
2039 NoIncrementalWriteBarrierSwap(content_array, | |
2040 ToValueIndex(first), | 2060 ToValueIndex(first), |
2041 ToValueIndex(second)); | 2061 ToValueIndex(second)); |
2042 NoIncrementalWriteBarrierSwap(content_array, | 2062 NoIncrementalWriteBarrierSwap(this, |
2043 ToDetailsIndex(first), | 2063 ToDetailsIndex(first), |
2044 ToDetailsIndex(second)); | 2064 ToDetailsIndex(second)); |
2045 } | 2065 } |
2046 | 2066 |
2047 | 2067 |
2048 DescriptorArray::WhitenessWitness::WhitenessWitness(DescriptorArray* array) | 2068 DescriptorArray::WhitenessWitness::WhitenessWitness(DescriptorArray* array) |
2049 : marking_(array->GetHeap()->incremental_marking()) { | 2069 : marking_(array->GetHeap()->incremental_marking()) { |
2050 marking_->EnterNoMarkingScope(); | 2070 marking_->EnterNoMarkingScope(); |
2051 if (array->number_of_descriptors() > 0) { | 2071 if (array->number_of_descriptors() > 0) { |
2052 ASSERT(Marking::Color(array) == Marking::WHITE_OBJECT); | 2072 ASSERT(Marking::Color(array) == Marking::WHITE_OBJECT); |
2053 ASSERT(Marking::Color(array->GetContentArray()) == Marking::WHITE_OBJECT); | |
2054 } | 2073 } |
2055 } | 2074 } |
2056 | 2075 |
2057 | 2076 |
2058 DescriptorArray::WhitenessWitness::~WhitenessWitness() { | 2077 DescriptorArray::WhitenessWitness::~WhitenessWitness() { |
2059 marking_->LeaveNoMarkingScope(); | 2078 marking_->LeaveNoMarkingScope(); |
2060 } | 2079 } |
2061 | 2080 |
2062 | 2081 |
2063 template<typename Shape, typename Key> | 2082 template<typename Shape, typename Key> |
(...skipping 2963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5027 #undef WRITE_UINT32_FIELD | 5046 #undef WRITE_UINT32_FIELD |
5028 #undef READ_SHORT_FIELD | 5047 #undef READ_SHORT_FIELD |
5029 #undef WRITE_SHORT_FIELD | 5048 #undef WRITE_SHORT_FIELD |
5030 #undef READ_BYTE_FIELD | 5049 #undef READ_BYTE_FIELD |
5031 #undef WRITE_BYTE_FIELD | 5050 #undef WRITE_BYTE_FIELD |
5032 | 5051 |
5033 | 5052 |
5034 } } // namespace v8::internal | 5053 } } // namespace v8::internal |
5035 | 5054 |
5036 #endif // V8_OBJECTS_INL_H_ | 5055 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |