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 5783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5794 FixedArray* result; | 5794 FixedArray* result; |
5795 if (number_of_descriptors == 0 && shared_mode == MAY_BE_SHARED) { | 5795 if (number_of_descriptors == 0 && shared_mode == MAY_BE_SHARED) { |
5796 return heap->empty_descriptor_array(); | 5796 return heap->empty_descriptor_array(); |
5797 } | 5797 } |
5798 // Allocate the array of keys. | 5798 // Allocate the array of keys. |
5799 { MaybeObject* maybe_array = | 5799 { MaybeObject* maybe_array = |
5800 heap->AllocateFixedArray(ToKeyIndex(number_of_descriptors)); | 5800 heap->AllocateFixedArray(ToKeyIndex(number_of_descriptors)); |
5801 if (!maybe_array->To(&result)) return maybe_array; | 5801 if (!maybe_array->To(&result)) return maybe_array; |
5802 } | 5802 } |
5803 | 5803 |
5804 result->set(kLastAddedIndex, Smi::FromInt(-1)); | 5804 result->set(kLastAddedIndex, Smi::FromInt(kNoneAdded)); |
5805 result->set(kTransitionsIndex, Smi::FromInt(0)); | 5805 result->set(kTransitionsIndex, Smi::FromInt(0)); |
5806 return result; | 5806 return result; |
5807 } | 5807 } |
5808 | 5808 |
5809 | 5809 |
5810 void DescriptorArray::SetEnumCache(FixedArray* bridge_storage, | 5810 void DescriptorArray::SetEnumCache(FixedArray* bridge_storage, |
5811 FixedArray* new_cache, | 5811 FixedArray* new_cache, |
5812 Object* new_index_cache) { | 5812 Object* new_index_cache) { |
5813 ASSERT(bridge_storage->length() >= kEnumCacheBridgeLength); | 5813 ASSERT(bridge_storage->length() >= kEnumCacheBridgeLength); |
5814 ASSERT(new_index_cache->IsSmi() || new_index_cache->IsFixedArray()); | 5814 ASSERT(new_index_cache->IsSmi() || new_index_cache->IsFixedArray()); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5921 | 5921 |
5922 int new_size = number_of_descriptors() + 1; | 5922 int new_size = number_of_descriptors() + 1; |
5923 | 5923 |
5924 DescriptorArray* new_descriptors; | 5924 DescriptorArray* new_descriptors; |
5925 { MaybeObject* maybe_result = Allocate(new_size, MAY_BE_SHARED); | 5925 { MaybeObject* maybe_result = Allocate(new_size, MAY_BE_SHARED); |
5926 if (!maybe_result->To(&new_descriptors)) return maybe_result; | 5926 if (!maybe_result->To(&new_descriptors)) return maybe_result; |
5927 } | 5927 } |
5928 | 5928 |
5929 FixedArray::WhitenessWitness witness(new_descriptors); | 5929 FixedArray::WhitenessWitness witness(new_descriptors); |
5930 | 5930 |
5931 descriptor->SetEnumerationIndex(NextEnumerationIndex()); | 5931 ASSERT(new_size == NextEnumerationIndex()); |
| 5932 descriptor->SetEnumerationIndex(new_size); |
5932 | 5933 |
5933 // Copy the descriptors, inserting or replacing a descriptor. | 5934 // Copy the descriptors, inserting or replacing a descriptor. |
5934 int insertion_index = -1; | 5935 int insertion_index = -1; |
5935 int to = 0; | 5936 int to = 0; |
5936 for (int from = 0; from < number_of_descriptors(); ++from) { | 5937 for (int from = 0; from < number_of_descriptors(); ++from) { |
5937 if (insertion_index < 0 && InsertionPointFound(GetKey(from), key)) { | 5938 if (insertion_index < 0 && InsertionPointFound(GetKey(from), key)) { |
5938 insertion_index = to++; | 5939 insertion_index = to++; |
5939 } | 5940 } |
5940 MaybeObject* copy_result = | 5941 MaybeObject* copy_result = |
5941 new_descriptors->CopyFrom(to++, this, from, witness); | 5942 new_descriptors->CopyFrom(to++, this, from, witness); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6028 child_index++; | 6029 child_index++; |
6029 child_hash = right_child_hash; | 6030 child_hash = right_child_hash; |
6030 } | 6031 } |
6031 } | 6032 } |
6032 if (child_hash <= parent_hash) break; | 6033 if (child_hash <= parent_hash) break; |
6033 NoIncrementalWriteBarrierSwapDescriptors(parent_index, child_index); | 6034 NoIncrementalWriteBarrierSwapDescriptors(parent_index, child_index); |
6034 parent_index = child_index; | 6035 parent_index = child_index; |
6035 } | 6036 } |
6036 } | 6037 } |
6037 | 6038 |
6038 int last_enum_index = -1; | 6039 ASSERT(LastAdded() == kNoneAdded); |
6039 int last_added = -1; | |
6040 for (int i = 0; i < len; ++i) { | 6040 for (int i = 0; i < len; ++i) { |
6041 int current_enum = GetDetails(i).index(); | 6041 int current_enum = GetDetails(i).index(); |
6042 if (current_enum > last_enum_index) { | 6042 ASSERT(current_enum <= len); |
6043 last_added = i; | 6043 |
6044 last_enum_index = current_enum; | 6044 if (current_enum == len) { |
| 6045 ASSERT(LastAdded() == kNoneAdded); |
| 6046 SetLastAdded(i); |
| 6047 #ifndef DEBUG |
| 6048 return; |
| 6049 #endif |
6045 } | 6050 } |
6046 } | 6051 } |
6047 SetLastAdded(last_added); | 6052 ASSERT(LastAdded() != kNoneAdded); |
6048 | |
6049 ASSERT(LastAdded() != -1); | |
6050 } | 6053 } |
6051 | 6054 |
6052 | 6055 |
6053 void DescriptorArray::Sort(const WhitenessWitness& witness) { | 6056 void DescriptorArray::Sort(const WhitenessWitness& witness) { |
6054 SortUnchecked(witness); | 6057 SortUnchecked(witness); |
6055 SLOW_ASSERT(IsSortedNoDuplicates()); | 6058 SLOW_ASSERT(IsSortedNoDuplicates()); |
6056 } | 6059 } |
6057 | 6060 |
6058 | 6061 |
6059 MaybeObject* AccessorPair::CopyWithoutTransitions() { | 6062 MaybeObject* AccessorPair::CopyWithoutTransitions() { |
(...skipping 7238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13298 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13301 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13299 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13302 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13300 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13303 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13301 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13304 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13302 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13305 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13303 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13306 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13304 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13307 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13305 } | 13308 } |
13306 | 13309 |
13307 } } // namespace v8::internal | 13310 } } // namespace v8::internal |
OLD | NEW |