| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 MarkObject(obj); | 216 MarkObject(obj); |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 | 220 |
| 221 private: | 221 private: |
| 222 // Mark object pointed to by p. | 222 // Mark object pointed to by p. |
| 223 INLINE(void MarkObject(Object* obj)) { | 223 INLINE(void MarkObject(Object* obj)) { |
| 224 HeapObject* heap_object = HeapObject::cast(obj); | 224 HeapObject* heap_object = HeapObject::cast(obj); |
| 225 MarkBit mark_bit = Marking::MarkBitFrom(heap_object); | 225 MarkBit mark_bit = Marking::MarkBitFrom(heap_object); |
| 226 if (mark_bit.data_only()) { | 226 if (Marking::IsWhite(mark_bit)) { |
| 227 if (incremental_marking_->MarkBlackOrKeepGrey(mark_bit)) { | |
| 228 MemoryChunk::IncrementLiveBytes(heap_object->address(), | |
| 229 heap_object->Size()); | |
| 230 } | |
| 231 } else if (Marking::IsWhite(mark_bit)) { | |
| 232 incremental_marking_->WhiteToGreyAndPush(heap_object, mark_bit); | 227 incremental_marking_->WhiteToGreyAndPush(heap_object, mark_bit); |
| 233 } | 228 } |
| 234 } | 229 } |
| 235 | 230 |
| 236 Heap* heap_; | 231 Heap* heap_; |
| 237 IncrementalMarking* incremental_marking_; | 232 IncrementalMarking* incremental_marking_; |
| 238 }; | 233 }; |
| 239 | 234 |
| 240 | 235 |
| 241 class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor { | 236 class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 254 for (Object** p = start; p < end; p++) MarkObjectByPointer(p); | 249 for (Object** p = start; p < end; p++) MarkObjectByPointer(p); |
| 255 } | 250 } |
| 256 | 251 |
| 257 private: | 252 private: |
| 258 void MarkObjectByPointer(Object** p) { | 253 void MarkObjectByPointer(Object** p) { |
| 259 Object* obj = *p; | 254 Object* obj = *p; |
| 260 if (!obj->IsHeapObject()) return; | 255 if (!obj->IsHeapObject()) return; |
| 261 | 256 |
| 262 HeapObject* heap_object = HeapObject::cast(obj); | 257 HeapObject* heap_object = HeapObject::cast(obj); |
| 263 MarkBit mark_bit = Marking::MarkBitFrom(heap_object); | 258 MarkBit mark_bit = Marking::MarkBitFrom(heap_object); |
| 264 if (mark_bit.data_only()) { | 259 if (Marking::IsWhite(mark_bit)) { |
| 265 if (incremental_marking_->MarkBlackOrKeepGrey(mark_bit)) { | 260 incremental_marking_->WhiteToGreyAndPush(heap_object, mark_bit); |
| 266 MemoryChunk::IncrementLiveBytes(heap_object->address(), | |
| 267 heap_object->Size()); | |
| 268 } | |
| 269 } else { | |
| 270 if (Marking::IsWhite(mark_bit)) { | |
| 271 incremental_marking_->WhiteToGreyAndPush(heap_object, mark_bit); | |
| 272 } | |
| 273 } | 261 } |
| 274 } | 262 } |
| 275 | 263 |
| 276 Heap* heap_; | 264 Heap* heap_; |
| 277 IncrementalMarking* incremental_marking_; | 265 IncrementalMarking* incremental_marking_; |
| 278 }; | 266 }; |
| 279 | 267 |
| 280 | 268 |
| 281 void IncrementalMarking::SetOldSpacePageFlags(MemoryChunk* chunk, | 269 void IncrementalMarking::SetOldSpacePageFlags(MemoryChunk* chunk, |
| 282 bool is_marking, | 270 bool is_marking, |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 allocation_marking_factor_ = kInitialAllocationMarkingFactor; | 899 allocation_marking_factor_ = kInitialAllocationMarkingFactor; |
| 912 bytes_scanned_ = 0; | 900 bytes_scanned_ = 0; |
| 913 } | 901 } |
| 914 | 902 |
| 915 | 903 |
| 916 int64_t IncrementalMarking::SpaceLeftInOldSpace() { | 904 int64_t IncrementalMarking::SpaceLeftInOldSpace() { |
| 917 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSize(); | 905 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSize(); |
| 918 } | 906 } |
| 919 | 907 |
| 920 } } // namespace v8::internal | 908 } } // namespace v8::internal |
| OLD | NEW |