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

Side by Side Diff: src/mark-compact.cc

Issue 10692130: Swap bitfield3 and backpointer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: u Created 8 years, 5 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
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 1811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 1822
1823 1823
1824 template <class T> 1824 template <class T>
1825 void Marker<T>::MarkMapContents(Map* map) { 1825 void Marker<T>::MarkMapContents(Map* map) {
1826 // Make sure that the back pointer stored either in the map itself or inside 1826 // Make sure that the back pointer stored either in the map itself or inside
1827 // its prototype transitions array is marked. Treat pointers in the descriptor 1827 // its prototype transitions array is marked. Treat pointers in the descriptor
1828 // array as weak and also mark that array to prevent visiting it later. 1828 // array as weak and also mark that array to prevent visiting it later.
1829 base_marker()->MarkObjectAndPush(HeapObject::cast(map->GetBackPointer())); 1829 base_marker()->MarkObjectAndPush(HeapObject::cast(map->GetBackPointer()));
1830 1830
1831 Object** descriptor_array_slot = 1831 Object** descriptor_array_slot =
1832 HeapObject::RawField(map, Map::kInstanceDescriptorsOrBitField3Offset); 1832 HeapObject::RawField(map, Map::kInstanceDescriptorsOrBackPointerOffset);
1833 Object* descriptor_array = *descriptor_array_slot; 1833 Object* descriptor_array = *descriptor_array_slot;
1834 if (!descriptor_array->IsSmi()) { 1834 if (descriptor_array->IsDescriptorArray()) {
1835 MarkDescriptorArray(reinterpret_cast<DescriptorArray*>(descriptor_array)); 1835 MarkDescriptorArray(reinterpret_cast<DescriptorArray*>(descriptor_array));
1836 } else {
1837 ASSERT(descriptor_array->IsMap() || descriptor_array->IsUndefined());
Jakob Kummerow 2012/07/10 12:26:25 When descriptor_array->IsMap(), then it's the back
Toon Verwaest 2012/07/10 13:28:28 It's already marked above, by accessing map->GetBa
1836 } 1838 }
1837 1839
1838 // Mark the Object* fields of the Map. Since the descriptor array has been 1840 // Mark the Object* fields of the Map. Since the descriptor array has been
1839 // marked already, it is fine that one of these fields contains a pointer 1841 // marked already, it is fine that one of these fields contains a pointer
1840 // to it. But make sure to skip back pointer. 1842 // to it. But make sure to skip back pointer.
1841 STATIC_ASSERT(Map::kPointerFieldsEndOffset == 1843 STATIC_ASSERT(Map::kPointerFieldsEndOffset ==
1842 Map::kBackPointerOffset + kPointerSize); 1844 Map::kBitField3Offset + kPointerSize);
1843 Object** start_slot = 1845 Object** start_slot =
1844 HeapObject::RawField(map, Map::kPointerFieldsBeginOffset); 1846 HeapObject::RawField(map, Map::kPointerFieldsBeginOffset);
1845 Object** end_slot = HeapObject::RawField(map, Map::kBackPointerOffset); 1847 Object** end_slot = HeapObject::RawField(map, Map::kBitField3Offset);
1846 for (Object** slot = start_slot; slot < end_slot; slot++) { 1848 for (Object** slot = start_slot; slot < end_slot; slot++) {
1847 Object* obj = *slot; 1849 Object* obj = *slot;
1848 if (!obj->NonFailureIsHeapObject()) continue; 1850 if (!obj->NonFailureIsHeapObject()) continue;
1849 mark_compact_collector()->RecordSlot(start_slot, slot, obj); 1851 mark_compact_collector()->RecordSlot(start_slot, slot, obj);
1850 base_marker()->MarkObjectAndPush(reinterpret_cast<HeapObject*>(obj)); 1852 base_marker()->MarkObjectAndPush(reinterpret_cast<HeapObject*>(obj));
1851 } 1853 }
1852 } 1854 }
1853 1855
1854 1856
1855 template <class T> 1857 template <class T>
(...skipping 2296 matching lines...) Expand 10 before | Expand all | Expand 10 after
4152 while (buffer != NULL) { 4154 while (buffer != NULL) {
4153 SlotsBuffer* next_buffer = buffer->next(); 4155 SlotsBuffer* next_buffer = buffer->next();
4154 DeallocateBuffer(buffer); 4156 DeallocateBuffer(buffer);
4155 buffer = next_buffer; 4157 buffer = next_buffer;
4156 } 4158 }
4157 *buffer_address = NULL; 4159 *buffer_address = NULL;
4158 } 4160 }
4159 4161
4160 4162
4161 } } // namespace v8::internal 4163 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698