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_(configuration), | 50 : configuration_(ComputeConfiguration(configuration, name)), |
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_(configuration), | 69 : configuration_(ComputeConfiguration(configuration, name)), |
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 |
190 Configuration configuration_; | 199 Configuration configuration_; |
191 State state_; | 200 State state_; |
192 bool has_property_; | 201 bool has_property_; |
193 PropertyKind property_kind_; | 202 PropertyKind property_kind_; |
194 PropertyEncoding property_encoding_; | 203 PropertyEncoding property_encoding_; |
195 PropertyDetails property_details_; | 204 PropertyDetails property_details_; |
196 Isolate* isolate_; | 205 Isolate* isolate_; |
197 Handle<Name> name_; | 206 Handle<Name> name_; |
198 Handle<Map> holder_map_; | 207 Handle<Map> holder_map_; |
199 MaybeHandle<Object> maybe_receiver_; | 208 MaybeHandle<Object> maybe_receiver_; |
200 MaybeHandle<JSReceiver> maybe_holder_; | 209 MaybeHandle<JSReceiver> maybe_holder_; |
201 | 210 |
202 int number_; | 211 int number_; |
203 }; | 212 }; |
204 | 213 |
205 | 214 |
206 } } // namespace v8::internal | 215 } } // namespace v8::internal |
207 | 216 |
208 #endif // V8_LOOKUP_H_ | 217 #endif // V8_LOOKUP_H_ |
OLD | NEW |