Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index f77800ad1f789cc6d2121e876032408a9a5b25b1..677176f557257cebc4f096991691b4f92311401b 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -5930,21 +5930,24 @@ bool JSObject::HasElementWithInterceptor(JSObject* receiver, uint32_t index) { |
} |
-bool JSObject::HasLocalElement(uint32_t index) { |
+JSObject::LocalElementType JSObject::HasLocalElement(uint32_t index) { |
// Check access rights if needed. |
if (IsAccessCheckNeeded() && |
!Top::MayIndexedAccess(this, index, v8::ACCESS_HAS)) { |
Top::ReportFailedAccessCheck(this, v8::ACCESS_HAS); |
- return false; |
+ return UNDEFINED_ELEMENT; |
} |
// Check for lookup interceptor |
if (HasIndexedInterceptor()) { |
- return HasElementWithInterceptor(this, index); |
+ return HasElementWithInterceptor(this, index) ? INTERCEPTED_ELEMENT |
+ : UNDEFINED_ELEMENT; |
} |
// Handle [] on String objects. |
- if (this->IsStringObjectWithCharacterAt(index)) return true; |
+ if (this->IsStringObjectWithCharacterAt(index)) { |
+ return STRING_CHARACTER_ELEMENT; |
+ } |
switch (GetElementsKind()) { |
case FAST_ELEMENTS: { |
@@ -5952,12 +5955,17 @@ bool JSObject::HasLocalElement(uint32_t index) { |
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(); |
+ if ((index < length) && |
+ !FixedArray::cast(elements())->get(index)->IsTheHole()) { |
+ return FAST_ELEMENT; |
+ } |
+ |
Rico
2010/09/22 15:23:56
remove blank line?
|
+ break; |
} |
case PIXEL_ELEMENTS: { |
PixelArray* pixels = PixelArray::cast(elements()); |
- return (index < static_cast<uint32_t>(pixels->length())); |
+ if (index < static_cast<uint32_t>(pixels->length())) return FAST_ELEMENT; |
+ break; |
} |
case EXTERNAL_BYTE_ELEMENTS: |
case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
@@ -5967,18 +5975,22 @@ bool JSObject::HasLocalElement(uint32_t index) { |
case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
case EXTERNAL_FLOAT_ELEMENTS: { |
ExternalArray* array = ExternalArray::cast(elements()); |
- return (index < static_cast<uint32_t>(array->length())); |
+ if (index < static_cast<uint32_t>(array->length())) return FAST_ELEMENT; |
+ break; |
} |
case DICTIONARY_ELEMENTS: { |
- return element_dictionary()->FindEntry(index) |
- != NumberDictionary::kNotFound; |
+ if (element_dictionary()->FindEntry(index) != |
+ NumberDictionary::kNotFound) { |
+ return DICTIONARY_ELEMENT; |
+ } |
+ break; |
} |
default: |
UNREACHABLE(); |
break; |
} |
- UNREACHABLE(); |
- return Heap::null_value(); |
+ |
+ return UNDEFINED_ELEMENT; |
} |