Cleanup of constant optimization

This commit cleans up constant optimization from the review of
https://github.com/scala/scala/pull/2214 .

* drops are done using the instruction's consumed count rather than a
  numeric literal
* One instance of x.length > y.length is replaced with
  x.lengthCompare(y.length) > 0
* NaN is dealt with by avoiding pointer equality and
  explicitly checking for NaN.
* A test is added to make sure NaN semantics aren't broken.
* The constant-optmization test is improved with tests for switch
  statements