src/Array.h
changeset 234 26e3035cdffc
parent 209 5cbec15fadfe
child 247 7721042bdb67
     1.1 --- a/src/Array.h	Sat Dec 22 23:18:57 2012 -0800
     1.2 +++ b/src/Array.h	Mon Dec 24 02:49:20 2012 -0800
     1.3 @@ -48,7 +48,7 @@
     1.4  
     1.5    public:
     1.6      static Array *NewFixed(Zone *zone, Handle<ArrayMap> map, Heap::Tenure = Heap::Tenure_Default);
     1.7 -    static Array *NewString(Zone *zone, Handle<ArrayMap> map, Address buffer, size_t length, Heap::Tenure = Heap::Tenure_Default);
     1.8 +    static Array *NewString(Zone *zone, Handle<ArrayMap> map, char *buffer, size_t length, Heap::Tenure = Heap::Tenure_Default);
     1.9      static Array *NewSized(Zone *zone, Handle<ArrayMap> map, int sizes[MAX_ARRAY_DEPTH], Heap::Tenure = Heap::Tenure_Default);
    1.10  
    1.11      static Array *New1D(Zone *zone, Handle<ArrayMap> map, uint32 elements, Heap::Tenure tenure = Heap::Tenure_Default);
    1.12 @@ -61,6 +61,15 @@
    1.13                                unsigned length,
    1.14                                Heap::Tenure tenure = Heap::Tenure_Default);
    1.15  
    1.16 +    // Copies an array from one reference to another, obeying language semantics.
    1.17 +    static bool ShallowCopy(Zone *zone, Handle<Array> dest, Handle<Array> source);
    1.18 +
    1.19 +    // Creates a full duplicate of an array, following all array references as if
    1.20 +    // they were fixed. Array references inside structs or objects use ShallowCopy
    1.21 +    // semantics, as this is only intended for duplicating array literals, which
    1.22 +    // cannot contain structs.
    1.23 +    static Array *DeepCopy(Zone *zone, Handle<Array> source, Heap::Tenure tenure);
    1.24 +
    1.25      uint32 length() {
    1.26          return length_;
    1.27      }
    1.28 @@ -72,6 +81,7 @@
    1.29      inline char *chars();
    1.30      inline void *bytes();
    1.31  
    1.32 +    bool resize(Zone *zone, size_t newLength);
    1.33  
    1.34      static inline size_t SizeForElement(ArrayType *type) {
    1.35          if (type->contained()->isTraceable())