Bug 154685

Summary: B3 should have a DoubleToInt that takes a list of exceptional values
Product: WebKit Reporter: Filip Pizlo <fpizlo>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: benjamin
Priority: P2    
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 154319    

Filip Pizlo
Reported 2016-02-25 10:58:16 PST
Different hardware returns different results for double-to-int failure. Because of that, we avoided adding DoubleToInt as an opcode in B3. But we could add a DoubleToInt opcode that has this syntax: @result = DoubleToInt(@input, @negOverflow, @posOverflow, @negNaN, @posNaN) Where: - @negOverflow is the value we return if @input is smaller than INT_MIN. - @posOverflow is the value we return if @input is larger than INT_MAX. - @negNaN is the value we return if @input is negative NaN. - @posNaN is the value we return if @input is positive NaN. Collectively these are the failure codes. This means that the client could request that B3 emulates any kind of hardware doubleToInt operation. If you want X86 behavior, you pass INT_MIN for all of the failure codes. On ARM64, we would pass either INT_MIN or INT_MAX depending on whether it's positive or negative.
Attachments
Filip Pizlo
Comment 1 2016-02-25 10:59:50 PST
This was @titzer's idea for making wasm d2i trap-free. It's super profitable for wasm to do this. We don't *need* to do this in B3 since we can d2i using a patchpoint, but it would probably be a progression.
Note You need to log in before you can comment on or make changes to this bug.