LGTM. I would remove the extra newlines because they aren't used in
the other parts of the function though, and maybe add a comment that
the IS_OBJECT check and the %_ObjectEquals call handles the case where
y is null. Alternatively, you could change the

  if (IS_UNDEFINED(y)) return 1;  // not equal

to a

  if (y == null) return 1;  // not equal

Maybe you should measure what works best?

On Fri, Oct 24, 2008 at 8:30 PM,  <[EMAIL PROTECTED]> wrote:
> Reviewers: Kasper Lund,
>
> Description:
> Fast check undefined in EQUALS.
>
>
> Please review this at http://codereview.chromium.org/7979
>
> SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/
>
> Affected files:
>  M     src/runtime.js
>
>
> Index: src/runtime.js
> ===================================================================
> --- src/runtime.js      (revision 592)
> +++ src/runtime.js      (working copy)
> @@ -78,12 +78,16 @@
>       // NOTE: This checks for both null and undefined.
>       return (y == null) ? 0 : 1;
>     } else {
> +      // x is not a number, boolean, null or undefined.
> +      if (IS_UNDEFINED(y)) return 1;  // not equal
> +
>       if (IS_OBJECT(y)) {
>         return %_ObjectEquals(x, y) ? 0 : 1;
>       }
>       if (IS_FUNCTION(y)) {
>         return %_ObjectEquals(x, y) ? 0 : 1;
>       }
> +
>       x = %ToPrimitive(x, NO_HINT);
>     }
>   }
>
>
>

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

Reply via email to