Bug 470129 - Skip parentheses when doing optimizations based on parse node type. r=igor
authorBlake Kaplan <mrbkap@gmail.com>
Tue, 06 Jan 2009 15:13:57 -0500
changeset 22921 8280c2b9bbf9d43d874a33ba06c93c65d6446d3e
parent 22920 fec42342d9b6f169c71c4880058ea63af297bbbc
child 22922 df576b0261cd1336043ca4a9f0db404044f471d0
push id500
push userrsayre@mozilla.com
push dateFri, 23 Jan 2009 04:05:55 +0000
reviewersigor
bugs470129
milestone1.9.1b3pre
Bug 470129 - Skip parentheses when doing optimizations based on parse node type. r=igor
js/src/jsemit.cpp
--- a/js/src/jsemit.cpp
+++ b/js/src/jsemit.cpp
@@ -2735,16 +2735,18 @@ EmitSwitch(JSContext *cx, JSCodeGenerato
                 continue;
             }
 
             JS_ASSERT(pn3->pn_type == TOK_CASE);
             if (switchOp == JSOP_CONDSWITCH)
                 continue;
 
             pn4 = pn3->pn_left;
+            while (pn4->pn_type == TOK_RP)
+                pn4 = pn4->pn_kid;
             switch (pn4->pn_type) {
               case TOK_NUMBER:
                 d = pn4->pn_dval;
                 if (JSDOUBLE_IS_INT(d, i) && INT_FITS_IN_JSVAL(i)) {
                     pn3->pn_val = INT_TO_JSVAL(i);
                 } else {
                     atom = js_AtomizeDouble(cx, d);
                     if (!atom) {