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

Unified Diff: src/runtime.js

Issue 1288923002: Revert of [runtime] Remove useless IN builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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 | « src/hydrogen.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/hydrogen.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698