Revision: 3462
Author: [email protected]
Date: Mon Dec 14 04:18:20 2009
Log: Do a fast check for undefined values when comparing.
Review URL: http://codereview.chromium.org/496008
http://code.google.com/p/v8/source/detail?r=3462

Modified:
  /branches/bleeding_edge/src/runtime.js

=======================================
--- /branches/bleeding_edge/src/runtime.js      Wed Dec  2 23:56:21 2009
+++ /branches/bleeding_edge/src/runtime.js      Mon Dec 14 04:18:20 2009
@@ -121,6 +121,12 @@
    if (IS_STRING(this) && IS_STRING(x)) {
      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);

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

Reply via email to