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

Unified Diff: src/objects.cc

Issue 1517073003: Fix^2 HasEnumerableElements (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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.cc
diff --git a/src/objects.cc b/src/objects.cc
index d5e8b73ef26b72c4e3eea0f5d097c1fb2b56db55..e25e7f10de1697dfa2d9b21e1bbda6407e688d2e 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -7985,8 +7985,9 @@ bool HasEnumerableElements(JSObject* object) {
case FAST_SMI_ELEMENTS:
case FAST_ELEMENTS:
case FAST_DOUBLE_ELEMENTS: {
- DCHECK(object->IsJSArray());
- int length = Smi::cast(JSArray::cast(object)->length())->value();
+ int length = object->IsJSArray()
+ ? Smi::cast(JSArray::cast(object)->length())->value()
+ : object->elements()->length();
return length > 0;
}
case FAST_HOLEY_SMI_ELEMENTS:
« 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