Commit 347f099c authored by antonm@chromium.org's avatar antonm@chromium.org

Minor refactorings to use some recently added methods.

Review URL: http://codereview.chromium.org/760002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4105 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 21af2c36
......@@ -218,9 +218,7 @@ void CompilationSubCache::Iterate(ObjectVisitor* v) {
void CompilationSubCache::Clear() {
for (int i = 0; i < generations_; i++) {
tables_[i] = Heap::undefined_value();
}
MemsetPointer(tables_, Heap::undefined_value(), generations_);
}
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment