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 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 | 1055 |
1056 MaybeHandle<Object> Object::GetElement(Isolate* isolate, Handle<Object> object, | 1056 MaybeHandle<Object> Object::GetElement(Isolate* isolate, Handle<Object> object, |
1057 uint32_t index) { | 1057 uint32_t index) { |
1058 LookupIterator it(isolate, object, index); | 1058 LookupIterator it(isolate, object, index); |
1059 if (!it.IsFound()) return it.factory()->undefined_value(); | 1059 if (!it.IsFound()) return it.factory()->undefined_value(); |
1060 return GetProperty(&it); | 1060 return GetProperty(&it); |
1061 } | 1061 } |
1062 | 1062 |
1063 Handle<Object> JSReceiver::GetDataProperty(Handle<JSReceiver> object, | 1063 Handle<Object> JSReceiver::GetDataProperty(Handle<JSReceiver> object, |
1064 Handle<Name> name) { | 1064 Handle<Name> name) { |
1065 LookupIterator it(object, name, | 1065 LookupIterator it(object, name, object, |
1066 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 1066 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
1067 if (!it.IsFound()) return it.factory()->undefined_value(); | 1067 if (!it.IsFound()) return it.factory()->undefined_value(); |
1068 return GetDataProperty(&it); | 1068 return GetDataProperty(&it); |
1069 } | 1069 } |
1070 | 1070 |
1071 MaybeHandle<Object> Object::SetElement(Isolate* isolate, Handle<Object> object, | 1071 MaybeHandle<Object> Object::SetElement(Isolate* isolate, Handle<Object> object, |
1072 uint32_t index, Handle<Object> value, | 1072 uint32_t index, Handle<Object> value, |
1073 LanguageMode language_mode) { | 1073 LanguageMode language_mode) { |
1074 LookupIterator it(isolate, object, index); | 1074 LookupIterator it(isolate, object, index); |
1075 MAYBE_RETURN_NULL( | 1075 MAYBE_RETURN_NULL( |
(...skipping 5959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7035 | 7035 |
7036 NameDictionary* JSReceiver::property_dictionary() { | 7036 NameDictionary* JSReceiver::property_dictionary() { |
7037 DCHECK(!HasFastProperties()); | 7037 DCHECK(!HasFastProperties()); |
7038 DCHECK(!IsJSGlobalObject()); | 7038 DCHECK(!IsJSGlobalObject()); |
7039 return NameDictionary::cast(properties()); | 7039 return NameDictionary::cast(properties()); |
7040 } | 7040 } |
7041 | 7041 |
7042 | 7042 |
7043 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, | 7043 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, |
7044 Handle<Name> name) { | 7044 Handle<Name> name) { |
7045 LookupIterator it = | 7045 LookupIterator it = LookupIterator::PropertyOrElement(object->GetIsolate(), |
7046 LookupIterator::PropertyOrElement(object->GetIsolate(), object, name); | 7046 object, name, object); |
7047 return HasProperty(&it); | 7047 return HasProperty(&it); |
7048 } | 7048 } |
7049 | 7049 |
7050 | 7050 |
7051 Maybe<bool> JSReceiver::HasOwnProperty(Handle<JSReceiver> object, | 7051 Maybe<bool> JSReceiver::HasOwnProperty(Handle<JSReceiver> object, |
7052 Handle<Name> name) { | 7052 Handle<Name> name) { |
7053 if (object->IsJSObject()) { // Shortcut | 7053 if (object->IsJSObject()) { // Shortcut |
7054 LookupIterator it = LookupIterator::PropertyOrElement( | 7054 LookupIterator it = LookupIterator::PropertyOrElement( |
7055 object->GetIsolate(), object, name, LookupIterator::HIDDEN); | 7055 object->GetIsolate(), object, name, object, LookupIterator::HIDDEN); |
7056 return HasProperty(&it); | 7056 return HasProperty(&it); |
7057 } | 7057 } |
7058 | 7058 |
7059 Maybe<PropertyAttributes> attributes = | 7059 Maybe<PropertyAttributes> attributes = |
7060 JSReceiver::GetOwnPropertyAttributes(object, name); | 7060 JSReceiver::GetOwnPropertyAttributes(object, name); |
7061 MAYBE_RETURN(attributes, Nothing<bool>()); | 7061 MAYBE_RETURN(attributes, Nothing<bool>()); |
7062 return Just(attributes.FromJust() != ABSENT); | 7062 return Just(attributes.FromJust() != ABSENT); |
7063 } | 7063 } |
7064 | 7064 |
7065 | 7065 |
7066 Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes( | 7066 Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes( |
7067 Handle<JSReceiver> object, Handle<Name> name) { | 7067 Handle<JSReceiver> object, Handle<Name> name) { |
7068 LookupIterator it = | 7068 LookupIterator it = LookupIterator::PropertyOrElement(name->GetIsolate(), |
7069 LookupIterator::PropertyOrElement(name->GetIsolate(), object, name); | 7069 object, name, object); |
7070 return GetPropertyAttributes(&it); | 7070 return GetPropertyAttributes(&it); |
7071 } | 7071 } |
7072 | 7072 |
7073 | 7073 |
7074 Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes( | 7074 Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes( |
7075 Handle<JSReceiver> object, Handle<Name> name) { | 7075 Handle<JSReceiver> object, Handle<Name> name) { |
7076 LookupIterator it = LookupIterator::PropertyOrElement( | 7076 LookupIterator it = LookupIterator::PropertyOrElement( |
7077 name->GetIsolate(), object, name, LookupIterator::HIDDEN); | 7077 name->GetIsolate(), object, name, object, LookupIterator::HIDDEN); |
7078 return GetPropertyAttributes(&it); | 7078 return GetPropertyAttributes(&it); |
7079 } | 7079 } |
7080 | 7080 |
7081 | 7081 |
7082 Maybe<bool> JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { | 7082 Maybe<bool> JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { |
7083 LookupIterator it(object->GetIsolate(), object, index); | 7083 LookupIterator it(object->GetIsolate(), object, index, object); |
7084 return HasProperty(&it); | 7084 return HasProperty(&it); |
7085 } | 7085 } |
7086 | 7086 |
7087 | 7087 |
7088 Maybe<PropertyAttributes> JSReceiver::GetElementAttributes( | 7088 Maybe<PropertyAttributes> JSReceiver::GetElementAttributes( |
7089 Handle<JSReceiver> object, uint32_t index) { | 7089 Handle<JSReceiver> object, uint32_t index) { |
7090 Isolate* isolate = object->GetIsolate(); | 7090 Isolate* isolate = object->GetIsolate(); |
7091 LookupIterator it(isolate, object, index); | 7091 LookupIterator it(isolate, object, index, object); |
7092 return GetPropertyAttributes(&it); | 7092 return GetPropertyAttributes(&it); |
7093 } | 7093 } |
7094 | 7094 |
7095 | 7095 |
7096 Maybe<PropertyAttributes> JSReceiver::GetOwnElementAttributes( | 7096 Maybe<PropertyAttributes> JSReceiver::GetOwnElementAttributes( |
7097 Handle<JSReceiver> object, uint32_t index) { | 7097 Handle<JSReceiver> object, uint32_t index) { |
7098 Isolate* isolate = object->GetIsolate(); | 7098 Isolate* isolate = object->GetIsolate(); |
7099 LookupIterator it(isolate, object, index, LookupIterator::HIDDEN); | 7099 LookupIterator it(isolate, object, index, object, LookupIterator::HIDDEN); |
7100 return GetPropertyAttributes(&it); | 7100 return GetPropertyAttributes(&it); |
7101 } | 7101 } |
7102 | 7102 |
7103 | 7103 |
7104 bool JSGlobalObject::IsDetached() { | 7104 bool JSGlobalObject::IsDetached() { |
7105 return JSGlobalProxy::cast(global_proxy())->IsDetachedFrom(this); | 7105 return JSGlobalProxy::cast(global_proxy())->IsDetachedFrom(this); |
7106 } | 7106 } |
7107 | 7107 |
7108 | 7108 |
7109 bool JSGlobalProxy::IsDetachedFrom(JSGlobalObject* global) const { | 7109 bool JSGlobalProxy::IsDetachedFrom(JSGlobalObject* global) const { |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7757 #undef WRITE_INT64_FIELD | 7757 #undef WRITE_INT64_FIELD |
7758 #undef READ_BYTE_FIELD | 7758 #undef READ_BYTE_FIELD |
7759 #undef WRITE_BYTE_FIELD | 7759 #undef WRITE_BYTE_FIELD |
7760 #undef NOBARRIER_READ_BYTE_FIELD | 7760 #undef NOBARRIER_READ_BYTE_FIELD |
7761 #undef NOBARRIER_WRITE_BYTE_FIELD | 7761 #undef NOBARRIER_WRITE_BYTE_FIELD |
7762 | 7762 |
7763 } // namespace internal | 7763 } // namespace internal |
7764 } // namespace v8 | 7764 } // namespace v8 |
7765 | 7765 |
7766 #endif // V8_OBJECTS_INL_H_ | 7766 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |