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 DECL_ACCESSORS(length, Object) | 10177 DECL_ACCESSORS(length, Object) |
10178 | 10178 |
10179 // Overload the length setter to skip write barrier when the length | 10179 // Overload the length setter to skip write barrier when the length |
10180 // is set to a smi. This matches the set function on FixedArray. | 10180 // is set to a smi. This matches the set function on FixedArray. |
10181 inline void set_length(Smi* length); | 10181 inline void set_length(Smi* length); |
10182 | 10182 |
10183 static void JSArrayUpdateLengthFromIndex(Handle<JSArray> array, | 10183 static void JSArrayUpdateLengthFromIndex(Handle<JSArray> array, |
10184 uint32_t index, | 10184 uint32_t index, |
10185 Handle<Object> value); | 10185 Handle<Object> value); |
10186 | 10186 |
10187 static bool IsReadOnlyLengthDescriptor(Handle<Map> jsarray_map); | 10187 static bool HasReadOnlyLength(Handle<JSArray> array); |
10188 static bool WouldChangeReadOnlyLength(Handle<JSArray> array, uint32_t index); | 10188 static bool WouldChangeReadOnlyLength(Handle<JSArray> array, uint32_t index); |
10189 static MaybeHandle<Object> ReadOnlyLengthError(Handle<JSArray> array); | 10189 static MaybeHandle<Object> ReadOnlyLengthError(Handle<JSArray> array); |
10190 | 10190 |
| 10191 // TODO(adamk): Remove this method in favor of HasReadOnlyLength(). |
| 10192 static bool IsReadOnlyLengthDescriptor(Handle<Map> jsarray_map); |
| 10193 |
10191 // Initialize the array with the given capacity. The function may | 10194 // Initialize the array with the given capacity. The function may |
10192 // fail due to out-of-memory situations, but only if the requested | 10195 // fail due to out-of-memory situations, but only if the requested |
10193 // capacity is non-zero. | 10196 // capacity is non-zero. |
10194 static void Initialize(Handle<JSArray> array, int capacity, int length = 0); | 10197 static void Initialize(Handle<JSArray> array, int capacity, int length = 0); |
10195 | 10198 |
10196 // Initializes the array to a certain length. | 10199 // Initializes the array to a certain length. |
10197 inline bool AllowsSetElementsLength(); | 10200 inline bool AllowsSetElementsLength(); |
10198 // Can cause GC. | 10201 // Can cause GC. |
10199 MUST_USE_RESULT static MaybeHandle<Object> SetElementsLength( | 10202 MUST_USE_RESULT static MaybeHandle<Object> SetElementsLength( |
10200 Handle<JSArray> array, | 10203 Handle<JSArray> array, |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10961 } else { | 10964 } else { |
10962 value &= ~(1 << bit_position); | 10965 value &= ~(1 << bit_position); |
10963 } | 10966 } |
10964 return value; | 10967 return value; |
10965 } | 10968 } |
10966 }; | 10969 }; |
10967 | 10970 |
10968 } } // namespace v8::internal | 10971 } } // namespace v8::internal |
10969 | 10972 |
10970 #endif // V8_OBJECTS_H_ | 10973 #endif // V8_OBJECTS_H_ |
OLD | NEW |