OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2558 heap()->mark_compact_collector()->tracer()-> | 2558 heap()->mark_compact_collector()->tracer()-> |
2559 increment_promoted_objects_size(object_size); | 2559 increment_promoted_objects_size(object_size); |
2560 return true; | 2560 return true; |
2561 } | 2561 } |
2562 } else { | 2562 } else { |
2563 OldSpace* target_space = heap()->TargetSpace(object); | 2563 OldSpace* target_space = heap()->TargetSpace(object); |
2564 | 2564 |
2565 ASSERT(target_space == heap()->old_pointer_space() || | 2565 ASSERT(target_space == heap()->old_pointer_space() || |
2566 target_space == heap()->old_data_space()); | 2566 target_space == heap()->old_data_space()); |
2567 MaybeObject* maybe_result = target_space->AllocateRaw(object_size); | 2567 MaybeObject* maybe_result = target_space->AllocateRaw(object_size); |
2568 if (maybe_result->IsFailure()) { | |
Vyacheslav Egorov (Chromium)
2011/11/30 10:34:43
I don't think you need this. (also you can move Ex
| |
2569 target_space->Expand(); | |
2570 maybe_result = target_space->AllocateRaw(object_size); | |
2571 } | |
2568 if (maybe_result->ToObject(&result)) { | 2572 if (maybe_result->ToObject(&result)) { |
2569 HeapObject* target = HeapObject::cast(result); | 2573 HeapObject* target = HeapObject::cast(result); |
2570 MigrateObject(target->address(), | 2574 MigrateObject(target->address(), |
2571 object->address(), | 2575 object->address(), |
2572 object_size, | 2576 object_size, |
2573 target_space->identity()); | 2577 target_space->identity()); |
2574 heap()->mark_compact_collector()->tracer()-> | 2578 heap()->mark_compact_collector()->tracer()-> |
2575 increment_promoted_objects_size(object_size); | 2579 increment_promoted_objects_size(object_size); |
2576 return true; | 2580 return true; |
2577 } | 2581 } |
2578 } | 2582 } |
2579 | 2583 |
2580 return false; | 2584 return false; |
2581 } | 2585 } |
2582 | 2586 |
2583 | 2587 |
2584 void MarkCompactCollector::EvacuateNewSpace() { | 2588 void MarkCompactCollector::EvacuateNewSpace() { |
2589 // There are soft limits in the allocation code, designed trigger a mark | |
2590 // sweep collection by failing allocations. But since we are already in | |
2591 // a mark-sweep allocation, there is no sense in trying to trigger one. | |
2592 AlwaysAllocateScope scope; | |
2585 heap()->CheckNewSpaceExpansionCriteria(); | 2593 heap()->CheckNewSpaceExpansionCriteria(); |
2586 | 2594 |
2587 NewSpace* new_space = heap()->new_space(); | 2595 NewSpace* new_space = heap()->new_space(); |
2588 | 2596 |
2589 // Store allocation range before flipping semispaces. | 2597 // Store allocation range before flipping semispaces. |
2590 Address from_bottom = new_space->bottom(); | 2598 Address from_bottom = new_space->bottom(); |
2591 Address from_top = new_space->top(); | 2599 Address from_top = new_space->top(); |
2592 | 2600 |
2593 // Flip the semispaces. After flipping, to space is empty, from space has | 2601 // Flip the semispaces. After flipping, to space is empty, from space has |
2594 // live objects. | 2602 // live objects. |
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3862 while (buffer != NULL) { | 3870 while (buffer != NULL) { |
3863 SlotsBuffer* next_buffer = buffer->next(); | 3871 SlotsBuffer* next_buffer = buffer->next(); |
3864 DeallocateBuffer(buffer); | 3872 DeallocateBuffer(buffer); |
3865 buffer = next_buffer; | 3873 buffer = next_buffer; |
3866 } | 3874 } |
3867 *buffer_address = NULL; | 3875 *buffer_address = NULL; |
3868 } | 3876 } |
3869 | 3877 |
3870 | 3878 |
3871 } } // namespace v8::internal | 3879 } } // namespace v8::internal |
OLD | NEW |