[JAEGER] Added JSOP_NEWARRAY.
authorDavid Anderson <danderson@mozilla.com>
Fri, 04 Jun 2010 22:38:54 -0700
changeset 52703 55b5e2d14a988bb4b64b56be9052b7f9627d1189
parent 52702 cb2d305330698e5b44ccd6d9748427f715bd3cad
child 52704 935d36239d327106716a87c99fc1ad9f4ba53b58
push idunknown
push userunknown
push dateunknown
milestone1.9.3a5pre
[JAEGER] Added JSOP_NEWARRAY.
js/src/methodjit/Compiler.cpp
js/src/methodjit/Compiler.h
js/src/methodjit/StubCalls.cpp
js/src/methodjit/StubCalls.h
--- a/js/src/methodjit/Compiler.cpp
+++ b/js/src/methodjit/Compiler.cpp
@@ -638,16 +638,28 @@ mjit::Compiler::generateMethod()
           BEGIN_CASE(JSOP_INT8)
             frame.push(Value(Int32Tag(GET_INT8(PC))));
           END_CASE(JSOP_INT8)
 
           BEGIN_CASE(JSOP_INT32)
             frame.push(Value(Int32Tag(GET_INT32(PC))));
           END_CASE(JSOP_INT32)
 
+          BEGIN_CASE(JSOP_NEWARRAY)
+          {
+            prepareStubCall();
+            uint32 len = GET_UINT16(PC);
+            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_TRACE)
           END_CASE(JSOP_TRACE)
 
           BEGIN_CASE(JSOP_GETGLOBAL)
             jsop_getglobal(GET_SLOTNO(PC));
           END_CASE(JSOP_GETGLOBAL)
 
           BEGIN_CASE(JSOP_SETGLOBAL)
--- a/js/src/methodjit/Compiler.h
+++ b/js/src/methodjit/Compiler.h
@@ -146,16 +146,17 @@ class Compiler
     }
 
     STUB_CALL_TYPE(JSObjStub);
     STUB_CALL_TYPE(VoidStubUInt32);
     STUB_CALL_TYPE(VoidStub);
     STUB_CALL_TYPE(VoidPtrStubUInt32);
     STUB_CALL_TYPE(VoidPtrStub);
     STUB_CALL_TYPE(BoolStub);
+    STUB_CALL_TYPE(JSObjStubUInt32);
 
 #undef STUB_CALL_TYPE
     void prepareStubCall();
     Call stubCall(void *ptr, Uses uses, Defs defs);
 };
 
 } /* namespace js */
 } /* namespace mjit */
--- a/js/src/methodjit/StubCalls.cpp
+++ b/js/src/methodjit/StubCalls.cpp
@@ -1599,8 +1599,17 @@ stubs::Mod(VMFrame &f)
             regs.sp[-2].setDouble(js_NaN);
         } else {
             d1 = js_fmod(d1, d2);
             regs.sp[-2].setDouble(d1);
         }
     }
 }
 
+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;
+}
+
--- 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 {
 
+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);
 void JS_FASTCALL GetElem(VMFrame &f);