• svenpanne@chromium.org's avatar
    Unify the handling of comparinsons against null and undefined. · cf63503c
    svenpanne@chromium.org authored
    Although this patch is not small, most parts of it are rather mechanical:
    
     * First of all, the concept of a 'nil-like' value is introduced, which can be
       null or undefined. They are treated symmetrically regarding comparisons, so
       it makes sense to handle them in a uniform manner. It is a mystery why
       JavaScript defines two of those beasts, when even *one* is a design wart...
    
     * Extended and renamed a few things which now handle undefined in addition to
       null.
    
     * Made the parts of the full code generator and the hydrogen generation which
       deal with comparisons a bit more similar regarding their handling of special
       cases.
    
     * Refactored the syntactical detection of special cases for comparisons,
       hopefully making them a bit more readable and less copy-n-paste-oriented.
       Things like this should really be a one-liner in any sane programming
       language... :-P
    
     * Cut down the length of the argument lists of a few functions to something
       less insane, making them more easily understandable locally. This involves
       minor code duplication, but this was a good tradeoff and can be remedied
       later if necessary.
    
     * Replaced some boolean arguments with more readable enums.
    
     * Fixed a TODO: Values which are definitely a Smi or unboxed can never be equal
       to null or undefined.
    Review URL: http://codereview.chromium.org/7918012
    
    git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9323 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
    cf63503c
token.h 14.1 KB