[Webkit-unassigned] [Bug 94779] To reduce cost of converting type during modulo for integers

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 18 00:53:01 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=94779





--- Comment #22 from Filip Pizlo <fpizlo at apple.com>  2012-09-18 00:53:31 PST ---
(In reply to comment #21)
> (In reply to comment #20)
> > (In reply to comment #19)
> > > (In reply to comment #18)
> > > > (In reply to comment #17)
> > > > > (In reply to comment #16)
> > > > > I prefer a browser that doesn't crash over a browser that computes prime numbers quickly.
> > > > 
> > > > I totally agree with your thought. I'm appreciated for your comment.
> > > 
> > > I figured out why the crash didn't occur on my device. That's because of the compile optimization level.
> > 
> > I'm curious about this.  Can you share more details?
> > 
> > For me, here's what I see:
> > 
> > If I make it obvious to my compiler (clang+llvm) what the constants are in the modulo operation, like so:
> 
> Now I'm using gcc.
> 
> > 
> > int a = -2147483647 - 1;
> > int b = -1;
> > return a % b; // a and b are known constants
> > 
> > Then I only crash when optimizations are disabled.  With optimizations, I do get a garbage result, however.
> > 
> 
> It's same as yours without optimizations but with optimizations I can get the right result, zero.
> 
> > But if I make it non-obvious, such as in my test program that I attached, by virtue of the fact that the integers a and b are parsed from the command-line, then I do crash on (-2^31)%-1, regardless of optimization level.
> > 
> 
> non-obvious case is same as yours. 

Strange.  That would imply that integer-division-neg2tothe32-by-neg1.js should have crashed.

Can you try the following program:

function notInlineable(a, b) {
    function foo() { } // use this to force-disable inlining
    return [foo, a % b];
}

for (var i = 0; i < 1000; ++i)
    print(notInlineable(-2147483648, -1));

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list