Precise sweeping makes zapping of garbage memory when trimming arrays obsolete
BUG= R=mstarzinger@chromium.org Review URL: https://codereview.chromium.org/439863006 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22867 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
947899e1e1
commit
c76318bc30
@ -3260,15 +3260,6 @@ void Heap::AdjustLiveBytes(Address address, int by, InvocationMode mode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void ZapFixedArrayForTrimming(Address address, int elements_to_trim) {
|
|
||||||
Object** zap = reinterpret_cast<Object**>(address);
|
|
||||||
zap++; // Header of filler must be at least one word so skip that.
|
|
||||||
for (int i = 1; i < elements_to_trim; i++) {
|
|
||||||
*zap++ = Smi::FromInt(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FixedArrayBase* Heap::LeftTrimFixedArray(FixedArrayBase* object,
|
FixedArrayBase* Heap::LeftTrimFixedArray(FixedArrayBase* object,
|
||||||
int elements_to_trim) {
|
int elements_to_trim) {
|
||||||
const int element_size = object->IsFixedArray() ? kPointerSize : kDoubleSize;
|
const int element_size = object->IsFixedArray() ? kPointerSize : kDoubleSize;
|
||||||
@ -3291,15 +3282,6 @@ FixedArrayBase* Heap::LeftTrimFixedArray(FixedArrayBase* object,
|
|||||||
// Calculate location of new array start.
|
// Calculate location of new array start.
|
||||||
Address new_start = object->address() + bytes_to_trim;
|
Address new_start = object->address() + bytes_to_trim;
|
||||||
|
|
||||||
if (bytes_to_trim > FreeSpace::kHeaderSize &&
|
|
||||||
object->IsFixedArray() &&
|
|
||||||
!new_space()->Contains(object)) {
|
|
||||||
// If we are doing a big trim in old space then we zap the space that was
|
|
||||||
// formerly part of the array so that the GC (aided by the card-based
|
|
||||||
// remembered set) won't find pointers to new-space there.
|
|
||||||
ZapFixedArrayForTrimming(object->address(), elements_to_trim);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Technically in new space this write might be omitted (except for
|
// Technically in new space this write might be omitted (except for
|
||||||
// debug mode which iterates through the heap), but to play safer
|
// debug mode which iterates through the heap), but to play safer
|
||||||
// we still do it.
|
// we still do it.
|
||||||
@ -3348,15 +3330,6 @@ void Heap::RightTrimFixedArray(FixedArrayBase* object, int elements_to_trim) {
|
|||||||
// Calculate location of new array end.
|
// Calculate location of new array end.
|
||||||
Address new_end = object->address() + object->Size() - bytes_to_trim;
|
Address new_end = object->address() + object->Size() - bytes_to_trim;
|
||||||
|
|
||||||
if (bytes_to_trim > FreeSpace::kHeaderSize &&
|
|
||||||
object->IsFixedArray() &&
|
|
||||||
(mode != Heap::FROM_GC || Heap::ShouldZapGarbage())) {
|
|
||||||
// If we are doing a big trim in old space then we zap the space that was
|
|
||||||
// formerly part of the array so that the GC (aided by the card-based
|
|
||||||
// remembered set) won't find pointers to new-space there.
|
|
||||||
ZapFixedArrayForTrimming(new_end, elements_to_trim);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Technically in new space this write might be omitted (except for
|
// Technically in new space this write might be omitted (except for
|
||||||
// debug mode which iterates through the heap), but to play safer
|
// debug mode which iterates through the heap), but to play safer
|
||||||
// we still do it.
|
// we still do it.
|
||||||
|
Loading…
Reference in New Issue
Block a user