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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 intptr_t offset_inside_normal_page = OffsetFrom(addr) & kPageAlignmentMask; | 145 intptr_t offset_inside_normal_page = OffsetFrom(addr) & kPageAlignmentMask; |
146 return static_cast<int>(offset_inside_normal_page >> kRegionSizeLog2); | 146 return static_cast<int>(offset_inside_normal_page >> kRegionSizeLog2); |
147 } | 147 } |
148 | 148 |
149 | 149 |
150 uint32_t Page::GetRegionMaskForAddress(Address addr) { | 150 uint32_t Page::GetRegionMaskForAddress(Address addr) { |
151 return 1 << GetRegionNumberForAddress(addr); | 151 return 1 << GetRegionNumberForAddress(addr); |
152 } | 152 } |
153 | 153 |
154 | 154 |
| 155 uint32_t Page::GetRegionMaskForSpan(Address start, int length_in_bytes) { |
| 156 uint32_t result = 0; |
| 157 if (length_in_bytes >= kPageSize) { |
| 158 result = kAllRegionsDirtyMarks; |
| 159 } else if (length_in_bytes > 0) { |
| 160 int start_region = GetRegionNumberForAddress(start); |
| 161 int end_region = |
| 162 GetRegionNumberForAddress(start + length_in_bytes - kPointerSize); |
| 163 uint32_t start_mask = (~0) << start_region; |
| 164 uint32_t end_mask = ~((~1) << end_region); |
| 165 result = start_mask & end_mask; |
| 166 // if end_region < start_region, the mask is ored. |
| 167 if (result == 0) result = start_mask | end_mask; |
| 168 } |
| 169 #ifdef DEBUG |
| 170 if (FLAG_enable_slow_asserts) { |
| 171 uint32_t expected = 0; |
| 172 for (Address a = start; a < start + length_in_bytes; a += kPointerSize) { |
| 173 expected |= GetRegionMaskForAddress(a); |
| 174 } |
| 175 ASSERT(expected == result); |
| 176 } |
| 177 #endif |
| 178 return result; |
| 179 } |
| 180 |
| 181 |
155 void Page::MarkRegionDirty(Address address) { | 182 void Page::MarkRegionDirty(Address address) { |
156 SetRegionMarks(GetRegionMarks() | GetRegionMaskForAddress(address)); | 183 SetRegionMarks(GetRegionMarks() | GetRegionMaskForAddress(address)); |
157 } | 184 } |
158 | 185 |
159 | 186 |
160 bool Page::IsRegionDirty(Address address) { | 187 bool Page::IsRegionDirty(Address address) { |
161 return GetRegionMarks() & GetRegionMaskForAddress(address); | 188 return GetRegionMarks() & GetRegionMaskForAddress(address); |
162 } | 189 } |
163 | 190 |
164 | 191 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 474 |
448 bool FreeListNode::IsFreeListNode(HeapObject* object) { | 475 bool FreeListNode::IsFreeListNode(HeapObject* object) { |
449 return object->map() == Heap::raw_unchecked_byte_array_map() | 476 return object->map() == Heap::raw_unchecked_byte_array_map() |
450 || object->map() == Heap::raw_unchecked_one_pointer_filler_map() | 477 || object->map() == Heap::raw_unchecked_one_pointer_filler_map() |
451 || object->map() == Heap::raw_unchecked_two_pointer_filler_map(); | 478 || object->map() == Heap::raw_unchecked_two_pointer_filler_map(); |
452 } | 479 } |
453 | 480 |
454 } } // namespace v8::internal | 481 } } // namespace v8::internal |
455 | 482 |
456 #endif // V8_SPACES_INL_H_ | 483 #endif // V8_SPACES_INL_H_ |
OLD | NEW |