Reviewers: Mads Ager,

Description:
Do a fast check for undefined values when comparing.

Please review this at http://codereview.chromium.org/496008

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     bleeding_edge/src/runtime.js


Index: bleeding_edge/src/runtime.js
===================================================================
--- bleeding_edge/src/runtime.js        (revision 3458)
+++ bleeding_edge/src/runtime.js        (working copy)
@@ -122,6 +122,12 @@
      return %StringCompare(this, x);
    }

+  // If one of the operands is undefined, it will convert to NaN and
+  // thus the result should be as if one of the operands was NaN.
+  if (IS_UNDEFINED(this) || IS_UNDEFINED(x)) {
+    return ncr;
+  }
+
    // Default implementation.
    var a = %ToPrimitive(this, NUMBER_HINT);
    var b = %ToPrimitive(x, NUMBER_HINT);


-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to