TIL: Why ARM Has a JavaScript Instruction

ARM has this very specific instruction, FJCVTZS, doing "Floating-point Javascript Convert to Signed fixed-point, rounding toward Zero". For example, it converts Float64(42.99) to Int32(42). JavaScript uses double-precision floating-point (Float64) for all numbers (i.e., of type number). Yet many operations require 32-bit integers: bitwise operations, array indexing, typed array access. The…