Remove duplicated heap allocation functions.

R=hpayer@chromium.org

Review URL: https://codereview.chromium.org/24261012

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16897 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d59b8fe5
......@@ -2911,23 +2911,6 @@ MaybeObject* Heap::AllocateHeapNumber(double value, PretenureFlag pretenure) {
}
MaybeObject* Heap::AllocateHeapNumber(double value) {
// Use general version, if we're forced to always allocate.
if (always_allocate()) return AllocateHeapNumber(value, TENURED);
// This version of AllocateHeapNumber is optimized for
// allocation in new space.
STATIC_ASSERT(HeapNumber::kSize <= Page::kMaxNonCodeHeapObjectSize);
Object* result;
{ MaybeObject* maybe_result = new_space_.AllocateRaw(HeapNumber::kSize);
if (!maybe_result->ToObject(&result)) return maybe_result;
}
HeapObject::cast(result)->set_map_no_write_barrier(heap_number_map());
HeapNumber::cast(result)->set_value(value);
return result;
}
MaybeObject* Heap::AllocateCell(Object* value) {
Object* result;
{ MaybeObject* maybe_result = AllocateRawCell();
......@@ -5414,24 +5397,6 @@ MaybeObject* Heap::CopyFixedDoubleArrayWithMap(FixedDoubleArray* src,
}
MaybeObject* Heap::AllocateFixedArray(int length) {
ASSERT(length >= 0);
if (length == 0) return empty_fixed_array();
Object* result;
{ MaybeObject* maybe_result = AllocateRawFixedArray(length);
if (!maybe_result->ToObject(&result)) return maybe_result;
}
// Initialize header.
FixedArray* array = reinterpret_cast<FixedArray*>(result);
array->set_map_no_write_barrier(fixed_array_map());
array->set_length(length);
// Initialize body.
ASSERT(!InNewSpace(undefined_value()));
MemsetPointer(array->data_start(), undefined_value(), length);
return result;
}
MaybeObject* Heap::AllocateRawFixedArray(int length, PretenureFlag pretenure) {
if (length < 0 || length > FixedArray::kMaxLength) {
return Failure::OutOfMemoryException(0xe);
......
......@@ -907,10 +907,9 @@ class Heap {
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
MUST_USE_RESULT MaybeObject* AllocateFixedArray(int length,
PretenureFlag pretenure);
// Allocates a fixed array initialized with undefined values
MUST_USE_RESULT MaybeObject* AllocateFixedArray(int length);
MUST_USE_RESULT MaybeObject* AllocateFixedArray(
int length,
PretenureFlag pretenure = NOT_TENURED);
// Allocates an uninitialized fixed array. It must be filled by the caller.
//
......@@ -1039,10 +1038,7 @@ class Heap {
// Allocated a HeapNumber from value.
MUST_USE_RESULT MaybeObject* AllocateHeapNumber(
double value,
PretenureFlag pretenure);
// pretenure = NOT_TENURED
MUST_USE_RESULT MaybeObject* AllocateHeapNumber(double value);
double value, PretenureFlag pretenure = NOT_TENURED);
// Converts an int into either a Smi or a HeapNumber object.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
......
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