Index: src/runtime.js |
diff --git a/src/runtime.js b/src/runtime.js |
index 4d15d205a495b6623cf399ccd0dd36973cac22c4..dbb8e45b343370585f836aa1dd70301289575b3c 100644 |
--- a/src/runtime.js |
+++ b/src/runtime.js |
@@ -324,8 +324,13 @@ function IN(x) { |
if (!IS_SPEC_OBJECT(x)) { |
throw %MakeTypeError('invalid_in_operator_use', [this, x]); |
} |
- return %_IsNonNegativeSmi(this) ? |
- %HasElement(x, this) : %HasProperty(x, %ToName(this)); |
+ if (%_IsNonNegativeSmi(this)) { |
+ if (IS_ARRAY(x) && %_HasFastPackedElements(x)) { |
+ return this < x.length; |
+ } |
+ return %HasElement(x, this); |
+ } |
+ return %HasProperty(x, %ToName(this)); |
} |