]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - jit/JITStubCall.h
JavaScriptCore-1097.13.tar.gz
[apple/javascriptcore.git] / jit / JITStubCall.h
index cfbd7dc68befd618cae23fba2631f787c6c19c80..a525ff22750e098b952ec58575132511bd5dacd7 100644 (file)
@@ -99,12 +99,24 @@ namespace JSC {
             m_stackIndex += stackIndexStep;
         }
 
+        void addArgument(JIT::TrustedImm32 argument)
+        {
+            m_jit->poke(argument, m_stackIndex);
+            m_stackIndex += stackIndexStep;
+        }
+        
         void addArgument(JIT::Imm32 argument)
         {
             m_jit->poke(argument, m_stackIndex);
             m_stackIndex += stackIndexStep;
         }
 
+        void addArgument(JIT::TrustedImmPtr argument)
+        {
+            m_jit->poke(argument, m_stackIndex);
+            m_stackIndex += stackIndexStep;
+        }
+        
         void addArgument(JIT::ImmPtr argument)
         {
             m_jit->poke(argument, m_stackIndex);
@@ -116,13 +128,15 @@ namespace JSC {
             m_jit->poke(argument, m_stackIndex);
             m_stackIndex += stackIndexStep;
         }
-
+        
+#if USE(JSVALUE32_64)
         void addArgument(const JSValue& value)
         {
             m_jit->poke(JIT::Imm32(value.payload()), m_stackIndex);
             m_jit->poke(JIT::Imm32(value.tag()), m_stackIndex + 1);
             m_stackIndex += stackIndexStep;
         }
+#endif
 
         void addArgument(JIT::RegisterID tag, JIT::RegisterID payload)
         {
@@ -165,17 +179,18 @@ namespace JSC {
         JIT::Call call()
         {
 #if ENABLE(OPCODE_SAMPLING)
-            if (m_jit->m_bytecodeIndex != (unsigned)-1)
-                m_jit->sampleInstruction(m_jit->m_codeBlock->instructions().begin() + m_jit->m_bytecodeIndex, true);
+            if (m_jit->m_bytecodeOffset != (unsigned)-1)
+                m_jit->sampleInstruction(m_jit->m_codeBlock->instructions().begin() + m_jit->m_bytecodeOffset, true);
 #endif
 
             m_jit->restoreArgumentReference();
+            m_jit->updateTopCallFrame();
             JIT::Call call = m_jit->call();
-            m_jit->m_calls.append(CallRecord(call, m_jit->m_bytecodeIndex, m_stub.value()));
+            m_jit->m_calls.append(CallRecord(call, m_jit->m_bytecodeOffset, m_stub.value()));
 
 #if ENABLE(OPCODE_SAMPLING)
-            if (m_jit->m_bytecodeIndex != (unsigned)-1)
-                m_jit->sampleInstruction(m_jit->m_codeBlock->instructions().begin() + m_jit->m_bytecodeIndex, false);
+            if (m_jit->m_bytecodeOffset != (unsigned)-1)
+                m_jit->sampleInstruction(m_jit->m_codeBlock->instructions().begin() + m_jit->m_bytecodeOffset, false);
 #endif
 
 #if USE(JSVALUE32_64)
@@ -197,6 +212,21 @@ namespace JSC {
                 m_jit->emitStoreCell(dst, JIT::returnValueRegister);
             return call;
         }
+        
+        JIT::Call callWithValueProfiling(unsigned dst)
+        {
+            ASSERT(m_returnType == Value || m_returnType == Cell);
+            JIT::Call call = this->call();
+            ASSERT(JIT::returnValueRegister == JIT::regT0);
+            if (m_returnType == Cell)
+                m_jit->move(JIT::TrustedImm32(JSValue::CellTag), JIT::regT1);
+            m_jit->emitValueProfilingSite();
+            if (m_returnType == Value)
+                m_jit->emitStore(dst, JIT::regT1, JIT::regT0);
+            else
+                m_jit->emitStoreCell(dst, JIT::returnValueRegister);
+            return call;
+        }
 #else
         JIT::Call call(unsigned dst) // dst is a virtual register.
         {
@@ -205,6 +235,16 @@ namespace JSC {
             m_jit->emitPutVirtualRegister(dst);
             return call;
         }
+        
+        JIT::Call callWithValueProfiling(unsigned dst)
+        {
+            ASSERT(m_returnType == VoidPtr || m_returnType == Cell);
+            JIT::Call call = this->call();
+            ASSERT(JIT::returnValueRegister == JIT::regT0);
+            m_jit->emitValueProfilingSite();
+            m_jit->emitPutVirtualRegister(dst);
+            return call;
+        }
 #endif
 
         JIT::Call call(JIT::RegisterID dst) // dst is a machine register.