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 3028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3039 } | 3039 } |
3040 | 3040 |
3041 return false; | 3041 return false; |
3042 } | 3042 } |
3043 | 3043 |
3044 | 3044 |
3045 void MarkCompactCollector::EvacuateNewSpace() { | 3045 void MarkCompactCollector::EvacuateNewSpace() { |
3046 // There are soft limits in the allocation code, designed trigger a mark | 3046 // There are soft limits in the allocation code, designed trigger a mark |
3047 // sweep collection by failing allocations. But since we are already in | 3047 // sweep collection by failing allocations. But since we are already in |
3048 // a mark-sweep allocation, there is no sense in trying to trigger one. | 3048 // a mark-sweep allocation, there is no sense in trying to trigger one. |
3049 AlwaysAllocateScope scope; | 3049 AlwaysAllocateScope scope(isolate()); |
3050 heap()->CheckNewSpaceExpansionCriteria(); | 3050 heap()->CheckNewSpaceExpansionCriteria(); |
3051 | 3051 |
3052 NewSpace* new_space = heap()->new_space(); | 3052 NewSpace* new_space = heap()->new_space(); |
3053 | 3053 |
3054 // Store allocation range before flipping semispaces. | 3054 // Store allocation range before flipping semispaces. |
3055 Address from_bottom = new_space->bottom(); | 3055 Address from_bottom = new_space->bottom(); |
3056 Address from_top = new_space->top(); | 3056 Address from_top = new_space->top(); |
3057 | 3057 |
3058 // Flip the semispaces. After flipping, to space is empty, from space has | 3058 // Flip the semispaces. After flipping, to space is empty, from space has |
3059 // live objects. | 3059 // live objects. |
(...skipping 11 matching lines...) Expand all Loading... |
3071 NewSpacePage* p = it.next(); | 3071 NewSpacePage* p = it.next(); |
3072 survivors_size += DiscoverAndPromoteBlackObjectsOnPage(new_space, p); | 3072 survivors_size += DiscoverAndPromoteBlackObjectsOnPage(new_space, p); |
3073 } | 3073 } |
3074 | 3074 |
3075 heap_->IncrementYoungSurvivorsCounter(survivors_size); | 3075 heap_->IncrementYoungSurvivorsCounter(survivors_size); |
3076 new_space->set_age_mark(new_space->top()); | 3076 new_space->set_age_mark(new_space->top()); |
3077 } | 3077 } |
3078 | 3078 |
3079 | 3079 |
3080 void MarkCompactCollector::EvacuateLiveObjectsFromPage(Page* p) { | 3080 void MarkCompactCollector::EvacuateLiveObjectsFromPage(Page* p) { |
3081 AlwaysAllocateScope always_allocate; | 3081 AlwaysAllocateScope always_allocate(isolate()); |
3082 PagedSpace* space = static_cast<PagedSpace*>(p->owner()); | 3082 PagedSpace* space = static_cast<PagedSpace*>(p->owner()); |
3083 ASSERT(p->IsEvacuationCandidate() && !p->WasSwept()); | 3083 ASSERT(p->IsEvacuationCandidate() && !p->WasSwept()); |
3084 p->MarkSweptPrecisely(); | 3084 p->MarkSweptPrecisely(); |
3085 | 3085 |
3086 int offsets[16]; | 3086 int offsets[16]; |
3087 | 3087 |
3088 for (MarkBitCellIterator it(p); !it.Done(); it.Advance()) { | 3088 for (MarkBitCellIterator it(p); !it.Done(); it.Advance()) { |
3089 Address cell_base = it.CurrentCellBase(); | 3089 Address cell_base = it.CurrentCellBase(); |
3090 MarkBit::CellType* cell = it.CurrentCell(); | 3090 MarkBit::CellType* cell = it.CurrentCell(); |
3091 | 3091 |
(...skipping 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4513 while (buffer != NULL) { | 4513 while (buffer != NULL) { |
4514 SlotsBuffer* next_buffer = buffer->next(); | 4514 SlotsBuffer* next_buffer = buffer->next(); |
4515 DeallocateBuffer(buffer); | 4515 DeallocateBuffer(buffer); |
4516 buffer = next_buffer; | 4516 buffer = next_buffer; |
4517 } | 4517 } |
4518 *buffer_address = NULL; | 4518 *buffer_address = NULL; |
4519 } | 4519 } |
4520 | 4520 |
4521 | 4521 |
4522 } } // namespace v8::internal | 4522 } } // namespace v8::internal |
OLD | NEW |