Bug 838759 - Remove assertJit shell function. r=bhackett
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 07 Feb 2013 10:21:15 +0100
changeset 131802 0431044cf3e6be5bea7d22128171064c99abbdf2
parent 131801 2c929bc0ee9afb2b59f581880c5a842e202fd650
child 131803 cb97c0155552b222453d328bb02f5cd8a2ab0a69
push idunknown
push userunknown
push dateunknown
reviewersbhackett
bugs838759
milestone21.0a1
Bug 838759 - Remove assertJit shell function. r=bhackett
js/src/jit-test/tests/jaeger/bug563000/eif-call-typechange.js
js/src/jit-test/tests/jaeger/bug563000/eif-call.js
js/src/jit-test/tests/jaeger/bug563000/eif-getter-typechange.js
js/src/jit-test/tests/jaeger/bug563000/eif-getter.js
js/src/jit-test/tests/jaeger/bug563000/eif-global-newvar.js
js/src/jit-test/tests/jaeger/bug563000/eif-trap-typechange.js
js/src/jit-test/tests/jaeger/bug563000/eif-trap.js
js/src/jit-test/tests/jaeger/testForOps.js
js/src/jsshell.msg
js/src/shell/js.cpp
--- a/js/src/jit-test/tests/jaeger/bug563000/eif-call-typechange.js
+++ b/js/src/jit-test/tests/jaeger/bug563000/eif-call-typechange.js
@@ -1,14 +1,12 @@
 // |jit-test| mjitalways;debug
 setDebug(true);
 
 function callee() {
-  assertJit();
   evalInFrame(1, "x = 'success'");
 }
 function caller() {
-  assertJit();
   var x = ({ dana : "zuul" });
   callee();
   return x;
 }
 assertEq(caller(), "success");
--- a/js/src/jit-test/tests/jaeger/bug563000/eif-call.js
+++ b/js/src/jit-test/tests/jaeger/bug563000/eif-call.js
@@ -1,14 +1,12 @@
 // |jit-test| mjitalways;debug
 setDebug(true);
 
 function callee() {
-  assertJit();
   evalInFrame(1, "x = 'success'");
 }
 function caller() {
-  assertJit();
   var x = "failure";
   callee();
   return x;
 }
 assertEq(caller(), "success");
--- a/js/src/jit-test/tests/jaeger/bug563000/eif-getter-typechange.js
+++ b/js/src/jit-test/tests/jaeger/bug563000/eif-getter-typechange.js
@@ -1,11 +1,10 @@
 // |jit-test| mjitalways;debug
 setDebug(true);
 
 this.__defineGetter__("someProperty", function () { evalInFrame(1, "var x = 'success'"); });
 function caller(obj) {
-  assertJit();
   var x = ({ dana : 'zuul' });
   obj.someProperty;
   return x;
 }
 assertEq(caller(this), "success");
--- a/js/src/jit-test/tests/jaeger/bug563000/eif-getter.js
+++ b/js/src/jit-test/tests/jaeger/bug563000/eif-getter.js
@@ -1,11 +1,10 @@
 // |jit-test| mjitalways;debug
 setDebug(true);
 
 this.__defineGetter__("someProperty", function () { evalInFrame(1, "x = 'success'"); });
 function caller(obj) {
-  assertJit();
   var x = "failure";
   obj.someProperty;
   return x;
 }
 assertEq(caller(this), "success");
--- a/js/src/jit-test/tests/jaeger/bug563000/eif-global-newvar.js
+++ b/js/src/jit-test/tests/jaeger/bug563000/eif-global-newvar.js
@@ -1,9 +1,8 @@
 // |jit-test| mjitalways;debug
 setDebug(true);
 
 function callee() {
-  assertJit();
   evalInFrame(1, "var x = 'success'");
 }
 callee();
 assertEq(x, "success");
--- a/js/src/jit-test/tests/jaeger/bug563000/eif-trap-typechange.js
+++ b/js/src/jit-test/tests/jaeger/bug563000/eif-trap-typechange.js
@@ -1,13 +1,12 @@
 // |jit-test| mjitalways;debug
 setDebug(true);
 
 function nop(){}
 function caller(obj) {
-  assertJit();
   var x = ({ dana : "zuul" });
   return x;
 }
-// 0 is the pc of "assertJit()", we want the pc of "return x", 2 lines below.
-var pc = line2pc(caller, pc2line(caller, 0) + 2);
+// 0 is the pc of the first line, we want the pc of "return x", on the next line.
+var pc = line2pc(caller, pc2line(caller, 0) + 1);
 trap(caller, pc, "x = 'success'; nop()");
 assertEq(caller(this), "success");
--- a/js/src/jit-test/tests/jaeger/bug563000/eif-trap.js
+++ b/js/src/jit-test/tests/jaeger/bug563000/eif-trap.js
@@ -1,11 +1,10 @@
 // |jit-test| mjitalways;debug
 setDebug(true);
 
 function nop(){}
 function caller(obj) {
-  assertJit();
   var x = "failure";
   return x;
 }
-trap(caller, 20, "x = 'success'; nop()");
+trap(caller, 9 /* GETLOCAL x */, "x = 'success'; nop()");
 assertEq(caller(this), "success");
--- a/js/src/jit-test/tests/jaeger/testForOps.js
+++ b/js/src/jit-test/tests/jaeger/testForOps.js
@@ -7,63 +7,55 @@ function assertObjectsEqual(obj1, obj2) 
     assertEq(obj1.c, obj2.c);
     assertEq(obj1.d, obj2.d);
     assertEq(obj2.a, 1);
     assertEq(obj2.b, "bee");
     assertEq(obj2.c, "crab");
     assertEq(obj2.d, 12);
 }
 
