| 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_KEYS_H_ | 5 #ifndef V8_KEYS_H_ |
| 6 #define V8_KEYS_H_ | 6 #define V8_KEYS_H_ |
| 7 | 7 |
| 8 #include "src/isolate.h" | 8 #include "src/isolate.h" |
| 9 #include "src/objects.h" | 9 #include "src/objects.h" |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 Maybe<bool> CollectKeys(Handle<JSReceiver> receiver, | 46 Maybe<bool> CollectKeys(Handle<JSReceiver> receiver, |
| 47 Handle<JSReceiver> object); | 47 Handle<JSReceiver> object); |
| 48 Maybe<bool> CollectOwnElementIndices(Handle<JSReceiver> receiver, | 48 Maybe<bool> CollectOwnElementIndices(Handle<JSReceiver> receiver, |
| 49 Handle<JSObject> object); | 49 Handle<JSObject> object); |
| 50 Maybe<bool> CollectOwnPropertyNames(Handle<JSReceiver> receiver, | 50 Maybe<bool> CollectOwnPropertyNames(Handle<JSReceiver> receiver, |
| 51 Handle<JSObject> object); | 51 Handle<JSObject> object); |
| 52 Maybe<bool> CollectAccessCheckInterceptorKeys( | 52 Maybe<bool> CollectAccessCheckInterceptorKeys( |
| 53 Handle<AccessCheckInfo> access_check_info, Handle<JSReceiver> receiver, | 53 Handle<AccessCheckInfo> access_check_info, Handle<JSReceiver> receiver, |
| 54 Handle<JSObject> object); | 54 Handle<JSObject> object); |
| 55 | 55 |
| 56 // Might return directly the object's enum_cache, copy the result before using |
| 57 // as an elements backing store for a JSObject. |
| 56 static Handle<FixedArray> GetOwnEnumPropertyKeys(Isolate* isolate, | 58 static Handle<FixedArray> GetOwnEnumPropertyKeys(Isolate* isolate, |
| 57 Handle<JSObject> object); | 59 Handle<JSObject> object); |
| 58 | |
| 59 void AddKey(Object* key, AddKeyConversion convert = DO_NOT_CONVERT); | 60 void AddKey(Object* key, AddKeyConversion convert = DO_NOT_CONVERT); |
| 60 void AddKey(Handle<Object> key, AddKeyConversion convert = DO_NOT_CONVERT); | 61 void AddKey(Handle<Object> key, AddKeyConversion convert = DO_NOT_CONVERT); |
| 61 void AddKeys(Handle<FixedArray> array, AddKeyConversion convert); | 62 void AddKeys(Handle<FixedArray> array, AddKeyConversion convert); |
| 62 void AddKeys(Handle<JSObject> array_like, AddKeyConversion convert); | 63 void AddKeys(Handle<JSObject> array_like, AddKeyConversion convert); |
| 63 | 64 |
| 64 // Jump to the next level, pushing the current |levelLength_| to | 65 // Jump to the next level, pushing the current |levelLength_| to |
| 65 // |levelLengths_| and adding a new list to |elements_|. | 66 // |levelLengths_| and adding a new list to |elements_|. |
| 66 Isolate* isolate() { return isolate_; } | 67 Isolate* isolate() { return isolate_; } |
| 67 // Filter keys based on their property descriptors. | 68 // Filter keys based on their property descriptors. |
| 68 PropertyFilter filter() { return filter_; } | 69 PropertyFilter filter() { return filter_; } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 void set_is_for_in(bool value) { is_for_in_ = value; } | 134 void set_is_for_in(bool value) { is_for_in_ = value; } |
| 134 | 135 |
| 135 MaybeHandle<FixedArray> GetKeys( | 136 MaybeHandle<FixedArray> GetKeys( |
| 136 GetKeysConversion convert = GetKeysConversion::kKeepNumbers); | 137 GetKeysConversion convert = GetKeysConversion::kKeepNumbers); |
| 137 | 138 |
| 138 private: | 139 private: |
| 139 void Prepare(); | 140 void Prepare(); |
| 140 MaybeHandle<FixedArray> GetKeysFast(GetKeysConversion convert); | 141 MaybeHandle<FixedArray> GetKeysFast(GetKeysConversion convert); |
| 141 MaybeHandle<FixedArray> GetKeysSlow(GetKeysConversion convert); | 142 MaybeHandle<FixedArray> GetKeysSlow(GetKeysConversion convert); |
| 142 | 143 |
| 144 MaybeHandle<FixedArray> GetOwnKeysWithUninitializedEnumCache(); |
| 145 |
| 143 Isolate* isolate_; | 146 Isolate* isolate_; |
| 144 Handle<JSReceiver> receiver_; | 147 Handle<JSReceiver> receiver_; |
| 145 Handle<JSReceiver> last_non_empty_prototype_; | 148 Handle<JSReceiver> last_non_empty_prototype_; |
| 146 KeyCollectionMode mode_; | 149 KeyCollectionMode mode_; |
| 147 PropertyFilter filter_; | 150 PropertyFilter filter_; |
| 148 bool is_for_in_ = false; | 151 bool is_for_in_ = false; |
| 149 bool is_receiver_simple_enum_ = false; | 152 bool is_receiver_simple_enum_ = false; |
| 150 bool has_empty_prototype_ = false; | 153 bool has_empty_prototype_ = false; |
| 151 | 154 |
| 152 DISALLOW_COPY_AND_ASSIGN(FastKeyAccumulator); | 155 DISALLOW_COPY_AND_ASSIGN(FastKeyAccumulator); |
| 153 }; | 156 }; |
| 154 | 157 |
| 155 } // namespace internal | 158 } // namespace internal |
| 156 } // namespace v8 | 159 } // namespace v8 |
| 157 | 160 |
| 158 #endif // V8_KEYS_H_ | 161 #endif // V8_KEYS_H_ |
| OLD | NEW |