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

Side by Side Diff: src/incremental-marking-inl.h

Issue 8431010: Split incremental marking write barrier into fast and slow paths. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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
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 19 matching lines...) Expand all
30 30
31 #include "incremental-marking.h" 31 #include "incremental-marking.h"
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36 36
37 bool IncrementalMarking::BaseRecordWrite(HeapObject* obj, 37 bool IncrementalMarking::BaseRecordWrite(HeapObject* obj,
38 Object** slot, 38 Object** slot,
39 Object* value) { 39 Object* value) {
40 if (IsMarking() && value->IsHeapObject()) { 40 MarkBit value_bit = Marking::MarkBitFrom(HeapObject::cast(value));
41 MarkBit value_bit = Marking::MarkBitFrom(HeapObject::cast(value)); 41 if (Marking::IsWhite(value_bit)) {
42 if (Marking::IsWhite(value_bit)) { 42 MarkBit obj_bit = Marking::MarkBitFrom(obj);
43 MarkBit obj_bit = Marking::MarkBitFrom(obj); 43 if (Marking::IsBlack(obj_bit)) {
44 if (Marking::IsBlack(obj_bit)) { 44 BlackToGreyAndUnshift(obj, obj_bit);
45 BlackToGreyAndUnshift(obj, obj_bit); 45 RestartIfNotMarking();
46 RestartIfNotMarking(); 46 }
47 }
48 47
49 // Object is either grey or white it will be scanned if survives. 48 // Object is either grey or white it will be scanned if survives.
50 return false; 49 return false;
51 }
52 return true;
53 } 50 }
54 return false; 51 return true;
55 } 52 }
56 53
57 54
58 void IncrementalMarking::RecordWrite(HeapObject* obj, 55 void IncrementalMarking::RecordWrite(HeapObject* obj,
59 Object** slot, 56 Object** slot,
60 Object* value) { 57 Object* value) {
61 if (BaseRecordWrite(obj, slot, value) && is_compacting_ && slot != NULL) { 58 if (IsMarking() && value->NonFailureIsHeapObject()) {
62 MarkBit obj_bit = Marking::MarkBitFrom(obj); 59 RecordWriteSlow(obj, slot, value);
63 if (Marking::IsBlack(obj_bit)) {
64 // Object is not going to be rescanned we need to record the slot.
65 heap_->mark_compact_collector()->RecordSlot(
66 HeapObject::RawField(obj, 0), slot, value);
67 }
68 } 60 }
69 } 61 }
70 62
71 63
64 void IncrementalMarking::RecordWriteOfCodeEntry(JSFunction* host,
65 Object** slot,
66 Code* value) {
67 if (IsMarking()) RecordWriteOfCodeEntrySlow(host, slot, value);
68 }
69
70
72 void IncrementalMarking::RecordWriteIntoCode(HeapObject* obj, 71 void IncrementalMarking::RecordWriteIntoCode(HeapObject* obj,
73 RelocInfo* rinfo, 72 RelocInfo* rinfo,
74 Object* value) { 73 Object* value) {
75 if (IsMarking() && value->IsHeapObject()) { 74 if (IsMarking() && value->NonFailureIsHeapObject()) {
76 MarkBit value_bit = Marking::MarkBitFrom(HeapObject::cast(value)); 75 RecordWriteIntoCodeSlow(obj, rinfo, value);
77 if (Marking::IsWhite(value_bit)) {
78 MarkBit obj_bit = Marking::MarkBitFrom(obj);
79 if (Marking::IsBlack(obj_bit)) {
80 BlackToGreyAndUnshift(obj, obj_bit);
81 RestartIfNotMarking();
82 }
83
84 // Object is either grey or white it will be scanned if survives.
85 return;
86 }
87
88 if (is_compacting_) {
89 MarkBit obj_bit = Marking::MarkBitFrom(obj);
90 if (Marking::IsBlack(obj_bit)) {
91 // Object is not going to be rescanned we need to record the slot.
92 heap_->mark_compact_collector()->RecordRelocSlot(rinfo,
93 Code::cast(value));
94 }
95 }
96 } 76 }
97 } 77 }
98 78
99 79
100 void IncrementalMarking::RecordWrites(HeapObject* obj) { 80 void IncrementalMarking::RecordWrites(HeapObject* obj) {
101 if (IsMarking()) { 81 if (IsMarking()) {
102 MarkBit obj_bit = Marking::MarkBitFrom(obj); 82 MarkBit obj_bit = Marking::MarkBitFrom(obj);
103 if (Marking::IsBlack(obj_bit)) { 83 if (Marking::IsBlack(obj_bit)) {
104 BlackToGreyAndUnshift(obj, obj_bit); 84 BlackToGreyAndUnshift(obj, obj_bit);
105 RestartIfNotMarking(); 85 RestartIfNotMarking();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 123
144 124
145 void IncrementalMarking::WhiteToGrey(HeapObject* obj, MarkBit mark_bit) { 125 void IncrementalMarking::WhiteToGrey(HeapObject* obj, MarkBit mark_bit) {
146 Marking::WhiteToGrey(mark_bit); 126 Marking::WhiteToGrey(mark_bit);
147 } 127 }
148 128
149 129
150 } } // namespace v8::internal 130 } } // namespace v8::internal
151 131
152 #endif // V8_INCREMENTAL_MARKING_INL_H_ 132 #endif // V8_INCREMENTAL_MARKING_INL_H_
OLDNEW
« src/incremental-marking.cc ('K') | « src/incremental-marking.cc ('k') | src/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698