Chromium Code Reviews| Index: src/heap.h |
| diff --git a/src/heap.h b/src/heap.h |
| index fec85184670b74a9cf817cf52fdab62dc5fbf4d8..c80f8e45012758bda06bc646e65d05b6d3beaadb 100644 |
| --- a/src/heap.h |
| +++ b/src/heap.h |
| @@ -431,6 +431,11 @@ class ExternalStringTable { |
| }; |
| +enum ArrayStorageAllocationMode { |
| + DONT_INITIALIZE_ARRAY_ELEMENTS, |
| + INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE |
| +}; |
| + |
| class Heap { |
| public: |
| // Configure heap size before setup. Return false if the heap has been |
| @@ -532,6 +537,30 @@ class Heap { |
| MUST_USE_RESULT MaybeObject* AllocateJSObject( |
| JSFunction* constructor, PretenureFlag pretenure = NOT_TENURED); |
| + // Allocate a JSArray with no elements |
| + MUST_USE_RESULT MaybeObject* AllocateEmptyJSArray( |
| + ElementsKind elements_kind, |
| + PretenureFlag pretenure = NOT_TENURED) { |
| + return AllocateJSArrayAndStorage(elements_kind, 0, 0, |
| + DONT_INITIALIZE_ARRAY_ELEMENTS, |
| + pretenure); |
| + } |
| + |
| + // Allocate a JSArray with a specified length but elements that are left |
| + // uninitialized. |
| + MUST_USE_RESULT MaybeObject* AllocateJSArrayAndStorage( |
| + ElementsKind elements_kind, |
| + int length, |
| + int capacity, |
| + ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS, |
| + PretenureFlag pretenure = NOT_TENURED); |
| + |
| + // Allocate a JSArray with no elements |
| + MUST_USE_RESULT MaybeObject* AllocateJSArrayWithElements( |
| + FixedArrayBase* array_base, |
| + ElementsKind elements_kind, |
| + PretenureFlag pretenure = NOT_TENURED); |
| + |
| // Allocates and initializes a new global object based on a constructor. |
| // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| // failed. |
| @@ -778,6 +807,13 @@ class Heap { |
| int length, |
| PretenureFlag pretenure = NOT_TENURED); |
| + // Allocates a fixed double array with hole values. Returns |
|
Jakob Kummerow
2012/01/23 17:16:55
nit: s/ / /
danno
2012/01/26 21:32:34
Done.
|
| + // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. |
| + // Please note this does not perform a garbage collection. |
| + MUST_USE_RESULT MaybeObject* AllocateFixedDoubleArrayWithHoles( |
| + int length, |
| + PretenureFlag pretenure = NOT_TENURED); |
| + |
| // AllocateHashTable is identical to AllocateFixedArray except |
| // that the resulting object has hash_table_map as map. |
| MUST_USE_RESULT MaybeObject* AllocateHashTable( |
| @@ -1743,6 +1779,11 @@ class Heap { |
| Object* to_number, |
| byte kind); |
| + // Allocate a JSArray with no elements |
| + MUST_USE_RESULT MaybeObject* AllocateJSArray( |
| + ElementsKind elements_kind, |
| + PretenureFlag pretenure = NOT_TENURED); |
| + |
| // Allocate empty fixed array. |
| MUST_USE_RESULT MaybeObject* AllocateEmptyFixedArray(); |
| @@ -2615,6 +2656,7 @@ class PathTracer : public ObjectVisitor { |
| AssertNoAllocation no_alloc; // i.e. no gc allowed. |
|
Jakob Kummerow
2012/01/23 17:16:55
nit: No reason for an empty line here.
danno
2012/01/26 21:32:34
Done.
|
| + |
| DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| }; |
| #endif // DEBUG || LIVE_OBJECT_LIST |