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

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

Issue 8404030: Version 3.7.1 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 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.cc ('k') | src/messages.js » ('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 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 20 matching lines...) Expand all
31 #include "isolate.h" 31 #include "isolate.h"
32 #include "memory.h" 32 #include "memory.h"
33 #include "mark-compact.h" 33 #include "mark-compact.h"
34 34
35 35
36 namespace v8 { 36 namespace v8 {
37 namespace internal { 37 namespace internal {
38 38
39 39
40 MarkBit Marking::MarkBitFrom(Address addr) { 40 MarkBit Marking::MarkBitFrom(Address addr) {
41 MemoryChunk *p = MemoryChunk::FromAddress(addr); 41 MemoryChunk* p = MemoryChunk::FromAddress(addr);
42 return p->markbits()->MarkBitFromIndex(p->AddressToMarkbitIndex(addr), 42 return p->markbits()->MarkBitFromIndex(p->AddressToMarkbitIndex(addr),
43 p->ContainsOnlyData()); 43 p->ContainsOnlyData());
44 } 44 }
45 45
46 46
47 void MarkCompactCollector::SetFlags(int flags) { 47 void MarkCompactCollector::SetFlags(int flags) {
48 sweep_precisely_ = ((flags & Heap::kMakeHeapIterableMask) != 0); 48 sweep_precisely_ = ((flags & Heap::kMakeHeapIterableMask) != 0);
49 } 49 }
50 50
51 51
52 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { 52 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) {
53 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); 53 ASSERT(Marking::MarkBitFrom(obj) == mark_bit);
54 if (!mark_bit.Get()) { 54 if (!mark_bit.Get()) {
55 mark_bit.Set(); 55 mark_bit.Set();
56 MemoryChunk::IncrementLiveBytes(obj->address(), obj->Size()); 56 MemoryChunk::IncrementLiveBytes(obj->address(), obj->Size());
57 #ifdef DEBUG
58 UpdateLiveObjectCount(obj);
59 #endif
60 ProcessNewlyMarkedObject(obj); 57 ProcessNewlyMarkedObject(obj);
61 } 58 }
62 } 59 }
63 60
64 61
65 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) { 62 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) {
66 ASSERT(!mark_bit.Get()); 63 ASSERT(!mark_bit.Get());
67 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); 64 ASSERT(Marking::MarkBitFrom(obj) == mark_bit);
68 mark_bit.Set(); 65 mark_bit.Set();
69 MemoryChunk::IncrementLiveBytes(obj->address(), obj->Size()); 66 MemoryChunk::IncrementLiveBytes(obj->address(), obj->Size());
70 #ifdef DEBUG
71 UpdateLiveObjectCount(obj);
72 #endif
73 } 67 }
74 68
75 69
76 bool MarkCompactCollector::IsMarked(Object* obj) { 70 bool MarkCompactCollector::IsMarked(Object* obj) {
77 ASSERT(obj->IsHeapObject()); 71 ASSERT(obj->IsHeapObject());
78 HeapObject* heap_object = HeapObject::cast(obj); 72 HeapObject* heap_object = HeapObject::cast(obj);
79 return Marking::MarkBitFrom(heap_object).Get(); 73 return Marking::MarkBitFrom(heap_object).Get();
80 } 74 }
81 75
82 76
83 void MarkCompactCollector::RecordSlot(Object** anchor_slot, 77 void MarkCompactCollector::RecordSlot(Object** anchor_slot,
84 Object** slot, 78 Object** slot,
85 Object* object) { 79 Object* object) {
86 Page* object_page = Page::FromAddress(reinterpret_cast<Address>(object)); 80 Page* object_page = Page::FromAddress(reinterpret_cast<Address>(object));
87 if (object_page->IsEvacuationCandidate() && 81 if (object_page->IsEvacuationCandidate() &&
88 !ShouldSkipEvacuationSlotRecording(anchor_slot)) { 82 !ShouldSkipEvacuationSlotRecording(anchor_slot)) {
89 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_, 83 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_,
90 object_page->slots_buffer_address(), 84 object_page->slots_buffer_address(),
91 slot, 85 slot,
92 SlotsBuffer::FAIL_ON_OVERFLOW)) { 86 SlotsBuffer::FAIL_ON_OVERFLOW)) {
93 EvictEvacuationCandidate(object_page); 87 EvictEvacuationCandidate(object_page);
94 } 88 }
95 } 89 }
96 } 90 }
97 91
98 92
99 } } // namespace v8::internal 93 } } // namespace v8::internal
100 94
101 #endif // V8_MARK_COMPACT_INL_H_ 95 #endif // V8_MARK_COMPACT_INL_H_
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698