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

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

Issue 1707743002: [key-accumulator] Starting to reimplement the key-accumulator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: WIP fast path for collecting receiver-only elements Created 4 years, 9 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // |levelLength_| keeps track of the number of String keys in the current 79 // |levelLength_| keeps track of the number of String keys in the current
80 // level. 80 // level.
81 int level_string_length_ = 0; 81 int level_string_length_ = 0;
82 // |levelSymbolLength_| keeps track of the number of Symbol keys in the 82 // |levelSymbolLength_| keeps track of the number of Symbol keys in the
83 // current level. 83 // current level.
84 int level_symbol_length_ = 0; 84 int level_symbol_length_ = 0;
85 85
86 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); 86 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator);
87 }; 87 };
88 88
89 class FastKeyAccumulator {
90 public:
91 FastKeyAccumulator(Isolate* isolate, Handle<JSReceiver> receiver,
92 KeyCollectionType type, PropertyFilter filter)
93 : isolate_(isolate), receiver_(receiver), type_(type), filter_(filter) {
94 Prepare();
95 }
96
97 void UseVars();
98
99 bool is_simple_enum() { return is_simple_enum_; }
100 bool has_empty_prototype() { return has_empty_prototype_; }
101
102 MaybeHandle<FixedArray> GetKeys(GetKeysConversion convert = KEEP_NUMBERS);
103
104 private:
105 void Prepare();
106 MaybeHandle<FixedArray> GetKeysFast(GetKeysConversion convert);
107 MaybeHandle<FixedArray> GetKeysSlow(GetKeysConversion convert);
108
109 Isolate* isolate_;
110 Handle<JSReceiver> receiver_;
111 KeyCollectionType type_;
112 PropertyFilter filter_;
113 bool is_simple_enum_ = false;
114 bool has_empty_prototype_ = false;
115
116 DISALLOW_COPY_AND_ASSIGN(FastKeyAccumulator);
117 };
89 118
90 } // namespace internal 119 } // namespace internal
91 } // namespace v8 120 } // namespace v8
92 121
93 122
94 #endif // V8_KEY_ACCUMULATOR_H_ 123 #endif // V8_KEY_ACCUMULATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698