[INFER] Build and jit-tests fixes for Windows, bug 619433.
authorBrian Hackett <bhackett1024@gmail.com>
Thu, 12 May 2011 09:49:04 -0700
changeset 75041 09461ee644367f357a0481492c4bdf1d2894d29a
parent 75040 3f089c0d63f84d0e7602ce8a8772d4d8203d26b7
child 75042 a9744127fee40095cf88d77d6feed9fabdff436e
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
bugs619433
milestone6.0a1
[INFER] Build and jit-tests fixes for Windows, bug 619433.
js/src/jsanalyze.h
js/src/jsinfer.cpp
js/src/jsinfer.h
js/src/methodjit/Compiler.cpp
js/src/methodjit/MethodJIT.cpp
--- a/js/src/jsanalyze.h
+++ b/js/src/jsanalyze.h
@@ -616,25 +616,27 @@ struct SSAPhiNode;
  * the values and types in an SSAPhiNode.
  */
 class SSAValue
 {
     friend class ScriptAnalysis;
 
   public:
     enum Kind {
-        EMPTY = 0, /* Empty entry in a phi node. */
-        PUSHED,    /* Value pushed by some bytecode. */
-        VAR,       /* Initial or written value to some argument or local. */
-        PHI        /* Selector for one of several values. */
+        EMPTY  = 0, /* Invalid entry. */
+        PUSHED = 1, /* Value pushed by some bytecode. */
+        VAR    = 2, /* Initial or written value to some argument or local. */
+        PHI    = 3  /* Selector for one of several values. */
     };
 
     Kind kind() const {
         JS_ASSERT(u.pushed.kind == u.var.kind && u.pushed.kind == u.phi.kind);
-        return u.pushed.kind;
+
+        /* Use a bitmask because MSVC wants to use -1 for PHI nodes. */
+        return (Kind) (u.pushed.kind & 0x3);
     }
 
     bool equals(const SSAValue &o) const {
         return !memcmp(this, &o, sizeof(SSAValue));
     }
 
     /* Accessors for values pushed by a bytecode within this script. */
 
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -4286,17 +4286,17 @@ types::TypeObject::trace(JSTracer *trc)
 
 /*
  * Condense any constraints on a type set which were generated during analysis
  * of a script, and sweep all type objects and references to type objects
  * which no longer exist.
  */
 void
 TypeSet::CondenseSweepTypeSet(JSContext *cx, TypeCompartment *compartment,
-                              HashSet<JSScript*> *pcondensed, TypeSet *types)
+                              ScriptSet *pcondensed, TypeSet *types)
 {
     /*
      * This function is called from GC, and cannot malloc any data that could
      * trigger a reentrant GC. The only allocation that can happen here is
      * the construction of condensed constraints and tables for hash sets.
      * Both of these use off-the-books malloc rather than cx->malloc, and thus
      * do not contribute towards the runtime's overall malloc bytes.
      */
@@ -4391,17 +4391,17 @@ TypeSet::CondenseSweepTypeSet(JSContext 
             (script->fun && IsAboutToBeFinalized(cx, script->fun))) {
             if (constraint->condensed())
                 cx->delete_(constraint);
             constraint = next;
             continue;
         }
 
         if (pcondensed) {
-            HashSet<JSScript*>::AddPtr p = pcondensed->lookupForAdd(script);
+            ScriptSet::AddPtr p = pcondensed->lookupForAdd(script);
             if (!p) {
                 if (pcondensed->add(p, script))
                     types->addCondensed(cx, script);
                 else
                     compartment->setPendingNukeTypes(cx);
             }
         }
 
@@ -4425,17 +4425,17 @@ PruneInstanceObjects(TypeObject *object)
         else
             *pinstance = (*pinstance)->instanceNext;
     }
 }
 
 static void
 CondenseTypeObjectList(JSContext *cx, TypeCompartment *compartment, TypeObject *objects)
 {
-    HashSet<JSScript *> condensed(cx), *pcondensed = &condensed;
+    TypeSet::ScriptSet condensed(cx), *pcondensed = &condensed;
     if (!condensed.init()) {
         compartment->setPendingNukeTypes(cx);
         pcondensed = NULL;
     }
 
     TypeObject *object = objects;
     while (object) {
         if (!object->marked) {
@@ -4579,17 +4579,17 @@ TypeCompartment::~TypeCompartment()
 }
 
 void
 JSScript::condenseTypes(JSContext *cx)
 {
     CondenseTypeObjectList(cx, &compartment->types, typeObjects);
 
     if (varTypes) {
-        js::HashSet<JSScript *> condensed(cx), *pcondensed = &condensed;
+        TypeSet::ScriptSet condensed(cx), *pcondensed = &condensed;
         if (!condensed.init()) {
             compartment->types.setPendingNukeTypes(cx);
             pcondensed = NULL;
         }
 
         unsigned num = 2 + nfixed + (fun ? fun->nargs : 0) + bindings.countUpvars();
 
         if (isCachedEval ||
--- a/js/src/jsinfer.h
+++ b/js/src/jsinfer.h
@@ -410,19 +410,24 @@ class TypeSet
     void pushAllTypes(JSContext *cx, JSScript *script, const jsbytecode *pc);
 
     /*
      * Clone (possibly NULL) source onto target; if any new types are added to
      * source in the future, the script will be recompiled.
      */
     static void Clone(JSContext *cx, TypeSet *source, ClonedTypeSet *target);
 
+    /* Set of scripts which condensed constraints have been generated for. */
+    typedef HashSet<JSScript *,
+                    DefaultHasher<JSScript *>,
+                    ContextAllocPolicy> ScriptSet;
+
     static void
     CondenseSweepTypeSet(JSContext *cx, TypeCompartment *compartment,
-                         HashSet<JSScript*> *pcondensed, TypeSet *types);
+                         ScriptSet *pcondensed, TypeSet *types);
 
   private:
     inline void markUnknown(JSContext *cx);
 };
 
 /* A type set captured for use by JIT compilers. */
 struct ClonedTypeSet
 {
--- a/js/src/methodjit/Compiler.cpp
+++ b/js/src/methodjit/Compiler.cpp
@@ -2447,17 +2447,17 @@ mjit::Compiler::generateMethod()
             updateVarType();
             uint32 slot = GET_SLOTNO(PC);
             JSFunction *fun = script->getFunction(fullAtomIndex(&PC[SLOTNO_LEN]));
             prepareStubCall(Uses(frame.frameSlots()));
             masm.move(ImmPtr(fun), Registers::ArgReg1);
             INLINE_STUBCALL(stubs::DefLocalFun_FC, REJOIN_DEFLOCALFUN);
             frame.takeReg(Registers::ReturnReg);
             frame.pushTypedPayload(JSVAL_TYPE_OBJECT, Registers::ReturnReg);
-            frame.storeLocal(slot, JSVAL_TYPE_OBJECT, true);
+            frame.storeLocal(slot, true, true);
             frame.pop();
           }
           END_CASE(JSOP_DEFLOCALFUN_FC)
 
           BEGIN_CASE(JSOP_LAMBDA)
           {
             JSFunction *fun = script->getFunction(fullAtomIndex(PC));
 
@@ -2545,17 +2545,17 @@ mjit::Compiler::generateMethod()
             updateVarType();
             uint32 slot = GET_SLOTNO(PC);
             JSFunction *fun = script->getFunction(fullAtomIndex(&PC[SLOTNO_LEN]));
             prepareStubCall(Uses(0));
             masm.move(ImmPtr(fun), Registers::ArgReg1);
             INLINE_STUBCALL(stubs::DefLocalFun, REJOIN_DEFLOCALFUN);
             frame.takeReg(Registers::ReturnReg);
             frame.pushTypedPayload(JSVAL_TYPE_OBJECT, Registers::ReturnReg);
-            frame.storeLocal(slot, JSVAL_TYPE_OBJECT, true);
+            frame.storeLocal(slot, true, true);
             frame.pop();
           }
           END_CASE(JSOP_DEFLOCALFUN)
 
           BEGIN_CASE(JSOP_RETRVAL)
             emitReturn(NULL);
           END_CASE(JSOP_RETRVAL)
 
@@ -3459,17 +3459,17 @@ mjit::Compiler::inlineCallHelper(uint32 
         callIC.argTypes = (types::ClonedTypeSet *)
             cx->calloc_((1 + argc) * sizeof(types::ClonedTypeSet));
         if (!callIC.argTypes) {
             js_ReportOutOfMemory(cx);
             return false;
         }
         types::TypeSet *types = frame.extra(frame.peek(-((int)argc + 1))).types;
         types::TypeSet::Clone(cx, types, &callIC.argTypes[0]);
-        for (unsigned i = 0; i < argc; i++) {
+        for (int i = 0; i < (int)argc; i++) {
             types::TypeSet *types = frame.extra(frame.peek(-((int)argc - i))).types;
             types::TypeSet::Clone(cx, types, &callIC.argTypes[i + 1]);
         }
     }
 
     /* Test the type if necessary. Failing this always takes a really slow path. */
     MaybeJump notObjectJump;
     if (icCalleeType.isSet())
--- a/js/src/methodjit/MethodJIT.cpp
+++ b/js/src/methodjit/MethodJIT.cpp
@@ -763,20 +763,20 @@ extern "C" {
         __asm {
             /* Align the stack to 16 bytes. */
             push esp;
             push eax;
             push edi;
             push esi;
             call js_InternalInterpret;
             add esp, 0x10;
-            mov [esp + 0x1C], ebp;  /* Load frame */
-            mov [ebp + 0x18], esi;  /* Load rval payload */
-            mov [ebp + 0x1C], edi;  /* Load rval type */
-            mov [esp + 0xC], ecx;   /* Load scratch -> argc */
+            mov ebp, [esp + 0x1C];  /* Load frame */
+            mov esi, [ebp + 0x18];  /* Load rval payload */
+            mov edi, [ebp + 0x1C];  /* Load rval type */
+            mov ecx, [esp + 0xC];   /* Load scratch -> argc */
             test eax, eax;
             je interpoline_exit;
             jmp eax;
         interpoline_exit:
             mov ecx, esp;
             call PopActiveVMFrame;
             add esp, 0x3c;
             pop ebx;
@@ -785,18 +785,18 @@ extern "C" {
             pop ebp;
             xor eax, eax
             ret;
         }
     }
 
     __declspec(naked) void JaegerInterpolineScripted() {
         __asm {
-            mov [ebp + 0x10], ebp;  /* Load prev */
-            mov ebp, [esp + 0x1C];  /* fp -> regs.fp */
+            mov ebp, [ebp + 0x10];  /* Load prev */
+            mov [esp + 0x1C], ebp;  /* fp -> regs.fp */
             jmp JaegerInterpoline;
         }
     }
 }
 
 // Windows x64 uses assembler version since compiler doesn't support
 // inline assembler
 #elif defined(_WIN64)