Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index fbe04640db0e7eed77b09d347469d14bdb3a4125..505429a466e0b19e708650c591d31dc050822d2b 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -2571,11 +2571,9 @@ Object* Heap::CopyJSObject(JSObject* source) { |
reinterpret_cast<Object**>(source->address()), |
object_size); |
// Update write barrier for all fields that lie beyond the header. |
- for (int offset = JSObject::kHeaderSize; |
- offset < object_size; |
- offset += kPointerSize) { |
- RecordWrite(clone_address, offset); |
- } |
+ RecordWrites(clone_address, |
+ JSObject::kHeaderSize, |
+ object_size - JSObject::kHeaderSize); |
} else { |
clone = new_space_.AllocateRaw(object_size); |
if (clone->IsFailure()) return clone; |
@@ -2906,12 +2904,9 @@ Object* Heap::AllocateFixedArray(int length) { |
reinterpret_cast<Array*>(result)->set_map(fixed_array_map()); |
FixedArray* array = FixedArray::cast(result); |
array->set_length(length); |
- Object* value = undefined_value(); |
// Initialize body. |
- for (int index = 0; index < length; index++) { |
- ASSERT(!Heap::InNewSpace(value)); // value = undefined |
- array->set(index, value, SKIP_WRITE_BARRIER); |
- } |
+ ASSERT(!Heap::InNewSpace(undefined_value())); |
+ MemsetPointer(array->data_start(), undefined_value(), length); |
} |
return result; |
} |
@@ -2963,11 +2958,8 @@ Object* Heap::AllocateFixedArray(int length, PretenureFlag pretenure) { |
reinterpret_cast<Array*>(result)->set_map(fixed_array_map()); |
FixedArray* array = FixedArray::cast(result); |
array->set_length(length); |
- Object* value = undefined_value(); |
- for (int index = 0; index < length; index++) { |
- ASSERT(!Heap::InNewSpace(value)); // value = undefined |
- array->set(index, value, SKIP_WRITE_BARRIER); |
- } |
+ ASSERT(!Heap::InNewSpace(undefined_value())); |
+ MemsetPointer(array->data_start(), undefined_value(), length); |
return array; |
} |
@@ -2994,9 +2986,7 @@ Object* Heap::AllocateFixedArrayWithHoles(int length) { |
array->set_length(length); |
// Initialize body. |
ASSERT(!Heap::InNewSpace(the_hole_value())); |
- MemsetPointer(HeapObject::RawField(array, FixedArray::kHeaderSize), |
- the_hole_value(), |
- length); |
+ MemsetPointer(array->data_start(), the_hole_value(), length); |
} |
return result; |
} |