Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: src/objects-debug.cc

Issue 10381053: Implement explicit back pointers in transition tree. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed some comments by Vyacheslav Egorov. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 296
297 297
298 void Map::MapVerify() { 298 void Map::MapVerify() {
299 ASSERT(!HEAP->InNewSpace(this)); 299 ASSERT(!HEAP->InNewSpace(this));
300 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); 300 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE);
301 ASSERT(instance_size() == kVariableSizeSentinel || 301 ASSERT(instance_size() == kVariableSizeSentinel ||
302 (kPointerSize <= instance_size() && 302 (kPointerSize <= instance_size() &&
303 instance_size() < HEAP->Capacity())); 303 instance_size() < HEAP->Capacity()));
304 VerifyHeapPointer(prototype()); 304 VerifyHeapPointer(prototype());
305 VerifyHeapPointer(instance_descriptors()); 305 VerifyHeapPointer(instance_descriptors());
306 SLOW_ASSERT(instance_descriptors()->IsSortedNoDuplicates());
307 SLOW_ASSERT(instance_descriptors()->IsConsistentWithBackPointers(this));
306 } 308 }
307 309
308 310
309 void Map::SharedMapVerify() { 311 void Map::SharedMapVerify() {
310 MapVerify(); 312 MapVerify();
311 ASSERT(is_shared()); 313 ASSERT(is_shared());
312 ASSERT(instance_descriptors()->IsEmpty()); 314 ASSERT(instance_descriptors()->IsEmpty());
313 ASSERT_EQ(0, pre_allocated_property_fields()); 315 ASSERT_EQ(0, pre_allocated_property_fields());
314 ASSERT_EQ(0, unused_property_fields()); 316 ASSERT_EQ(0, unused_property_fields());
315 ASSERT_EQ(StaticVisitorBase::GetVisitorId(instance_type(), instance_size()), 317 ASSERT_EQ(StaticVisitorBase::GetVisitorId(instance_type(), instance_size()),
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 if (hash < current) { 889 if (hash < current) {
888 PrintDescriptors(); 890 PrintDescriptors();
889 return false; 891 return false;
890 } 892 }
891 current = hash; 893 current = hash;
892 } 894 }
893 return true; 895 return true;
894 } 896 }
895 897
896 898
899 static bool CheckOneBackPointer(Map* current_map, Object* target) {
900 return !target->IsMap() || Map::cast(target)->GetBackPointer() == current_map;
901 }
902
903
904 bool DescriptorArray::IsConsistentWithBackPointers(Map* current_map) {
905 for (int i = 0; i < number_of_descriptors(); ++i) {
906 switch (GetType(i)) {
907 case MAP_TRANSITION:
908 case CONSTANT_TRANSITION:
909 if (!CheckOneBackPointer(current_map, GetValue(i))) {
910 return false;
911 }
912 break;
913 case ELEMENTS_TRANSITION: {
914 Object* object = GetValue(i);
915 if (!CheckOneBackPointer(current_map, object)) {
916 return false;
917 }
918 if (object->IsFixedArray()) {
919 FixedArray* array = FixedArray::cast(object);
920 for (int i = 0; i < array->length(); ++i) {
921 if (!CheckOneBackPointer(current_map, array->get(i))) {
922 return false;
923 }
924 }
925 }
926 break;
927 }
928 case CALLBACKS: {
929 Object* object = GetValue(i);
930 if (object->IsAccessorPair()) {
931 AccessorPair* accessors = AccessorPair::cast(object);
932 if (!CheckOneBackPointer(current_map, accessors->getter())) {
933 return false;
934 }
935 if (!CheckOneBackPointer(current_map, accessors->setter())) {
936 return false;
937 }
938 }
939 break;
940 }
941 case NORMAL:
942 case FIELD:
943 case CONSTANT_FUNCTION:
944 case HANDLER:
945 case INTERCEPTOR:
946 case NULL_DESCRIPTOR:
947 break;
948 }
949 }
950 return true;
951 }
952
953
897 void JSFunctionResultCache::JSFunctionResultCacheVerify() { 954 void JSFunctionResultCache::JSFunctionResultCacheVerify() {
898 JSFunction::cast(get(kFactoryIndex))->Verify(); 955 JSFunction::cast(get(kFactoryIndex))->Verify();
899 956
900 int size = Smi::cast(get(kCacheSizeIndex))->value(); 957 int size = Smi::cast(get(kCacheSizeIndex))->value();
901 ASSERT(kEntriesIndex <= size); 958 ASSERT(kEntriesIndex <= size);
902 ASSERT(size <= length()); 959 ASSERT(size <= length());
903 ASSERT_EQ(0, size % kEntrySize); 960 ASSERT_EQ(0, size % kEntrySize);
904 961
905 int finger = Smi::cast(get(kFingerIndex))->value(); 962 int finger = Smi::cast(get(kFingerIndex))->value();
906 ASSERT(kEntriesIndex <= finger); 963 ASSERT(kEntriesIndex <= finger);
(...skipping 24 matching lines...) Expand all
931 ASSERT(e->IsUndefined()); 988 ASSERT(e->IsUndefined());
932 } 989 }
933 } 990 }
934 } 991 }
935 } 992 }
936 993
937 994
938 #endif // DEBUG 995 #endif // DEBUG
939 996
940 } } // namespace v8::internal 997 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698