| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index e56c917bd4b8cca5e44d5fc2a71ba443b7254e6a..2d100529ea59b1d350bf671f0b49b71aca03f919 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -6666,7 +6666,6 @@ bool JSObject::HasElementPostInterceptor(JSObject* receiver, uint32_t index) {
|
| break;
|
| }
|
| case PIXEL_ELEMENTS: {
|
| - // TODO(iposva): Add testcase.
|
| PixelArray* pixels = PixelArray::cast(elements());
|
| if (index < static_cast<uint32_t>(pixels->length())) {
|
| return true;
|
| @@ -6680,7 +6679,6 @@ bool JSObject::HasElementPostInterceptor(JSObject* receiver, uint32_t index) {
|
| case EXTERNAL_INT_ELEMENTS:
|
| case EXTERNAL_UNSIGNED_INT_ELEMENTS:
|
| case EXTERNAL_FLOAT_ELEMENTS: {
|
| - // TODO(kbr): Add testcase.
|
| ExternalArray* array = ExternalArray::cast(elements());
|
| if (index < static_cast<uint32_t>(array->length())) {
|
| return true;
|
| @@ -7271,11 +7269,7 @@ MaybeObject* JSObject::GetElementPostInterceptor(Object* receiver,
|
| }
|
| break;
|
| }
|
| - case PIXEL_ELEMENTS: {
|
| - // TODO(iposva): Add testcase and implement.
|
| - UNIMPLEMENTED();
|
| - break;
|
| - }
|
| + case PIXEL_ELEMENTS:
|
| case EXTERNAL_BYTE_ELEMENTS:
|
| case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
|
| case EXTERNAL_SHORT_ELEMENTS:
|
| @@ -7283,8 +7277,8 @@ MaybeObject* JSObject::GetElementPostInterceptor(Object* receiver,
|
| case EXTERNAL_INT_ELEMENTS:
|
| case EXTERNAL_UNSIGNED_INT_ELEMENTS:
|
| case EXTERNAL_FLOAT_ELEMENTS: {
|
| - // TODO(kbr): Add testcase and implement.
|
| - UNIMPLEMENTED();
|
| + MaybeObject* value = GetExternalElement(index);
|
| + if (!value->ToObjectUnchecked()->IsUndefined()) return value;
|
| break;
|
| }
|
| case DICTIONARY_ELEMENTS: {
|
| @@ -7372,6 +7366,46 @@ MaybeObject* JSObject::GetElementWithReceiver(Object* receiver,
|
| }
|
| break;
|
| }
|
| + case PIXEL_ELEMENTS:
|
| + 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: {
|
| + MaybeObject* value = GetExternalElement(index);
|
| + if (!value->ToObjectUnchecked()->IsUndefined()) return value;
|
| + break;
|
| + }
|
| + case DICTIONARY_ELEMENTS: {
|
| + NumberDictionary* dictionary = element_dictionary();
|
| + int entry = dictionary->FindEntry(index);
|
| + if (entry != NumberDictionary::kNotFound) {
|
| + Object* element = dictionary->ValueAt(entry);
|
| + PropertyDetails details = dictionary->DetailsAt(entry);
|
| + if (details.type() == CALLBACKS) {
|
| + return GetElementWithCallback(receiver,
|
| + element,
|
| + index,
|
| + this);
|
| + }
|
| + return element;
|
| + }
|
| + break;
|
| + }
|
| + }
|
| +
|
| + Object* pt = GetPrototype();
|
| + if (pt == Heap::null_value()) return Heap::undefined_value();
|
| + return pt->GetElementWithReceiver(receiver, index);
|
| +}
|
| +
|
| +
|
| +MaybeObject* JSObject::GetExternalElement(uint32_t index) {
|
| + // Get element works for both JSObject and JSArray since
|
| + // JSArray::length cannot change.
|
| + switch (GetElementsKind()) {
|
| case PIXEL_ELEMENTS: {
|
| PixelArray* pixels = PixelArray::cast(elements());
|
| if (index < static_cast<uint32_t>(pixels->length())) {
|
| @@ -7439,27 +7473,12 @@ MaybeObject* JSObject::GetElementWithReceiver(Object* receiver,
|
| }
|
| break;
|
| }
|
| - case DICTIONARY_ELEMENTS: {
|
| - NumberDictionary* dictionary = element_dictionary();
|
| - int entry = dictionary->FindEntry(index);
|
| - if (entry != NumberDictionary::kNotFound) {
|
| - Object* element = dictionary->ValueAt(entry);
|
| - PropertyDetails details = dictionary->DetailsAt(entry);
|
| - if (details.type() == CALLBACKS) {
|
| - return GetElementWithCallback(receiver,
|
| - element,
|
| - index,
|
| - this);
|
| - }
|
| - return element;
|
| - }
|
| + case FAST_ELEMENTS:
|
| + case DICTIONARY_ELEMENTS:
|
| + UNREACHABLE();
|
| break;
|
| - }
|
| }
|
| -
|
| - Object* pt = GetPrototype();
|
| - if (pt == Heap::null_value()) return Heap::undefined_value();
|
| - return pt->GetElementWithReceiver(receiver, index);
|
| + return Heap::undefined_value();
|
| }
|
|
|
|
|
|
|