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

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

Issue 162001: Fix bug in X64 RSet code. Optimize IA32 version. (Closed)
Patch Set: Created 11 years, 4 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
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 Address rset_address = 121 Address rset_address =
122 page->address() + kRSetOffset + (bit_offset / kBitsPerInt) * kIntSize; 122 page->address() + kRSetOffset + (bit_offset / kBitsPerInt) * kIntSize;
123 // The remembered set address is either in the normal remembered set range 123 // The remembered set address is either in the normal remembered set range
124 // of a page or else we have a large object page. 124 // of a page or else we have a large object page.
125 ASSERT((page->RSetStart() <= rset_address && rset_address < page->RSetEnd()) 125 ASSERT((page->RSetStart() <= rset_address && rset_address < page->RSetEnd())
126 || page->IsLargeObjectPage()); 126 || page->IsLargeObjectPage());
127 127
128 if (rset_address >= page->RSetEnd()) { 128 if (rset_address >= page->RSetEnd()) {
129 // We have a large object page, and the remembered set address is actually 129 // We have a large object page, and the remembered set address is actually
130 // past the end of the object. The address of the remembered set in this 130 // past the end of the object.
131 // case is the extra remembered set start address at the address of the 131
William Hesse 2009/08/05 10:17:50 Rather than saying "FixedArray" everywhere in comm
132 // end of the object: 132 // The first part of the remembered set is still located at the start of
133 // the page, but anything after kRSetEndOffset must be relocated to after
134 // the FixedArray, i.e. after
133 // (page->ObjectAreaStart() + object size) 135 // (page->ObjectAreaStart() + object size)
134 // plus the offset of the computed remembered set address from the start 136 // We do that by adding the difference between the normal RSet's end and
135 // of the object: 137 // the object's end.
136 // (rset_address - page->ObjectAreaStart()).
137 // Ie, we can just add the object size.
138 // In the X64 architecture, the remembered set ends before the object start,
139 // so we need to add an additional offset, from rset end to object start
140 ASSERT(HeapObject::FromAddress(address)->IsFixedArray()); 138 ASSERT(HeapObject::FromAddress(address)->IsFixedArray());
141 rset_address += kObjectStartOffset - kRSetEndOffset + 139 int fixedarray_length =
142 FixedArray::SizeFor(Memory::int_at(page->ObjectAreaStart() 140 FixedArray::SizeFor(Memory::int_at(page->ObjectAreaStart()
143 + Array::kLengthOffset)); 141 + Array::kLengthOffset));
142 rset_address += kObjectStartOffset - kRSetEndOffset + fixedarray_length;
144 } 143 }
145 return rset_address; 144 return rset_address;
146 } 145 }
147 146
148 147
149 void Page::SetRSet(Address address, int offset) { 148 void Page::SetRSet(Address address, int offset) {
150 uint32_t bitmask = 0; 149 uint32_t bitmask = 0;
151 Address rset_address = ComputeRSetBitPosition(address, offset, &bitmask); 150 Address rset_address = ComputeRSetBitPosition(address, offset, &bitmask);
152 Memory::uint32_at(rset_address) |= bitmask; 151 Memory::uint32_at(rset_address) |= bitmask;
153 152
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 ASSERT(space->low() <= alloc_info->top 356 ASSERT(space->low() <= alloc_info->top
358 && alloc_info->top <= space->high() 357 && alloc_info->top <= space->high()
359 && alloc_info->limit == space->high()); 358 && alloc_info->limit == space->high());
360 #endif 359 #endif
361 return obj; 360 return obj;
362 } 361 }
363 362
364 } } // namespace v8::internal 363 } } // namespace v8::internal
365 364
366 #endif // V8_SPACES_INL_H_ 365 #endif // V8_SPACES_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698