| 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_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
| 6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 10166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10177 static bool WouldChangeReadOnlyLength(Handle<JSArray> array, uint32_t index); | 10177 static bool WouldChangeReadOnlyLength(Handle<JSArray> array, uint32_t index); |
| 10178 static MaybeHandle<Object> ReadOnlyLengthError(Handle<JSArray> array); | 10178 static MaybeHandle<Object> ReadOnlyLengthError(Handle<JSArray> array); |
| 10179 | 10179 |
| 10180 // Initialize the array with the given capacity. The function may | 10180 // Initialize the array with the given capacity. The function may |
| 10181 // fail due to out-of-memory situations, but only if the requested | 10181 // fail due to out-of-memory situations, but only if the requested |
| 10182 // capacity is non-zero. | 10182 // capacity is non-zero. |
| 10183 static void Initialize(Handle<JSArray> array, int capacity, int length = 0); | 10183 static void Initialize(Handle<JSArray> array, int capacity, int length = 0); |
| 10184 | 10184 |
| 10185 // If the JSArray has fast elements, and new_length would result in | 10185 // If the JSArray has fast elements, and new_length would result in |
| 10186 // normalization, returns true. | 10186 // normalization, returns true. |
| 10187 static inline bool SetElementsLengthWouldNormalize( | 10187 static inline bool SetLengthWouldNormalize(Heap* heap, uint32_t new_length); |
| 10188 Heap* heap, Handle<Object> new_length_handle); | |
| 10189 | 10188 |
| 10190 // Initializes the array to a certain length. | 10189 // Initializes the array to a certain length. |
| 10191 inline bool AllowsSetElementsLength(); | 10190 inline bool AllowsSetLength(); |
| 10192 // Can cause GC. | 10191 |
| 10193 MUST_USE_RESULT static MaybeHandle<Object> SetElementsLength( | 10192 static void SetLength(Handle<JSArray> array, uint32_t length); |
| 10194 Handle<JSArray> array, | 10193 // Same as above but will also queue splice records if |array| is observed. |
| 10195 Handle<Object> length); | 10194 static MaybeHandle<Object> ObservableSetLength(Handle<JSArray> array, |
| 10195 uint32_t length); |
| 10196 | 10196 |
| 10197 // Set the content of the array to the content of storage. | 10197 // Set the content of the array to the content of storage. |
| 10198 static inline void SetContent(Handle<JSArray> array, | 10198 static inline void SetContent(Handle<JSArray> array, |
| 10199 Handle<FixedArrayBase> storage); | 10199 Handle<FixedArrayBase> storage); |
| 10200 | 10200 |
| 10201 DECLARE_CAST(JSArray) | 10201 DECLARE_CAST(JSArray) |
| 10202 | 10202 |
| 10203 // Ensures that the fixed array backing the JSArray has at | 10203 // Ensures that the fixed array backing the JSArray has at |
| 10204 // least the stated size. | 10204 // least the stated size. |
| 10205 static inline void EnsureSize(Handle<JSArray> array, | 10205 static inline void EnsureSize(Handle<JSArray> array, |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10861 } else { | 10861 } else { |
| 10862 value &= ~(1 << bit_position); | 10862 value &= ~(1 << bit_position); |
| 10863 } | 10863 } |
| 10864 return value; | 10864 return value; |
| 10865 } | 10865 } |
| 10866 }; | 10866 }; |
| 10867 | 10867 |
| 10868 } } // namespace v8::internal | 10868 } } // namespace v8::internal |
| 10869 | 10869 |
| 10870 #endif // V8_OBJECTS_H_ | 10870 #endif // V8_OBJECTS_H_ |
| OLD | NEW |