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

Side by Side Diff: src/spaces.cc

Issue 218993005: Tighten object verification. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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-debug.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 // The first word should be a map, and we expect all map pointers to 1188 // The first word should be a map, and we expect all map pointers to
1189 // be in map space. 1189 // be in map space.
1190 Map* map = object->map(); 1190 Map* map = object->map();
1191 CHECK(map->IsMap()); 1191 CHECK(map->IsMap());
1192 CHECK(heap()->map_space()->Contains(map)); 1192 CHECK(heap()->map_space()->Contains(map));
1193 1193
1194 // Perform space-specific object verification. 1194 // Perform space-specific object verification.
1195 VerifyObject(object); 1195 VerifyObject(object);
1196 1196
1197 // The object itself should look OK. 1197 // The object itself should look OK.
1198 object->Verify(); 1198 object->ObjectVerify();
1199 1199
1200 // All the interior pointers should be contained in the heap. 1200 // All the interior pointers should be contained in the heap.
1201 int size = object->Size(); 1201 int size = object->Size();
1202 object->IterateBody(map->instance_type(), size, visitor); 1202 object->IterateBody(map->instance_type(), size, visitor);
1203 if (Marking::IsBlack(Marking::MarkBitFrom(object))) { 1203 if (Marking::IsBlack(Marking::MarkBitFrom(object))) {
1204 black_size += size; 1204 black_size += size;
1205 } 1205 }
1206 1206
1207 CHECK(object->address() + size <= top); 1207 CHECK(object->address() + size <= top);
1208 end_of_previous_object = object->address() + size; 1208 end_of_previous_object = object->address() + size;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 // be in map space. 1471 // be in map space.
1472 Map* map = object->map(); 1472 Map* map = object->map();
1473 CHECK(map->IsMap()); 1473 CHECK(map->IsMap());
1474 CHECK(heap()->map_space()->Contains(map)); 1474 CHECK(heap()->map_space()->Contains(map));
1475 1475
1476 // The object should not be code or a map. 1476 // The object should not be code or a map.
1477 CHECK(!object->IsMap()); 1477 CHECK(!object->IsMap());
1478 CHECK(!object->IsCode()); 1478 CHECK(!object->IsCode());
1479 1479
1480 // The object itself should look OK. 1480 // The object itself should look OK.
1481 object->Verify(); 1481 object->ObjectVerify();
1482 1482
1483 // All the interior pointers should be contained in the heap. 1483 // All the interior pointers should be contained in the heap.
1484 VerifyPointersVisitor visitor; 1484 VerifyPointersVisitor visitor;
1485 int size = object->Size(); 1485 int size = object->Size();
1486 object->IterateBody(map->instance_type(), size, &visitor); 1486 object->IterateBody(map->instance_type(), size, &visitor);
1487 1487
1488 current += size; 1488 current += size;
1489 } else { 1489 } else {
1490 // At end of page, switch to next page. 1490 // At end of page, switch to next page.
1491 NewSpacePage* page = NewSpacePage::FromLimit(current)->next_page(); 1491 NewSpacePage* page = NewSpacePage::FromLimit(current)->next_page();
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
3112 CHECK(heap()->map_space()->Contains(map)); 3112 CHECK(heap()->map_space()->Contains(map));
3113 3113
3114 // We have only code, sequential strings, external strings 3114 // We have only code, sequential strings, external strings
3115 // (sequential strings that have been morphed into external 3115 // (sequential strings that have been morphed into external
3116 // strings), fixed arrays, and byte arrays in large object space. 3116 // strings), fixed arrays, and byte arrays in large object space.
3117 CHECK(object->IsCode() || object->IsSeqString() || 3117 CHECK(object->IsCode() || object->IsSeqString() ||
3118 object->IsExternalString() || object->IsFixedArray() || 3118 object->IsExternalString() || object->IsFixedArray() ||
3119 object->IsFixedDoubleArray() || object->IsByteArray()); 3119 object->IsFixedDoubleArray() || object->IsByteArray());
3120 3120
3121 // The object itself should look OK. 3121 // The object itself should look OK.
3122 object->Verify(); 3122 object->ObjectVerify();
3123 3123
3124 // Byte arrays and strings don't have interior pointers. 3124 // Byte arrays and strings don't have interior pointers.
3125 if (object->IsCode()) { 3125 if (object->IsCode()) {
3126 VerifyPointersVisitor code_visitor; 3126 VerifyPointersVisitor code_visitor;
3127 object->IterateBody(map->instance_type(), 3127 object->IterateBody(map->instance_type(),
3128 object->Size(), 3128 object->Size(),
3129 &code_visitor); 3129 &code_visitor);
3130 } else if (object->IsFixedArray()) { 3130 } else if (object->IsFixedArray()) {
3131 FixedArray* array = FixedArray::cast(object); 3131 FixedArray* array = FixedArray::cast(object);
3132 for (int j = 0; j < array->length(); j++) { 3132 for (int j = 0; j < array->length(); j++) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3199 object->ShortPrint(); 3199 object->ShortPrint();
3200 PrintF("\n"); 3200 PrintF("\n");
3201 } 3201 }
3202 printf(" --------------------------------------\n"); 3202 printf(" --------------------------------------\n");
3203 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3203 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3204 } 3204 }
3205 3205
3206 #endif // DEBUG 3206 #endif // DEBUG
3207 3207
3208 } } // namespace v8::internal 3208 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698