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

Unified Diff: src/objects.cc

Issue 1568863002: Fix^3 cast in HasEnumerableElements (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months 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 | test/mjsunit/regress/regress-crbug-569534.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 4ff0e3404d495930ae65325158c63fee2f3fad89..6d65f48e1acd1318d67efed386cf33269805385d 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -8273,10 +8273,13 @@ bool HasEnumerableElements(JSObject* object) {
return false;
}
case FAST_HOLEY_DOUBLE_ELEMENTS: {
- FixedDoubleArray* elements = FixedDoubleArray::cast(object->elements());
int length = object->IsJSArray()
? Smi::cast(JSArray::cast(object)->length())->value()
- : elements->length();
+ : object->elements()->length();
+ // Zero-length arrays would use the empty FixedArray...
+ if (length == 0) return false;
+ // ...so only cast to FixedDoubleArray otherwise.
+ FixedDoubleArray* elements = FixedDoubleArray::cast(object->elements());
for (int i = 0; i < length; i++) {
if (!elements->is_the_hole(i)) return true;
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-569534.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698