| 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 15 matching lines...) Expand all  Loading... | 
|   26   // Checks the elements of an object for consistency, asserting when a problem |   26   // Checks the elements of an object for consistency, asserting when a problem | 
|   27   // is found. |   27   // is found. | 
|   28   virtual void Validate(Handle<JSObject> obj) = 0; |   28   virtual void Validate(Handle<JSObject> obj) = 0; | 
|   29  |   29  | 
|   30   // Returns true if a holder contains an element with the specified key |   30   // Returns true if a holder contains an element with the specified key | 
|   31   // without iterating up the prototype chain.  The caller can optionally pass |   31   // without iterating up the prototype chain.  The caller can optionally pass | 
|   32   // in the backing store to use for the check, which must be compatible with |   32   // in the backing store to use for the check, which must be compatible with | 
|   33   // the ElementsKind of the ElementsAccessor. If backing_store is NULL, the |   33   // the ElementsKind of the ElementsAccessor. If backing_store is NULL, the | 
|   34   // holder->elements() is used as the backing store. |   34   // holder->elements() is used as the backing store. | 
|   35   virtual bool HasElement( |   35   virtual bool HasElement( | 
|   36       Handle<Object> receiver, |  | 
|   37       Handle<JSObject> holder, |   36       Handle<JSObject> holder, | 
|   38       uint32_t key, |   37       uint32_t key, | 
|   39       Handle<FixedArrayBase> backing_store) = 0; |   38       Handle<FixedArrayBase> backing_store) = 0; | 
|   40  |   39  | 
|   41   inline bool HasElement( |   40   inline bool HasElement( | 
|   42       Handle<Object> receiver, |  | 
|   43       Handle<JSObject> holder, |   41       Handle<JSObject> holder, | 
|   44       uint32_t key) { |   42       uint32_t key) { | 
|   45     return HasElement(receiver, holder, key, handle(holder->elements())); |   43     return HasElement(holder, key, handle(holder->elements())); | 
|   46   } |   44   } | 
|   47  |   45  | 
|   48   // Returns the element with the specified key or undefined if there is no such |   46   // Returns the element with the specified key or undefined if there is no such | 
|   49   // element. This method doesn't iterate up the prototype chain.  The caller |   47   // element. This method doesn't iterate up the prototype chain.  The caller | 
|   50   // can optionally pass in the backing store to use for the check, which must |   48   // can optionally pass in the backing store to use for the check, which must | 
|   51   // be compatible with the ElementsKind of the ElementsAccessor. If |   49   // be compatible with the ElementsKind of the ElementsAccessor. If | 
|   52   // backing_store is NULL, the holder->elements() is used as the backing store. |   50   // backing_store is NULL, the holder->elements() is used as the backing store. | 
|   53   MUST_USE_RESULT virtual MaybeHandle<Object> Get( |   51   MUST_USE_RESULT virtual MaybeHandle<Object> Get( | 
|   54       Handle<Object> receiver, |   52       Handle<Object> receiver, | 
|   55       Handle<JSObject> holder, |   53       Handle<JSObject> holder, | 
|   56       uint32_t key, |   54       uint32_t key, | 
|   57       Handle<FixedArrayBase> backing_store) = 0; |   55       Handle<FixedArrayBase> backing_store) = 0; | 
|   58  |   56  | 
|   59   MUST_USE_RESULT inline MaybeHandle<Object> Get( |   57   MUST_USE_RESULT inline MaybeHandle<Object> Get( | 
|   60       Handle<Object> receiver, |   58       Handle<Object> receiver, | 
|   61       Handle<JSObject> holder, |   59       Handle<JSObject> holder, | 
|   62       uint32_t key) { |   60       uint32_t key) { | 
|   63     return Get(receiver, holder, key, handle(holder->elements())); |   61     return Get(receiver, holder, key, handle(holder->elements())); | 
|   64   } |   62   } | 
|   65  |   63  | 
|   66   // Returns an element's attributes, or ABSENT if there is no such |   64   // Returns an element's attributes, or ABSENT if there is no such | 
|   67   // element. This method doesn't iterate up the prototype chain.  The caller |   65   // element. This method doesn't iterate up the prototype chain.  The caller | 
|   68   // can optionally pass in the backing store to use for the check, which must |   66   // can optionally pass in the backing store to use for the check, which must | 
|   69   // be compatible with the ElementsKind of the ElementsAccessor. If |   67   // be compatible with the ElementsKind of the ElementsAccessor. If | 
|   70   // backing_store is NULL, the holder->elements() is used as the backing store. |   68   // backing_store is NULL, the holder->elements() is used as the backing store. | 
|   71   MUST_USE_RESULT virtual PropertyAttributes GetAttributes( |   69   MUST_USE_RESULT virtual PropertyAttributes GetAttributes( | 
|   72       Handle<Object> receiver, |  | 
|   73       Handle<JSObject> holder, |   70       Handle<JSObject> holder, | 
|   74       uint32_t key, |   71       uint32_t key, | 
|   75       Handle<FixedArrayBase> backing_store) = 0; |   72       Handle<FixedArrayBase> backing_store) = 0; | 
|   76  |   73  | 
|   77   MUST_USE_RESULT inline PropertyAttributes GetAttributes( |   74   MUST_USE_RESULT inline PropertyAttributes GetAttributes( | 
|   78       Handle<Object> receiver, |  | 
|   79       Handle<JSObject> holder, |   75       Handle<JSObject> holder, | 
|   80       uint32_t key) { |   76       uint32_t key) { | 
|   81     return GetAttributes(receiver, holder, key, handle(holder->elements())); |   77     return GetAttributes(holder, key, handle(holder->elements())); | 
|   82   } |   78   } | 
|   83  |   79  | 
|   84   // Returns an element's accessors, or NULL if the element does not exist or |   80   // Returns an element's accessors, or NULL if the element does not exist or | 
|   85   // is plain. This method doesn't iterate up the prototype chain.  The caller |   81   // is plain. This method doesn't iterate up the prototype chain.  The caller | 
|   86   // can optionally pass in the backing store to use for the check, which must |   82   // can optionally pass in the backing store to use for the check, which must | 
|   87   // be compatible with the ElementsKind of the ElementsAccessor. If |   83   // be compatible with the ElementsKind of the ElementsAccessor. If | 
|   88   // backing_store is NULL, the holder->elements() is used as the backing store. |   84   // backing_store is NULL, the holder->elements() is used as the backing store. | 
|   89   MUST_USE_RESULT virtual MaybeHandle<AccessorPair> GetAccessorPair( |   85   MUST_USE_RESULT virtual MaybeHandle<AccessorPair> GetAccessorPair( | 
|   90       Handle<Object> receiver, |  | 
|   91       Handle<JSObject> holder, |   86       Handle<JSObject> holder, | 
|   92       uint32_t key, |   87       uint32_t key, | 
|   93       Handle<FixedArrayBase> backing_store) = 0; |   88       Handle<FixedArrayBase> backing_store) = 0; | 
|   94  |   89  | 
|   95   MUST_USE_RESULT inline MaybeHandle<AccessorPair> GetAccessorPair( |   90   MUST_USE_RESULT inline MaybeHandle<AccessorPair> GetAccessorPair( | 
|   96       Handle<Object> receiver, |  | 
|   97       Handle<JSObject> holder, |   91       Handle<JSObject> holder, | 
|   98       uint32_t key) { |   92       uint32_t key) { | 
|   99     return GetAccessorPair(receiver, holder, key, handle(holder->elements())); |   93     return GetAccessorPair(holder, key, handle(holder->elements())); | 
|  100   } |   94   } | 
|  101  |   95  | 
|  102   // Modifies the length data property as specified for JSArrays and resizes the |   96   // Modifies the length data property as specified for JSArrays and resizes the | 
|  103   // underlying backing store accordingly. The method honors the semantics of |   97   // underlying backing store accordingly. The method honors the semantics of | 
|  104   // changing array sizes as defined in EcmaScript 5.1 15.4.5.2, i.e. array that |   98   // changing array sizes as defined in EcmaScript 5.1 15.4.5.2, i.e. array that | 
|  105   // have non-deletable elements can only be shrunk to the size of highest |   99   // have non-deletable elements can only be shrunk to the size of highest | 
|  106   // element that is non-deletable. |  100   // element that is non-deletable. | 
|  107   MUST_USE_RESULT virtual MaybeHandle<Object> SetLength( |  101   MUST_USE_RESULT virtual MaybeHandle<Object> SetLength( | 
|  108       Handle<JSArray> holder, |  102       Handle<JSArray> holder, | 
|  109       Handle<Object> new_length) = 0; |  103       Handle<Object> new_length) = 0; | 
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  212 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key, |  206 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key, | 
|  213                      bool allow_appending = false); |  207                      bool allow_appending = false); | 
|  214  |  208  | 
|  215 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( |  209 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( | 
|  216     Handle<JSArray> array, |  210     Handle<JSArray> array, | 
|  217     Arguments* args); |  211     Arguments* args); | 
|  218  |  212  | 
|  219 } }  // namespace v8::internal |  213 } }  // namespace v8::internal | 
|  220  |  214  | 
|  221 #endif  // V8_ELEMENTS_H_ |  215 #endif  // V8_ELEMENTS_H_ | 
| OLD | NEW |