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

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

Issue 3679002: [Isolates] Remove more HEAP macros from GC. (Closed)
Patch Set: Created 10 years, 2 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 | « no previous file | src/mark-compact.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 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 class OverflowedObjectsScanner; 103 class OverflowedObjectsScanner;
104 104
105 class MarkCompactCollector { 105 class MarkCompactCollector {
106 public: 106 public:
107 // Type of functions to compute forwarding addresses of objects in 107 // Type of functions to compute forwarding addresses of objects in
108 // compacted spaces. Given an object and its size, return a (non-failure) 108 // compacted spaces. Given an object and its size, return a (non-failure)
109 // Object* that will be the object after forwarding. There is a separate 109 // Object* that will be the object after forwarding. There is a separate
110 // allocation function for each (compactable) space based on the location 110 // allocation function for each (compactable) space based on the location
111 // of the object before compaction. 111 // of the object before compaction.
112 typedef Object* (*AllocationFunction)(HeapObject* object, int object_size); 112 typedef Object* (*AllocationFunction)(Heap* heap,
113 HeapObject* object,
114 int object_size);
113 115
114 // Type of functions to encode the forwarding address for an object. 116 // Type of functions to encode the forwarding address for an object.
115 // Given the object, its size, and the new (non-failure) object it will be 117 // Given the object, its size, and the new (non-failure) object it will be
116 // forwarded to, encode the forwarding address. For paged spaces, the 118 // forwarded to, encode the forwarding address. For paged spaces, the
117 // 'offset' input/output parameter contains the offset of the forwarded 119 // 'offset' input/output parameter contains the offset of the forwarded
118 // object from the forwarding address of the previous live object in the 120 // object from the forwarding address of the previous live object in the
119 // page as input, and is updated to contain the offset to be used for the 121 // page as input, and is updated to contain the offset to be used for the
120 // next live object in the same page. For spaces using a different 122 // next live object in the same page. For spaces using a different
121 // encoding (ie, contiguous spaces), the offset parameter is ignored. 123 // encoding (ie, contiguous spaces), the offset parameter is ignored.
122 typedef void (*EncodingFunction)(HeapObject* old_object, 124 typedef void (*EncodingFunction)(Heap* heap,
125 HeapObject* old_object,
123 int object_size, 126 int object_size,
124 Object* new_object, 127 Object* new_object,
125 int* offset); 128 int* offset);
126 129
127 // Type of functions to process non-live objects. 130 // Type of functions to process non-live objects.
128 typedef void (*ProcessNonLiveFunction)(HeapObject* object); 131 typedef void (*ProcessNonLiveFunction)(HeapObject* object);
129 132
130 // Pointer to member function, used in IterateLiveObjects. 133 // Pointer to member function, used in IterateLiveObjects.
131 typedef int (MarkCompactCollector::*LiveObjectCallback)(HeapObject* obj); 134 typedef int (MarkCompactCollector::*LiveObjectCallback)(HeapObject* obj);
132 135
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 #endif 178 #endif
176 179
177 // Determine type of object and emit deletion log event. 180 // Determine type of object and emit deletion log event.
178 static void ReportDeleteIfNeeded(HeapObject* obj); 181 static void ReportDeleteIfNeeded(HeapObject* obj);
179 182
180 // Distinguishable invalid map encodings (for single word and multiple words) 183 // Distinguishable invalid map encodings (for single word and multiple words)
181 // that indicate free regions. 184 // that indicate free regions.
182 static const uint32_t kSingleFreeEncoding = 0; 185 static const uint32_t kSingleFreeEncoding = 0;
183 static const uint32_t kMultiFreeEncoding = 1; 186 static const uint32_t kMultiFreeEncoding = 1;
184 187
188 inline Heap* heap() const { return heap_; }
189
185 private: 190 private:
186 MarkCompactCollector(); 191 MarkCompactCollector();
187 192
188 #ifdef DEBUG 193 #ifdef DEBUG
189 enum CollectorState { 194 enum CollectorState {
190 IDLE, 195 IDLE,
191 PREPARE_GC, 196 PREPARE_GC,
192 MARK_LIVE_OBJECTS, 197 MARK_LIVE_OBJECTS,
193 SWEEP_SPACES, 198 SWEEP_SPACES,
194 ENCODE_FORWARDING_ADDRESSES, 199 ENCODE_FORWARDING_ADDRESSES,
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 Heap* heap_; 485 Heap* heap_;
481 MarkingStack marking_stack_; 486 MarkingStack marking_stack_;
482 friend class Heap; 487 friend class Heap;
483 friend class OverflowedObjectsScanner; 488 friend class OverflowedObjectsScanner;
484 }; 489 };
485 490
486 491
487 } } // namespace v8::internal 492 } } // namespace v8::internal
488 493
489 #endif // V8_MARK_COMPACT_H_ 494 #endif // V8_MARK_COMPACT_H_
OLDNEW
« no previous file with comments | « no previous file | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698