[INFER] Add missing spew for handling static overflows.
authorBrian Hackett <bhackett1024@gmail.com>
Sat, 11 Dec 2010 07:00:37 -0800
changeset 74653 43e322e70e68207fde0cbe4f1081f272a90ca0cf
parent 74652 c247104a1499c8d980a1b8bbf2cf682c25d34df5
child 74654 0462de4a8aa1fcc1addf410df4a305421539b2bd
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
milestone2.0b8pre
[INFER] Add missing spew for handling static overflows.
js/src/jit-test/tests/jaeger/recompile/staticoverflow.js
js/src/methodjit/Compiler.cpp
js/src/methodjit/FastArithmetic.cpp
--- a/js/src/jit-test/tests/jaeger/recompile/staticoverflow.js
+++ b/js/src/jit-test/tests/jaeger/recompile/staticoverflow.js
@@ -1,14 +1,17 @@
 
 // overflows occurring during constant folding
 
 var y = -null - y;
 assertEq(y, NaN);
 
+var x = -(void 0);
+assertEq(x, NaN);
+
 function overdiv() {
   for(var i=0; i<25; i++) {
     var a, b;
     function f() { 
     }
     a = f();
     b = (123 ^ 1) / 1234;
   }
--- a/js/src/methodjit/Compiler.cpp
+++ b/js/src/methodjit/Compiler.cpp
@@ -1302,20 +1302,17 @@ mjit::Compiler::generateMethod()
             if (top->isConstant() && top->getValue().isPrimitive()) {
                 double d;
                 ValueToNumber(cx, top->getValue(), &d);
                 d = -d;
                 Value v = NumberValue(d);
 
                 /* Watch for overflow in constant propagation. */
                 if (!v.isInt32() && knownPushedType(0) == JSVAL_TYPE_INT32) {
-#ifdef JS_METHODJIT_SPEW
-                    JaegerSpew(JSpew_Abort, "overflow in negation (%s line %d)\n",
-                               script->filename, js_PCToLineNumber(cx, script, PC));
-#endif
+                    JaegerSpew(JSpew_Abort, "overflow in negation (%u)\n", PC - script->code);
                     markPushedOverflow(0);
                     return Compile_Overflow;
                 }
 
                 frame.pop();
                 frame.push(v);
             } else {
                 jsop_neg();
--- a/js/src/methodjit/FastArithmetic.cpp
+++ b/js/src/methodjit/FastArithmetic.cpp
@@ -201,16 +201,17 @@ mjit::Compiler::jsop_binary(JSOp op, Voi
 {
     FrameEntry *rhs = frame.peek(-1);
     FrameEntry *lhs = frame.peek(-2);
 
     Value v;
     if (tryBinaryConstantFold(cx, frame, op, lhs, rhs, &v)) {
         if (type == JSVAL_TYPE_INT32 && !v.isInt32()) {
             /* Caller must mark the right type set as having overflowed. */
+            JaegerSpew(JSpew_Abort, "overflow in binary (%u)\n", PC - script->code);
             return false;
         }
         frame.popn(2);
         frame.push(v);
         return true;
     }
 
     /*
@@ -876,16 +877,17 @@ mjit::Compiler::jsop_mod()
     JSValueType type = knownPushedType(0);
 
     FrameEntry *lhs = frame.peek(-2);
     FrameEntry *rhs = frame.peek(-1);
 
     Value v;
     if (tryBinaryConstantFold(cx, frame, JSOP_MOD, lhs, rhs, &v)) {
         if (type == JSVAL_TYPE_INT32 && !v.isInt32()) {
+            JaegerSpew(JSpew_Abort, "overflow in mod (%u)\n", PC - script->code);
             markPushedOverflow(0);
             return false;
         }
         frame.popn(2);
         frame.push(v);
         return true;
     }