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

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

Issue 10412030: Merging ContentArray into DescriptorArray (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: merged patchset Created 8 years, 6 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 | src/objects.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 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 base_marker()->MarkObjectAndPush(reinterpret_cast<HeapObject*>(obj)); 1860 base_marker()->MarkObjectAndPush(reinterpret_cast<HeapObject*>(obj));
1861 } 1861 }
1862 } 1862 }
1863 1863
1864 1864
1865 template <class T> 1865 template <class T>
1866 void Marker<T>::MarkDescriptorArray(DescriptorArray* descriptors) { 1866 void Marker<T>::MarkDescriptorArray(DescriptorArray* descriptors) {
1867 // Empty descriptor array is marked as a root before any maps are marked. 1867 // Empty descriptor array is marked as a root before any maps are marked.
1868 ASSERT(descriptors != descriptors->GetHeap()->empty_descriptor_array()); 1868 ASSERT(descriptors != descriptors->GetHeap()->empty_descriptor_array());
1869 1869
1870 // The DescriptorArray contains a pointer to its contents array, but the 1870 if (!base_marker()->MarkObjectWithoutPush(descriptors)) return;
1871 // contents array will be marked black and hence not be visited again. 1871 Object** descriptor_start = descriptors->data_start();
1872 if (!base_marker()->MarkObjectAndPush(descriptors)) return; 1872
1873 FixedArray* contents = FixedArray::cast( 1873 if (descriptors->HasEnumCache()) {
Michael Starzinger 2012/06/01 14:03:15 It's important that we don't forget to mark every
Toon Verwaest 2012/06/04 07:30:45 Done.
1874 descriptors->get(DescriptorArray::kContentArrayIndex)); 1874 Object** enum_cache_slot = descriptors->GetEnumCacheSlot();
1875 ASSERT(Marking::IsWhite(Marking::MarkBitFrom(contents))); 1875 Object* enum_cache = *enum_cache_slot;
1876 base_marker()->MarkObjectWithoutPush(contents); 1876 base_marker()->MarkObjectAndPush(
1877 reinterpret_cast<HeapObject*>(enum_cache));
1878 mark_compact_collector()->RecordSlot(descriptor_start,
1879 enum_cache_slot,
1880 enum_cache);
1881 }
1877 1882
1878 // If the descriptor contains a transition (value is a Map), we don't mark the 1883 // If the descriptor contains a transition (value is a Map), we don't mark the
1879 // value as live. It might be set to the NULL_DESCRIPTOR in 1884 // value as live. It might be set to the NULL_DESCRIPTOR in
1880 // ClearNonLiveTransitions later. 1885 // ClearNonLiveTransitions later.
1881 for (int i = 0; i < descriptors->number_of_descriptors(); ++i) { 1886 for (int i = 0; i < descriptors->number_of_descriptors(); ++i) {
1887 Object** key_slot = descriptors->GetKeySlot(i);
1888 Object* key = *key_slot;
1889 if (key->IsHeapObject()) {
1890 base_marker()->MarkObjectAndPush(reinterpret_cast<HeapObject*>(key));
1891 mark_compact_collector()->RecordSlot(descriptor_start, key_slot, key);
1892 }
1893
1894 Object** value_slot = descriptors->GetValueSlot(i);
1895 if (!(*value_slot)->IsHeapObject()) continue;
1896 HeapObject* value = HeapObject::cast(*value_slot);
1897
1898 mark_compact_collector()->RecordSlot(descriptor_start,
1899 value_slot,
1900 *value_slot);
Michael Starzinger 2012/06/01 14:03:15 Just pass "value" as the third parameter here.
Toon Verwaest 2012/06/04 07:30:45 Done.
1901
1882 PropertyDetails details(descriptors->GetDetails(i)); 1902 PropertyDetails details(descriptors->GetDetails(i));
1883 Object** slot = descriptors->GetValueSlot(i);
1884
1885 if (!(*slot)->IsHeapObject()) continue;
1886 HeapObject* value = HeapObject::cast(*slot);
1887
1888 mark_compact_collector()->RecordSlot(slot, slot, *slot);
1889 1903
1890 switch (details.type()) { 1904 switch (details.type()) {
1891 case NORMAL: 1905 case NORMAL:
1892 case FIELD: 1906 case FIELD:
1893 case CONSTANT_FUNCTION: 1907 case CONSTANT_FUNCTION:
1894 case HANDLER: 1908 case HANDLER:
1895 case INTERCEPTOR: 1909 case INTERCEPTOR:
1896 base_marker()->MarkObjectAndPush(value); 1910 base_marker()->MarkObjectAndPush(value);
1897 break; 1911 break;
1898 case CALLBACKS: 1912 case CALLBACKS:
(...skipping 2202 matching lines...) Expand 10 before | Expand all | Expand 10 after
4101 while (buffer != NULL) { 4115 while (buffer != NULL) {
4102 SlotsBuffer* next_buffer = buffer->next(); 4116 SlotsBuffer* next_buffer = buffer->next();
4103 DeallocateBuffer(buffer); 4117 DeallocateBuffer(buffer);
4104 buffer = next_buffer; 4118 buffer = next_buffer;
4105 } 4119 }
4106 *buffer_address = NULL; 4120 *buffer_address = NULL;
4107 } 4121 }
4108 4122
4109 4123
4110 } } // namespace v8::internal 4124 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698