[JAEGER] Added JSOP_LAMBDA_FC.
authorDavid Anderson <danderson@mozilla.com>
Tue, 08 Jun 2010 21:24:19 -0700
changeset 52775 18198a3e11ea4e64ae257b8c8a6d05a6e9373ede
parent 52774 41eb0a3a9568559f278597d1ff03a1c3180fda64
child 52777 16eaa1944917e9c8d5ef56a539ae1c22ab1893e9
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
milestone1.9.3a5pre
[JAEGER] Added JSOP_LAMBDA_FC.
js/src/methodjit/Compiler.cpp
js/src/methodjit/StubCalls.cpp
js/src/methodjit/StubCalls.h
--- a/js/src/methodjit/Compiler.cpp
+++ b/js/src/methodjit/Compiler.cpp
@@ -1011,16 +1011,27 @@ mjit::Compiler::generateMethod()
             masm.move(Imm32(len), Registers::ArgReg1);
             stubCall(stubs::NewArray, Uses(len), Defs(1));
             frame.popn(len);
             frame.takeReg(Registers::ReturnReg);
             frame.pushTypedPayload(JSVAL_MASK32_NONFUNOBJ, Registers::ReturnReg);
           }
           END_CASE(JSOP_NEWARRAY)
 
+          BEGIN_CASE(JSOP_LAMBDA_FC)
+          {
+            JSFunction *fun = script->getFunction(fullAtomIndex(PC));
+            prepareStubCall();
+            masm.move(ImmPtr(fun), Registers::ArgReg1);
+            stubCall(stubs::FlatLambda, Uses(0), Defs(1));
+            frame.takeReg(Registers::ReturnReg);
+            frame.pushTypedPayload(JSVAL_MASK32_FUNOBJ, Registers::ReturnReg);
+          }
+          END_CASE(JSOP_LAMBDA_FC)
+
           BEGIN_CASE(JSOP_TRACE)
           {
             if (analysis[PC].nincoming > 0) {
                 RegisterID cxreg = frame.allocReg();
                 masm.loadPtr(FrameAddress(offsetof(VMFrame, cx)), cxreg);
                 Address flag(cxreg, offsetof(JSContext, interruptFlags));
                 Jump jump = masm.branchTest32(Assembler::NonZero, flag);
                 frame.freeReg(cxreg);
--- a/js/src/methodjit/StubCalls.cpp
+++ b/js/src/methodjit/StubCalls.cpp
@@ -2451,8 +2451,17 @@ stubs::Throw(VMFrame &f)
     JSContext *cx = f.cx;
 
     JS_ASSERT(!cx->throwing);
     cx->throwing = JS_TRUE;
     cx->exception = f.regs.sp[-1];
     THROW();
 }
 
+JSObject * JS_FASTCALL
+stubs::FlatLambda(VMFrame &f, JSFunction *fun)
+{
+    JSObject *obj = js_NewFlatClosure(f.cx, fun);
+    if (!obj)
+        THROWV(NULL);
+    return obj;
+}
+
--- a/js/src/methodjit/StubCalls.h
+++ b/js/src/methodjit/StubCalls.h
@@ -82,16 +82,17 @@ void JS_FASTCALL PropDec(VMFrame &f, JSA
 void JS_FASTCALL IncProp(VMFrame &f, JSAtom *atom);
 void JS_FASTCALL DecProp(VMFrame &f, JSAtom *atom);
 void JS_FASTCALL CallProp(VMFrame &f, JSAtom *atom);
 
 void JS_FASTCALL DefFun(VMFrame &f, uint32 index);
 JSObject * JS_FASTCALL DefLocalFun(VMFrame &f, JSFunction *fun);
 JSObject * JS_FASTCALL RegExp(VMFrame &f, JSObject *regex);
 JSObject * JS_FASTCALL Lambda(VMFrame &f, JSFunction *fun);
+JSObject * JS_FASTCALL FlatLambda(VMFrame &f, JSFunction *fun);
 
 void JS_FASTCALL VpInc(VMFrame &f, Value *vp);
 void JS_FASTCALL VpDec(VMFrame &f, Value *vp);
 void JS_FASTCALL DecVp(VMFrame &f, Value *vp);
 void JS_FASTCALL IncVp(VMFrame &f, Value *vp);
 
 JSBool JS_FASTCALL LessThan(VMFrame &f);
 JSBool JS_FASTCALL LessEqual(VMFrame &f);