Updates:
Summary: Add fast path for smis to Number.isInteger()
Comment #6 on issue 3696 by [email protected]: Add fast path for smis
to Number.isInteger()
https://code.google.com/p/v8/issues/detail?id=3696
I don't think this is related to compiler architectures. The reason for not
doing it in Crankshaft is simply that Crankshaft is deprecated.
By my "it's hard" comment I meant that it's hard for compilers in general
to guess programmer intent.
Sure, we could pattern-match "comparison of a float with a truncating
to-int32 conversion of the same float", but that's what I described as "a
very specific hack [for] just this one pattern". What if someone writes "(x
<< 0) === x"? "(x >>> 0) === x"? "(x & x) === x"? "parseInt(x) ===
x"? "Math.min(Math.round(x), Math.pow(2, 31)) === x"? "x - Math.round(x)
=== 0"? Where do you draw the line?
To solve the general problem, the compiler would need a way to prove that a
given instruction sequence can be bypassed by some fast path, which is
guaranteed to provide the same result for the cases where it is taken.
Sounds next to impossible, unless you want to restrict it to a hand-picked
set of patterns.
That's why I pointed to Number.isInteger. When you use a language feature
or builtin, the VM knows exactly what you want to do, and can provide an
efficient implementation[*], which in this particular case would even be
compiler independent.
[*] Unless the language feature's specification demands crazy/slow
semantics, which is the case often enough.
Updating the issue description to make it clear what I think the action
item is.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.