Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 2a7252ca13825355cb715eb2bb5b543e16db838d..2044484b92290511cf4105915b7592cd33eccff2 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -6422,8 +6422,8 @@ MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object, |
FixedArray); |
ASSIGN_RETURN_ON_EXCEPTION( |
isolate, content, |
- FixedArray::AddKeysFromJSArray( |
- content, Handle<JSArray>::cast(names)), |
+ FixedArray::AddKeysFromArrayLike( |
+ content, Handle<JSObject>::cast(names)), |
FixedArray); |
break; |
} |
@@ -6451,12 +6451,12 @@ MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object, |
// Add the element keys from the interceptor. |
if (current->HasIndexedInterceptor()) { |
- Handle<JSArray> result; |
+ Handle<JSObject> result; |
if (JSObject::GetKeysForIndexedInterceptor( |
current, object).ToHandle(&result)) { |
ASSIGN_RETURN_ON_EXCEPTION( |
isolate, content, |
- FixedArray::AddKeysFromJSArray(content, result), |
+ FixedArray::AddKeysFromArrayLike(content, result), |
FixedArray); |
} |
ASSERT(ContainsOnlyValidKeys(content)); |
@@ -6488,12 +6488,12 @@ MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object, |
// Add the property keys from the interceptor. |
if (current->HasNamedInterceptor()) { |
- Handle<JSArray> result; |
+ Handle<JSObject> result; |
if (JSObject::GetKeysForNamedInterceptor( |
current, object).ToHandle(&result)) { |
ASSIGN_RETURN_ON_EXCEPTION( |
isolate, content, |
- FixedArray::AddKeysFromJSArray(content, result), |
+ FixedArray::AddKeysFromArrayLike(content, result), |
FixedArray); |
} |
ASSERT(ContainsOnlyValidKeys(content)); |
@@ -8231,9 +8231,10 @@ void FixedArray::Shrink(int new_length) { |
} |
-MaybeHandle<FixedArray> FixedArray::AddKeysFromJSArray( |
+MaybeHandle<FixedArray> FixedArray::AddKeysFromArrayLike( |
Handle<FixedArray> content, |
- Handle<JSArray> array) { |
+ Handle<JSObject> array) { |
+ ASSERT(array->IsJSArray() || array->HasSloppyArgumentsElements()); |
ElementsAccessor* accessor = array->GetElementsAccessor(); |
Handle<FixedArray> result; |
ASSIGN_RETURN_ON_EXCEPTION( |
@@ -13905,13 +13906,13 @@ MaybeHandle<Object> JSObject::GetPropertyWithInterceptor( |
// Compute the property keys from the interceptor. |
// TODO(rossberg): support symbols in API, and filter here if needed. |
-MaybeHandle<JSArray> JSObject::GetKeysForNamedInterceptor( |
+MaybeHandle<JSObject> JSObject::GetKeysForNamedInterceptor( |
Handle<JSObject> object, Handle<JSReceiver> receiver) { |
Isolate* isolate = receiver->GetIsolate(); |
Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); |
PropertyCallbackArguments |
args(isolate, interceptor->data(), *receiver, *object); |
- v8::Handle<v8::Array> result; |
+ v8::Handle<v8::Object> result; |
if (!interceptor->enumerator()->IsUndefined()) { |
v8::NamedPropertyEnumeratorCallback enum_fun = |
v8::ToCData<v8::NamedPropertyEnumeratorCallback>( |
@@ -13919,9 +13920,10 @@ MaybeHandle<JSArray> JSObject::GetKeysForNamedInterceptor( |
LOG(isolate, ApiObjectAccess("interceptor-named-enum", *object)); |
result = args.Call(enum_fun); |
} |
- if (result.IsEmpty()) return MaybeHandle<JSArray>(); |
+ if (result.IsEmpty()) return MaybeHandle<JSObject>(); |
#if ENABLE_EXTRA_CHECKS |
- CHECK(v8::Utils::OpenHandle(*result)->IsJSObject()); |
+ CHECK(v8::Utils::OpenHandle(*result)->IsJSArray() || |
+ v8::Utils::OpenHandle(*result)->HasSloppyArgumentsElements()); |
#endif |
// Rebox before returning. |
return handle(*v8::Utils::OpenHandle(*result), isolate); |
@@ -13929,13 +13931,13 @@ MaybeHandle<JSArray> JSObject::GetKeysForNamedInterceptor( |
// Compute the element keys from the interceptor. |
-MaybeHandle<JSArray> JSObject::GetKeysForIndexedInterceptor( |
+MaybeHandle<JSObject> JSObject::GetKeysForIndexedInterceptor( |
Handle<JSObject> object, Handle<JSReceiver> receiver) { |
Isolate* isolate = receiver->GetIsolate(); |
Handle<InterceptorInfo> interceptor(object->GetIndexedInterceptor()); |
PropertyCallbackArguments |
args(isolate, interceptor->data(), *receiver, *object); |
- v8::Handle<v8::Array> result; |
+ v8::Handle<v8::Object> result; |
if (!interceptor->enumerator()->IsUndefined()) { |
v8::IndexedPropertyEnumeratorCallback enum_fun = |
v8::ToCData<v8::IndexedPropertyEnumeratorCallback>( |
@@ -13943,9 +13945,10 @@ MaybeHandle<JSArray> JSObject::GetKeysForIndexedInterceptor( |
LOG(isolate, ApiObjectAccess("interceptor-indexed-enum", *object)); |
result = args.Call(enum_fun); |
} |
- if (result.IsEmpty()) return MaybeHandle<JSArray>(); |
+ if (result.IsEmpty()) return MaybeHandle<JSObject>(); |
#if ENABLE_EXTRA_CHECKS |
- CHECK(v8::Utils::OpenHandle(*result)->IsJSObject()); |
+ CHECK(v8::Utils::OpenHandle(*result)->IsJSArray() || |
+ v8::Utils::OpenHandle(*result)->HasSloppyArgumentsElements()); |
#endif |
// Rebox before returning. |
return handle(*v8::Utils::OpenHandle(*result), isolate); |