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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/lookup.h" | 8 #include "src/lookup.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 bool LookupIterator::HasProperty() { | 107 bool LookupIterator::HasProperty() { |
108 ASSERT_EQ(PROPERTY, state_); | 108 ASSERT_EQ(PROPERTY, state_); |
109 ASSERT(is_guaranteed_to_have_holder()); | 109 ASSERT(is_guaranteed_to_have_holder()); |
110 | 110 |
111 if (property_encoding_ == DICTIONARY) { | 111 if (property_encoding_ == DICTIONARY) { |
112 Handle<JSObject> holder = GetHolder(); | 112 Handle<JSObject> holder = GetHolder(); |
113 number_ = holder->property_dictionary()->FindEntry(name_); | 113 number_ = holder->property_dictionary()->FindEntry(name_); |
114 if (number_ == NameDictionary::kNotFound) return false; | 114 if (number_ == NameDictionary::kNotFound) return false; |
115 | 115 |
116 property_details_ = GetHolder()->property_dictionary()->DetailsAt(number_); | 116 property_details_ = GetHolder()->property_dictionary()->DetailsAt(number_); |
117 // Holes in dictionary cells are absent values unless marked as read-only. | 117 // Holes in dictionary cells are absent values. |
118 if (holder->IsGlobalObject() && | 118 if (holder->IsGlobalObject() && |
119 (property_details_.IsDeleted() || | 119 (property_details_.IsDeleted() || FetchValue()->IsTheHole())) { |
120 (!property_details_.IsReadOnly() && FetchValue()->IsTheHole()))) { | |
121 return false; | 120 return false; |
122 } | 121 } |
123 } else { | 122 } else { |
124 property_details_ = holder_map_->instance_descriptors()->GetDetails( | 123 property_details_ = holder_map_->instance_descriptors()->GetDetails( |
125 number_); | 124 number_); |
126 } | 125 } |
127 | 126 |
128 switch (property_details_.type()) { | 127 switch (property_details_.type()) { |
129 case v8::internal::FIELD: | 128 case v8::internal::FIELD: |
130 case v8::internal::NORMAL: | 129 case v8::internal::NORMAL: |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 ASSERT(has_property_); | 170 ASSERT(has_property_); |
172 ASSERT_EQ(ACCESSOR, property_kind_); | 171 ASSERT_EQ(ACCESSOR, property_kind_); |
173 return FetchValue(); | 172 return FetchValue(); |
174 } | 173 } |
175 | 174 |
176 | 175 |
177 Handle<Object> LookupIterator::GetDataValue() const { | 176 Handle<Object> LookupIterator::GetDataValue() const { |
178 ASSERT(has_property_); | 177 ASSERT(has_property_); |
179 ASSERT_EQ(DATA, property_kind_); | 178 ASSERT_EQ(DATA, property_kind_); |
180 Handle<Object> value = FetchValue(); | 179 Handle<Object> value = FetchValue(); |
181 if (value->IsTheHole()) { | |
182 ASSERT(property_details_.IsReadOnly()); | |
183 return factory()->undefined_value(); | |
184 } | |
185 return value; | 180 return value; |
186 } | 181 } |
187 | 182 |
188 | 183 |
189 } } // namespace v8::internal | 184 } } // namespace v8::internal |
OLD | NEW |