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 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 } | 1042 } |
1043 | 1043 |
1044 | 1044 |
1045 bool Object::HasSpecificClassOf(String* name) { | 1045 bool Object::HasSpecificClassOf(String* name) { |
1046 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); | 1046 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); |
1047 } | 1047 } |
1048 | 1048 |
1049 MaybeHandle<Object> Object::GetProperty(Handle<Object> object, | 1049 MaybeHandle<Object> Object::GetProperty(Handle<Object> object, |
1050 Handle<Name> name) { | 1050 Handle<Name> name) { |
1051 LookupIterator it(object, name); | 1051 LookupIterator it(object, name); |
| 1052 if (!it.IsFound()) return it.factory()->undefined_value(); |
1052 return GetProperty(&it); | 1053 return GetProperty(&it); |
1053 } | 1054 } |
1054 | 1055 |
1055 MaybeHandle<Object> Object::GetElement(Isolate* isolate, Handle<Object> object, | 1056 MaybeHandle<Object> Object::GetElement(Isolate* isolate, Handle<Object> object, |
1056 uint32_t index) { | 1057 uint32_t index) { |
1057 LookupIterator it(isolate, object, index); | 1058 LookupIterator it(isolate, object, index); |
| 1059 if (!it.IsFound()) return it.factory()->undefined_value(); |
1058 return GetProperty(&it); | 1060 return GetProperty(&it); |
1059 } | 1061 } |
1060 | 1062 |
| 1063 Handle<Object> JSReceiver::GetDataProperty(Handle<JSReceiver> object, |
| 1064 Handle<Name> name) { |
| 1065 LookupIterator it(object, name, |
| 1066 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
| 1067 if (!it.IsFound()) return it.factory()->undefined_value(); |
| 1068 return GetDataProperty(&it); |
| 1069 } |
1061 | 1070 |
1062 MaybeHandle<Object> Object::SetElement(Isolate* isolate, Handle<Object> object, | 1071 MaybeHandle<Object> Object::SetElement(Isolate* isolate, Handle<Object> object, |
1063 uint32_t index, Handle<Object> value, | 1072 uint32_t index, Handle<Object> value, |
1064 LanguageMode language_mode) { | 1073 LanguageMode language_mode) { |
1065 LookupIterator it(isolate, object, index); | 1074 LookupIterator it(isolate, object, index); |
1066 MAYBE_RETURN_NULL( | 1075 MAYBE_RETURN_NULL( |
1067 SetProperty(&it, value, language_mode, MAY_BE_STORE_FROM_KEYED)); | 1076 SetProperty(&it, value, language_mode, MAY_BE_STORE_FROM_KEYED)); |
1068 return value; | 1077 return value; |
1069 } | 1078 } |
1070 | 1079 |
(...skipping 6677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7748 #undef WRITE_INT64_FIELD | 7757 #undef WRITE_INT64_FIELD |
7749 #undef READ_BYTE_FIELD | 7758 #undef READ_BYTE_FIELD |
7750 #undef WRITE_BYTE_FIELD | 7759 #undef WRITE_BYTE_FIELD |
7751 #undef NOBARRIER_READ_BYTE_FIELD | 7760 #undef NOBARRIER_READ_BYTE_FIELD |
7752 #undef NOBARRIER_WRITE_BYTE_FIELD | 7761 #undef NOBARRIER_WRITE_BYTE_FIELD |
7753 | 7762 |
7754 } // namespace internal | 7763 } // namespace internal |
7755 } // namespace v8 | 7764 } // namespace v8 |
7756 | 7765 |
7757 #endif // V8_OBJECTS_INL_H_ | 7766 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |