| 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 | 295 |
| 296 | 296 |
| 297 void Map::MapVerify() { | 297 void Map::MapVerify() { |
| 298 ASSERT(!HEAP->InNewSpace(this)); | 298 ASSERT(!HEAP->InNewSpace(this)); |
| 299 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); | 299 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); |
| 300 ASSERT(instance_size() == kVariableSizeSentinel || | 300 ASSERT(instance_size() == kVariableSizeSentinel || |
| 301 (kPointerSize <= instance_size() && | 301 (kPointerSize <= instance_size() && |
| 302 instance_size() < HEAP->Capacity())); | 302 instance_size() < HEAP->Capacity())); |
| 303 VerifyHeapPointer(prototype()); | 303 VerifyHeapPointer(prototype()); |
| 304 VerifyHeapPointer(instance_descriptors()); | 304 VerifyHeapPointer(instance_descriptors()); |
| 305 if (instance_descriptors()->number_of_descriptors() == 0) { | 305 DescriptorArray* descriptors = instance_descriptors(); |
| 306 ASSERT(LastAdded() == kNoneAdded); | 306 for (int i = 0; i < NumberOfOwnDescriptors(); ++i) { |
| 307 } else { | 307 ASSERT_EQ(i, descriptors->GetDetails(i).descriptor_index() - 1); |
| 308 ASSERT(instance_descriptors()->GetDetails(LastAdded()).index() == | |
| 309 instance_descriptors()->number_of_descriptors()); | |
| 310 } | 308 } |
| 311 SLOW_ASSERT(instance_descriptors()->IsSortedNoDuplicates()); | 309 SLOW_ASSERT(instance_descriptors()->IsSortedNoDuplicates()); |
| 312 if (HasTransitionArray()) { | 310 if (HasTransitionArray()) { |
| 313 SLOW_ASSERT(transitions()->IsSortedNoDuplicates()); | 311 SLOW_ASSERT(transitions()->IsSortedNoDuplicates()); |
| 314 SLOW_ASSERT(transitions()->IsConsistentWithBackPointers(this)); | 312 SLOW_ASSERT(transitions()->IsConsistentWithBackPointers(this)); |
| 315 } | 313 } |
| 316 } | 314 } |
| 317 | 315 |
| 318 | 316 |
| 319 void Map::SharedMapVerify() { | 317 void Map::SharedMapVerify() { |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 number_of_slow_used_elements_, number_of_slow_unused_elements_); | 897 number_of_slow_used_elements_, number_of_slow_unused_elements_); |
| 900 | 898 |
| 901 PrintF("\n"); | 899 PrintF("\n"); |
| 902 } | 900 } |
| 903 | 901 |
| 904 | 902 |
| 905 bool DescriptorArray::IsSortedNoDuplicates() { | 903 bool DescriptorArray::IsSortedNoDuplicates() { |
| 906 String* current_key = NULL; | 904 String* current_key = NULL; |
| 907 uint32_t current = 0; | 905 uint32_t current = 0; |
| 908 for (int i = 0; i < number_of_descriptors(); i++) { | 906 for (int i = 0; i < number_of_descriptors(); i++) { |
| 909 String* key = GetKey(i); | 907 String* key = GetSortedKey(i); |
| 910 if (key == current_key) { | 908 if (key == current_key) { |
| 911 PrintDescriptors(); | 909 PrintDescriptors(); |
| 912 return false; | 910 return false; |
| 913 } | 911 } |
| 914 current_key = key; | 912 current_key = key; |
| 915 uint32_t hash = GetKey(i)->Hash(); | 913 uint32_t hash = GetSortedKey(i)->Hash(); |
| 916 if (hash < current) { | 914 if (hash < current) { |
| 917 PrintDescriptors(); | 915 PrintDescriptors(); |
| 918 return false; | 916 return false; |
| 919 } | 917 } |
| 920 current = hash; | 918 current = hash; |
| 921 } | 919 } |
| 922 return true; | 920 return true; |
| 923 } | 921 } |
| 924 | 922 |
| 925 | 923 |
| 926 bool TransitionArray::IsSortedNoDuplicates() { | 924 bool TransitionArray::IsSortedNoDuplicates() { |
| 927 String* current_key = NULL; | 925 String* current_key = NULL; |
| 928 uint32_t current = 0; | 926 uint32_t current = 0; |
| 929 for (int i = 0; i < number_of_transitions(); i++) { | 927 for (int i = 0; i < number_of_transitions(); i++) { |
| 930 String* key = GetKey(i); | 928 String* key = GetSortedKey(i); |
| 931 if (key == current_key) { | 929 if (key == current_key) { |
| 932 PrintTransitions(); | 930 PrintTransitions(); |
| 933 return false; | 931 return false; |
| 934 } | 932 } |
| 935 current_key = key; | 933 current_key = key; |
| 936 uint32_t hash = GetKey(i)->Hash(); | 934 uint32_t hash = GetSortedKey(i)->Hash(); |
| 937 if (hash < current) { | 935 if (hash < current) { |
| 938 PrintTransitions(); | 936 PrintTransitions(); |
| 939 return false; | 937 return false; |
| 940 } | 938 } |
| 941 current = hash; | 939 current = hash; |
| 942 } | 940 } |
| 943 return true; | 941 return true; |
| 944 } | 942 } |
| 945 | 943 |
| 946 | 944 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 FixedArray* proto_transitions = GetPrototypeTransitions(); | 1012 FixedArray* proto_transitions = GetPrototypeTransitions(); |
| 1015 MemsetPointer(proto_transitions->data_start(), | 1013 MemsetPointer(proto_transitions->data_start(), |
| 1016 GetHeap()->the_hole_value(), | 1014 GetHeap()->the_hole_value(), |
| 1017 proto_transitions->length()); | 1015 proto_transitions->length()); |
| 1018 } | 1016 } |
| 1019 | 1017 |
| 1020 | 1018 |
| 1021 #endif // DEBUG | 1019 #endif // DEBUG |
| 1022 | 1020 |
| 1023 } } // namespace v8::internal | 1021 } } // namespace v8::internal |
| OLD | NEW |