Index: src/spaces-inl.h |
=================================================================== |
--- src/spaces-inl.h (revision 2316) |
+++ src/spaces-inl.h (working copy) |
@@ -93,17 +93,21 @@ |
void Page::ClearRSet() { |
-#ifndef V8_HOST_ARCH_64_BIT |
// This method can be called in all rset states. |
memset(RSetStart(), 0, kRSetEndOffset - kRSetStartOffset); |
-#endif |
} |
-// Give an address a (32-bits): |
+// Given an address (32-bits), separate its bits into: |
// | page address | words (6) | bit offset (5) | pointer alignment (2) | |
// The rset address is computed as: |
// page_address + words * 4 |
+// For a 64-bit address, if it is: |
+// | page address | quadwords(5) | bit offset(5) | pointer alignment (3) | |
+// The reset address is computed as: |
Lasse Reichstein
2009/07/01 12:30:18
reset -> rset (or RSet?)
|
+// page_address + words * 4 + kRSetOffset. |
Lasse Reichstein
2009/07/01 12:30:18
words -> quadwords
|
+// The rset is accessed as 32-bit words, and bit offsets in a 32-bit word, |
+// even on the X64 architecture. |
Lasse Reichstein
2009/07/01 12:30:18
We could probably speed up a little by loading 64
|
Address Page::ComputeRSetBitPosition(Address address, int offset, |
uint32_t* bitmask) { |
@@ -115,7 +119,7 @@ |
*bitmask = 1 << (bit_offset % kBitsPerInt); |
Address rset_address = |
- page->address() + (bit_offset / kBitsPerInt) * kIntSize; |
+ page->address() + kRSetOffset + (bit_offset / kBitsPerInt) * kIntSize; |
// The remembered set address is either in the normal remembered set range |
// of a page or else we have a large object page. |
ASSERT((page->RSetStart() <= rset_address && rset_address < page->RSetEnd()) |
@@ -131,8 +135,10 @@ |
// of the object: |
// (rset_address - page->ObjectAreaStart()). |
// Ie, we can just add the object size. |
+ // In the X64 architecture, the remembered set ends before the object start, |
+ // so we need to add an additional offset, from rset end to object start |
ASSERT(HeapObject::FromAddress(address)->IsFixedArray()); |
- rset_address += |
+ rset_address += kObjectStartOffset - kRSetEndOffset + |
FixedArray::SizeFor(Memory::int_at(page->ObjectAreaStart() |
+ Array::kLengthOffset)); |
} |
@@ -160,14 +166,9 @@ |
bool Page::IsRSetSet(Address address, int offset) { |
-#ifdef V8_HOST_ARCH_64_BIT |
- // TODO(X64): Reenable when RSet works. |
- return true; |
-#else // V8_HOST_ARCH_64_BIT |
uint32_t bitmask = 0; |
Address rset_address = ComputeRSetBitPosition(address, offset, &bitmask); |
return (Memory::uint32_at(rset_address) & bitmask) != 0; |
-#endif // V8_HOST_ARCH_64_BIT |
} |