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

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

Issue 5188006: Push version 2.5.7 to trunk.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 10 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/mark-compact.h ('k') | 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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 1092
1093 // Process the weak references. 1093 // Process the weak references.
1094 MarkCompactWeakObjectRetainer mark_compact_object_retainer; 1094 MarkCompactWeakObjectRetainer mark_compact_object_retainer;
1095 Heap::ProcessWeakReferences(&mark_compact_object_retainer); 1095 Heap::ProcessWeakReferences(&mark_compact_object_retainer);
1096 1096
1097 // Remove object groups after marking phase. 1097 // Remove object groups after marking phase.
1098 GlobalHandles::RemoveObjectGroups(); 1098 GlobalHandles::RemoveObjectGroups();
1099 } 1099 }
1100 1100
1101 1101
1102 static int CountMarkedCallback(HeapObject* obj) {
1103 MapWord map_word = obj->map_word();
1104 map_word.ClearMark();
1105 return obj->SizeFromMap(map_word.ToMap());
1106 }
1107
1108
1109 #ifdef DEBUG 1102 #ifdef DEBUG
1110 void MarkCompactCollector::UpdateLiveObjectCount(HeapObject* obj) { 1103 void MarkCompactCollector::UpdateLiveObjectCount(HeapObject* obj) {
1111 live_bytes_ += obj->Size(); 1104 live_bytes_ += obj->Size();
1112 if (Heap::new_space()->Contains(obj)) { 1105 if (Heap::new_space()->Contains(obj)) {
1113 live_young_objects_size_ += obj->Size(); 1106 live_young_objects_size_ += obj->Size();
1114 } else if (Heap::map_space()->Contains(obj)) { 1107 } else if (Heap::map_space()->Contains(obj)) {
1115 ASSERT(obj->IsMap()); 1108 ASSERT(obj->IsMap());
1116 live_map_objects_size_ += obj->Size(); 1109 live_map_objects_size_ += obj->Size();
1117 } else if (Heap::cell_space()->Contains(obj)) { 1110 } else if (Heap::cell_space()->Contains(obj)) {
1118 ASSERT(obj->IsJSGlobalPropertyCell()); 1111 ASSERT(obj->IsJSGlobalPropertyCell());
(...skipping 26 matching lines...) Expand all
1145 1138
1146 // Safe to use during marking phase only. 1139 // Safe to use during marking phase only.
1147 bool MarkCompactCollector::SafeIsMap(HeapObject* object) { 1140 bool MarkCompactCollector::SafeIsMap(HeapObject* object) {
1148 MapWord metamap = object->map_word(); 1141 MapWord metamap = object->map_word();
1149 metamap.ClearMark(); 1142 metamap.ClearMark();
1150 return metamap.ToMap()->instance_type() == MAP_TYPE; 1143 return metamap.ToMap()->instance_type() == MAP_TYPE;
1151 } 1144 }
1152 1145
1153 1146
1154 void MarkCompactCollector::ClearNonLiveTransitions() { 1147 void MarkCompactCollector::ClearNonLiveTransitions() {
1155 HeapObjectIterator map_iterator(Heap::map_space(), &CountMarkedCallback); 1148 HeapObjectIterator map_iterator(Heap::map_space(), &SizeOfMarkedObject);
1156 // Iterate over the map space, setting map transitions that go from 1149 // Iterate over the map space, setting map transitions that go from
1157 // a marked map to an unmarked map to null transitions. At the same time, 1150 // a marked map to an unmarked map to null transitions. At the same time,
1158 // set all the prototype fields of maps back to their original value, 1151 // set all the prototype fields of maps back to their original value,
1159 // dropping the back pointers temporarily stored in the prototype field. 1152 // dropping the back pointers temporarily stored in the prototype field.
1160 // Setting the prototype field requires following the linked list of 1153 // Setting the prototype field requires following the linked list of
1161 // back pointers, reversing them all at once. This allows us to find 1154 // back pointers, reversing them all at once. This allows us to find
1162 // those maps with map transitions that need to be nulled, and only 1155 // those maps with map transitions that need to be nulled, and only
1163 // scan the descriptor arrays of those maps, not all maps. 1156 // scan the descriptor arrays of those maps, not all maps.
1164 // All of these actions are carried out only on maps of JSObjects 1157 // All of these actions are carried out only on maps of JSObjects
1165 // and related subtypes. 1158 // and related subtypes.
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
2666 #ifdef ENABLE_LOGGING_AND_PROFILING 2659 #ifdef ENABLE_LOGGING_AND_PROFILING
2667 if (obj->IsCode()) { 2660 if (obj->IsCode()) {
2668 PROFILE(CodeDeleteEvent(obj->address())); 2661 PROFILE(CodeDeleteEvent(obj->address()));
2669 } else if (obj->IsJSFunction()) { 2662 } else if (obj->IsJSFunction()) {
2670 PROFILE(FunctionDeleteEvent(obj->address())); 2663 PROFILE(FunctionDeleteEvent(obj->address()));
2671 } 2664 }
2672 #endif 2665 #endif
2673 } 2666 }
2674 2667
2675 2668
2669 int MarkCompactCollector::SizeOfMarkedObject(HeapObject* obj) {
2670 MapWord map_word = obj->map_word();
2671 map_word.ClearMark();
2672 return obj->SizeFromMap(map_word.ToMap());
2673 }
2674
2675
2676 void MarkCompactCollector::Initialize() { 2676 void MarkCompactCollector::Initialize() {
2677 StaticPointersToNewGenUpdatingVisitor::Initialize(); 2677 StaticPointersToNewGenUpdatingVisitor::Initialize();
2678 StaticMarkingVisitor::Initialize(); 2678 StaticMarkingVisitor::Initialize();
2679 } 2679 }
2680 2680
2681 2681
2682 } } // namespace v8::internal 2682 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698