Index: src/objects.cc |
=================================================================== |
--- src/objects.cc (revision 2137) |
+++ src/objects.cc (working copy) |
@@ -5203,27 +5203,6 @@ |
} |
-Object* JSObject::SetElementPostInterceptor(uint32_t index, Object* value) { |
- if (HasFastElements()) return SetFastElement(index, value); |
- |
- // Dictionary case. |
- ASSERT(!HasFastElements()); |
- |
- FixedArray* elms = FixedArray::cast(elements()); |
- Object* result = Dictionary::cast(elms)->AtNumberPut(index, value); |
- if (result->IsFailure()) return result; |
- if (elms != FixedArray::cast(result)) { |
- set_elements(FixedArray::cast(result)); |
- } |
- |
- if (IsJSArray()) { |
- return JSArray::cast(this)->JSArrayUpdateLengthFromIndex(index, value); |
- } |
- |
- return value; |
-} |
- |
- |
Object* JSObject::SetElementWithInterceptor(uint32_t index, Object* value) { |
// Make sure that the top context does not change when doing |
// callbacks or interceptor calls. |
@@ -5250,7 +5229,7 @@ |
if (!result.IsEmpty()) return *value_handle; |
} |
Object* raw_result = |
- this_handle->SetElementPostInterceptor(index, *value_handle); |
+ this_handle->SetElementWithoutInterceptor(index, *value_handle); |
RETURN_IF_SCHEDULED_EXCEPTION(); |
return raw_result; |
} |
@@ -5332,6 +5311,11 @@ |
return SetElementWithInterceptor(index, value); |
} |
+ return SetElementWithoutInterceptor(index, value); |
+} |
+ |
+ |
+Object* JSObject::SetElementWithoutInterceptor(uint32_t index, Object* value) { |
// Fast case. |
if (HasFastElements()) return SetFastElement(index, value); |
@@ -5438,7 +5422,21 @@ |
Dictionary* dictionary = element_dictionary(); |
int entry = dictionary->FindNumberEntry(index); |
if (entry != -1) { |
- return dictionary->ValueAt(entry); |
+ Object* element = dictionary->ValueAt(entry); |
+ PropertyDetails details = dictionary->DetailsAt(entry); |
+ if (details.type() == CALLBACKS) { |
+ // Only accessors allowed as elements. |
+ FixedArray* structure = FixedArray::cast(element); |
+ Object* getter = structure->get(kGetterIndex); |
+ if (getter->IsJSFunction()) { |
+ return GetPropertyWithDefinedGetter(receiver, |
+ JSFunction::cast(getter)); |
+ } else { |
+ // Getter is not a function. |
+ return Heap::undefined_value(); |
+ } |
+ } |
+ return element; |
} |
} |