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

Side by Side Diff: src/objects-inl.h

Issue 3615009: Parallelize marking phase of mark-sweep/compact collection cycle. (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 | « src/objects.h ('k') | src/objects-visiting.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 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 void HeapObject::IteratePointer(ObjectVisitor* v, int offset) { 1103 void HeapObject::IteratePointer(ObjectVisitor* v, int offset) {
1104 v->VisitPointer(reinterpret_cast<Object**>(FIELD_ADDR(this, offset))); 1104 v->VisitPointer(reinterpret_cast<Object**>(FIELD_ADDR(this, offset)));
1105 } 1105 }
1106 1106
1107 1107
1108 bool HeapObject::IsMarked() { 1108 bool HeapObject::IsMarked() {
1109 return map_word().IsMarked(); 1109 return map_word().IsMarked();
1110 } 1110 }
1111 1111
1112 1112
1113 void HeapObject::SetMark() { 1113 bool HeapObject::SetMark() {
1114 ASSERT(!IsMarked());
1115 MapWord first_word = map_word(); 1114 MapWord first_word = map_word();
1116 first_word.SetMark(); 1115
1117 set_map_word(first_word); 1116 if (!first_word.IsMarked()) {
1117 first_word.SetMark();
1118 set_map_word(first_word);
1119 return true;
1120 }
1121
1122 return false;
1118 } 1123 }
1119 1124
1120 1125
1126 bool HeapObject::SetMarkExclusively() {
1127 MapWord first_word = map_word();
1128
1129 if (!first_word.IsMarked()) {
1130 MapWord new_first_word = first_word;
1131 new_first_word.SetMark();
1132
1133 AtomicWord* map_word_slot =
1134 reinterpret_cast<AtomicWord*>(this->address() + kMapOffset);
1135
1136 return AtomicCompareAndSwap(map_word_slot,
1137 static_cast<AtomicWord>(first_word.value_),
1138 static_cast<AtomicWord>(new_first_word.value_));
1139 }
1140
1141 return false;
1142 }
1143
1144
1121 void HeapObject::ClearMark() { 1145 void HeapObject::ClearMark() {
1122 ASSERT(IsMarked()); 1146 ASSERT(IsMarked());
1123 MapWord first_word = map_word(); 1147 MapWord first_word = map_word();
1124 first_word.ClearMark(); 1148 first_word.ClearMark();
1125 set_map_word(first_word); 1149 set_map_word(first_word);
1126 } 1150 }
1127 1151
1128 1152
1129 bool HeapObject::IsOverflowed() { 1153 bool HeapObject::IsOverflowed() {
1130 return map_word().IsOverflowed(); 1154 return map_word().IsOverflowed();
(...skipping 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after
3550 #undef WRITE_INT_FIELD 3574 #undef WRITE_INT_FIELD
3551 #undef READ_SHORT_FIELD 3575 #undef READ_SHORT_FIELD
3552 #undef WRITE_SHORT_FIELD 3576 #undef WRITE_SHORT_FIELD
3553 #undef READ_BYTE_FIELD 3577 #undef READ_BYTE_FIELD
3554 #undef WRITE_BYTE_FIELD 3578 #undef WRITE_BYTE_FIELD
3555 3579
3556 3580
3557 } } // namespace v8::internal 3581 } } // namespace v8::internal
3558 3582
3559 #endif // V8_OBJECTS_INL_H_ 3583 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-visiting.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698