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

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

Issue 43383004: The Elements pointer in a JSObject can have a filler map instead of a (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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.h ('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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 if (r.IsDouble()) ASSERT(value->IsHeapNumber()); 328 if (r.IsDouble()) ASSERT(value->IsHeapNumber());
329 if (value->IsUninitialized()) continue; 329 if (value->IsUninitialized()) continue;
330 if (r.IsSmi()) ASSERT(value->IsSmi()); 330 if (r.IsSmi()) ASSERT(value->IsSmi());
331 if (r.IsHeapObject()) ASSERT(value->IsHeapObject()); 331 if (r.IsHeapObject()) ASSERT(value->IsHeapObject());
332 } 332 }
333 } 333 }
334 } 334 }
335 335
336 // If a GC was caused while constructing this object, the elements 336 // If a GC was caused while constructing this object, the elements
337 // pointer may point to a one pointer filler map. 337 // pointer may point to a one pointer filler map.
338 if ((FLAG_use_gvn && FLAG_use_allocation_folding) || 338 if (ElementsAreSafeToExamine()) {
339 (reinterpret_cast<Map*>(elements()) !=
340 GetHeap()->one_pointer_filler_map())) {
341 CHECK_EQ((map()->has_fast_smi_or_object_elements() || 339 CHECK_EQ((map()->has_fast_smi_or_object_elements() ||
342 (elements() == GetHeap()->empty_fixed_array())), 340 (elements() == GetHeap()->empty_fixed_array())),
343 (elements()->map() == GetHeap()->fixed_array_map() || 341 (elements()->map() == GetHeap()->fixed_array_map() ||
344 elements()->map() == GetHeap()->fixed_cow_array_map())); 342 elements()->map() == GetHeap()->fixed_cow_array_map()));
345 CHECK(map()->has_fast_object_elements() == HasFastObjectElements()); 343 CHECK(map()->has_fast_object_elements() == HasFastObjectElements());
346 } 344 }
347 } 345 }
348 346
349 347
350 void Map::MapVerify() { 348 void Map::MapVerify() {
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 } 689 }
692 } 690 }
693 } 691 }
694 692
695 693
696 void JSArray::JSArrayVerify() { 694 void JSArray::JSArrayVerify() {
697 JSObjectVerify(); 695 JSObjectVerify();
698 CHECK(length()->IsNumber() || length()->IsUndefined()); 696 CHECK(length()->IsNumber() || length()->IsUndefined());
699 // If a GC was caused while constructing this array, the elements 697 // If a GC was caused while constructing this array, the elements
700 // pointer may point to a one pointer filler map. 698 // pointer may point to a one pointer filler map.
701 if ((FLAG_use_gvn && FLAG_use_allocation_folding) || 699 if (ElementsAreSafeToExamine()) {
702 (reinterpret_cast<Map*>(elements()) !=
703 GetHeap()->one_pointer_filler_map())) {
704 CHECK(elements()->IsUndefined() || 700 CHECK(elements()->IsUndefined() ||
705 elements()->IsFixedArray() || 701 elements()->IsFixedArray() ||
706 elements()->IsFixedDoubleArray()); 702 elements()->IsFixedDoubleArray());
707 } 703 }
708 } 704 }
709 705
710 706
711 void JSSet::JSSetVerify() { 707 void JSSet::JSSetVerify() {
712 CHECK(IsJSSet()); 708 CHECK(IsJSSet());
713 JSObjectVerify(); 709 JSObjectVerify();
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 number_of_fast_used_elements_, number_of_fast_unused_elements_); 1132 number_of_fast_used_elements_, number_of_fast_unused_elements_);
1137 1133
1138 PrintF(" - slow elements (#%d): %d (used) %d (unused)\n", 1134 PrintF(" - slow elements (#%d): %d (used) %d (unused)\n",
1139 number_of_objects_ - number_of_objects_with_fast_elements_, 1135 number_of_objects_ - number_of_objects_with_fast_elements_,
1140 number_of_slow_used_elements_, number_of_slow_unused_elements_); 1136 number_of_slow_used_elements_, number_of_slow_unused_elements_);
1141 1137
1142 PrintF("\n"); 1138 PrintF("\n");
1143 } 1139 }
1144 1140
1145 1141
1142 bool JSObject::ElementsAreSafeToExamine() {
1143 return (FLAG_use_gvn && FLAG_use_allocation_folding) ||
1144 reinterpret_cast<Map*>(elements()) !=
1145 GetHeap()->one_pointer_filler_map();
1146 }
1147
1148
1146 bool DescriptorArray::IsSortedNoDuplicates(int valid_entries) { 1149 bool DescriptorArray::IsSortedNoDuplicates(int valid_entries) {
1147 if (valid_entries == -1) valid_entries = number_of_descriptors(); 1150 if (valid_entries == -1) valid_entries = number_of_descriptors();
1148 Name* current_key = NULL; 1151 Name* current_key = NULL;
1149 uint32_t current = 0; 1152 uint32_t current = 0;
1150 for (int i = 0; i < number_of_descriptors(); i++) { 1153 for (int i = 0; i < number_of_descriptors(); i++) {
1151 Name* key = GetSortedKey(i); 1154 Name* key = GetSortedKey(i);
1152 if (key == current_key) { 1155 if (key == current_key) {
1153 PrintDescriptors(); 1156 PrintDescriptors();
1154 return false; 1157 return false;
1155 } 1158 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 for (int i = 0; i < number_of_transitions(); ++i) { 1199 for (int i = 0; i < number_of_transitions(); ++i) {
1197 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; 1200 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false;
1198 } 1201 }
1199 return true; 1202 return true;
1200 } 1203 }
1201 1204
1202 1205
1203 #endif // DEBUG 1206 #endif // DEBUG
1204 1207
1205 } } // namespace v8::internal 1208 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698