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

Side by Side Diff: src/keys.h

Issue 1707743002: [key-accumulator] Starting to reimplement the key-accumulator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: use proper type 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
« no previous file with comments | « src/key-accumulator.cc ('k') | src/keys.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // The FastKeyAccumulator handles the cases where there are no elements on the
90 // prototype chain and forwords the complex/slow cases to the normal
91 // KeyAccumulator.
92 class FastKeyAccumulator {
93 public:
94 FastKeyAccumulator(Isolate* isolate, Handle<JSReceiver> receiver,
95 KeyCollectionType type, PropertyFilter filter)
96 : isolate_(isolate), receiver_(receiver), type_(type), filter_(filter) {
97 Prepare();
98 // TODO(cbruni): pass filter_ directly to the KeyAccumulator.
99 USE(filter_);
100 }
101
102 bool is_receiver_simple_enum() { return is_receiver_simple_enum_; }
103 bool has_empty_prototype() { return has_empty_prototype_; }
104
105 MaybeHandle<FixedArray> GetKeys(GetKeysConversion convert = KEEP_NUMBERS);
106
107 private:
108 void Prepare();
109 MaybeHandle<FixedArray> GetKeysFast(GetKeysConversion convert);
110 MaybeHandle<FixedArray> GetKeysSlow(GetKeysConversion convert);
111
112 Isolate* isolate_;
113 Handle<JSReceiver> receiver_;
114 KeyCollectionType type_;
115 PropertyFilter filter_;
116 bool is_receiver_simple_enum_ = false;
117 bool has_empty_prototype_ = false;
118
119 DISALLOW_COPY_AND_ASSIGN(FastKeyAccumulator);
120 };
89 121
90 } // namespace internal 122 } // namespace internal
91 } // namespace v8 123 } // namespace v8
92 124
93
94 #endif // V8_KEY_ACCUMULATOR_H_ 125 #endif // V8_KEY_ACCUMULATOR_H_
OLDNEW
« no previous file with comments | « src/key-accumulator.cc ('k') | src/keys.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698