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 5873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5884 | 5884 |
5885 PropertyAttributes JSReceiver::GetElementAttribute(uint32_t index) { | 5885 PropertyAttributes JSReceiver::GetElementAttribute(uint32_t index) { |
5886 if (IsJSProxy()) { | 5886 if (IsJSProxy()) { |
5887 return JSProxy::cast(this)->GetElementAttributeWithHandler(this, index); | 5887 return JSProxy::cast(this)->GetElementAttributeWithHandler(this, index); |
5888 } | 5888 } |
5889 return JSObject::cast(this)->GetElementAttributeWithReceiver( | 5889 return JSObject::cast(this)->GetElementAttributeWithReceiver( |
5890 this, index, true); | 5890 this, index, true); |
5891 } | 5891 } |
5892 | 5892 |
5893 | 5893 |
5894 // TODO(504): this may be useful in other places too where JSGlobalProxy | 5894 bool JSGlobalObject::IsDetached() { |
5895 // is used. | 5895 return JSGlobalProxy::cast(global_receiver())->IsDetachedFrom(this); |
5896 Object* JSObject::BypassGlobalProxy() { | |
5897 if (IsJSGlobalProxy()) { | |
5898 Object* proto = GetPrototype(); | |
5899 if (proto->IsNull()) return GetHeap()->undefined_value(); | |
5900 ASSERT(proto->IsJSGlobalObject()); | |
5901 return proto; | |
5902 } | |
5903 return this; | |
5904 } | 5896 } |
5905 | 5897 |
5906 | 5898 |
| 5899 bool JSGlobalProxy::IsDetachedFrom(GlobalObject* global) { |
| 5900 return GetPrototype() != global; |
| 5901 } |
| 5902 |
| 5903 |
5907 Handle<Object> JSReceiver::GetOrCreateIdentityHash(Handle<JSReceiver> object) { | 5904 Handle<Object> JSReceiver::GetOrCreateIdentityHash(Handle<JSReceiver> object) { |
5908 return object->IsJSProxy() | 5905 return object->IsJSProxy() |
5909 ? JSProxy::GetOrCreateIdentityHash(Handle<JSProxy>::cast(object)) | 5906 ? JSProxy::GetOrCreateIdentityHash(Handle<JSProxy>::cast(object)) |
5910 : JSObject::GetOrCreateIdentityHash(Handle<JSObject>::cast(object)); | 5907 : JSObject::GetOrCreateIdentityHash(Handle<JSObject>::cast(object)); |
5911 } | 5908 } |
5912 | 5909 |
5913 | 5910 |
5914 Object* JSReceiver::GetIdentityHash() { | 5911 Object* JSReceiver::GetIdentityHash() { |
5915 return IsJSProxy() | 5912 return IsJSProxy() |
5916 ? JSProxy::cast(this)->GetIdentityHash() | 5913 ? JSProxy::cast(this)->GetIdentityHash() |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6463 #undef WRITE_UINT32_FIELD | 6460 #undef WRITE_UINT32_FIELD |
6464 #undef READ_SHORT_FIELD | 6461 #undef READ_SHORT_FIELD |
6465 #undef WRITE_SHORT_FIELD | 6462 #undef WRITE_SHORT_FIELD |
6466 #undef READ_BYTE_FIELD | 6463 #undef READ_BYTE_FIELD |
6467 #undef WRITE_BYTE_FIELD | 6464 #undef WRITE_BYTE_FIELD |
6468 | 6465 |
6469 | 6466 |
6470 } } // namespace v8::internal | 6467 } } // namespace v8::internal |
6471 | 6468 |
6472 #endif // V8_OBJECTS_INL_H_ | 6469 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |