Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 | 43 |
| 44 Handle<FixedArray> GetKeys( | 44 Handle<FixedArray> GetKeys( |
| 45 GetKeysConversion convert = GetKeysConversion::kKeepNumbers); | 45 GetKeysConversion convert = GetKeysConversion::kKeepNumbers); |
| 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 | 52 |
| 53 static Handle<FixedArray> GetEnumPropertyKeys(Isolate* isolate, | 53 static Handle<FixedArray> GetOwnEnumPropertyKeys(Isolate* isolate, |
| 54 Handle<JSObject> object); | 54 Handle<JSObject> object); |
| 55 | 55 |
| 56 void AddKey(Object* key, AddKeyConversion convert = DO_NOT_CONVERT); | 56 void AddKey(Object* key, AddKeyConversion convert = DO_NOT_CONVERT); |
| 57 void AddKey(Handle<Object> key, AddKeyConversion convert = DO_NOT_CONVERT); | 57 void AddKey(Handle<Object> key, AddKeyConversion convert = DO_NOT_CONVERT); |
| 58 void AddKeys(Handle<FixedArray> array, AddKeyConversion convert); | 58 void AddKeys(Handle<FixedArray> array, AddKeyConversion convert); |
| 59 void AddKeys(Handle<JSObject> array_like, AddKeyConversion convert); | 59 void AddKeys(Handle<JSObject> array_like, AddKeyConversion convert); |
| 60 | 60 |
| 61 // Jump to the next level, pushing the current |levelLength_| to | 61 // Jump to the next level, pushing the current |levelLength_| to |
| 62 // |levelLengths_| and adding a new list to |elements_|. | 62 // |levelLengths_| and adding a new list to |elements_|. |
| 63 Isolate* isolate() { return isolate_; } | 63 Isolate* isolate() { return isolate_; } |
| 64 PropertyFilter filter() { return filter_; } | 64 PropertyFilter filter() { return filter_; } |
| 65 KeyCollectionMode mode() { return mode_; } | |
| 65 void set_filter_proxy_keys(bool filter) { filter_proxy_keys_ = filter; } | 66 void set_filter_proxy_keys(bool filter) { filter_proxy_keys_ = filter; } |
| 66 void set_is_for_in(bool value) { is_for_in_ = value; } | 67 void set_is_for_in(bool value) { is_for_in_ = value; } |
| 67 void set_skip_indices(bool value) { skip_indices_ = value; } | 68 void set_skip_indices(bool value) { skip_indices_ = value; } |
| 68 void set_last_non_empty_prototype(Handle<JSReceiver> object) { | 69 void set_last_non_empty_prototype(Handle<JSReceiver> object) { |
| 69 last_non_empty_prototype_ = object; | 70 last_non_empty_prototype_ = object; |
| 70 } | 71 } |
| 72 void AddShadowKey(Object* key); | |
|
adamk
2016/06/27 19:19:33
Please add comments for these methods, outside of
Camillo Bruni
2016/06/29 17:27:56
added more descriptive comments.
| |
| 73 void AddShadowKey(Handle<Object> key); | |
| 71 | 74 |
| 72 private: | 75 private: |
| 73 Maybe<bool> CollectOwnKeys(Handle<JSReceiver> receiver, | 76 Maybe<bool> CollectOwnKeys(Handle<JSReceiver> receiver, |
| 74 Handle<JSObject> object); | 77 Handle<JSObject> object); |
| 75 Maybe<bool> CollectOwnJSProxyKeys(Handle<JSReceiver> receiver, | 78 Maybe<bool> CollectOwnJSProxyKeys(Handle<JSReceiver> receiver, |
| 76 Handle<JSProxy> proxy); | 79 Handle<JSProxy> proxy); |
| 77 Maybe<bool> CollectOwnJSProxyTargetKeys(Handle<JSProxy> proxy, | 80 Maybe<bool> CollectOwnJSProxyTargetKeys(Handle<JSProxy> proxy, |
| 78 Handle<JSReceiver> target); | 81 Handle<JSReceiver> target); |
| 79 | |
| 80 Maybe<bool> AddKeysFromJSProxy(Handle<JSProxy> proxy, | 82 Maybe<bool> AddKeysFromJSProxy(Handle<JSProxy> proxy, |
| 81 Handle<FixedArray> keys); | 83 Handle<FixedArray> keys); |
| 82 | 84 bool IsShadowed(Handle<Object> key); |
| 83 Handle<OrderedHashSet> keys() { return Handle<OrderedHashSet>::cast(keys_); } | 85 Handle<OrderedHashSet> keys() { return Handle<OrderedHashSet>::cast(keys_); } |
| 84 | 86 |
| 85 Isolate* isolate_; | 87 Isolate* isolate_; |
| 86 // keys_ is either an Handle<OrderedHashSet> or in the case of own JSProxy | 88 // keys_ is either an Handle<OrderedHashSet> or in the case of own JSProxy |
| 87 // keys a Handle<FixedArray>. | 89 // keys a Handle<FixedArray>. |
| 88 Handle<FixedArray> keys_; | 90 Handle<FixedArray> keys_; |
| 89 Handle<JSReceiver> last_non_empty_prototype_; | 91 Handle<JSReceiver> last_non_empty_prototype_; |
| 92 Handle<ObjectHashSet> shadowed_keys_; | |
| 90 KeyCollectionMode mode_; | 93 KeyCollectionMode mode_; |
| 91 PropertyFilter filter_; | 94 PropertyFilter filter_; |
| 92 bool filter_proxy_keys_ = true; | 95 bool filter_proxy_keys_ = true; |
| 93 bool is_for_in_ = false; | 96 bool is_for_in_ = false; |
| 94 bool skip_indices_ = false; | 97 bool skip_indices_ = false; |
| 95 | 98 |
| 96 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); | 99 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); |
| 97 }; | 100 }; |
| 98 | 101 |
| 99 // The FastKeyAccumulator handles the cases where there are no elements on the | 102 // The FastKeyAccumulator handles the cases where there are no elements on the |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 130 bool is_receiver_simple_enum_ = false; | 133 bool is_receiver_simple_enum_ = false; |
| 131 bool has_empty_prototype_ = false; | 134 bool has_empty_prototype_ = false; |
| 132 | 135 |
| 133 DISALLOW_COPY_AND_ASSIGN(FastKeyAccumulator); | 136 DISALLOW_COPY_AND_ASSIGN(FastKeyAccumulator); |
| 134 }; | 137 }; |
| 135 | 138 |
| 136 } // namespace internal | 139 } // namespace internal |
| 137 } // namespace v8 | 140 } // namespace v8 |
| 138 | 141 |
| 139 #endif // V8_KEYS_H_ | 142 #endif // V8_KEYS_H_ |
| OLD | NEW |