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

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

Issue 23934008: Fix heap verifier for partially constructed arrays when allocation folding is off. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 | « no previous file | 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 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 int field = descriptors->GetFieldIndex(i); 323 int field = descriptors->GetFieldIndex(i);
324 Object* value = RawFastPropertyAt(field); 324 Object* value = RawFastPropertyAt(field);
325 if (r.IsDouble()) ASSERT(value->IsHeapNumber()); 325 if (r.IsDouble()) ASSERT(value->IsHeapNumber());
326 if (value->IsUninitialized()) continue; 326 if (value->IsUninitialized()) continue;
327 if (r.IsSmi()) ASSERT(value->IsSmi()); 327 if (r.IsSmi()) ASSERT(value->IsSmi());
328 if (r.IsHeapObject()) ASSERT(value->IsHeapObject()); 328 if (r.IsHeapObject()) ASSERT(value->IsHeapObject());
329 } 329 }
330 } 330 }
331 } 331 }
332 332
333 // TODO(hpayer): deal gracefully with partially constructed JSObjects, when 333 if ((!FLAG_use_gvn || !FLAG_use_allocation_folding) &&
334 // allocation folding is turned off. 334 (reinterpret_cast<Map*>(elements()) ==
335 if (reinterpret_cast<Map*>(elements()) != 335 GetHeap()->one_pointer_filler_map())) {
336 GetHeap()->one_pointer_filler_map()) { 336 // A GC was caused while constructing this object. This can just happen when
337 // allocation folding is turned off. The elements pointer may point to a
mvstanton 2013/09/13 09:57:13 cool but can you reverse the if, I don't really li
Hannes Payer (out of office) 2013/09/13 11:30:27 Done.
338 // filler map in that case.
339 } else {
337 CHECK_EQ((map()->has_fast_smi_or_object_elements() || 340 CHECK_EQ((map()->has_fast_smi_or_object_elements() ||
338 (elements() == GetHeap()->empty_fixed_array())), 341 (elements() == GetHeap()->empty_fixed_array())),
339 (elements()->map() == GetHeap()->fixed_array_map() || 342 (elements()->map() == GetHeap()->fixed_array_map() ||
340 elements()->map() == GetHeap()->fixed_cow_array_map())); 343 elements()->map() == GetHeap()->fixed_cow_array_map()));
341 CHECK(map()->has_fast_object_elements() == HasFastObjectElements()); 344 CHECK(map()->has_fast_object_elements() == HasFastObjectElements());
342 } 345 }
343 } 346 }
344 347
345 348
346 void Map::MapVerify() { 349 void Map::MapVerify() {
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 DependentCode::kWeaklyEmbeddedGroup, this)); 679 DependentCode::kWeaklyEmbeddedGroup, this));
677 } 680 }
678 } 681 }
679 } 682 }
680 } 683 }
681 684
682 685
683 void JSArray::JSArrayVerify() { 686 void JSArray::JSArrayVerify() {
684 JSObjectVerify(); 687 JSObjectVerify();
685 CHECK(length()->IsNumber() || length()->IsUndefined()); 688 CHECK(length()->IsNumber() || length()->IsUndefined());
686 // TODO(hpayer): deal gracefully with partially constructed JSObjects, when 689 if ((!FLAG_use_gvn || !FLAG_use_allocation_folding) &&
687 // allocation folding is turned off. 690 (reinterpret_cast<Map*>(elements()) ==
688 if (reinterpret_cast<Map*>(elements()) != 691 GetHeap()->one_pointer_filler_map())) {
689 GetHeap()->one_pointer_filler_map()) { 692 // A GC was caused while constructing this array. This can just happen when
693 // allocation folding is turned off. The elements pointer may point to a
mvstanton 2013/09/13 09:57:13 same thing.
Hannes Payer (out of office) 2013/09/13 11:30:27 Done.
694 // filler map in that case.
695 } else {
690 CHECK(elements()->IsUndefined() || 696 CHECK(elements()->IsUndefined() ||
691 elements()->IsFixedArray() || 697 elements()->IsFixedArray() ||
692 elements()->IsFixedDoubleArray()); 698 elements()->IsFixedDoubleArray());
693 // TODO(mvstanton): to diagnose chromium bug 284577, remove after. 699 // TODO(mvstanton): to diagnose chromium bug 284577, remove after.
694 AllocationMemento* memento = AllocationMemento::FindForJSObject(this); 700 AllocationMemento* memento = AllocationMemento::FindForJSObject(this);
695 if (memento != NULL && memento->IsValid()) { 701 if (memento != NULL && memento->IsValid()) {
696 memento->AllocationMementoVerify(); 702 memento->AllocationMementoVerify();
697 } 703 }
698 } 704 }
699 } 705 }
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 for (int i = 0; i < number_of_transitions(); ++i) { 1193 for (int i = 0; i < number_of_transitions(); ++i) {
1188 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; 1194 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false;
1189 } 1195 }
1190 return true; 1196 return true;
1191 } 1197 }
1192 1198
1193 1199
1194 #endif // DEBUG 1200 #endif // DEBUG
1195 1201
1196 } } // namespace v8::internal 1202 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698