Minor cleanup and optimisation of element methods.
R=verwaest@chromium.org BUG= Review URL: https://codereview.chromium.org/11365175 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12927 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
4cca6c6081
commit
92e783bc28
@ -528,9 +528,8 @@ class ElementsAccessorBase : public ElementsAccessor {
|
||||
JSObject* holder,
|
||||
uint32_t key,
|
||||
BackingStore* backing_store) {
|
||||
MaybeObject* element =
|
||||
ElementsAccessorSubclass::GetImpl(receiver, holder, key, backing_store);
|
||||
return !element->IsTheHole();
|
||||
return ElementsAccessorSubclass::GetAttributesImpl(
|
||||
receiver, holder, key, backing_store) != ABSENT;
|
||||
}
|
||||
|
||||
virtual bool HasElement(Object* receiver,
|
||||
|
@ -5046,7 +5046,11 @@ PropertyAttributes JSReceiver::GetPropertyAttribute(String* key) {
|
||||
|
||||
|
||||
PropertyAttributes JSReceiver::GetElementAttribute(uint32_t index) {
|
||||
return GetElementAttributeWithReceiver(this, index, true);
|
||||
if (IsJSProxy()) {
|
||||
return JSProxy::cast(this)->GetElementAttributeWithHandler(this, index);
|
||||
}
|
||||
return JSObject::cast(this)->GetElementAttributeWithReceiver(
|
||||
this, index, true);
|
||||
}
|
||||
|
||||
|
||||
@ -5074,7 +5078,8 @@ bool JSReceiver::HasElement(uint32_t index) {
|
||||
if (IsJSProxy()) {
|
||||
return JSProxy::cast(this)->HasElementWithHandler(index);
|
||||
}
|
||||
return JSObject::cast(this)->GetElementAttribute(index) != ABSENT;
|
||||
return JSObject::cast(this)->GetElementAttributeWithReceiver(
|
||||
this, index, true) != ABSENT;
|
||||
}
|
||||
|
||||
|
||||
@ -5082,17 +5087,8 @@ bool JSReceiver::HasLocalElement(uint32_t index) {
|
||||
if (IsJSProxy()) {
|
||||
return JSProxy::cast(this)->HasElementWithHandler(index);
|
||||
}
|
||||
return JSObject::cast(this)->GetLocalElementAttribute(index) != ABSENT;
|
||||
}
|
||||
|
||||
|
||||
PropertyAttributes JSReceiver::GetElementAttributeWithReceiver(
|
||||
JSReceiver* receiver, uint32_t index, bool continue_search) {
|
||||
if (IsJSProxy()) {
|
||||
return JSProxy::cast(this)->GetElementAttributeWithHandler(receiver, index);
|
||||
}
|
||||
return JSObject::cast(this)->GetElementAttributeWithReceiver(
|
||||
receiver, index, continue_search);
|
||||
this, index, false) != ABSENT;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3318,7 +3318,7 @@ PropertyAttributes JSObject::GetElementAttributeWithReceiver(
|
||||
Object* proto = GetPrototype();
|
||||
if (proto->IsNull()) return ABSENT;
|
||||
ASSERT(proto->IsJSGlobalObject());
|
||||
return JSReceiver::cast(proto)->GetElementAttributeWithReceiver(
|
||||
return JSObject::cast(proto)->GetElementAttributeWithReceiver(
|
||||
receiver, index, continue_search);
|
||||
}
|
||||
|
||||
|
@ -1483,10 +1483,6 @@ class JSReceiver: public HeapObject {
|
||||
PropertyAttributes GetLocalPropertyAttribute(String* name);
|
||||
|
||||
inline PropertyAttributes GetElementAttribute(uint32_t index);
|
||||
inline PropertyAttributes GetElementAttributeWithReceiver(
|
||||
JSReceiver* receiver,
|
||||
uint32_t index,
|
||||
bool continue_search);
|
||||
inline PropertyAttributes GetLocalElementAttribute(uint32_t index);
|
||||
|
||||
// Can cause a GC.
|
||||
|
Loading…
Reference in New Issue
Block a user