| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 return GetAccessorPair(holder, key, handle(holder->elements())); | 69 return GetAccessorPair(holder, key, handle(holder->elements())); |
| 70 } | 70 } |
| 71 | 71 |
| 72 // Modifies the length data property as specified for JSArrays and resizes the | 72 // Modifies the length data property as specified for JSArrays and resizes the |
| 73 // underlying backing store accordingly. The method honors the semantics of | 73 // underlying backing store accordingly. The method honors the semantics of |
| 74 // changing array sizes as defined in EcmaScript 5.1 15.4.5.2, i.e. array that | 74 // changing array sizes as defined in EcmaScript 5.1 15.4.5.2, i.e. array that |
| 75 // have non-deletable elements can only be shrunk to the size of highest | 75 // have non-deletable elements can only be shrunk to the size of highest |
| 76 // element that is non-deletable. | 76 // element that is non-deletable. |
| 77 virtual void SetLength(Handle<JSArray> holder, uint32_t new_length) = 0; | 77 virtual void SetLength(Handle<JSArray> holder, uint32_t new_length) = 0; |
| 78 | 78 |
| 79 // Modifies both the length and capacity of a JSArray, resizing the underlying | |
| 80 // backing store as necessary. This method does NOT honor the semantics of | |
| 81 // EcmaScript 5.1 15.4.5.2, arrays can be shrunk beyond non-deletable | |
| 82 // elements. This method should only be called for array expansion OR by | |
| 83 // runtime JavaScript code that use InternalArrays and don't care about | |
| 84 // EcmaScript 5.1 semantics. | |
| 85 virtual void SetCapacityAndLength( | |
| 86 Handle<JSArray> array, | |
| 87 int capacity, | |
| 88 int length) = 0; | |
| 89 | |
| 90 // Deletes an element in an object. | 79 // Deletes an element in an object. |
| 91 virtual void Delete(Handle<JSObject> holder, uint32_t key, | 80 virtual void Delete(Handle<JSObject> holder, uint32_t key, |
| 92 LanguageMode language_mode) = 0; | 81 LanguageMode language_mode) = 0; |
| 93 | 82 |
| 94 // If kCopyToEnd is specified as the copy_size to CopyElements, it copies all | 83 // If kCopyToEnd is specified as the copy_size to CopyElements, it copies all |
| 95 // of elements from source after source_start to the destination array. | 84 // of elements from source after source_start to the destination array. |
| 96 static const int kCopyToEnd = -1; | 85 static const int kCopyToEnd = -1; |
| 97 // If kCopyToEndAndInitializeToHole is specified as the copy_size to | 86 // If kCopyToEndAndInitializeToHole is specified as the copy_size to |
| 98 // CopyElements, it copies all of elements from source after source_start to | 87 // CopyElements, it copies all of elements from source after source_start to |
| 99 // destination array, padding any remaining uninitialized elements in the | 88 // destination array, padding any remaining uninitialized elements in the |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key, | 175 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key, |
| 187 bool allow_appending = false); | 176 bool allow_appending = false); |
| 188 | 177 |
| 189 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( | 178 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( |
| 190 Handle<JSArray> array, | 179 Handle<JSArray> array, |
| 191 Arguments* args); | 180 Arguments* args); |
| 192 | 181 |
| 193 } } // namespace v8::internal | 182 } } // namespace v8::internal |
| 194 | 183 |
| 195 #endif // V8_ELEMENTS_H_ | 184 #endif // V8_ELEMENTS_H_ |
| OLD | NEW |