Bug 554043 - fix negated bool, broken by TT_VOID patch (r=dvander)
authorLuke Wagner <lw@mozilla.com>
Mon, 22 Mar 2010 10:26:08 -0700
changeset 40326 d52333800c73dbef8b0fefab4c41eeec06f63828
parent 40325 f4e6161afc357b37c8cf3b4af3b9fd85fc590daf
child 40327 ff6b54ac276de71f3d73801431a001657af421e3
push id12610
push userrsayre@mozilla.com
push dateMon, 05 Apr 2010 17:26:41 +0000
treeherdermozilla-central@1942c0b4e101 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs554043
milestone1.9.3a3pre
Bug 554043 - fix negated bool, broken by TT_VOID patch (r=dvander)
js/src/jsscan.h
js/src/jstracer.cpp
js/src/trace-test/tests/basic/testBug554043.js
--- a/js/src/jsscan.h
+++ b/js/src/jsscan.h
@@ -141,28 +141,31 @@ enum TokenKind {
     TOK_ARGSBODY = 84,                  /* formal args in list + body at end */
     TOK_UPVARS = 85,                    /* lexical dependencies as JSAtomList
                                            of definitions paired with a parse
                                            tree full of uses of those names */
     TOK_RESERVED,                       /* reserved keywords */
     TOK_LIMIT                           /* domain size */
 };
 
-static inline bool TokenKindIsXML(TokenKind tt)
+static inline bool
+TokenKindIsXML(TokenKind tt)
 {
     return tt == TOK_AT || tt == TOK_DBLCOLON || tt == TOK_ANYNAME;
 }
 
-static inline bool TreeTypeIsXML(TokenKind tt)
+static inline bool
+TreeTypeIsXML(TokenKind tt)
 {
     return tt == TOK_XMLCOMMENT || tt == TOK_XMLCDATA || tt == TOK_XMLPI ||
            tt == TOK_XMLELEM || tt == TOK_XMLLIST;
 }
 
-static inline bool TokenKindIsDecl(TokenKind tt)
+static inline bool
+TokenKindIsDecl(TokenKind tt)
 {
 #if JS_HAS_BLOCK_SCOPE
     return tt == TOK_VAR || tt == TOK_LET;
 #else
     return tt == TOK_VAR;
 #endif
 }
 
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -9398,17 +9398,17 @@ TraceRecorder::unbox_jsval(jsval v, LIns
             guard(true, lir->ins2(LIR_peq, v_ins, INS_CONSTWORD(JSVAL_VOID)), exit);
             return INS_VOID();
         }
         guard(true,
               lir->ins2(LIR_peq,
                         lir->ins2(LIR_piand, v_ins, INS_CONSTWORD(JSVAL_TAGMASK)),
                         INS_CONSTWORD(JSVAL_SPECIAL)),
               exit);
-        assert(!v_ins->isconstp());
+        JS_ASSERT(!v_ins->isconstp());
         guard(false, lir->ins2(LIR_peq, v_ins, INS_CONSTWORD(JSVAL_VOID)), exit);
         return p2i(lir->ins2i(LIR_pursh, v_ins, JSVAL_TAGBITS));
 
       case JSVAL_OBJECT:
         if (JSVAL_IS_NULL(v)) {
             // JSVAL_NULL maps to type TT_NULL, so insist that v_ins == 0 here.
             guard(true, lir->ins_peq0(v_ins), exit);
         } else {
@@ -10273,17 +10273,17 @@ TraceRecorder::record_JSOP_NEG()
     if (JSVAL_IS_STRING(v)) {
         LIns* args[] = { get(&v), cx_ins };
         set(&v, lir->ins1(LIR_fneg,
                           lir->insCall(&js_StringToNumber_ci, args)));
         return ARECORD_CONTINUE;
     }
 
     JS_ASSERT(JSVAL_IS_BOOLEAN(v));
-    set(&v, i2f(get(&v)));
+    set(&v, lir->ins1(LIR_fneg, i2f(get(&v))));
     return ARECORD_CONTINUE;
 }
 
 JS_REQUIRES_STACK AbortableRecordingStatus
 TraceRecorder::record_JSOP_POS()
 {
     jsval& v = stackval(-1);
 
new file mode 100644
--- /dev/null
+++ b/js/src/trace-test/tests/basic/testBug554043.js
@@ -0,0 +1,6 @@
+(function () {
+    for (var a = 0; a < 5; a++) {
+        print(-false)
+        assertEq(-false, -0.0);
+    }
+})()