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

Unified Diff: src/objects-debug.cc

Issue 2501303002: [heap-verify] Allow for temporary invalid array length for slow elements (Closed)
Patch Set: fixing of by one Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-debug.cc
diff --git a/src/objects-debug.cc b/src/objects-debug.cc
index 09be2682e252c599f16014a06aa725c38120cfec..2580bfb397d80640de18c5840c5e376fd9b5010c 100644
--- a/src/objects-debug.cc
+++ b/src/objects-debug.cc
@@ -785,12 +785,19 @@ void JSArray::JSArrayVerify() {
elements() == isolate->heap()->empty_fixed_array());
} else {
CHECK(HasDictionaryElements());
- uint32_t size;
- CHECK(length()->ToArrayLength(&size));
- if (size != 0) {
+ uint32_t array_length;
+ CHECK(length()->ToArrayLength(&array_length));
+ if (array_length == 0xffffffff) {
+ CHECK(length()->ToArrayLength(&array_length));
+ }
+ if (array_length != 0) {
SeededNumberDictionary* dict = SeededNumberDictionary::cast(elements());
- // The dictionary can never have more elements than the array length.
- CHECK(static_cast<uint32_t>(dict->NumberOfElements()) <= size);
+ // The dictionary can never have more elements than the array length + 1.
+ // If the backing store grows the verification might be triggered with
+ // the old length in place.
+ uint32_t nof_elements = static_cast<uint32_t>(dict->NumberOfElements());
+ if (nof_elements != 0) nof_elements--;
+ CHECK_LE(nof_elements, array_length);
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698