OLD | NEW |
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // This method can be called in all rset states. | 96 // This method can be called in all rset states. |
97 memset(RSetStart(), 0, kRSetEndOffset - kRSetStartOffset); | 97 memset(RSetStart(), 0, kRSetEndOffset - kRSetStartOffset); |
98 } | 98 } |
99 | 99 |
100 | 100 |
101 // Given a 32-bit address, separate its bits into: | 101 // Given a 32-bit address, separate its bits into: |
102 // | page address | words (6) | bit offset (5) | pointer alignment (2) | | 102 // | page address | words (6) | bit offset (5) | pointer alignment (2) | |
103 // The address of the rset word containing the bit for this word is computed as: | 103 // The address of the rset word containing the bit for this word is computed as: |
104 // page_address + words * 4 | 104 // page_address + words * 4 |
105 // For a 64-bit address, if it is: | 105 // For a 64-bit address, if it is: |
106 // | page address | quadwords(5) | bit offset(5) | pointer alignment (3) | | 106 // | page address | words(5) | bit offset(5) | pointer alignment (3) | |
107 // The address of the rset word containing the bit for this word is computed as: | 107 // The address of the rset word containing the bit for this word is computed as: |
108 // page_address + quadwords * 4 + kRSetOffset. | 108 // page_address + words * 4 + kRSetOffset. |
109 // The rset is accessed as 32-bit words, and bit offsets in a 32-bit word, | 109 // The rset is accessed as 32-bit words, and bit offsets in a 32-bit word, |
110 // even on the X64 architecture. | 110 // even on the X64 architecture. |
111 | 111 |
112 Address Page::ComputeRSetBitPosition(Address address, int offset, | 112 Address Page::ComputeRSetBitPosition(Address address, int offset, |
113 uint32_t* bitmask) { | 113 uint32_t* bitmask) { |
114 ASSERT(Page::is_rset_in_use()); | 114 ASSERT(Page::is_rset_in_use()); |
115 | 115 |
116 Page* page = Page::FromAddress(address); | 116 Page* page = Page::FromAddress(address); |
117 uint32_t bit_offset = ArithmeticShiftRight(page->Offset(address) + offset, | 117 uint32_t bit_offset = ArithmeticShiftRight(page->Offset(address) + offset, |
118 kObjectAlignmentBits); | 118 kPointerSizeLog2); |
119 *bitmask = 1 << (bit_offset % kBitsPerInt); | 119 *bitmask = 1 << (bit_offset % kBitsPerInt); |
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()) { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 ASSERT(space->low() <= alloc_info->top | 357 ASSERT(space->low() <= alloc_info->top |
358 && alloc_info->top <= space->high() | 358 && alloc_info->top <= space->high() |
359 && alloc_info->limit == space->high()); | 359 && alloc_info->limit == space->high()); |
360 #endif | 360 #endif |
361 return obj; | 361 return obj; |
362 } | 362 } |
363 | 363 |
364 } } // namespace v8::internal | 364 } } // namespace v8::internal |
365 | 365 |
366 #endif // V8_SPACES_INL_H_ | 366 #endif // V8_SPACES_INL_H_ |
OLD | NEW |