Index: src/runtime/runtime-array.cc |
diff --git a/src/runtime/runtime-array.cc b/src/runtime/runtime-array.cc |
index 5a6bba424b78ca73c0902e41e7f2c8038ff2072b..c3a6d80ecf5ba422f0a2ff1ffa632a4cb5bd1269 100644 |
--- a/src/runtime/runtime-array.cc |
+++ b/src/runtime/runtime-array.cc |
@@ -1043,6 +1043,30 @@ RUNTIME_FUNCTION(Runtime_NormalizeElements) { |
} |
+RUNTIME_FUNCTION(Runtime_HasComplexElements) { |
+ HandleScope scope(isolate); |
+ DCHECK(args.length() == 1); |
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0); |
+ for (PrototypeIterator iter(isolate, array, |
+ PrototypeIterator::START_AT_RECEIVER); |
+ !iter.IsAtEnd(); iter.Advance()) { |
+ if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { |
+ return isolate->heap()->true_value(); |
+ } |
+ Handle<JSObject> current = |
+ Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)); |
+ if (current->HasIndexedInterceptor()) { |
+ return isolate->heap()->true_value(); |
+ } |
+ if (!current->HasDictionaryElements()) continue; |
+ if (current->element_dictionary()->HasComplexElements()) { |
+ return isolate->heap()->true_value(); |
+ } |
+ } |
+ return isolate->heap()->false_value(); |
+} |
+ |
+ |
// TODO(dcarney): remove this function when TurboFan supports it. |
// Takes the object to be iterated over and the result of GetPropertyNamesFast |
// Returns pair (cache_array, cache_type). |