| OLD | NEW | 
|    1 // Copyright 2012 the V8 project authors. All rights reserved. |    1 // Copyright 2012 the V8 project authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #ifndef V8_ELEMENTS_H_ |    5 #ifndef V8_ELEMENTS_H_ | 
|    6 #define V8_ELEMENTS_H_ |    6 #define V8_ELEMENTS_H_ | 
|    7  |    7  | 
|    8 #include "src/elements-kind.h" |    8 #include "src/elements-kind.h" | 
|    9 #include "src/heap/heap.h" |    9 #include "src/heap/heap.h" | 
|   10 #include "src/isolate.h" |   10 #include "src/isolate.h" | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   53  |   53  | 
|   54   // If kCopyToEnd is specified as the copy_size to CopyElements, it copies all |   54   // If kCopyToEnd is specified as the copy_size to CopyElements, it copies all | 
|   55   // of elements from source after source_start to the destination array. |   55   // of elements from source after source_start to the destination array. | 
|   56   static const int kCopyToEnd = -1; |   56   static const int kCopyToEnd = -1; | 
|   57   // If kCopyToEndAndInitializeToHole is specified as the copy_size to |   57   // If kCopyToEndAndInitializeToHole is specified as the copy_size to | 
|   58   // CopyElements, it copies all of elements from source after source_start to |   58   // CopyElements, it copies all of elements from source after source_start to | 
|   59   // destination array, padding any remaining uninitialized elements in the |   59   // destination array, padding any remaining uninitialized elements in the | 
|   60   // destination array with the hole. |   60   // destination array with the hole. | 
|   61   static const int kCopyToEndAndInitializeToHole = -2; |   61   static const int kCopyToEndAndInitializeToHole = -2; | 
|   62  |   62  | 
 |   63   static const int kDirectionForward = 1; | 
 |   64   static const int kDirectionReverse = -1; | 
 |   65  | 
|   63   // Copy elements from one backing store to another. Typically, callers specify |   66   // Copy elements from one backing store to another. Typically, callers specify | 
|   64   // the source JSObject or JSArray in source_holder. If the holder's backing |   67   // the source JSObject or JSArray in source_holder. If the holder's backing | 
|   65   // store is available, it can be passed in source and source_holder is |   68   // store is available, it can be passed in source and source_holder is | 
|   66   // ignored. |   69   // ignored. | 
|   67   virtual void CopyElements( |   70   virtual void CopyElements( | 
|   68       Handle<FixedArrayBase> source, |   71       Handle<FixedArrayBase> source, | 
|   69       uint32_t source_start, |   72       uint32_t source_start, | 
|   70       ElementsKind source_kind, |   73       ElementsKind source_kind, | 
|   71       Handle<FixedArrayBase> destination, |   74       Handle<FixedArrayBase> destination, | 
|   72       uint32_t destination_start, |   75       uint32_t destination_start, | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  105     return elements_accessors_[elements_kind]; |  108     return elements_accessors_[elements_kind]; | 
|  106   } |  109   } | 
|  107  |  110  | 
|  108   static ElementsAccessor* ForArray(Handle<FixedArrayBase> array); |  111   static ElementsAccessor* ForArray(Handle<FixedArrayBase> array); | 
|  109  |  112  | 
|  110   static void InitializeOncePerProcess(); |  113   static void InitializeOncePerProcess(); | 
|  111   static void TearDown(); |  114   static void TearDown(); | 
|  112  |  115  | 
|  113   virtual void Set(FixedArrayBase* backing_store, uint32_t entry, |  116   virtual void Set(FixedArrayBase* backing_store, uint32_t entry, | 
|  114                    Object* value) = 0; |  117                    Object* value) = 0; | 
 |  118  | 
|  115   virtual void Reconfigure(Handle<JSObject> object, |  119   virtual void Reconfigure(Handle<JSObject> object, | 
|  116                            Handle<FixedArrayBase> backing_store, uint32_t entry, |  120                            Handle<FixedArrayBase> backing_store, uint32_t entry, | 
|  117                            Handle<Object> value, |  121                            Handle<Object> value, | 
|  118                            PropertyAttributes attributes) = 0; |  122                            PropertyAttributes attributes) = 0; | 
 |  123  | 
|  119   virtual void Add(Handle<JSObject> object, uint32_t index, |  124   virtual void Add(Handle<JSObject> object, uint32_t index, | 
|  120                    Handle<Object> value, PropertyAttributes attributes, |  125                    Handle<Object> value, PropertyAttributes attributes, | 
|  121                    uint32_t new_capacity) = 0; |  126                    uint32_t new_capacity) = 0; | 
|  122  |  127  | 
 |  128   // TODO(cbruni): Consider passing Arguments* instead of Object** depending on | 
 |  129   // the requirements of future callers. | 
 |  130   virtual uint32_t Push(Handle<JSArray> receiver, | 
 |  131                         Handle<FixedArrayBase> backing_store, Object** objects, | 
 |  132                         uint32_t start, int direction) = 0; | 
 |  133  | 
|  123  protected: |  134  protected: | 
|  124   friend class LookupIterator; |  135   friend class LookupIterator; | 
|  125  |  136  | 
|  126   static ElementsAccessor* ForArray(FixedArrayBase* array); |  137   static ElementsAccessor* ForArray(FixedArrayBase* array); | 
|  127  |  138  | 
|  128   virtual uint32_t GetCapacity(JSObject* holder, |  139   virtual uint32_t GetCapacity(JSObject* holder, | 
|  129                                FixedArrayBase* backing_store) = 0; |  140                                FixedArrayBase* backing_store) = 0; | 
|  130  |  141  | 
|  131   // Element handlers distinguish between entries and indices when they |  142   // Element handlers distinguish between entries and indices when they | 
|  132   // manipulate elements. Entries refer to elements in terms of their location |  143   // manipulate elements. Entries refer to elements in terms of their location | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
|  152 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t index, |  163 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t index, | 
|  153                      bool allow_appending = false); |  164                      bool allow_appending = false); | 
|  154  |  165  | 
|  155 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( |  166 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( | 
|  156     Handle<JSArray> array, |  167     Handle<JSArray> array, | 
|  157     Arguments* args); |  168     Arguments* args); | 
|  158  |  169  | 
|  159 } }  // namespace v8::internal |  170 } }  // namespace v8::internal | 
|  160  |  171  | 
|  161 #endif  // V8_ELEMENTS_H_ |  172 #endif  // V8_ELEMENTS_H_ | 
| OLD | NEW |