Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 41b4fd4dbcdb7a8179e912efb007553618a098f9..7c445884e84e6d105748dec040324cd8fce481a4 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -7788,72 +7788,6 @@ MaybeObject* JSReceiver::SetPrototype(Object* value, |
} |
-bool JSObject::HasElementPostInterceptor(JSReceiver* receiver, uint32_t index) { |
- switch (GetElementsKind()) { |
- case FAST_ELEMENTS: { |
- uint32_t length = IsJSArray() ? |
- static_cast<uint32_t> |
- (Smi::cast(JSArray::cast(this)->length())->value()) : |
- static_cast<uint32_t>(FixedArray::cast(elements())->length()); |
- if ((index < length) && |
- !FixedArray::cast(elements())->get(index)->IsTheHole()) { |
- return true; |
- } |
- break; |
- } |
- case FAST_DOUBLE_ELEMENTS: { |
- uint32_t length = IsJSArray() ? |
- static_cast<uint32_t> |
- (Smi::cast(JSArray::cast(this)->length())->value()) : |
- static_cast<uint32_t>(FixedDoubleArray::cast(elements())->length()); |
- if ((index < length) && |
- !FixedDoubleArray::cast(elements())->is_the_hole(index)) { |
- return true; |
- } |
- break; |
- } |
- case EXTERNAL_PIXEL_ELEMENTS: { |
- ExternalPixelArray* pixels = ExternalPixelArray::cast(elements()); |
- if (index < static_cast<uint32_t>(pixels->length())) { |
- return true; |
- } |
- break; |
- } |
- case EXTERNAL_BYTE_ELEMENTS: |
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
- case EXTERNAL_SHORT_ELEMENTS: |
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
- case EXTERNAL_INT_ELEMENTS: |
- case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
- case EXTERNAL_FLOAT_ELEMENTS: |
- case EXTERNAL_DOUBLE_ELEMENTS: { |
- ExternalArray* array = ExternalArray::cast(elements()); |
- if (index < static_cast<uint32_t>(array->length())) { |
- return true; |
- } |
- break; |
- } |
- case DICTIONARY_ELEMENTS: { |
- if (element_dictionary()->FindEntry(index) |
- != NumberDictionary::kNotFound) { |
- return true; |
- } |
- break; |
- } |
- case NON_STRICT_ARGUMENTS_ELEMENTS: |
- UNREACHABLE(); |
- break; |
- } |
- |
- // Handle [] on String objects. |
- if (this->IsStringObjectWithCharacterAt(index)) return true; |
- |
- Object* pt = GetPrototype(); |
- if (pt->IsNull()) return false; |
- return JSObject::cast(pt)->HasElementWithReceiver(receiver, index); |
-} |
- |
- |
bool JSObject::HasElementWithInterceptor(JSReceiver* receiver, uint32_t index) { |
Isolate* isolate = GetIsolate(); |
// Make sure that the top context does not change when doing |
@@ -7893,7 +7827,17 @@ bool JSObject::HasElementWithInterceptor(JSReceiver* receiver, uint32_t index) { |
} |
if (!result.IsEmpty()) return true; |
} |
- return holder_handle->HasElementPostInterceptor(*receiver_handle, index); |
+ |
+ if (holder_handle->GetElementsAccessor()->HasElementAtKey( |
+ holder_handle->elements(), index, *holder_handle, *receiver_handle)) { |
+ return true; |
+ } |
+ |
+ if (holder_handle->IsStringObjectWithCharacterAt(index)) return true; |
+ |
+ Object* pt = holder_handle->GetPrototype(); |
+ if (pt->IsNull()) return false; |
+ return JSObject::cast(pt)->HasElementWithReceiver(*receiver_handle, index); |
} |