Make similar-acting code similar-reading as well (but not shared due to the +/- difference), no bug
authorJeff Walden <jwalden@mit.edu>
Mon, 29 Dec 2008 07:59:06 -0600
changeset 22907 6b6b7c1250302c9e0bdb150f91f7d87d595b3299
parent 22906 89c91656464beb996e02fedafab292dd577200a3
child 22908 348227af256540cd3ff2a87ff2ef0750261aaee4
push id498
push userrsayre@mozilla.com
push dateFri, 23 Jan 2009 02:33:10 +0000
milestone1.9.1b3pre
Make similar-acting code similar-reading as well (but not shared due to the +/- difference), no bug
js/src/jstracer.cpp
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -5898,45 +5898,47 @@ TraceRecorder::record_JSOP_NEG()
 
     if (JSVAL_IS_NULL(v)) {
         jsdpun u;
         u.d = -0.0;
         set(&v, lir->insImmq(u.u64));
         return true;
     }
 
+    JS_ASSERT(JSVAL_TAG(v) == JSVAL_STRING || JSVAL_TAG(v) == JSVAL_BOOLEAN);
+
     LIns* args[] = { get(&v), cx_ins };
-    if (JSVAL_IS_STRING(v)) {
-        set(&v, lir->ins1(LIR_fneg, lir->insCall(&js_StringToNumber_ci, args)));
-        return true;
-    }
-
-    JS_ASSERT(JSVAL_TAG(v) == JSVAL_BOOLEAN);
-    set(&v, lir->ins1(LIR_fneg, lir->insCall(&js_BooleanOrUndefinedToNumber_ci, args)));
+    set(&v, lir->ins1(LIR_fneg,
+                      lir->insCall(JSVAL_IS_STRING(v)
+                                   ? &js_StringToNumber_ci
+                                   : &js_BooleanOrUndefinedToNumber_ci,
+                                   args)));
     return true;
 }
 
 JS_REQUIRES_STACK bool
 TraceRecorder::record_JSOP_POS()
 {
-    jsval& r = stackval(-1);
-
-    if (!JSVAL_IS_PRIMITIVE(r))
+    jsval& v = stackval(-1);
+
+    if (!JSVAL_IS_PRIMITIVE(v))
         return call_imacro(unary_imacros.sign);
 
-    if (isNumber(r))
+    if (isNumber(v))
         return true;
 
-    if (JSVAL_IS_NULL(r)) {
-        set(&r, lir->insImmq(0));
+    if (JSVAL_IS_NULL(v)) {
+        set(&v, lir->insImmq(0));
         return true;
     }
 
-    LIns* args[] = { get(&r), cx_ins };
-    set(&r, lir->insCall(JSVAL_IS_STRING(r)
+    JS_ASSERT(JSVAL_TAG(v) == JSVAL_STRING || JSVAL_TAG(v) == JSVAL_BOOLEAN);
+
+    LIns* args[] = { get(&v), cx_ins };
+    set(&v, lir->insCall(JSVAL_IS_STRING(v)
                          ? &js_StringToNumber_ci
                          : &js_BooleanOrUndefinedToNumber_ci,
                          args));
     return true;
 }
 
 JS_REQUIRES_STACK bool
 TraceRecorder::record_JSOP_PRIMTOP()