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

Side by Side Diff: src/lookup.h

Issue 992913002: handle the special snowflakes that are Integer Indexed Exotic objects (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/ic/ic.cc ('k') | src/lookup.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_LOOKUP_H_ 5 #ifndef V8_LOOKUP_H_
6 #define V8_LOOKUP_H_ 6 #define V8_LOOKUP_H_
7 7
8 #include "src/factory.h" 8 #include "src/factory.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 13 matching lines...) Expand all
24 OWN_SKIP_INTERCEPTOR = 0, 24 OWN_SKIP_INTERCEPTOR = 0,
25 OWN = kInterceptor, 25 OWN = kInterceptor,
26 HIDDEN_SKIP_INTERCEPTOR = kHidden, 26 HIDDEN_SKIP_INTERCEPTOR = kHidden,
27 HIDDEN = kHidden | kInterceptor, 27 HIDDEN = kHidden | kInterceptor,
28 PROTOTYPE_CHAIN_SKIP_INTERCEPTOR = kHidden | kPrototypeChain, 28 PROTOTYPE_CHAIN_SKIP_INTERCEPTOR = kHidden | kPrototypeChain,
29 PROTOTYPE_CHAIN = kHidden | kPrototypeChain | kInterceptor 29 PROTOTYPE_CHAIN = kHidden | kPrototypeChain | kInterceptor
30 }; 30 };
31 31
32 enum State { 32 enum State {
33 ACCESS_CHECK, 33 ACCESS_CHECK,
34 INTEGER_INDEXED_EXOTIC,
34 INTERCEPTOR, 35 INTERCEPTOR,
35 JSPROXY, 36 JSPROXY,
36 NOT_FOUND, 37 NOT_FOUND,
37 ACCESSOR, 38 ACCESSOR,
38 DATA, 39 DATA,
39 TRANSITION, 40 TRANSITION,
40 // Set state_ to BEFORE_PROPERTY to ensure that the next lookup will be a 41 // Set state_ to BEFORE_PROPERTY to ensure that the next lookup will be a
41 // PROPERTY lookup. 42 // PROPERTY lookup.
42 BEFORE_PROPERTY = INTERCEPTOR 43 BEFORE_PROPERTY = INTERCEPTOR
43 }; 44 };
44 45
45 LookupIterator(Handle<Object> receiver, Handle<Name> name, 46 LookupIterator(Handle<Object> receiver, Handle<Name> name,
46 Configuration configuration = PROTOTYPE_CHAIN) 47 Configuration configuration = PROTOTYPE_CHAIN)
47 : configuration_(ComputeConfiguration(configuration, name)), 48 : configuration_(ComputeConfiguration(configuration, name)),
48 state_(NOT_FOUND), 49 state_(NOT_FOUND),
50 exotic_index_state_(ExoticIndexState::kUninitialized),
49 property_details_(NONE, v8::internal::DATA, 0), 51 property_details_(NONE, v8::internal::DATA, 0),
50 isolate_(name->GetIsolate()), 52 isolate_(name->GetIsolate()),
51 name_(name), 53 name_(name),
52 receiver_(receiver), 54 receiver_(receiver),
53 number_(DescriptorArray::kNotFound) { 55 number_(DescriptorArray::kNotFound) {
54 holder_ = GetRoot(); 56 holder_ = GetRoot();
55 holder_map_ = handle(holder_->map(), isolate_); 57 holder_map_ = handle(holder_->map(), isolate_);
56 Next(); 58 Next();
57 } 59 }
58 60
59 LookupIterator(Handle<Object> receiver, Handle<Name> name, 61 LookupIterator(Handle<Object> receiver, Handle<Name> name,
60 Handle<JSReceiver> holder, 62 Handle<JSReceiver> holder,
61 Configuration configuration = PROTOTYPE_CHAIN) 63 Configuration configuration = PROTOTYPE_CHAIN)
62 : configuration_(ComputeConfiguration(configuration, name)), 64 : configuration_(ComputeConfiguration(configuration, name)),
63 state_(NOT_FOUND), 65 state_(NOT_FOUND),
66 exotic_index_state_(ExoticIndexState::kUninitialized),
64 property_details_(NONE, v8::internal::DATA, 0), 67 property_details_(NONE, v8::internal::DATA, 0),
65 isolate_(name->GetIsolate()), 68 isolate_(name->GetIsolate()),
66 name_(name), 69 name_(name),
67 holder_map_(holder->map(), isolate_), 70 holder_map_(holder->map(), isolate_),
68 receiver_(receiver), 71 receiver_(receiver),
69 holder_(holder), 72 holder_(holder),
70 number_(DescriptorArray::kNotFound) { 73 number_(DescriptorArray::kNotFound) {
71 Next(); 74 Next();
72 } 75 }
73 76
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 Handle<PropertyCell> GetPropertyCell() const; 136 Handle<PropertyCell> GetPropertyCell() const;
134 Handle<PropertyCell> GetTransitionPropertyCell() const { 137 Handle<PropertyCell> GetTransitionPropertyCell() const {
135 DCHECK_EQ(TRANSITION, state_); 138 DCHECK_EQ(TRANSITION, state_);
136 return Handle<PropertyCell>::cast(transition_); 139 return Handle<PropertyCell>::cast(transition_);
137 } 140 }
138 Handle<Object> GetAccessors() const; 141 Handle<Object> GetAccessors() const;
139 Handle<Object> GetDataValue() const; 142 Handle<Object> GetDataValue() const;
140 // Usually returns the value that was passed in, but may perform 143 // Usually returns the value that was passed in, but may perform
141 // non-observable modifications on it, such as internalize strings. 144 // non-observable modifications on it, such as internalize strings.
142 Handle<Object> WriteDataValue(Handle<Object> value); 145 Handle<Object> WriteDataValue(Handle<Object> value);
143
144 // Checks whether the receiver is an indexed exotic object
145 // and name is a special numeric index.
146 bool IsSpecialNumericIndex() const;
147
148 void InternalizeName(); 146 void InternalizeName();
149 147
150 private: 148 private:
151 Handle<Map> GetReceiverMap() const; 149 Handle<Map> GetReceiverMap() const;
152 150
153 MUST_USE_RESULT inline JSReceiver* NextHolder(Map* map); 151 MUST_USE_RESULT inline JSReceiver* NextHolder(Map* map);
154 inline State LookupInHolder(Map* map, JSReceiver* holder); 152 inline State LookupInHolder(Map* map, JSReceiver* holder);
155 Handle<Object> FetchValue() const; 153 Handle<Object> FetchValue() const;
156 void ReloadPropertyInformation(); 154 void ReloadPropertyInformation();
157 155
(...skipping 20 matching lines...) Expand all
178 static Configuration ComputeConfiguration( 176 static Configuration ComputeConfiguration(
179 Configuration configuration, Handle<Name> name) { 177 Configuration configuration, Handle<Name> name) {
180 if (name->IsOwn()) { 178 if (name->IsOwn()) {
181 return static_cast<Configuration>(configuration & 179 return static_cast<Configuration>(configuration &
182 HIDDEN_SKIP_INTERCEPTOR); 180 HIDDEN_SKIP_INTERCEPTOR);
183 } else { 181 } else {
184 return configuration; 182 return configuration;
185 } 183 }
186 } 184 }
187 185
186 enum class ExoticIndexState { kUninitialized, kNoIndex, kIndex };
187 bool IsIntegerIndexedExotic(JSReceiver* holder);
188
188 // If configuration_ becomes mutable, update 189 // If configuration_ becomes mutable, update
189 // HolderIsReceiverOrHiddenPrototype. 190 // HolderIsReceiverOrHiddenPrototype.
190 Configuration configuration_; 191 Configuration configuration_;
191 State state_; 192 State state_;
192 bool has_property_; 193 bool has_property_;
194 ExoticIndexState exotic_index_state_;
193 PropertyDetails property_details_; 195 PropertyDetails property_details_;
194 Isolate* isolate_; 196 Isolate* isolate_;
195 Handle<Name> name_; 197 Handle<Name> name_;
196 Handle<Map> holder_map_; 198 Handle<Map> holder_map_;
197 Handle<Object> transition_; 199 Handle<Object> transition_;
198 Handle<Object> receiver_; 200 Handle<Object> receiver_;
199 Handle<JSReceiver> holder_; 201 Handle<JSReceiver> holder_;
200 202
201 int number_; 203 int number_;
202 }; 204 };
203 205
204 206
205 } } // namespace v8::internal 207 } } // namespace v8::internal
206 208
207 #endif // V8_LOOKUP_H_ 209 #endif // V8_LOOKUP_H_
OLDNEW
« no previous file with comments | « src/ic/ic.cc ('k') | src/lookup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698