| 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_KEY_ACCUMULATOR_H_ | 5 #ifndef V8_KEYS_H_ | 
| 6 #define V8_KEY_ACCUMULATOR_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 | 
| 11 namespace v8 { | 11 namespace v8 { | 
| 12 namespace internal { | 12 namespace internal { | 
| 13 | 13 | 
| 14 enum AddKeyConversion { DO_NOT_CONVERT, CONVERT_TO_ARRAY_INDEX, PROXY_MAGIC }; | 14 enum AddKeyConversion { DO_NOT_CONVERT, CONVERT_TO_ARRAY_INDEX, PROXY_MAGIC }; | 
| 15 | 15 | 
| 16 // This is a helper class for JSReceiver::GetKeys which collects and sorts keys. | 16 // This is a helper class for JSReceiver::GetKeys which collects and sorts keys. | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
| 46   void AddElementKeysFromInterceptor(Handle<JSObject> array); | 46   void AddElementKeysFromInterceptor(Handle<JSObject> array); | 
| 47   // Jump to the next level, pushing the current |levelLength_| to | 47   // Jump to the next level, pushing the current |levelLength_| to | 
| 48   // |levelLengths_| and adding a new list to |elements_|. | 48   // |levelLengths_| and adding a new list to |elements_|. | 
| 49   void NextPrototype(); | 49   void NextPrototype(); | 
| 50   // Sort the integer indices in the last list in |elements_| | 50   // Sort the integer indices in the last list in |elements_| | 
| 51   void SortCurrentElementsList(); | 51   void SortCurrentElementsList(); | 
| 52   Handle<FixedArray> GetKeys(GetKeysConversion convert = KEEP_NUMBERS); | 52   Handle<FixedArray> GetKeys(GetKeysConversion convert = KEEP_NUMBERS); | 
| 53   int length() { return length_; } | 53   int length() { return length_; } | 
| 54   Isolate* isolate() { return isolate_; } | 54   Isolate* isolate() { return isolate_; } | 
| 55   void set_filter_proxy_keys(bool filter) { filter_proxy_keys_ = filter; } | 55   void set_filter_proxy_keys(bool filter) { filter_proxy_keys_ = filter; } | 
|  | 56   PropertyFilter filter() { return filter_; } | 
|  | 57 | 
|  | 58   Maybe<bool> GetKeys_Internal(Handle<JSReceiver> receiver, | 
|  | 59                                Handle<JSReceiver> object, | 
|  | 60                                KeyCollectionType type); | 
|  | 61   static Handle<FixedArray> GetEnumPropertyKeys(Isolate* isolate, | 
|  | 62                                                 Handle<JSObject> object); | 
|  | 63 | 
|  | 64   void CollectOwnElementKeys(Handle<JSObject> object); | 
|  | 65   void CollectOwnPropertyNames(Handle<JSObject> object); | 
| 56 | 66 | 
| 57  private: | 67  private: | 
| 58   bool AddIntegerKey(uint32_t key); | 68   bool AddIntegerKey(uint32_t key); | 
| 59   bool AddStringKey(Handle<Object> key, AddKeyConversion convert); | 69   bool AddStringKey(Handle<Object> key, AddKeyConversion convert); | 
| 60   bool AddSymbolKey(Handle<Object> array); | 70   bool AddSymbolKey(Handle<Object> array); | 
| 61   void SortCurrentElementsListRemoveDuplicates(); | 71   void SortCurrentElementsListRemoveDuplicates(); | 
| 62 | 72 | 
|  | 73   Maybe<bool> JSProxyOwnPropertyKeys(Handle<JSReceiver> receiver, | 
|  | 74                                      Handle<JSProxy> proxy); | 
|  | 75   Maybe<bool> GetKeysFromJSObject(Handle<JSReceiver> receiver, | 
|  | 76                                   Handle<JSObject> object, | 
|  | 77                                   KeyCollectionType type); | 
|  | 78 | 
| 63   Isolate* isolate_; | 79   Isolate* isolate_; | 
| 64   KeyCollectionType type_; | 80   KeyCollectionType type_; | 
| 65   PropertyFilter filter_; | 81   PropertyFilter filter_; | 
| 66   bool filter_proxy_keys_ = true; | 82   bool filter_proxy_keys_ = true; | 
| 67   // |elements_| contains the sorted element keys (indices) per level. | 83   // |elements_| contains the sorted element keys (indices) per level. | 
| 68   std::vector<std::vector<uint32_t>*> elements_; | 84   std::vector<std::vector<uint32_t>*> elements_; | 
| 69   // |protoLengths_| contains the total number of keys (elements + properties) | 85   // |protoLengths_| contains the total number of keys (elements + properties) | 
| 70   // per level. Negative values mark counts for a level with keys from a proxy. | 86   // per level. Negative values mark counts for a level with keys from a proxy. | 
| 71   std::vector<int> level_lengths_; | 87   std::vector<int> level_lengths_; | 
| 72   // |string_properties_| contains the unique String property keys for all | 88   // |string_properties_| contains the unique String property keys for all | 
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 119   bool is_receiver_simple_enum_ = false; | 135   bool is_receiver_simple_enum_ = false; | 
| 120   bool has_empty_prototype_ = false; | 136   bool has_empty_prototype_ = false; | 
| 121   bool filter_proxy_keys_ = true; | 137   bool filter_proxy_keys_ = true; | 
| 122 | 138 | 
| 123   DISALLOW_COPY_AND_ASSIGN(FastKeyAccumulator); | 139   DISALLOW_COPY_AND_ASSIGN(FastKeyAccumulator); | 
| 124 }; | 140 }; | 
| 125 | 141 | 
| 126 }  // namespace internal | 142 }  // namespace internal | 
| 127 }  // namespace v8 | 143 }  // namespace v8 | 
| 128 | 144 | 
| 129 #endif  // V8_KEY_ACCUMULATOR_H_ | 145 #endif  // V8_KEYS_H_ | 
| OLD | NEW | 
|---|