| 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 5977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5988 return | 5988 return |
| 5989 Smi::cast(cache->get(kProtoTransitionNumberOfEntriesOffset))->value(); | 5989 Smi::cast(cache->get(kProtoTransitionNumberOfEntriesOffset))->value(); |
| 5990 } | 5990 } |
| 5991 | 5991 |
| 5992 inline void SetNumberOfProtoTransitions(int value) { | 5992 inline void SetNumberOfProtoTransitions(int value) { |
| 5993 FixedArray* cache = GetPrototypeTransitions(); | 5993 FixedArray* cache = GetPrototypeTransitions(); |
| 5994 DCHECK(cache->length() != 0); | 5994 DCHECK(cache->length() != 0); |
| 5995 cache->set(kProtoTransitionNumberOfEntriesOffset, Smi::FromInt(value)); | 5995 cache->set(kProtoTransitionNumberOfEntriesOffset, Smi::FromInt(value)); |
| 5996 } | 5996 } |
| 5997 | 5997 |
| 5998 // Lookup in the map's instance descriptors and fill out the result if the | |
| 5999 // name is found. | |
| 6000 inline void LookupDescriptor(Name* name, LookupResult* result); | |
| 6001 | |
| 6002 inline void LookupTransition(Name* name, PropertyAttributes attributes, | |
| 6003 LookupResult* result); | |
| 6004 | |
| 6005 inline PropertyDetails GetLastDescriptorDetails(); | 5998 inline PropertyDetails GetLastDescriptorDetails(); |
| 6006 | 5999 |
| 6007 // The size of transition arrays are limited so they do not end up in large | 6000 // The size of transition arrays are limited so they do not end up in large |
| 6008 // object space. Otherwise ClearNonLiveTransitions would leak memory while | 6001 // object space. Otherwise ClearNonLiveTransitions would leak memory while |
| 6009 // applying in-place right trimming. | 6002 // applying in-place right trimming. |
| 6010 inline bool CanHaveMoreTransitions(); | 6003 inline bool CanHaveMoreTransitions(); |
| 6011 | 6004 |
| 6012 int LastAdded() { | 6005 int LastAdded() { |
| 6013 int number_of_own_descriptors = NumberOfOwnDescriptors(); | 6006 int number_of_own_descriptors = NumberOfOwnDescriptors(); |
| 6014 DCHECK(number_of_own_descriptors > 0); | 6007 DCHECK(number_of_own_descriptors > 0); |
| (...skipping 4289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10304 inline void set_length(Smi* length); | 10297 inline void set_length(Smi* length); |
| 10305 | 10298 |
| 10306 static void JSArrayUpdateLengthFromIndex(Handle<JSArray> array, | 10299 static void JSArrayUpdateLengthFromIndex(Handle<JSArray> array, |
| 10307 uint32_t index, | 10300 uint32_t index, |
| 10308 Handle<Object> value); | 10301 Handle<Object> value); |
| 10309 | 10302 |
| 10310 static bool HasReadOnlyLength(Handle<JSArray> array); | 10303 static bool HasReadOnlyLength(Handle<JSArray> array); |
| 10311 static bool WouldChangeReadOnlyLength(Handle<JSArray> array, uint32_t index); | 10304 static bool WouldChangeReadOnlyLength(Handle<JSArray> array, uint32_t index); |
| 10312 static MaybeHandle<Object> ReadOnlyLengthError(Handle<JSArray> array); | 10305 static MaybeHandle<Object> ReadOnlyLengthError(Handle<JSArray> array); |
| 10313 | 10306 |
| 10314 // TODO(adamk): Remove this method in favor of HasReadOnlyLength(). | |
| 10315 static bool IsReadOnlyLengthDescriptor(Handle<Map> jsarray_map); | |
| 10316 | |
| 10317 // Initialize the array with the given capacity. The function may | 10307 // Initialize the array with the given capacity. The function may |
| 10318 // fail due to out-of-memory situations, but only if the requested | 10308 // fail due to out-of-memory situations, but only if the requested |
| 10319 // capacity is non-zero. | 10309 // capacity is non-zero. |
| 10320 static void Initialize(Handle<JSArray> array, int capacity, int length = 0); | 10310 static void Initialize(Handle<JSArray> array, int capacity, int length = 0); |
| 10321 | 10311 |
| 10322 // Initializes the array to a certain length. | 10312 // Initializes the array to a certain length. |
| 10323 inline bool AllowsSetElementsLength(); | 10313 inline bool AllowsSetElementsLength(); |
| 10324 // Can cause GC. | 10314 // Can cause GC. |
| 10325 MUST_USE_RESULT static MaybeHandle<Object> SetElementsLength( | 10315 MUST_USE_RESULT static MaybeHandle<Object> SetElementsLength( |
| 10326 Handle<JSArray> array, | 10316 Handle<JSArray> array, |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10981 } else { | 10971 } else { |
| 10982 value &= ~(1 << bit_position); | 10972 value &= ~(1 << bit_position); |
| 10983 } | 10973 } |
| 10984 return value; | 10974 return value; |
| 10985 } | 10975 } |
| 10986 }; | 10976 }; |
| 10987 | 10977 |
| 10988 } } // namespace v8::internal | 10978 } } // namespace v8::internal |
| 10989 | 10979 |
| 10990 #endif // V8_OBJECTS_H_ | 10980 #endif // V8_OBJECTS_H_ |
| OLD | NEW |