Recognize special comparisons via pattern matching on the hydrogen graph.
authorsvenpanne@chromium.org <svenpanne@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 13 Oct 2011 15:07:28 +0000 (15:07 +0000)
committersvenpanne@chromium.org <svenpanne@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 13 Oct 2011 15:07:28 +0000 (15:07 +0000)
commitbaa29ebafa1cee7853b7de933f2852e3912b1c66
tree8cc949ed73cdbdaa60785e02fa489ff796200938
parentba981deab03aa52fbef093bc7a3c083f36a2b7e4
Recognize special comparisons via pattern matching on the hydrogen graph.

Previously, comparisons against null/undefined and comparisons of the result of
typeof against a constant string were done syntactically. Now we do this via
pattern matching on the hydrogen graph, which opens up more opportunities for
better code generation, e.g. the following comparisons are now recognized to be
special:

   var bar = typeof foo;
   var baz = "undefined";
   if (bar == baz) ...

   var blah = undefined;
   if (hurz == blah) ...

If we did this handling of special cases even later at lithium generation time,
even more cases could be recognized, but this would involve bigger changes and
this CL handles most common cases.
Review URL: http://codereview.chromium.org/8242002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9612 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
src/hydrogen.cc
src/hydrogen.h