OLD | NEW |
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 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
(...skipping 7130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7141 object->GetIsolate(), object, name, object, LookupIterator::OWN); | 7141 object->GetIsolate(), object, name, object, LookupIterator::OWN); |
7142 return HasProperty(&it); | 7142 return HasProperty(&it); |
7143 } | 7143 } |
7144 | 7144 |
7145 Maybe<PropertyAttributes> attributes = | 7145 Maybe<PropertyAttributes> attributes = |
7146 JSReceiver::GetOwnPropertyAttributes(object, name); | 7146 JSReceiver::GetOwnPropertyAttributes(object, name); |
7147 MAYBE_RETURN(attributes, Nothing<bool>()); | 7147 MAYBE_RETURN(attributes, Nothing<bool>()); |
7148 return Just(attributes.FromJust() != ABSENT); | 7148 return Just(attributes.FromJust() != ABSENT); |
7149 } | 7149 } |
7150 | 7150 |
| 7151 Maybe<bool> JSReceiver::HasOwnProperty(Handle<JSReceiver> object, |
| 7152 uint32_t index) { |
| 7153 if (object->IsJSObject()) { // Shortcut |
| 7154 LookupIterator it(object->GetIsolate(), object, index, object, |
| 7155 LookupIterator::OWN); |
| 7156 return HasProperty(&it); |
| 7157 } |
| 7158 |
| 7159 Maybe<PropertyAttributes> attributes = |
| 7160 JSReceiver::GetOwnPropertyAttributes(object, index); |
| 7161 MAYBE_RETURN(attributes, Nothing<bool>()); |
| 7162 return Just(attributes.FromJust() != ABSENT); |
| 7163 } |
7151 | 7164 |
7152 Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes( | 7165 Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes( |
7153 Handle<JSReceiver> object, Handle<Name> name) { | 7166 Handle<JSReceiver> object, Handle<Name> name) { |
7154 LookupIterator it = LookupIterator::PropertyOrElement(name->GetIsolate(), | 7167 LookupIterator it = LookupIterator::PropertyOrElement(name->GetIsolate(), |
7155 object, name, object); | 7168 object, name, object); |
7156 return GetPropertyAttributes(&it); | 7169 return GetPropertyAttributes(&it); |
7157 } | 7170 } |
7158 | 7171 |
7159 | 7172 |
7160 Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes( | 7173 Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes( |
7161 Handle<JSReceiver> object, Handle<Name> name) { | 7174 Handle<JSReceiver> object, Handle<Name> name) { |
7162 LookupIterator it = LookupIterator::PropertyOrElement( | 7175 LookupIterator it = LookupIterator::PropertyOrElement( |
7163 name->GetIsolate(), object, name, object, LookupIterator::OWN); | 7176 name->GetIsolate(), object, name, object, LookupIterator::OWN); |
7164 return GetPropertyAttributes(&it); | 7177 return GetPropertyAttributes(&it); |
7165 } | 7178 } |
7166 | 7179 |
| 7180 Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes( |
| 7181 Handle<JSReceiver> object, uint32_t index) { |
| 7182 LookupIterator it(object->GetIsolate(), object, index, object, |
| 7183 LookupIterator::OWN); |
| 7184 return GetPropertyAttributes(&it); |
| 7185 } |
7167 | 7186 |
7168 Maybe<bool> JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { | 7187 Maybe<bool> JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { |
7169 LookupIterator it(object->GetIsolate(), object, index, object); | 7188 LookupIterator it(object->GetIsolate(), object, index, object); |
7170 return HasProperty(&it); | 7189 return HasProperty(&it); |
7171 } | 7190 } |
7172 | 7191 |
7173 | 7192 |
7174 Maybe<PropertyAttributes> JSReceiver::GetElementAttributes( | 7193 Maybe<PropertyAttributes> JSReceiver::GetElementAttributes( |
7175 Handle<JSReceiver> object, uint32_t index) { | 7194 Handle<JSReceiver> object, uint32_t index) { |
7176 Isolate* isolate = object->GetIsolate(); | 7195 Isolate* isolate = object->GetIsolate(); |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7876 #undef WRITE_INT64_FIELD | 7895 #undef WRITE_INT64_FIELD |
7877 #undef READ_BYTE_FIELD | 7896 #undef READ_BYTE_FIELD |
7878 #undef WRITE_BYTE_FIELD | 7897 #undef WRITE_BYTE_FIELD |
7879 #undef NOBARRIER_READ_BYTE_FIELD | 7898 #undef NOBARRIER_READ_BYTE_FIELD |
7880 #undef NOBARRIER_WRITE_BYTE_FIELD | 7899 #undef NOBARRIER_WRITE_BYTE_FIELD |
7881 | 7900 |
7882 } // namespace internal | 7901 } // namespace internal |
7883 } // namespace v8 | 7902 } // namespace v8 |
7884 | 7903 |
7885 #endif // V8_OBJECTS_INL_H_ | 7904 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |