Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/key-accumulator.h

Issue 1637753004: [es7] refactor and fix Object.values() / Object.entries() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: keepin it fresh Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 AddKeyConversion convert = DO_NOT_CONVERT); 44 AddKeyConversion convert = DO_NOT_CONVERT);
45 void AddKeysFromProxy(Handle<JSObject> array); 45 void AddKeysFromProxy(Handle<JSObject> array);
46 Maybe<bool> AddKeysFromProxy(Handle<JSProxy> proxy, Handle<FixedArray> keys); 46 Maybe<bool> AddKeysFromProxy(Handle<JSProxy> proxy, Handle<FixedArray> keys);
47 void AddElementKeysFromInterceptor(Handle<JSObject> array); 47 void AddElementKeysFromInterceptor(Handle<JSObject> array);
48 // Jump to the next level, pushing the current |levelLength_| to 48 // Jump to the next level, pushing the current |levelLength_| to
49 // |levelLengths_| and adding a new list to |elements_|. 49 // |levelLengths_| and adding a new list to |elements_|.
50 void NextPrototype(); 50 void NextPrototype();
51 // Sort the integer indices in the last list in |elements_| 51 // Sort the integer indices in the last list in |elements_|
52 void SortCurrentElementsList(); 52 void SortCurrentElementsList();
53 Handle<FixedArray> GetKeys(GetKeysConversion convert = KEEP_NUMBERS); 53 Handle<FixedArray> GetKeys(GetKeysConversion convert = KEEP_NUMBERS);
54 MaybeHandle<FixedArray> GetValues(Handle<JSReceiver> object,
55 GetKeysConversion convert = KEEP_NUMBERS);
56 MaybeHandle<FixedArray> GetEntries(Handle<JSReceiver> object,
57 GetKeysConversion convert = KEEP_NUMBERS);
Camillo Bruni 2016/02/03 12:03:48 Do you think we will ever need the convert argumen
caitp (gmail) 2016/02/03 12:57:30 it has been removed
54 int length() { return length_; } 58 int length() { return length_; }
55 Isolate* isolate() { return isolate_; } 59 Isolate* isolate() { return isolate_; }
56 60
57 private: 61 private:
58 bool AddIntegerKey(uint32_t key); 62 bool AddIntegerKey(uint32_t key);
59 bool AddStringKey(Handle<Object> key, AddKeyConversion convert); 63 bool AddStringKey(Handle<Object> key, AddKeyConversion convert);
60 bool AddSymbolKey(Handle<Object> array); 64 bool AddSymbolKey(Handle<Object> array);
61 void SortCurrentElementsListRemoveDuplicates(); 65 void SortCurrentElementsListRemoveDuplicates();
66 template <typename F>
67 MaybeHandle<FixedArray> GetKeys_Internal(GetKeysConversion convert,
68 bool trivial, F& accumulate);
62 69
63 Isolate* isolate_; 70 Isolate* isolate_;
64 PropertyFilter filter_; 71 PropertyFilter filter_;
65 // |elements_| contains the sorted element keys (indices) per level. 72 // |elements_| contains the sorted element keys (indices) per level.
66 std::vector<std::vector<uint32_t>*> elements_; 73 std::vector<std::vector<uint32_t>*> elements_;
67 // |protoLengths_| contains the total number of keys (elements + properties) 74 // |protoLengths_| contains the total number of keys (elements + properties)
68 // per level. Negative values mark counts for a level with keys from a proxy. 75 // per level. Negative values mark counts for a level with keys from a proxy.
69 std::vector<int> level_lengths_; 76 std::vector<int> level_lengths_;
70 // |string_properties_| contains the unique String property keys for all 77 // |string_properties_| contains the unique String property keys for all
71 // levels in insertion order per level. 78 // levels in insertion order per level.
(...skipping 12 matching lines...) Expand all
84 91
85 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); 92 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator);
86 }; 93 };
87 94
88 95
89 } // namespace internal 96 } // namespace internal
90 } // namespace v8 97 } // namespace v8
91 98
92 99
93 #endif // V8_KEY_ACCUMULATOR_H_ 100 #endif // V8_KEY_ACCUMULATOR_H_
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/key-accumulator.cc » ('j') | src/key-accumulator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698