[JAEGER] Added JSOP_THIS.
authorDavid Anderson <danderson@mozilla.com>
Fri, 04 Jun 2010 23:14:20 -0700
changeset 52704 935d36239d327106716a87c99fc1ad9f4ba53b58
parent 52703 55b5e2d14a988bb4b64b56be9052b7f9627d1189
child 52705 3957beee67b9d63c6dc2fffa3d9f9ab543b9d9a8
push idunknown
push userunknown
push dateunknown
milestone1.9.3a5pre
[JAEGER] Added JSOP_THIS.
js/src/methodjit/Compiler.cpp
js/src/methodjit/FrameState.cpp
js/src/methodjit/StubCalls.cpp
js/src/methodjit/StubCalls.h
--- a/js/src/methodjit/Compiler.cpp
+++ b/js/src/methodjit/Compiler.cpp
@@ -544,16 +544,26 @@ mjit::Compiler::generateMethod()
           BEGIN_CASE(JSOP_ONE)
             frame.push(Valueify(JSVAL_ONE));
           END_CASE(JSOP_ONE)
 
           BEGIN_CASE(JSOP_NULL)
             frame.push(NullTag());
           END_CASE(JSOP_NULL)
 
+          BEGIN_CASE(JSOP_THIS)
+            /*
+             * :FIXME: We don't know whether it's a funobj or not... but we
+             * DO know it's an object! This can help downstream opcodes.
+             */
+            prepareStubCall();
+            stubCall(stubs::This, Uses(0), Defs(1));
+            frame.pushSynced();
+          END_CASE(JSOP_THIS)
+
           BEGIN_CASE(JSOP_FALSE)
             frame.push(Value(BooleanTag(false)));
           END_CASE(JSOP_FALSE)
 
           BEGIN_CASE(JSOP_TRUE)
             frame.push(Value(BooleanTag(true)));
           END_CASE(JSOP_TRUE)
 
--- a/js/src/methodjit/FrameState.cpp
+++ b/js/src/methodjit/FrameState.cpp
@@ -87,21 +87,21 @@ FrameState::init(uint32 nargs)
     return true;
 }
 
 void
 FrameState::takeReg(RegisterID reg)
 {
     if (freeRegs.hasReg(reg)) {
         freeRegs.takeReg(reg);
-        return;
+    } else {
+        JS_ASSERT(regstate[reg].fe);
+        evictReg(reg);
+        regstate[reg].fe = NULL;
     }
-
-    evictReg(reg);
-    regstate[reg].fe = NULL;
 }
 
 void
 FrameState::evictReg(RegisterID reg)
 {
     FrameEntry *fe = regstate[reg].fe;
 
     if (regstate[reg].type == RematInfo::TYPE) {
@@ -341,16 +341,18 @@ FrameState::syncAndKill(uint32 mask)
             continue;
 
         FrameEntry *fe = entryFor(index);
         Address address = addressOf(fe);
         FrameEntry *backing = fe;
         if (fe->isCopy())
             backing = entryFor(fe->copyOf());
 
+        JS_ASSERT_IF(i == 0, !fe->isCopy());
+
         if (!fe->data.synced()) {
             if (backing != fe && backing->data.inMemory())
                 tempRegForData(backing);
             syncData(backing, address, masm);
             fe->data.sync();
             if (fe->isConstant() && !fe->type.synced())
                 fe->type.sync();
         }
--- a/js/src/methodjit/StubCalls.cpp
+++ b/js/src/methodjit/StubCalls.cpp
@@ -1608,8 +1608,16 @@ JSObject *JS_FASTCALL
 stubs::NewArray(VMFrame &f, uint32 len)
 {
     JSObject *obj = js_NewArrayObject(f.cx, len, f.regs.sp - len, JS_TRUE);
     if (!obj)
         THROWV(NULL);
     return obj;
 }
 
+void JS_FASTCALL
+stubs::This(VMFrame &f)
+{
+    if (!f.fp->getThisObject(f.cx))
+        THROW();
+    f.regs.sp[0] = f.fp->thisv;
+}
+
--- a/js/src/methodjit/StubCalls.h
+++ b/js/src/methodjit/StubCalls.h
@@ -42,16 +42,17 @@
 #define jslogic_h__
 
 #include "MethodJIT.h"
 
 namespace js {
 namespace mjit {
 namespace stubs {
 
+void JS_FASTCALL This(VMFrame &f);
 JSObject * JS_FASTCALL NewArray(VMFrame &f, uint32 len);
 void * JS_FASTCALL Call(VMFrame &f, uint32 argc);
 void * JS_FASTCALL New(VMFrame &f, uint32 argc);
 void * JS_FASTCALL Return(VMFrame &f);
 
 JSObject * JS_FASTCALL BindName(VMFrame &f);
 void JS_FASTCALL SetName(VMFrame &f, uint32 index);
 void JS_FASTCALL Name(VMFrame &f, uint32 index);