[INFER] Fix fallout from bug 642307 commit.
authorBrian Hackett <bhackett1024@gmail.com>
Tue, 29 Mar 2011 22:26:21 -0700
changeset 74872 93bc88428f167e29e1060e972d199af4543c35cd
parent 74871 842d95ddaec5049b3c4b917d4d76cdd72ce27ac5
child 74873 81ee9f8d4c343c7bbc3e3268cee652723f20c4e0
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
bugs642307
milestone2.0b13pre
[INFER] Fix fallout from bug 642307 commit.
js/src/jsinfer.cpp
js/src/methodjit/Compiler.cpp
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -2932,16 +2932,28 @@ AnalyzeBytecode(JSContext *cx, AnalyzeSt
       case JSOP_GETGNAME:
       case JSOP_CALLGNAME: {
         jsid id;
         if (op == JSOP_GETGLOBAL || op == JSOP_CALLGLOBAL)
             id = GetGlobalId(cx, script, pc);
         else
             id = GetAtomId(cx, script, pc, 0);
 
+        /*
+         * Normally we rely on lazy standard class initialization to fill in
+         * the types of global properties the script can access. In a few cases
+         * the method JIT will bypass this, and we need to add the types direclty.
+         */
+        if (id == ATOM_TO_JSID(cx->runtime->atomState.typeAtoms[JSTYPE_VOID]))
+            cx->addTypePropertyId(script->getGlobalType(), id, TYPE_UNDEFINED);
+        if (id == ATOM_TO_JSID(cx->runtime->atomState.NaNAtom))
+            cx->addTypePropertyId(script->getGlobalType(), id, TYPE_DOUBLE);
+        if (id == ATOM_TO_JSID(cx->runtime->atomState.InfinityAtom))
+            cx->addTypePropertyId(script->getGlobalType(), id, TYPE_DOUBLE);
+
         /* Handle as a property access. */
         PropertyAccess(cx, script, pc, script->getGlobalType(),
                        false, &pushed[0], id);
 
         if (op == JSOP_CALLGLOBAL || op == JSOP_CALLGNAME)
             pushed[1].addType(cx, TYPE_UNKNOWN);
 
         if (CheckNextTest(pc))
--- a/js/src/methodjit/Compiler.cpp
+++ b/js/src/methodjit/Compiler.cpp
@@ -5547,16 +5547,20 @@ mjit::Compiler::jsop_getgname(uint32 ind
         frame.push(cx->runtime->positiveInfinityValue);
         return;
     }
 
     /* Optimize singletons like Math for JSOP_CALLPROP. */
     JSObject *obj = pushedSingleton(0);
     if (obj && testSingletonProperty(globalObj, ATOM_TO_JSID(atom))) {
         frame.push(ObjectValue(*obj));
+        if (recompiling) {
+            OOL_STUBCALL(ic::GetGlobalName);
+            stubcc.rejoin(Changes(1));
+        }
         return;
     }
 
 #if defined JS_MONOIC
     jsop_bindgname();
 
     FrameEntry *fe = frame.peek(-1);
     JS_ASSERT(fe->isTypeKnown() && fe->getKnownType() == JSVAL_TYPE_OBJECT);