Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The branch always has to be taken if executing JavaScript, because otherwise how would you tell if the value was correct or not? You'd have to calculate it using this method regardless and then compare!


If you always take a branch, it's not a branch.

Or did you mean by "taken" that the branch instruction has to be executed regardless of whether the branch is taken or not?


JavaScript JITs always emit this instruction when ToInt32 is required, since checking would be more expensive in user code. And the instruction always used the JS rounding method, since that's cheaper in silicon. I used branch since the parent used "branch".


What are you defining as correct?


"correct" in this case being consistent with the JavaScript specification.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: