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

Side by Side Diff: src/keys.h

Issue 2638323002: [keys] Make for-in great again. (Closed)
Patch Set: readding test Created 3 years, 11 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 | « no previous file | 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_KEYS_H_ 5 #ifndef V8_KEYS_H_
6 #define V8_KEYS_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
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 Maybe<bool> CollectKeys(Handle<JSReceiver> receiver, 46 Maybe<bool> CollectKeys(Handle<JSReceiver> receiver,
47 Handle<JSReceiver> object); 47 Handle<JSReceiver> object);
48 Maybe<bool> CollectOwnElementIndices(Handle<JSReceiver> receiver, 48 Maybe<bool> CollectOwnElementIndices(Handle<JSReceiver> receiver,
49 Handle<JSObject> object); 49 Handle<JSObject> object);
50 Maybe<bool> CollectOwnPropertyNames(Handle<JSReceiver> receiver, 50 Maybe<bool> CollectOwnPropertyNames(Handle<JSReceiver> receiver,
51 Handle<JSObject> object); 51 Handle<JSObject> object);
52 Maybe<bool> CollectAccessCheckInterceptorKeys( 52 Maybe<bool> CollectAccessCheckInterceptorKeys(
53 Handle<AccessCheckInfo> access_check_info, Handle<JSReceiver> receiver, 53 Handle<AccessCheckInfo> access_check_info, Handle<JSReceiver> receiver,
54 Handle<JSObject> object); 54 Handle<JSObject> object);
55 55
56 // Might return directly the object's enum_cache, copy the result before using
57 // as an elements backing store for a JSObject.
56 static Handle<FixedArray> GetOwnEnumPropertyKeys(Isolate* isolate, 58 static Handle<FixedArray> GetOwnEnumPropertyKeys(Isolate* isolate,
57 Handle<JSObject> object); 59 Handle<JSObject> object);
58
59 void AddKey(Object* key, AddKeyConversion convert = DO_NOT_CONVERT); 60 void AddKey(Object* key, AddKeyConversion convert = DO_NOT_CONVERT);
60 void AddKey(Handle<Object> key, AddKeyConversion convert = DO_NOT_CONVERT); 61 void AddKey(Handle<Object> key, AddKeyConversion convert = DO_NOT_CONVERT);
61 void AddKeys(Handle<FixedArray> array, AddKeyConversion convert); 62 void AddKeys(Handle<FixedArray> array, AddKeyConversion convert);
62 void AddKeys(Handle<JSObject> array_like, AddKeyConversion convert); 63 void AddKeys(Handle<JSObject> array_like, AddKeyConversion convert);
63 64
64 // Jump to the next level, pushing the current |levelLength_| to 65 // Jump to the next level, pushing the current |levelLength_| to
65 // |levelLengths_| and adding a new list to |elements_|. 66 // |levelLengths_| and adding a new list to |elements_|.
66 Isolate* isolate() { return isolate_; } 67 Isolate* isolate() { return isolate_; }
67 // Filter keys based on their property descriptors. 68 // Filter keys based on their property descriptors.
68 PropertyFilter filter() { return filter_; } 69 PropertyFilter filter() { return filter_; }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 void set_is_for_in(bool value) { is_for_in_ = value; } 134 void set_is_for_in(bool value) { is_for_in_ = value; }
134 135
135 MaybeHandle<FixedArray> GetKeys( 136 MaybeHandle<FixedArray> GetKeys(
136 GetKeysConversion convert = GetKeysConversion::kKeepNumbers); 137 GetKeysConversion convert = GetKeysConversion::kKeepNumbers);
137 138
138 private: 139 private:
139 void Prepare(); 140 void Prepare();
140 MaybeHandle<FixedArray> GetKeysFast(GetKeysConversion convert); 141 MaybeHandle<FixedArray> GetKeysFast(GetKeysConversion convert);
141 MaybeHandle<FixedArray> GetKeysSlow(GetKeysConversion convert); 142 MaybeHandle<FixedArray> GetKeysSlow(GetKeysConversion convert);
142 143
144 MaybeHandle<FixedArray> GetOwnKeysWithUninitializedEnumCache();
145
143 Isolate* isolate_; 146 Isolate* isolate_;
144 Handle<JSReceiver> receiver_; 147 Handle<JSReceiver> receiver_;
145 Handle<JSReceiver> last_non_empty_prototype_; 148 Handle<JSReceiver> last_non_empty_prototype_;
146 KeyCollectionMode mode_; 149 KeyCollectionMode mode_;
147 PropertyFilter filter_; 150 PropertyFilter filter_;
148 bool is_for_in_ = false; 151 bool is_for_in_ = false;
149 bool is_receiver_simple_enum_ = false; 152 bool is_receiver_simple_enum_ = false;
150 bool has_empty_prototype_ = false; 153 bool has_empty_prototype_ = false;
151 154
152 DISALLOW_COPY_AND_ASSIGN(FastKeyAccumulator); 155 DISALLOW_COPY_AND_ASSIGN(FastKeyAccumulator);
153 }; 156 };
154 157
155 } // namespace internal 158 } // namespace internal
156 } // namespace v8 159 } // namespace v8
157 160
158 #endif // V8_KEYS_H_ 161 #endif // V8_KEYS_H_
OLDNEW
« no previous file with comments | « no previous file | src/keys.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698