-// :XXX: below calls to assertJit can throw us out of JIT code for some TI settings.
-
 function forName(obj) {
-    // assertJit();
     eval('');
     var r = { };
     for (x in obj)
         r[x] = obj[x];
     return r;
 }
 
 function forGlobalName(obj) {
-    // assertJit();
     var r = { };
     for (x in obj)
         r[x] = obj[x];
     return r;
 }
 
 function forProp(obj) {
-    // assertJit();
     var r = { };
     var c = { };
     for (c.x in obj)
         r[c.x] = obj[c.x];
     return r;
 }
 
 function forElem(obj, x) {
-    // assertJit();
     var r = { };
     var c = { };
     for (c[x] in obj)
         r[c[x]] = obj[c[x]];
     return r;
 }
 
 function forLocal(obj) {
-    // assertJit();
     var r = { };
     for (var x in obj)
         r[x] = obj[x];
     return r;
 }
 
 function forArg(obj, x) {
-    // assertJit();
     var r = { };
     for (x in obj)
         r[x] = obj[x];
     return r;
 }
 
 var obj = { a: 1, b: "bee", c: "crab", d: 12 };
 assertObjectsEqual(obj, forName(obj));
--- a/js/src/jsshell.msg
+++ b/js/src/jsshell.msg
@@ -16,10 +16,9 @@ MSG_DEF(JSSMSG_FILE_SCRIPTS_ONLY,       
 MSG_DEF(JSSMSG_UNEXPECTED_EOF,           5, 1, JSEXN_NONE, "unexpected EOF in {0}")
 MSG_DEF(JSSMSG_DOEXP_USAGE,              6, 0, JSEXN_NONE, "usage: doexp obj id")
 MSG_DEF(JSSMSG_SCRIPTS_ONLY,             7, 0, JSEXN_NONE, "only works on scripts")
 MSG_DEF(JSSMSG_NOT_ENOUGH_ARGS,          8, 1, JSEXN_NONE, "{0}: not enough arguments")
 MSG_DEF(JSSMSG_TOO_MANY_ARGS,            9, 1, JSEXN_NONE, "{0}: too many arguments")
 MSG_DEF(JSSMSG_ASSERT_EQ_FAILED,        10, 2, JSEXN_NONE, "Assertion failed: got {0}, expected {1}")
 MSG_DEF(JSSMSG_ASSERT_EQ_FAILED_MSG,    11, 3, JSEXN_NONE, "Assertion failed: got {0}, expected {1}: {2}")
 MSG_DEF(JSSMSG_INVALID_ARGS,            12, 1, JSEXN_NONE, "{0}: invalid arguments")
-MSG_DEF(JSSMSG_ASSERT_JIT_FAILED,       13, 0, JSEXN_NONE, "unexpected failure to JIT")
-MSG_DEF(JSSMSG_BAD_ALIGNMENT,           14, 0, JSEXN_NONE, "serialized data must be 8-byte-aligned")
+MSG_DEF(JSSMSG_BAD_ALIGNMENT,           13, 0, JSEXN_NONE, "serialized data must be 8-byte-aligned")
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -1420,37 +1420,16 @@ AssertEq(JSContext *cx, unsigned argc, j
                                  actual, expected, bytes2.ptr());
         }
         return false;
     }
     JS_SET_RVAL(cx, vp, JSVAL_VOID);
     return true;
 }
 
-static JSBool
-AssertJit(JSContext *cx, unsigned argc, jsval *vp)
-{
-#ifdef JS_METHODJIT
-    if (JS_GetOptions(cx) & JSOPTION_METHODJIT) {
-        /*
-         * Ignore calls to this native when inference is enabled, with
-         * METHODJIT_ALWAYS recompilation can happen and discard the script's
-         * jitcode.
-         */
-        if (!cx->typeInferenceEnabled() && cx->hasfp() && !cx->fp()->jit()) {
-            JS_ReportErrorNumber(cx, my_GetErrorMessage, NULL, JSSMSG_ASSERT_JIT_FAILED);
-            return false;
-        }
-    }
-#endif
-
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
-    return true;
-}
-
 static UnrootedScript
 ValueToScript(JSContext *cx, jsval v, JSFunction **funp = NULL)
 {
     RootedFunction fun(cx, JS_ValueToFunction(cx, v));
     if (!fun)
         return UnrootedScript(NULL);
 
     RootedScript script(cx);
@@ -3658,20 +3637,16 @@ static JSFunctionSpecWithHelp shell_func
 "quit()",
 "  Quit the shell."),
 
     JS_FN_HELP("assertEq", AssertEq, 2, 0,
 "assertEq(actual, expected[, msg])",
 "  Throw if the first two arguments are not the same (both +0 or both -0,\n"
 "  both NaN, or non-zero and ===)."),
 
-    JS_FN_HELP("assertJit", AssertJit, 0, 0,
-"assertJit()",
-"  Throw if the calling function failed to JIT."),
-
     JS_FN_HELP("setDebug", SetDebug, 1, 0,
 "setDebug(debug)",
 "  Set debug mode."),
 
     JS_FN_HELP("setDebuggerHandler", SetDebuggerHandler, 1, 0,
 "setDebuggerHandler(f)",
 "  Set handler for debugger keyword to f."),