Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index f3e7471c07b74a43421ae1c90f110d9374211ec5..36b0f9fea8c686ea36684f0ef8d0816643e7dddd 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -11555,64 +11555,14 @@ bool JSObject::HasRealNamedProperty(Name* key) { |
bool JSObject::HasRealElementProperty(uint32_t index) { |
// Check access rights if needed. |
if (IsAccessCheckNeeded()) { |
- Heap* heap = GetHeap(); |
- if (!heap->isolate()->MayIndexedAccess(this, index, v8::ACCESS_HAS)) { |
- heap->isolate()->ReportFailedAccessCheck(this, v8::ACCESS_HAS); |
+ Isolate* isolate = GetIsolate(); |
Toon Verwaest
2013/04/04 13:06:17
Since this function is only called from the API, w
adamk
2013/04/04 19:09:47
Done, and added the Isolate argument to the other
|
+ if (!isolate->MayIndexedAccess(this, index, v8::ACCESS_HAS)) { |
+ isolate->ReportFailedAccessCheck(this, v8::ACCESS_HAS); |
return false; |
} |
} |
- // Handle [] on String objects. |
- if (this->IsStringObjectWithCharacterAt(index)) return true; |
- |
- switch (GetElementsKind()) { |
- case FAST_SMI_ELEMENTS: |
- case FAST_ELEMENTS: |
- case FAST_HOLEY_SMI_ELEMENTS: |
- case FAST_HOLEY_ELEMENTS: { |
- uint32_t length = IsJSArray() ? |
- static_cast<uint32_t>( |
- Smi::cast(JSArray::cast(this)->length())->value()) : |
- static_cast<uint32_t>(FixedArray::cast(elements())->length()); |
- return (index < length) && |
- !FixedArray::cast(elements())->get(index)->IsTheHole(); |
- } |
- case FAST_DOUBLE_ELEMENTS: |
- case FAST_HOLEY_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()); |
- return (index < length) && |
- !FixedDoubleArray::cast(elements())->is_the_hole(index); |
- break; |
- } |
- case EXTERNAL_PIXEL_ELEMENTS: { |
- ExternalPixelArray* pixels = ExternalPixelArray::cast(elements()); |
- return index < static_cast<uint32_t>(pixels->length()); |
- } |
- 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()); |
- return index < static_cast<uint32_t>(array->length()); |
- } |
- case DICTIONARY_ELEMENTS: { |
- return element_dictionary()->FindEntry(index) |
- != SeededNumberDictionary::kNotFound; |
- } |
- case NON_STRICT_ARGUMENTS_ELEMENTS: |
- UNIMPLEMENTED(); |
- break; |
- } |
- // All possibilities have been handled above already. |
- UNREACHABLE(); |
- return GetHeap()->null_value(); |
+ return GetElementAttributeWithoutInterceptor(this, index, false) != ABSENT; |
} |