Index: src/runtime.js |
diff --git a/src/runtime.js b/src/runtime.js |
index 25825d78131935a43c94a234d6c400e0c29f85c9..f7c91d3cc20e4130c4c6b20c46fe1c94483de68c 100644 |
--- a/src/runtime.js |
+++ b/src/runtime.js |
@@ -44,6 +44,7 @@ |
var SAR_STRONG; |
var SHR; |
var SHR_STRONG; |
+var IN; |
var INSTANCE_OF; |
var CALL_NON_FUNCTION; |
var CALL_NON_FUNCTION_AS_CONSTRUCTOR; |
@@ -482,6 +483,21 @@ |
----------------------------- |
*/ |
+// ECMA-262, section 11.8.7, page 54. |
+IN = function IN(x) { |
+ if (!IS_SPEC_OBJECT(x)) { |
+ throw %MakeTypeError(kInvalidInOperatorUse, this, x); |
+ } |
+ if (%_IsNonNegativeSmi(this)) { |
+ if (IS_ARRAY(x) && %_HasFastPackedElements(x)) { |
+ return this < x.length; |
+ } |
+ return %HasElement(x, this); |
+ } |
+ return %HasProperty(x, %$toName(this)); |
+} |
+ |
+ |
// ECMA-262, section 11.8.6, page 54. To make the implementation more |
// efficient, the return value should be zero if the 'this' is an |
// instance of F, and non-zero if not. This makes it possible to avoid |