Index: src/elements.cc |
diff --git a/src/elements.cc b/src/elements.cc |
index 715ecfb60a5fd5deb1d967449f8b38aab7385036..0798918b89531226d1ca96cf29aed97b53e258de 100644 |
--- a/src/elements.cc |
+++ b/src/elements.cc |
@@ -942,8 +942,12 @@ class ElementsAccessorBase : public ElementsAccessor { |
? index |
: kMaxUInt32; |
} else { |
- Smi* smi_length = Smi::cast(JSArray::cast(holder)->length()); |
- uint32_t length = static_cast<uint32_t>(smi_length->value()); |
+ uint32_t length = |
+ holder->IsJSArray() |
+ ? static_cast<uint32_t>( |
+ Smi::cast(JSArray::cast(holder)->length())->value()) |
+ : ElementsAccessorSubclass::GetCapacityImpl(holder, |
+ backing_store); |
return index < length ? index : kMaxUInt32; |
} |
} |