Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Unified Diff: src/objects.cc

Issue 726773002: Throw as per spec when modifying an Array with builtin methods (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {
adamk 2014/11/13 23:43:29 Should this just delegate to IsReadOnlyLengthDescr
Michael Starzinger 2014/11/14 17:00:22 Acknowledged. I chatted with Toon about this, sema
adamk 2014/11/14 19:13:19 Thanks for the background, added a TODO.
+ 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;
}

Powered by Google App Engine
This is Rietveld 408576698