OLD | NEW |
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 29 matching lines...) Expand all Loading... |
40 }; | 40 }; |
41 | 41 |
42 enum PropertyEncoding { | 42 enum PropertyEncoding { |
43 DICTIONARY, | 43 DICTIONARY, |
44 DESCRIPTOR | 44 DESCRIPTOR |
45 }; | 45 }; |
46 | 46 |
47 LookupIterator(Handle<Object> receiver, | 47 LookupIterator(Handle<Object> receiver, |
48 Handle<Name> name, | 48 Handle<Name> name, |
49 Configuration configuration = CHECK_ALL) | 49 Configuration configuration = CHECK_ALL) |
50 : configuration_(ComputeConfiguration(configuration, name)), | 50 : configuration_(configuration), |
51 state_(NOT_FOUND), | 51 state_(NOT_FOUND), |
52 property_kind_(DATA), | 52 property_kind_(DATA), |
53 property_encoding_(DESCRIPTOR), | 53 property_encoding_(DESCRIPTOR), |
54 property_details_(NONE, NONEXISTENT, Representation::None()), | 54 property_details_(NONE, NONEXISTENT, Representation::None()), |
55 isolate_(name->GetIsolate()), | 55 isolate_(name->GetIsolate()), |
56 name_(name), | 56 name_(name), |
57 maybe_receiver_(receiver), | 57 maybe_receiver_(receiver), |
58 number_(DescriptorArray::kNotFound) { | 58 number_(DescriptorArray::kNotFound) { |
59 Handle<JSReceiver> root = GetRoot(); | 59 Handle<JSReceiver> root = GetRoot(); |
60 holder_map_ = handle(root->map()); | 60 holder_map_ = handle(root->map()); |
61 maybe_holder_ = root; | 61 maybe_holder_ = root; |
62 Next(); | 62 Next(); |
63 } | 63 } |
64 | 64 |
65 LookupIterator(Handle<Object> receiver, | 65 LookupIterator(Handle<Object> receiver, |
66 Handle<Name> name, | 66 Handle<Name> name, |
67 Handle<JSReceiver> holder, | 67 Handle<JSReceiver> holder, |
68 Configuration configuration = CHECK_ALL) | 68 Configuration configuration = CHECK_ALL) |
69 : configuration_(ComputeConfiguration(configuration, name)), | 69 : configuration_(configuration), |
70 state_(NOT_FOUND), | 70 state_(NOT_FOUND), |
71 property_kind_(DATA), | 71 property_kind_(DATA), |
72 property_encoding_(DESCRIPTOR), | 72 property_encoding_(DESCRIPTOR), |
73 property_details_(NONE, NONEXISTENT, Representation::None()), | 73 property_details_(NONE, NONEXISTENT, Representation::None()), |
74 isolate_(name->GetIsolate()), | 74 isolate_(name->GetIsolate()), |
75 name_(name), | 75 name_(name), |
76 holder_map_(holder->map()), | 76 holder_map_(holder->map()), |
77 maybe_receiver_(receiver), | 77 maybe_receiver_(receiver), |
78 maybe_holder_(holder), | 78 maybe_holder_(holder), |
79 number_(DescriptorArray::kNotFound) { | 79 number_(DescriptorArray::kNotFound) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 DCHECK(has_property_); | 180 DCHECK(has_property_); |
181 DCHECK_EQ(DESCRIPTOR, property_encoding_); | 181 DCHECK_EQ(DESCRIPTOR, property_encoding_); |
182 return number_; | 182 return number_; |
183 } | 183 } |
184 int dictionary_entry() const { | 184 int dictionary_entry() const { |
185 DCHECK(has_property_); | 185 DCHECK(has_property_); |
186 DCHECK_EQ(DICTIONARY, property_encoding_); | 186 DCHECK_EQ(DICTIONARY, property_encoding_); |
187 return number_; | 187 return number_; |
188 } | 188 } |
189 | 189 |
190 static Configuration ComputeConfiguration( | |
191 Configuration configuration, Handle<Name> name) { | |
192 if (name->IsOwn()) { | |
193 return static_cast<Configuration>(configuration & CHECK_OWN); | |
194 } else { | |
195 return configuration; | |
196 } | |
197 } | |
198 | |
199 Configuration configuration_; | 190 Configuration configuration_; |
200 State state_; | 191 State state_; |
201 bool has_property_; | 192 bool has_property_; |
202 PropertyKind property_kind_; | 193 PropertyKind property_kind_; |
203 PropertyEncoding property_encoding_; | 194 PropertyEncoding property_encoding_; |
204 PropertyDetails property_details_; | 195 PropertyDetails property_details_; |
205 Isolate* isolate_; | 196 Isolate* isolate_; |
206 Handle<Name> name_; | 197 Handle<Name> name_; |
207 Handle<Map> holder_map_; | 198 Handle<Map> holder_map_; |
208 MaybeHandle<Object> maybe_receiver_; | 199 MaybeHandle<Object> maybe_receiver_; |
209 MaybeHandle<JSReceiver> maybe_holder_; | 200 MaybeHandle<JSReceiver> maybe_holder_; |
210 | 201 |
211 int number_; | 202 int number_; |
212 }; | 203 }; |
213 | 204 |
214 | 205 |
215 } } // namespace v8::internal | 206 } } // namespace v8::internal |
216 | 207 |
217 #endif // V8_LOOKUP_H_ | 208 #endif // V8_LOOKUP_H_ |
OLD | NEW |