| 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 6565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6576 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot)); | 6576 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot)); |
| 6577 DCHECK(canonical->IsInternalizedString()); | 6577 DCHECK(canonical->IsInternalizedString()); |
| 6578 DCHECK(SlowEquals(canonical)); | 6578 DCHECK(SlowEquals(canonical)); |
| 6579 DCHECK(canonical->HasHashCode()); | 6579 DCHECK(canonical->HasHashCode()); |
| 6580 return canonical; | 6580 return canonical; |
| 6581 } | 6581 } |
| 6582 | 6582 |
| 6583 | 6583 |
| 6584 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object, | 6584 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object, |
| 6585 Handle<Name> name) { | 6585 Handle<Name> name) { |
| 6586 uint32_t index; | 6586 LookupIterator it = |
| 6587 LookupIterator it = name->AsArrayIndex(&index) | 6587 LookupIterator::PropertyOrElement(name->GetIsolate(), object, name); |
| 6588 ? LookupIterator(name->GetIsolate(), object, index) | |
| 6589 : LookupIterator(object, name); | |
| 6590 return GetProperty(&it); | 6588 return GetProperty(&it); |
| 6591 } | 6589 } |
| 6592 | 6590 |
| 6593 | 6591 |
| 6594 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, | 6592 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, |
| 6595 Handle<Name> name) { | 6593 Handle<Name> name) { |
| 6596 // Call the "has" trap on proxies. | 6594 // Call the "has" trap on proxies. |
| 6597 if (object->IsJSProxy()) { | 6595 if (object->IsJSProxy()) { |
| 6598 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 6596 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
| 6599 return JSProxy::HasPropertyWithHandler(proxy, name); | 6597 return JSProxy::HasPropertyWithHandler(proxy, name); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 6612 return JSProxy::HasPropertyWithHandler(proxy, name); | 6610 return JSProxy::HasPropertyWithHandler(proxy, name); |
| 6613 } | 6611 } |
| 6614 | 6612 |
| 6615 Maybe<PropertyAttributes> result = GetOwnPropertyAttributes(object, name); | 6613 Maybe<PropertyAttributes> result = GetOwnPropertyAttributes(object, name); |
| 6616 return result.IsJust() ? Just(result.FromJust() != ABSENT) : Nothing<bool>(); | 6614 return result.IsJust() ? Just(result.FromJust() != ABSENT) : Nothing<bool>(); |
| 6617 } | 6615 } |
| 6618 | 6616 |
| 6619 | 6617 |
| 6620 Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes( | 6618 Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes( |
| 6621 Handle<JSReceiver> object, Handle<Name> name) { | 6619 Handle<JSReceiver> object, Handle<Name> name) { |
| 6622 uint32_t index = 0; | 6620 LookupIterator it = |
| 6623 LookupIterator it = name->AsArrayIndex(&index) | 6621 LookupIterator::PropertyOrElement(name->GetIsolate(), object, name); |
| 6624 ? LookupIterator(name->GetIsolate(), object, index) | |
| 6625 : LookupIterator(object, name); | |
| 6626 return GetPropertyAttributes(&it); | 6622 return GetPropertyAttributes(&it); |
| 6627 } | 6623 } |
| 6628 | 6624 |
| 6629 | 6625 |
| 6630 Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes( | 6626 Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes( |
| 6631 Handle<JSReceiver> object, Handle<Name> name) { | 6627 Handle<JSReceiver> object, Handle<Name> name) { |
| 6632 uint32_t index = 0; | 6628 LookupIterator it = LookupIterator::PropertyOrElement( |
| 6633 LookupIterator::Configuration c = LookupIterator::HIDDEN; | 6629 name->GetIsolate(), object, name, LookupIterator::HIDDEN); |
| 6634 LookupIterator it = name->AsArrayIndex(&index) | |
| 6635 ? LookupIterator(name->GetIsolate(), object, index, c) | |
| 6636 : LookupIterator(object, name, c); | |
| 6637 return GetPropertyAttributes(&it); | 6630 return GetPropertyAttributes(&it); |
| 6638 } | 6631 } |
| 6639 | 6632 |
| 6640 | 6633 |
| 6641 Maybe<bool> JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { | 6634 Maybe<bool> JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { |
| 6642 // Call the "has" trap on proxies. | 6635 // Call the "has" trap on proxies. |
| 6643 if (object->IsJSProxy()) { | 6636 if (object->IsJSProxy()) { |
| 6644 Isolate* isolate = object->GetIsolate(); | 6637 Isolate* isolate = object->GetIsolate(); |
| 6645 Handle<Name> name = isolate->factory()->Uint32ToString(index); | 6638 Handle<Name> name = isolate->factory()->Uint32ToString(index); |
| 6646 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 6639 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7347 #undef READ_SHORT_FIELD | 7340 #undef READ_SHORT_FIELD |
| 7348 #undef WRITE_SHORT_FIELD | 7341 #undef WRITE_SHORT_FIELD |
| 7349 #undef READ_BYTE_FIELD | 7342 #undef READ_BYTE_FIELD |
| 7350 #undef WRITE_BYTE_FIELD | 7343 #undef WRITE_BYTE_FIELD |
| 7351 #undef NOBARRIER_READ_BYTE_FIELD | 7344 #undef NOBARRIER_READ_BYTE_FIELD |
| 7352 #undef NOBARRIER_WRITE_BYTE_FIELD | 7345 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7353 | 7346 |
| 7354 } } // namespace v8::internal | 7347 } } // namespace v8::internal |
| 7355 | 7348 |
| 7356 #endif // V8_OBJECTS_INL_H_ | 7349 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |