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_KEY_ACCUMULATOR_H_ |
6 #define V8_KEY_ACCUMULATOR_H_ | 6 #define V8_KEY_ACCUMULATOR_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 18 matching lines...) Expand all Loading... | |
29 // Only unique keys are kept by the KeyAccumulator, strings are stored in a | 29 // Only unique keys are kept by the KeyAccumulator, strings are stored in a |
30 // HashSet for inexpensive lookups. Integer keys are kept in sorted lists which | 30 // HashSet for inexpensive lookups. Integer keys are kept in sorted lists which |
31 // are more compact and allow for reasonably fast includes check. | 31 // are more compact and allow for reasonably fast includes check. |
32 class KeyAccumulator final BASE_EMBEDDED { | 32 class KeyAccumulator final BASE_EMBEDDED { |
33 public: | 33 public: |
34 KeyAccumulator(Isolate* isolate, PropertyFilter filter) | 34 KeyAccumulator(Isolate* isolate, PropertyFilter filter) |
35 : isolate_(isolate), filter_(filter) {} | 35 : isolate_(isolate), filter_(filter) {} |
36 ~KeyAccumulator(); | 36 ~KeyAccumulator(); |
37 | 37 |
38 bool AddKey(uint32_t key); | 38 bool AddKey(uint32_t key); |
39 bool AddKey(Object* key, AddKeyConversion convert = DO_NOT_CONVERT); | 39 bool AddKey(Object* key, AddKeyConversion convert); |
Jakob Kummerow
2016/01/26 14:21:24
Forcing callers to think about what behavior they
Toon Verwaest
2016/01/27 15:02:21
Acknowledged.
| |
40 bool AddKey(Handle<Object> key, AddKeyConversion convert = DO_NOT_CONVERT); | 40 bool AddKey(Handle<Object> key, AddKeyConversion convert); |
41 void AddKeys(Handle<FixedArray> array, | 41 void AddKeys(Handle<FixedArray> array, AddKeyConversion convert); |
42 AddKeyConversion convert = DO_NOT_CONVERT); | 42 void AddKeys(Handle<JSObject> array, AddKeyConversion convert); |
43 void AddKeys(Handle<JSObject> array, | |
44 AddKeyConversion convert = DO_NOT_CONVERT); | |
45 void AddKeysFromProxy(Handle<JSObject> array); | 43 void AddKeysFromProxy(Handle<JSObject> array); |
46 Maybe<bool> AddKeysFromProxy(Handle<JSProxy> proxy, Handle<FixedArray> keys); | 44 Maybe<bool> AddKeysFromProxy(Handle<JSProxy> proxy, Handle<FixedArray> keys); |
47 void AddElementKeysFromInterceptor(Handle<JSObject> array); | 45 void AddElementKeysFromInterceptor(Handle<JSObject> array); |
48 // Jump to the next level, pushing the current |levelLength_| to | 46 // Jump to the next level, pushing the current |levelLength_| to |
49 // |levelLengths_| and adding a new list to |elements_|. | 47 // |levelLengths_| and adding a new list to |elements_|. |
50 void NextPrototype(); | 48 void NextPrototype(); |
51 // Sort the integer indices in the last list in |elements_| | 49 // Sort the integer indices in the last list in |elements_| |
52 void SortCurrentElementsList(); | 50 void SortCurrentElementsList(); |
53 Handle<FixedArray> GetKeys(GetKeysConversion convert = KEEP_NUMBERS); | 51 Handle<FixedArray> GetKeys(GetKeysConversion convert = KEEP_NUMBERS); |
54 int length() { return length_; } | 52 int length() { return length_; } |
(...skipping 29 matching lines...) Expand all Loading... | |
84 | 82 |
85 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); | 83 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); |
86 }; | 84 }; |
87 | 85 |
88 | 86 |
89 } // namespace internal | 87 } // namespace internal |
90 } // namespace v8 | 88 } // namespace v8 |
91 | 89 |
92 | 90 |
93 #endif // V8_KEY_ACCUMULATOR_H_ | 91 #endif // V8_KEY_ACCUMULATOR_H_ |
OLD | NEW |