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 5065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5076 return JSProxy::cast(this)->HasPropertyWithHandler(name); | 5076 return JSProxy::cast(this)->HasPropertyWithHandler(name); |
5077 } | 5077 } |
5078 return GetLocalPropertyAttribute(name) != ABSENT; | 5078 return GetLocalPropertyAttribute(name) != ABSENT; |
5079 } | 5079 } |
5080 | 5080 |
5081 | 5081 |
5082 PropertyAttributes JSReceiver::GetPropertyAttribute(String* key) { | 5082 PropertyAttributes JSReceiver::GetPropertyAttribute(String* key) { |
5083 return GetPropertyAttributeWithReceiver(this, key); | 5083 return GetPropertyAttributeWithReceiver(this, key); |
5084 } | 5084 } |
5085 | 5085 |
| 5086 |
| 5087 PropertyAttributes JSReceiver::GetElementAttribute(uint32_t index) { |
| 5088 return GetElementAttributeWithReceiver(this, index, true); |
| 5089 } |
| 5090 |
| 5091 |
5086 // TODO(504): this may be useful in other places too where JSGlobalProxy | 5092 // TODO(504): this may be useful in other places too where JSGlobalProxy |
5087 // is used. | 5093 // is used. |
5088 Object* JSObject::BypassGlobalProxy() { | 5094 Object* JSObject::BypassGlobalProxy() { |
5089 if (IsJSGlobalProxy()) { | 5095 if (IsJSGlobalProxy()) { |
5090 Object* proto = GetPrototype(); | 5096 Object* proto = GetPrototype(); |
5091 if (proto->IsNull()) return GetHeap()->undefined_value(); | 5097 if (proto->IsNull()) return GetHeap()->undefined_value(); |
5092 ASSERT(proto->IsJSGlobalObject()); | 5098 ASSERT(proto->IsJSGlobalObject()); |
5093 return proto; | 5099 return proto; |
5094 } | 5100 } |
5095 return this; | 5101 return this; |
5096 } | 5102 } |
5097 | 5103 |
5098 | 5104 |
5099 MaybeObject* JSReceiver::GetIdentityHash(CreationFlag flag) { | 5105 MaybeObject* JSReceiver::GetIdentityHash(CreationFlag flag) { |
5100 return IsJSProxy() | 5106 return IsJSProxy() |
5101 ? JSProxy::cast(this)->GetIdentityHash(flag) | 5107 ? JSProxy::cast(this)->GetIdentityHash(flag) |
5102 : JSObject::cast(this)->GetIdentityHash(flag); | 5108 : JSObject::cast(this)->GetIdentityHash(flag); |
5103 } | 5109 } |
5104 | 5110 |
5105 | 5111 |
5106 bool JSReceiver::HasElement(uint32_t index) { | 5112 bool JSReceiver::HasElement(uint32_t index) { |
5107 if (IsJSProxy()) { | 5113 if (IsJSProxy()) { |
5108 return JSProxy::cast(this)->HasElementWithHandler(index); | 5114 return JSProxy::cast(this)->HasElementWithHandler(index); |
5109 } | 5115 } |
5110 return JSObject::cast(this)->HasElementWithReceiver(this, index); | 5116 return JSObject::cast(this)->HasElementWithReceiver(this, index); |
5111 } | 5117 } |
5112 | 5118 |
5113 | 5119 |
| 5120 bool JSReceiver::HasLocalElement(uint32_t index) { |
| 5121 if (IsJSProxy()) { |
| 5122 return JSProxy::cast(this)->HasElementWithHandler(index); |
| 5123 } |
| 5124 return JSObject::cast(this)->HasLocalElement(index); |
| 5125 } |
| 5126 |
| 5127 |
| 5128 PropertyAttributes JSReceiver::GetElementAttributeWithReceiver( |
| 5129 JSReceiver* receiver, uint32_t index, bool continue_search) { |
| 5130 if (IsJSProxy()) { |
| 5131 return JSProxy::cast(this)->GetElementAttributeWithHandler(receiver, index); |
| 5132 } |
| 5133 return JSObject::cast(this)->GetElementAttributeWithReceiver( |
| 5134 receiver, index, continue_search); |
| 5135 } |
| 5136 |
| 5137 |
| 5138 PropertyAttributes JSReceiver::GetLocalElementAttribute(uint32_t index) { |
| 5139 if (IsJSProxy()) { |
| 5140 return JSProxy::cast(this)->GetElementAttributeWithHandler(this, index); |
| 5141 } |
| 5142 return JSObject::cast(this)->GetElementAttributeWithReceiver( |
| 5143 this, index, false); |
| 5144 } |
| 5145 |
| 5146 |
5114 bool AccessorInfo::all_can_read() { | 5147 bool AccessorInfo::all_can_read() { |
5115 return BooleanBit::get(flag(), kAllCanReadBit); | 5148 return BooleanBit::get(flag(), kAllCanReadBit); |
5116 } | 5149 } |
5117 | 5150 |
5118 | 5151 |
5119 void AccessorInfo::set_all_can_read(bool value) { | 5152 void AccessorInfo::set_all_can_read(bool value) { |
5120 set_flag(BooleanBit::set(flag(), kAllCanReadBit, value)); | 5153 set_flag(BooleanBit::set(flag(), kAllCanReadBit, value)); |
5121 } | 5154 } |
5122 | 5155 |
5123 | 5156 |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5559 #undef WRITE_UINT32_FIELD | 5592 #undef WRITE_UINT32_FIELD |
5560 #undef READ_SHORT_FIELD | 5593 #undef READ_SHORT_FIELD |
5561 #undef WRITE_SHORT_FIELD | 5594 #undef WRITE_SHORT_FIELD |
5562 #undef READ_BYTE_FIELD | 5595 #undef READ_BYTE_FIELD |
5563 #undef WRITE_BYTE_FIELD | 5596 #undef WRITE_BYTE_FIELD |
5564 | 5597 |
5565 | 5598 |
5566 } } // namespace v8::internal | 5599 } } // namespace v8::internal |
5567 | 5600 |
5568 #endif // V8_OBJECTS_INL_H_ | 5601 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |