Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index d48a30d8abc922dc4966c3d5e5413d7207f27f1c..27f5e3640cdf63d1dbbcbe9f7d3d4695ad09c325 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -13097,18 +13097,21 @@ bool JSArray::IsReadOnlyLengthDescriptor(Handle<Map> jsarray_map) { |
} |
+bool JSArray::HasReadOnlyLength(Handle<JSArray> array) { |
+ LookupIterator it(array, array->GetIsolate()->factory()->length_string(), |
+ LookupIterator::OWN_SKIP_INTERCEPTOR); |
+ CHECK_NE(LookupIterator::ACCESS_CHECK, it.state()); |
+ CHECK(it.IsFound()); |
+ CHECK_EQ(LookupIterator::ACCESSOR, it.state()); |
+ return it.IsReadOnly(); |
+} |
+ |
+ |
bool JSArray::WouldChangeReadOnlyLength(Handle<JSArray> array, |
uint32_t index) { |
uint32_t length = 0; |
CHECK(array->length()->ToArrayIndex(&length)); |
- if (length <= index) { |
- LookupIterator it(array, array->GetIsolate()->factory()->length_string(), |
- LookupIterator::OWN_SKIP_INTERCEPTOR); |
- CHECK_NE(LookupIterator::ACCESS_CHECK, it.state()); |
- CHECK(it.IsFound()); |
- CHECK_EQ(LookupIterator::ACCESSOR, it.state()); |
- return it.IsReadOnly(); |
- } |
+ if (length <= index) return HasReadOnlyLength(array); |
return false; |
} |