[INFER] Remove constant-double info from AnalyzeStateStack, bug 640098.
authorBrian Hackett <bhackett1024@gmail.com>
Wed, 09 Mar 2011 07:08:43 -0800
changeset 74743 db22345e7c04c22cf14b36766fbfe145931c32c3
parent 74742 acd2e423b6e1e83b19d5af1d37a321a13aed515a
child 74744 ab1e10fb626f63ec2a41b593d81d53f8d634a835
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
bugs640098
milestone2.0b12pre
[INFER] Remove constant-double info from AnalyzeStateStack, bug 640098.
js/src/jsinfer.cpp
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -308,20 +308,16 @@ void TypeFailure(JSContext *cx, const ch
 /* Type state maintained during the inference pass through the script. */
 
 struct AnalyzeStateStack {
     TypeSet *types;
 
     /* Whether this node is the iterator for a 'for each' loop. */
     bool isForEach;
 
-    /* Any value pushed by a JSOP_DOUBLE. */
-    bool hasDouble;
-    double doubleValue;
-
     /* Any active initializer. */
     TypeObject *initializer;
 };
 
 struct AnalyzeState {
     JSContext *cx;
 
     analyze::Script &analysis;
@@ -2940,26 +2936,22 @@ AnalyzeBytecode(JSContext *cx, AnalyzeSt
       case JSOP_ENDINIT:
         break;
 
       case JSOP_INITELEM:
         if (script->compileAndGo) {
             initializer = state.popped(2).initializer;
             pushed[0].addType(cx, (jstype) initializer);
 
-            TypeSet *types;
-            if (state.popped(1).hasDouble) {
-                Value val = DoubleValue(state.popped(1).doubleValue);
-                jsid id;
-                if (!js_InternNonIntElementId(cx, NULL, val, &id))
-                    JS_NOT_REACHED("Bad");
-                types = initializer->getProperty(cx, id, true);
-            } else {
-                types = initializer->getProperty(cx, JSID_VOID, true);
-            }
+            /*
+             * Assume the initialized element is an integer. INITELEM can be used
+             * for doubles which don't map to the JSID_VOID property, which must
+             * be caught with dynamic monitoring.
+             */
+            TypeSet *types = initializer->getProperty(cx, JSID_VOID, true);
             if (!types)
                 return false;
 
             if (state.hasGetSet) {
                 TypeObject *getset = cx->getTypeGetSet();
                 if (!getset)
                     return false;
                 types->addType(cx, (jstype) getset);
@@ -3263,23 +3255,16 @@ AnalyzeBytecode(JSContext *cx, AnalyzeSt
     switch (op) {
       case JSOP_ITER: {
         uintN flags = pc[1];
         if (flags & JSITER_FOREACH)
             state.popped(0).isForEach = true;
         break;
       }
 
-      case JSOP_DOUBLE: {
-        AnalyzeStateStack &stack = state.popped(0);
-        stack.hasDouble = true;
-        stack.doubleValue = GetScriptConst(cx, script, pc).toDouble();
-        break;
-      }
-
       case JSOP_NEWINIT:
       case JSOP_NEWARRAY:
       case JSOP_NEWOBJECT:
       case JSOP_INITELEM:
       case JSOP_INITPROP:
       case JSOP_INITMETHOD:
         state.popped(0).initializer = initializer;
         break;