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 6943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6954 } | 6954 } |
6955 | 6955 |
6956 | 6956 |
6957 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, | 6957 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, |
6958 Handle<Name> name) { | 6958 Handle<Name> name) { |
6959 if (object->IsJSProxy()) { | 6959 if (object->IsJSProxy()) { |
6960 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 6960 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
6961 return JSProxy::HasPropertyWithHandler(proxy, name); | 6961 return JSProxy::HasPropertyWithHandler(proxy, name); |
6962 } | 6962 } |
6963 Maybe<PropertyAttributes> result = GetPropertyAttributes(object, name); | 6963 Maybe<PropertyAttributes> result = GetPropertyAttributes(object, name); |
6964 return result.has_value ? Just(result.value != ABSENT) : Nothing<bool>(); | 6964 return result.IsJust() ? Just(result.FromJust() != ABSENT) : Nothing<bool>(); |
6965 } | 6965 } |
6966 | 6966 |
6967 | 6967 |
6968 Maybe<bool> JSReceiver::HasOwnProperty(Handle<JSReceiver> object, | 6968 Maybe<bool> JSReceiver::HasOwnProperty(Handle<JSReceiver> object, |
6969 Handle<Name> name) { | 6969 Handle<Name> name) { |
6970 if (object->IsJSProxy()) { | 6970 if (object->IsJSProxy()) { |
6971 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 6971 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
6972 return JSProxy::HasPropertyWithHandler(proxy, name); | 6972 return JSProxy::HasPropertyWithHandler(proxy, name); |
6973 } | 6973 } |
6974 Maybe<PropertyAttributes> result = GetOwnPropertyAttributes(object, name); | 6974 Maybe<PropertyAttributes> result = GetOwnPropertyAttributes(object, name); |
6975 return result.has_value ? Just(result.value != ABSENT) : Nothing<bool>(); | 6975 return result.IsJust() ? Just(result.FromJust() != ABSENT) : Nothing<bool>(); |
6976 } | 6976 } |
6977 | 6977 |
6978 | 6978 |
6979 Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes( | 6979 Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes( |
6980 Handle<JSReceiver> object, Handle<Name> key) { | 6980 Handle<JSReceiver> object, Handle<Name> key) { |
6981 uint32_t index; | 6981 uint32_t index; |
6982 if (object->IsJSObject() && key->AsArrayIndex(&index)) { | 6982 if (object->IsJSObject() && key->AsArrayIndex(&index)) { |
6983 return GetElementAttribute(object, index); | 6983 return GetElementAttribute(object, index); |
6984 } | 6984 } |
6985 LookupIterator it(object, key); | 6985 LookupIterator it(object, key); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7024 } | 7024 } |
7025 | 7025 |
7026 | 7026 |
7027 Maybe<bool> JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { | 7027 Maybe<bool> JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { |
7028 if (object->IsJSProxy()) { | 7028 if (object->IsJSProxy()) { |
7029 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 7029 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
7030 return JSProxy::HasElementWithHandler(proxy, index); | 7030 return JSProxy::HasElementWithHandler(proxy, index); |
7031 } | 7031 } |
7032 Maybe<PropertyAttributes> result = JSObject::GetElementAttributeWithReceiver( | 7032 Maybe<PropertyAttributes> result = JSObject::GetElementAttributeWithReceiver( |
7033 Handle<JSObject>::cast(object), object, index, true); | 7033 Handle<JSObject>::cast(object), object, index, true); |
7034 return result.has_value ? Just(result.value != ABSENT) : Nothing<bool>(); | 7034 return result.IsJust() ? Just(result.FromJust() != ABSENT) : Nothing<bool>(); |
7035 } | 7035 } |
7036 | 7036 |
7037 | 7037 |
7038 Maybe<bool> JSReceiver::HasOwnElement(Handle<JSReceiver> object, | 7038 Maybe<bool> JSReceiver::HasOwnElement(Handle<JSReceiver> object, |
7039 uint32_t index) { | 7039 uint32_t index) { |
7040 if (object->IsJSProxy()) { | 7040 if (object->IsJSProxy()) { |
7041 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 7041 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
7042 return JSProxy::HasElementWithHandler(proxy, index); | 7042 return JSProxy::HasElementWithHandler(proxy, index); |
7043 } | 7043 } |
7044 Maybe<PropertyAttributes> result = JSObject::GetElementAttributeWithReceiver( | 7044 Maybe<PropertyAttributes> result = JSObject::GetElementAttributeWithReceiver( |
7045 Handle<JSObject>::cast(object), object, index, false); | 7045 Handle<JSObject>::cast(object), object, index, false); |
7046 return result.has_value ? Just(result.value != ABSENT) : Nothing<bool>(); | 7046 return result.IsJust() ? Just(result.FromJust() != ABSENT) : Nothing<bool>(); |
7047 } | 7047 } |
7048 | 7048 |
7049 | 7049 |
7050 Maybe<PropertyAttributes> JSReceiver::GetOwnElementAttribute( | 7050 Maybe<PropertyAttributes> JSReceiver::GetOwnElementAttribute( |
7051 Handle<JSReceiver> object, uint32_t index) { | 7051 Handle<JSReceiver> object, uint32_t index) { |
7052 if (object->IsJSProxy()) { | 7052 if (object->IsJSProxy()) { |
7053 return JSProxy::GetElementAttributeWithHandler( | 7053 return JSProxy::GetElementAttributeWithHandler( |
7054 Handle<JSProxy>::cast(object), object, index); | 7054 Handle<JSProxy>::cast(object), object, index); |
7055 } | 7055 } |
7056 return JSObject::GetElementAttributeWithReceiver( | 7056 return JSObject::GetElementAttributeWithReceiver( |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7630 #undef READ_SHORT_FIELD | 7630 #undef READ_SHORT_FIELD |
7631 #undef WRITE_SHORT_FIELD | 7631 #undef WRITE_SHORT_FIELD |
7632 #undef READ_BYTE_FIELD | 7632 #undef READ_BYTE_FIELD |
7633 #undef WRITE_BYTE_FIELD | 7633 #undef WRITE_BYTE_FIELD |
7634 #undef NOBARRIER_READ_BYTE_FIELD | 7634 #undef NOBARRIER_READ_BYTE_FIELD |
7635 #undef NOBARRIER_WRITE_BYTE_FIELD | 7635 #undef NOBARRIER_WRITE_BYTE_FIELD |
7636 | 7636 |
7637 } } // namespace v8::internal | 7637 } } // namespace v8::internal |
7638 | 7638 |
7639 #endif // V8_OBJECTS_INL_H_ | 7639 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |