Chromium Code Reviews| Index: src/heap.cc |
| diff --git a/src/heap.cc b/src/heap.cc |
| index aa728fd051acef5e96d6ddb4ec45a99f6af57e6b..046f136088202797cd47f5e1f1a7f8d259cf7202 100644 |
| --- a/src/heap.cc |
| +++ b/src/heap.cc |
| @@ -1786,6 +1786,12 @@ bool Heap::CreateInitialMaps() { |
| Map::cast(obj)->set_is_undetectable(); |
| { MaybeObject* maybe_obj = |
| + AllocateMap(FIXED_DOUBLE_ARRAY_TYPE, kVariableSizeSentinel); |
| + if (!maybe_obj->ToObject(&obj)) return false; |
| + } |
| + set_fixed_double_array_map(Map::cast(obj)); |
| + |
| + { MaybeObject* maybe_obj = |
| AllocateMap(BYTE_ARRAY_TYPE, kVariableSizeSentinel); |
| if (!maybe_obj->ToObject(&obj)) return false; |
| } |
| @@ -3821,6 +3827,61 @@ MaybeObject* Heap::AllocateUninitializedFixedArray(int length) { |
| } |
| +MaybeObject* Heap::AllocateEmptyFixedDoubleArray() { |
| + int size = FixedDoubleArray::SizeFor(0); |
| + Object* result; |
| + { MaybeObject* maybe_result = |
| + AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE); |
| + if (!maybe_result->ToObject(&result)) return maybe_result; |
| + } |
| + // Initialize the object. |
| + reinterpret_cast<FixedDoubleArray*>(result)->set_map( |
| + fixed_double_array_map()); |
| + reinterpret_cast<FixedDoubleArray*>(result)->set_length(0); |
| + return result; |
| +} |
| + |
| + |
| +MaybeObject* Heap::AllocateFixedDoubleArray(int length, |
| + PretenureFlag pretenure) { |
| + if (length == 0) return empty_fixed_double_array(); |
| + |
| + Object* obj; |
| + { MaybeObject* maybe_obj = AllocateRawFixedDoubleArray(length, pretenure); |
| + if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| + } |
| + |
| + reinterpret_cast<FixedDoubleArray*>(obj)->set_map(fixed_double_array_map()); |
|
Mads Ager (chromium)
2011/06/06 07:58:23
No initialization of the body at all? Could you ca
danno
2011/06/08 12:09:43
Done.
|
| + FixedDoubleArray::cast(obj)->set_length(length); |
| + return obj; |
| +} |
| + |
| + |
| +MaybeObject* Heap::AllocateRawFixedDoubleArray(int length, |
| + PretenureFlag pretenure) { |
| + if (length < 0 || length > FixedDoubleArray::kMaxLength) { |
| + return Failure::OutOfMemoryException(); |
| + } |
| + |
| + AllocationSpace space = |
| + (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; |
| + int size = FixedDoubleArray::SizeFor(length); |
| + if (space == NEW_SPACE && size > kMaxObjectSizeInNewSpace) { |
| + // Too big for new space. |
| + space = LO_SPACE; |
| + } else if (space == OLD_DATA_SPACE && |
| + size > MaxObjectSizeInPagedSpace()) { |
| + // Too big for old data space. |
| + space = LO_SPACE; |
| + } |
| + |
| + AllocationSpace retry_space = |
| + (size <= MaxObjectSizeInPagedSpace()) ? OLD_DATA_SPACE : LO_SPACE; |
| + |
| + return AllocateRaw(size, space, retry_space); |
| +} |
| + |
| + |
| MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) { |
| Object* result; |
| { MaybeObject* maybe_result = AllocateFixedArray(length, pretenure); |