OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3000 | 3000 |
3001 // Store allocation range before flipping semispaces. | 3001 // Store allocation range before flipping semispaces. |
3002 Address from_bottom = new_space->bottom(); | 3002 Address from_bottom = new_space->bottom(); |
3003 Address from_top = new_space->top(); | 3003 Address from_top = new_space->top(); |
3004 | 3004 |
3005 // Flip the semispaces. After flipping, to space is empty, from space has | 3005 // Flip the semispaces. After flipping, to space is empty, from space has |
3006 // live objects. | 3006 // live objects. |
3007 new_space->Flip(); | 3007 new_space->Flip(); |
3008 new_space->ResetAllocationInfo(); | 3008 new_space->ResetAllocationInfo(); |
3009 | 3009 |
| 3010 // UpdateAllocationSiteFeedback expects that only objects at the end of |
| 3011 // newspace are not guaranteed to have the next word clear. It relies on |
| 3012 // FromSpacePageHigh to check whether an object is at the end of newspace. |
| 3013 // However, it is possible that newspace is being evacuated without it being |
| 3014 // full, e.g. to make the heap iterable, hence top will not equal high. In |
| 3015 // that case, fill up newspace with a filler to ensure the next word is |
| 3016 // cleared. |
| 3017 if (FLAG_allocation_site_pretenuring && |
| 3018 from_top < new_space->FromSpacePageHigh()) { |
| 3019 Address limit = NewSpacePage::FromLimit(from_top)->area_end(); |
| 3020 int remaining_in_page = static_cast<int>(limit - from_top); |
| 3021 heap()->CreateFillerObjectAt(from_top, remaining_in_page); |
| 3022 } |
| 3023 |
3010 int survivors_size = 0; | 3024 int survivors_size = 0; |
3011 | 3025 |
3012 // First pass: traverse all objects in inactive semispace, remove marks, | 3026 // First pass: traverse all objects in inactive semispace, remove marks, |
3013 // migrate live objects and write forwarding addresses. This stage puts | 3027 // migrate live objects and write forwarding addresses. This stage puts |
3014 // new entries in the store buffer and may cause some pages to be marked | 3028 // new entries in the store buffer and may cause some pages to be marked |
3015 // scan-on-scavenge. | 3029 // scan-on-scavenge. |
3016 NewSpacePageIterator it(from_bottom, from_top); | 3030 NewSpacePageIterator it(from_bottom, from_top); |
3017 while (it.has_next()) { | 3031 while (it.has_next()) { |
3018 NewSpacePage* p = it.next(); | 3032 NewSpacePage* p = it.next(); |
3019 survivors_size += DiscoverAndPromoteBlackObjectsOnPage(new_space, p); | 3033 survivors_size += DiscoverAndPromoteBlackObjectsOnPage(new_space, p); |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4396 while (buffer != NULL) { | 4410 while (buffer != NULL) { |
4397 SlotsBuffer* next_buffer = buffer->next(); | 4411 SlotsBuffer* next_buffer = buffer->next(); |
4398 DeallocateBuffer(buffer); | 4412 DeallocateBuffer(buffer); |
4399 buffer = next_buffer; | 4413 buffer = next_buffer; |
4400 } | 4414 } |
4401 *buffer_address = NULL; | 4415 *buffer_address = NULL; |
4402 } | 4416 } |
4403 | 4417 |
4404 | 4418 |
4405 } } // namespace v8::internal | 4419 } } // namespace v8::internal |
OLD | NEW |