diff -r bbb498ccb4ac -r 26e3035cdffc src/Array.h --- a/src/Array.h Sat Dec 22 23:18:57 2012 -0800 +++ b/src/Array.h Mon Dec 24 02:49:20 2012 -0800 @@ -48,7 +48,7 @@ public: static Array *NewFixed(Zone *zone, Handle map, Heap::Tenure = Heap::Tenure_Default); - static Array *NewString(Zone *zone, Handle map, Address buffer, size_t length, Heap::Tenure = Heap::Tenure_Default); + static Array *NewString(Zone *zone, Handle map, char *buffer, size_t length, Heap::Tenure = Heap::Tenure_Default); static Array *NewSized(Zone *zone, Handle map, int sizes[MAX_ARRAY_DEPTH], Heap::Tenure = Heap::Tenure_Default); static Array *New1D(Zone *zone, Handle map, uint32 elements, Heap::Tenure tenure = Heap::Tenure_Default); @@ -61,6 +61,15 @@ unsigned length, Heap::Tenure tenure = Heap::Tenure_Default); + // Copies an array from one reference to another, obeying language semantics. + static bool ShallowCopy(Zone *zone, Handle dest, Handle source); + + // Creates a full duplicate of an array, following all array references as if + // they were fixed. Array references inside structs or objects use ShallowCopy + // semantics, as this is only intended for duplicating array literals, which + // cannot contain structs. + static Array *DeepCopy(Zone *zone, Handle source, Heap::Tenure tenure); + uint32 length() { return length_; } @@ -72,6 +81,7 @@ inline char *chars(); inline void *bytes(); + bool resize(Zone *zone, size_t newLength); static inline size_t SizeForElement(ArrayType *type) { if (type->contained()->isTraceable())