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

Unified Diff: src/objects.cc

Issue 1515963002: Fix mix-up in 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 | test/mjsunit/regress/regress-crbug-568525.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 bef6dba7932e0297f3471f22b7829395c6379a24..952fe8ee11045a8f9e4eba57d923858eaf688e7a 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -7985,9 +7985,8 @@ bool HasEnumerableElements(JSObject* object) {
case FAST_SMI_ELEMENTS:
case FAST_ELEMENTS:
case FAST_DOUBLE_ELEMENTS: {
- int length = object->IsJSArray()
- ? Smi::cast(JSArray::cast(object)->length())->value()
- : object->elements()->length();
+ DCHECK(object->IsJSArray());
+ int length = Smi::cast(JSArray::cast(object)->length())->value();
Toon Verwaest 2015/12/10 21:15:54 This is not guaranteed; sloppy argument objects ar
Jakob Kummerow 2015/12/11 09:47:24 Thanks -> https://codereview.chromium.org/15170730
return length > 0;
}
case FAST_HOLEY_SMI_ELEMENTS:
@@ -8003,8 +8002,9 @@ bool HasEnumerableElements(JSObject* object) {
}
case FAST_HOLEY_DOUBLE_ELEMENTS: {
FixedDoubleArray* elements = FixedDoubleArray::cast(object->elements());
- DCHECK(object->IsJSArray());
- int length = Smi::cast(JSArray::cast(object)->length())->value();
+ int length = object->IsJSArray()
+ ? Smi::cast(JSArray::cast(object)->length())->value()
+ : elements->length();
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-568525.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698