X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/14957cd040308e3eeec43d26bae5d76da13fcd85..8b637bb680022adfddad653280734877951535a9:/jit/JITStubCall.h diff --git a/jit/JITStubCall.h b/jit/JITStubCall.h index a0341d6..2575588 100644 --- a/jit/JITStubCall.h +++ b/jit/JITStubCall.h @@ -37,7 +37,9 @@ namespace JSC { JITStubCall(JIT* jit, JSObject* (JIT_STUB *stub)(STUB_ARGS_DECLARATION)) : m_jit(jit) , m_stub(stub) +#if USE(JSVALUE32_64) || !ASSERT_DISABLED , m_returnType(Cell) +#endif , m_stackIndex(JITSTACKFRAME_ARGS_INDEX) { } @@ -45,7 +47,9 @@ namespace JSC { JITStubCall(JIT* jit, JSPropertyNameIterator* (JIT_STUB *stub)(STUB_ARGS_DECLARATION)) : m_jit(jit) , m_stub(stub) +#if USE(JSVALUE32_64) || !ASSERT_DISABLED , m_returnType(Cell) +#endif , m_stackIndex(JITSTACKFRAME_ARGS_INDEX) { } @@ -53,7 +57,9 @@ namespace JSC { JITStubCall(JIT* jit, void* (JIT_STUB *stub)(STUB_ARGS_DECLARATION)) : m_jit(jit) , m_stub(stub) +#if USE(JSVALUE32_64) || !ASSERT_DISABLED , m_returnType(VoidPtr) +#endif , m_stackIndex(JITSTACKFRAME_ARGS_INDEX) { } @@ -61,7 +67,9 @@ namespace JSC { JITStubCall(JIT* jit, int (JIT_STUB *stub)(STUB_ARGS_DECLARATION)) : m_jit(jit) , m_stub(stub) +#if USE(JSVALUE32_64) || !ASSERT_DISABLED , m_returnType(Int) +#endif , m_stackIndex(JITSTACKFRAME_ARGS_INDEX) { } @@ -69,7 +77,9 @@ namespace JSC { JITStubCall(JIT* jit, bool (JIT_STUB *stub)(STUB_ARGS_DECLARATION)) : m_jit(jit) , m_stub(stub) +#if USE(JSVALUE32_64) || !ASSERT_DISABLED , m_returnType(Int) +#endif , m_stackIndex(JITSTACKFRAME_ARGS_INDEX) { } @@ -77,20 +87,22 @@ namespace JSC { JITStubCall(JIT* jit, void (JIT_STUB *stub)(STUB_ARGS_DECLARATION)) : m_jit(jit) , m_stub(stub) +#if USE(JSVALUE32_64) || !ASSERT_DISABLED , m_returnType(Void) +#endif , m_stackIndex(JITSTACKFRAME_ARGS_INDEX) { } -#if USE(JSVALUE32_64) JITStubCall(JIT* jit, EncodedJSValue (JIT_STUB *stub)(STUB_ARGS_DECLARATION)) : m_jit(jit) , m_stub(stub) +#if USE(JSVALUE32_64) || !ASSERT_DISABLED , m_returnType(Value) +#endif , m_stackIndex(JITSTACKFRAME_ARGS_INDEX) { } -#endif // Arguments are added first to last. @@ -104,16 +116,32 @@ namespace JSC { 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); + m_stackIndex += stackIndexStep; + } void addArgument(JIT::RegisterID argument) { +#if USE(JSVALUE32_64) m_jit->poke(argument, m_stackIndex); +#else + m_jit->poke64(argument, m_stackIndex); +#endif m_stackIndex += stackIndexStep; } @@ -124,6 +152,18 @@ namespace JSC { m_jit->poke(JIT::Imm32(value.tag()), m_stackIndex + 1); m_stackIndex += stackIndexStep; } +#else + void addArgument(JIT::TrustedImm64 argument) + { + m_jit->poke(argument, m_stackIndex); + m_stackIndex += stackIndexStep; + } + + void addArgument(JIT::Imm64 argument) + { + m_jit->poke(argument, m_stackIndex); + m_stackIndex += stackIndexStep; + } #endif void addArgument(JIT::RegisterID tag, JIT::RegisterID payload) @@ -155,9 +195,9 @@ namespace JSC { void addArgument(unsigned src, JIT::RegisterID scratchRegister) // src is a virtual register. { if (m_jit->m_codeBlock->isConstantRegisterIndex(src)) - addArgument(JIT::ImmPtr(JSValue::encode(m_jit->m_codeBlock->getConstant(src)))); + addArgument(JIT::Imm64(JSValue::encode(m_jit->m_codeBlock->getConstant(src)))); else { - m_jit->loadPtr(JIT::Address(JIT::callFrameRegister, src * sizeof(Register)), scratchRegister); + m_jit->load64(JIT::Address(JIT::callFrameRegister, src * sizeof(Register)), scratchRegister); addArgument(scratchRegister); } m_jit->killLastResultRegister(); @@ -172,6 +212,7 @@ namespace JSC { #endif m_jit->restoreArgumentReference(); + m_jit->updateTopCallFrame(); JIT::Call call = m_jit->call(); m_jit->m_calls.append(CallRecord(call, m_jit->m_bytecodeOffset, m_stub.value())); @@ -199,22 +240,45 @@ 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. { - ASSERT(m_returnType == VoidPtr || m_returnType == Cell); + ASSERT(m_returnType == Value || m_returnType == Cell); JIT::Call call = this->call(); m_jit->emitPutVirtualRegister(dst); return call; } + + JIT::Call callWithValueProfiling(unsigned dst) + { + ASSERT(m_returnType == Value || 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. { -#if USE(JSVALUE32_64) +#if USE(JSVALUE32_64) || !ASSERT_DISABLED ASSERT(m_returnType == Value || m_returnType == VoidPtr || m_returnType == Int || m_returnType == Cell); -#else - ASSERT(m_returnType == VoidPtr || m_returnType == Int || m_returnType == Cell); #endif JIT::Call call = this->call(); if (dst != JIT::returnValueRegister) @@ -227,7 +291,9 @@ namespace JSC { JIT* m_jit; FunctionPtr m_stub; +#if USE(JSVALUE32_64) || !ASSERT_DISABLED enum { Void, VoidPtr, Int, Value, Cell } m_returnType; +#endif size_t m_stackIndex; }; }