OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 5696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5707 Object* JSReceiver::GetPrototype() { | 5707 Object* JSReceiver::GetPrototype() { |
5708 return map()->prototype(); | 5708 return map()->prototype(); |
5709 } | 5709 } |
5710 | 5710 |
5711 | 5711 |
5712 Object* JSReceiver::GetConstructor() { | 5712 Object* JSReceiver::GetConstructor() { |
5713 return map()->constructor(); | 5713 return map()->constructor(); |
5714 } | 5714 } |
5715 | 5715 |
5716 | 5716 |
5717 bool JSReceiver::HasProperty(Name* name) { | 5717 bool JSReceiver::HasProperty(Handle<JSReceiver> object, |
5718 if (IsJSProxy()) { | 5718 Handle<Name> name) { |
5719 return JSProxy::cast(this)->HasPropertyWithHandler(name); | 5719 if (object->IsJSProxy()) { |
| 5720 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
| 5721 return JSProxy::HasPropertyWithHandler(proxy, name); |
5720 } | 5722 } |
5721 return GetPropertyAttribute(name) != ABSENT; | 5723 return object->GetPropertyAttribute(*name) != ABSENT; |
5722 } | 5724 } |
5723 | 5725 |
5724 | 5726 |
5725 bool JSReceiver::HasLocalProperty(Name* name) { | 5727 bool JSReceiver::HasLocalProperty(Handle<JSReceiver> object, |
5726 if (IsJSProxy()) { | 5728 Handle<Name> name) { |
5727 return JSProxy::cast(this)->HasPropertyWithHandler(name); | 5729 if (object->IsJSProxy()) { |
| 5730 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
| 5731 return JSProxy::HasPropertyWithHandler(proxy, name); |
5728 } | 5732 } |
5729 return GetLocalPropertyAttribute(name) != ABSENT; | 5733 return object->GetLocalPropertyAttribute(*name) != ABSENT; |
5730 } | 5734 } |
5731 | 5735 |
5732 | 5736 |
5733 PropertyAttributes JSReceiver::GetPropertyAttribute(Name* key) { | 5737 PropertyAttributes JSReceiver::GetPropertyAttribute(Name* key) { |
5734 uint32_t index; | 5738 uint32_t index; |
5735 if (IsJSObject() && key->AsArrayIndex(&index)) { | 5739 if (IsJSObject() && key->AsArrayIndex(&index)) { |
5736 return GetElementAttribute(index); | 5740 return GetElementAttribute(index); |
5737 } | 5741 } |
5738 return GetPropertyAttributeWithReceiver(this, key); | 5742 return GetPropertyAttributeWithReceiver(this, key); |
5739 } | 5743 } |
(...skipping 21 matching lines...) Expand all Loading... |
5761 } | 5765 } |
5762 | 5766 |
5763 | 5767 |
5764 MaybeObject* JSReceiver::GetIdentityHash(CreationFlag flag) { | 5768 MaybeObject* JSReceiver::GetIdentityHash(CreationFlag flag) { |
5765 return IsJSProxy() | 5769 return IsJSProxy() |
5766 ? JSProxy::cast(this)->GetIdentityHash(flag) | 5770 ? JSProxy::cast(this)->GetIdentityHash(flag) |
5767 : JSObject::cast(this)->GetIdentityHash(flag); | 5771 : JSObject::cast(this)->GetIdentityHash(flag); |
5768 } | 5772 } |
5769 | 5773 |
5770 | 5774 |
5771 bool JSReceiver::HasElement(uint32_t index) { | 5775 bool JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { |
5772 if (IsJSProxy()) { | 5776 if (object->IsJSProxy()) { |
5773 return JSProxy::cast(this)->HasElementWithHandler(index); | 5777 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
| 5778 return JSProxy::HasElementWithHandler(proxy, index); |
5774 } | 5779 } |
5775 return JSObject::cast(this)->GetElementAttributeWithReceiver( | 5780 return Handle<JSObject>::cast(object)->GetElementAttributeWithReceiver( |
5776 this, index, true) != ABSENT; | 5781 *object, index, true) != ABSENT; |
5777 } | 5782 } |
5778 | 5783 |
5779 | 5784 |
5780 bool JSReceiver::HasLocalElement(uint32_t index) { | 5785 bool JSReceiver::HasLocalElement(Handle<JSReceiver> object, uint32_t index) { |
5781 if (IsJSProxy()) { | 5786 if (object->IsJSProxy()) { |
5782 return JSProxy::cast(this)->HasElementWithHandler(index); | 5787 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
| 5788 return JSProxy::HasElementWithHandler(proxy, index); |
5783 } | 5789 } |
5784 return JSObject::cast(this)->GetElementAttributeWithReceiver( | 5790 return Handle<JSObject>::cast(object)->GetElementAttributeWithReceiver( |
5785 this, index, false) != ABSENT; | 5791 *object, index, false) != ABSENT; |
5786 } | 5792 } |
5787 | 5793 |
5788 | 5794 |
5789 PropertyAttributes JSReceiver::GetLocalElementAttribute(uint32_t index) { | 5795 PropertyAttributes JSReceiver::GetLocalElementAttribute(uint32_t index) { |
5790 if (IsJSProxy()) { | 5796 if (IsJSProxy()) { |
5791 return JSProxy::cast(this)->GetElementAttributeWithHandler(this, index); | 5797 return JSProxy::cast(this)->GetElementAttributeWithHandler(this, index); |
5792 } | 5798 } |
5793 return JSObject::cast(this)->GetElementAttributeWithReceiver( | 5799 return JSObject::cast(this)->GetElementAttributeWithReceiver( |
5794 this, index, false); | 5800 this, index, false); |
5795 } | 5801 } |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6278 #undef WRITE_UINT32_FIELD | 6284 #undef WRITE_UINT32_FIELD |
6279 #undef READ_SHORT_FIELD | 6285 #undef READ_SHORT_FIELD |
6280 #undef WRITE_SHORT_FIELD | 6286 #undef WRITE_SHORT_FIELD |
6281 #undef READ_BYTE_FIELD | 6287 #undef READ_BYTE_FIELD |
6282 #undef WRITE_BYTE_FIELD | 6288 #undef WRITE_BYTE_FIELD |
6283 | 6289 |
6284 | 6290 |
6285 } } // namespace v8::internal | 6291 } } // namespace v8::internal |
6286 | 6292 |
6287 #endif // V8_OBJECTS_INL_H_ | 6293 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |