[INFER] Fix broken jstests, bug 620599.
authorBrian Hackett <bhackett1024@gmail.com>
Wed, 16 Mar 2011 12:03:47 -0700
changeset 74782 cf686d29779c998fdef2c0fd7c56e113509f3d18
parent 74781 0dc23b10fcf623558826fe50e37a3a029781acd9
child 74783 55ea5951461ed392ada34c33b94e6e19e39c0914
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
bugs620599
milestone2.0b13pre
[INFER] Fix broken jstests, bug 620599.
js/src/methodjit/FastOps.cpp
js/src/methodjit/InvokeHelpers.cpp
js/src/methodjit/StubCalls.cpp
js/src/tests/js1_8_5/regress/regress-595365-2.js
--- a/js/src/methodjit/FastOps.cpp
+++ b/js/src/methodjit/FastOps.cpp
@@ -1962,17 +1962,17 @@ void
 mjit::Compiler::jsop_initprop()
 {
     FrameEntry *obj = frame.peek(-2);
     FrameEntry *fe = frame.peek(-1);
     JSAtom *atom = script->getAtom(fullAtomIndex(PC));
 
     JSObject *baseobj = obj->initializerObject();
 
-    if (!baseobj) {
+    if (!baseobj || monitored(PC)) {
         prepareStubCall(Uses(2));
         masm.move(ImmPtr(atom), Registers::ArgReg1);
         INLINE_STUBCALL(stubs::InitProp);
         return;
     }
 
     JSObject *holder;
     JSProperty *prop = NULL;
--- a/js/src/methodjit/InvokeHelpers.cpp
+++ b/js/src/methodjit/InvokeHelpers.cpp
@@ -300,16 +300,20 @@ stubs::CompileFunction(VMFrame &f, uint3
     /*
      * Since we can only use members set by initCallFrameCallerHalf,
      * we must carefully extract the callee from the nactual.
      */
     JSObject &callee = fp->formalArgsEnd()[-(int(nactual) + 2)].toObject();
     JSFunction *fun = callee.getFunctionPrivate();
     JSScript *script = fun->script();
 
+    CallArgs args(fp->formalArgsEnd() - nactual, nactual);
+    if (!cx->typeMonitorCall(args, fp->isConstructing()))
+        return NULL;
+
     /*
      * FixupArity/RemovePartialFrame expect to be called after the early
      * prologue.
      */
     fp->initCallFrameEarlyPrologue(fun, nactual);
 
     if (nactual != fp->numFormalArgs()) {
         fp = (JSStackFrame *)FixupArity(f, nactual);
--- a/js/src/methodjit/StubCalls.cpp
+++ b/js/src/methodjit/StubCalls.cpp
@@ -1393,17 +1393,17 @@ stubs::NewInitObject(VMFrame &f, JSObjec
     JSContext *cx = f.cx;
     TypeObject *type = (TypeObject *) f.scratch;
 
     if (!baseobj) {
         gc::FinalizeKind kind = GuessObjectGCKind(0, false);
         JSObject *obj = NewBuiltinClassInstance(cx, &js_ObjectClass, kind);
         if (!obj)
             THROWV(NULL);
-        if (!type || !obj->setTypeAndEmptyShape(cx, type))
+        if (type && !obj->setTypeAndEmptyShape(cx, type))
             THROWV(NULL);
         return obj;
     }
 
     JS_ASSERT(type);
     JSObject *obj = CopyInitializerObject(cx, baseobj, type);
 
     if (!obj)
--- a/js/src/tests/js1_8_5/regress/regress-595365-2.js
+++ b/js/src/tests/js1_8_5/regress/regress-595365-2.js
@@ -25,18 +25,21 @@ function add_p0to127(o) {
   o.p130= ++i;o.p131= ++i;o.p132= ++i;o.p133= ++i;o.p134= ++i;o.p135= ++i;o.p136= ++i;o.p137= ++i;
   o.p140= ++i;o.p141= ++i;o.p142= ++i;o.p143= ++i;o.p144= ++i;o.p145= ++i;o.p146= ++i;o.p147= ++i;
   o.p150= ++i;o.p151= ++i;o.p152= ++i;o.p153= ++i;o.p154= ++i;o.p155= ++i;o.p156= ++i;o.p157= ++i;
   return o;
 }
 function add_p128(o) {
   o.p200 = ++i;
 }
-var o = add_p0to127({});
-var o2 = add_p0to127({});
+var oarr = [];
+for (var i = 0; i < 2; i++)
+  oarr[i] = {};
+var o = add_p0to127(oarr[0]);
+var o2 = add_p0to127(oarr[1]);
 var o_shape127 = shapeOf(o);
 assertEq(o_shape127, shapeOf(o2));
 add_p128(o);
 add_p128(o2);
 var o_shape128 = shapeOf(o);
 assertEq(false, o_shape128 === shapeOf(o2));
 delete o.p200;
 assertEq(false, shapeOf(o) === o_shape127);