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

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

Issue 14007008: New GC APIs, try 2. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: code review (yurys) Created 7 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
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | test/cctest/test-api.cc » ('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 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 1932
1933 void MarkCompactCollector::MarkImplicitRefGroups() { 1933 void MarkCompactCollector::MarkImplicitRefGroups() {
1934 List<ImplicitRefGroup*>* ref_groups = 1934 List<ImplicitRefGroup*>* ref_groups =
1935 isolate()->global_handles()->implicit_ref_groups(); 1935 isolate()->global_handles()->implicit_ref_groups();
1936 1936
1937 int last = 0; 1937 int last = 0;
1938 for (int i = 0; i < ref_groups->length(); i++) { 1938 for (int i = 0; i < ref_groups->length(); i++) {
1939 ImplicitRefGroup* entry = ref_groups->at(i); 1939 ImplicitRefGroup* entry = ref_groups->at(i);
1940 ASSERT(entry != NULL); 1940 ASSERT(entry != NULL);
1941 1941
1942 if (!IsMarked(*entry->parent_)) { 1942 if (!IsMarked(*entry->parent)) {
1943 (*ref_groups)[last++] = entry; 1943 (*ref_groups)[last++] = entry;
1944 continue; 1944 continue;
1945 } 1945 }
1946 1946
1947 Object*** children = entry->children_; 1947 Object*** children = entry->children;
1948 // A parent object is marked, so mark all child heap objects. 1948 // A parent object is marked, so mark all child heap objects.
1949 for (size_t j = 0; j < entry->length_; ++j) { 1949 for (size_t j = 0; j < entry->length; ++j) {
1950 if ((*children[j])->IsHeapObject()) { 1950 if ((*children[j])->IsHeapObject()) {
1951 HeapObject* child = HeapObject::cast(*children[j]); 1951 HeapObject* child = HeapObject::cast(*children[j]);
1952 MarkBit mark = Marking::MarkBitFrom(child); 1952 MarkBit mark = Marking::MarkBitFrom(child);
1953 MarkObject(child, mark); 1953 MarkObject(child, mark);
1954 } 1954 }
1955 } 1955 }
1956 1956
1957 // Once the entire group has been marked, dispose it because it's 1957 // Once the entire group has been marked, dispose it because it's
1958 // not needed anymore. 1958 // not needed anymore.
1959 entry->Dispose(); 1959 delete entry;
1960 } 1960 }
1961 ref_groups->Rewind(last); 1961 ref_groups->Rewind(last);
1962 } 1962 }
1963 1963
1964 1964
1965 // Mark all objects reachable from the objects on the marking stack. 1965 // Mark all objects reachable from the objects on the marking stack.
1966 // Before: the marking stack contains zero or more heap object pointers. 1966 // Before: the marking stack contains zero or more heap object pointers.
1967 // After: the marking stack is empty, and all objects reachable from the 1967 // After: the marking stack is empty, and all objects reachable from the
1968 // marking stack have been marked, or are overflowed in the heap. 1968 // marking stack have been marked, or are overflowed in the heap.
1969 void MarkCompactCollector::EmptyMarkingDeque() { 1969 void MarkCompactCollector::EmptyMarkingDeque() {
(...skipping 2161 matching lines...) Expand 10 before | Expand all | Expand 10 after
4131 while (buffer != NULL) { 4131 while (buffer != NULL) {
4132 SlotsBuffer* next_buffer = buffer->next(); 4132 SlotsBuffer* next_buffer = buffer->next();
4133 DeallocateBuffer(buffer); 4133 DeallocateBuffer(buffer);
4134 buffer = next_buffer; 4134 buffer = next_buffer;
4135 } 4135 }
4136 *buffer_address = NULL; 4136 *buffer_address = NULL;
4137 } 4137 }
4138 4138
4139 4139
4140 } } // namespace v8::internal 4140 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698