Bug 168789 - B3 should have a sane double-to-int opcode that behaves like JS
Summary: B3 should have a sane double-to-int opcode that behaves like JS
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-23 11:02 PST by Filip Pizlo
Modified: 2017-02-23 13:00 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2017-02-23 11:02:55 PST
This way, B3 could constant-fold silly cases of this.  Also, it can be instruction-selected very nicely on some CPUs.
Comment 1 Filip Pizlo 2017-02-23 11:03:40 PST
Check out how badly we compile this:

function foo(a) {
    a[0] = -1.0;
}

noInline(foo);

var a = new Int8Array(1);
for (var i = 0; i < 10000; ++i)
    foo(a);

We emit awful code in FTL for the "a[0] = -1.0" statement.
Comment 2 Saam Barati 2017-02-23 13:00:49 PST
(In reply to comment #0)
> This way, B3 could constant-fold silly cases of this.  Also, it can be
> instruction-selected very nicely on some CPUs.

Nice!