aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jit/qv4baselineassembler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jit/qv4baselineassembler.cpp')
-rw-r--r--src/qml/jit/qv4baselineassembler.cpp238
1 files changed, 119 insertions, 119 deletions
diff --git a/src/qml/jit/qv4baselineassembler.cpp b/src/qml/jit/qv4baselineassembler.cpp
index b13f646360..496624c752 100644
--- a/src/qml/jit/qv4baselineassembler.cpp
+++ b/src/qml/jit/qv4baselineassembler.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QBuffer>
#include <QFile>
@@ -55,7 +19,7 @@
#undef ENABLE_ALL_ASSEMBLERS_FOR_REFACTORING_PURPOSES
-#ifdef V4_ENABLE_JIT
+#if QT_CONFIG(qml_jit)
QT_BEGIN_NAMESPACE
namespace QV4 {
@@ -63,7 +27,8 @@ namespace JIT {
#define ASM_GENERATE_RUNTIME_CALL(function, destination) \
pasm()->GENERATE_RUNTIME_CALL(function, destination)
-#define callHelper(x) PlatformAssemblerCommon::callRuntimeUnchecked(#x, reinterpret_cast<void *>(&x))
+#define callHelper(x) \
+ PlatformAssemblerCommon::callRuntimeUnchecked(reinterpret_cast<void *>(&x), #x)
const QV4::Value::ValueTypeInternal IntegerTag = QV4::Value::ValueTypeInternal::Integer;
@@ -85,12 +50,13 @@ public:
: PlatformAssemblerCommon(constantTable)
{}
- void callRuntime(const char *functionName, const void *funcPtr,
- CallResultDestination dest)
+ void callRuntime(const void *funcPtr, CallResultDestination dest)
{
- PlatformAssemblerCommon::callRuntime(functionName, funcPtr);
+ PlatformAssemblerCommon::callRuntime(funcPtr);
if (dest == CallResultDestination::InAccumulator)
saveReturnValueInAccumulator();
+ else if (AccumulatorRegister == ReturnValueRegister)
+ loadUndefined();
}
void saveReturnValueInAccumulator()
@@ -180,7 +146,9 @@ public:
void toBoolean(std::function<void(RegisterID)> continuation)
{
urshift64(AccumulatorRegister, TrustedImm32(Value::IsIntegerConvertible_Shift), ScratchRegister);
- auto needsConversion = branch32(NotEqual, TrustedImm32(1), ScratchRegister);
+ auto needsConversion = branch32(
+ NotEqual, TrustedImm32(Value::IsIntegerConvertible_Value), ScratchRegister);
+
continuation(AccumulatorRegister);
Jump done = jump();
@@ -198,8 +166,10 @@ public:
void toNumber()
{
- urshift64(AccumulatorRegister, TrustedImm32(Value::QuickType_Shift), ScratchRegister);
- auto isNumber = branch32(GreaterThanOrEqual, ScratchRegister, TrustedImm32(Value::QT_Int));
+ move(TrustedImm64(Value::NumberMask), ScratchRegister);
+ and64(AccumulatorRegister, ScratchRegister);
+ move(TrustedImm64(Value::NumberDiscriminator), ScratchRegister2);
+ auto isNumber = branch64(GreaterThanOrEqual, ScratchRegister, ScratchRegister2);
move(AccumulatorRegister, registerForArg(0));
callHelper(toNumberHelper);
@@ -242,7 +212,7 @@ public:
auto isInt = branch32(Equal, TrustedImm32(Value::QT_Int), ScratchRegister2);
move(AccumulatorRegister, registerForArg(0));
- callRuntimeUnchecked("toInt32Helper", reinterpret_cast<void *>(&toInt32Helper));
+ callHelper(toInt32Helper);
saveReturnValueInAccumulator();
isInt.link(this);
@@ -280,7 +250,7 @@ public:
Jump isIntOrBool()
{
urshift64(AccumulatorRegister, TrustedImm32(Value::IsIntegerOrBool_Shift), ScratchRegister);
- return branch32(Equal, TrustedImm32(3), ScratchRegister);
+ return branch32(Equal, TrustedImm32(Value::IsIntegerOrBool_Value), ScratchRegister);
}
void jumpStrictEqualStackSlotInt(int lhs, int rhs, int offset)
@@ -314,7 +284,7 @@ public:
void encodeDoubleIntoAccumulator(FPRegisterID src)
{
moveDoubleTo64(src, AccumulatorRegister);
- move(TrustedImm64(Value::NaNEncodeMask), ScratchRegister);
+ move(TrustedImm64(Value::EncodeMask), ScratchRegister);
xor64(ScratchRegister, AccumulatorRegister);
}
@@ -353,7 +323,8 @@ public:
Jump unopIntPath(std::function<Jump(void)> fastPath)
{
urshift64(AccumulatorRegister, TrustedImm32(Value::IsIntegerConvertible_Shift), ScratchRegister);
- Jump accNotIntConvertible = branch32(NotEqual, TrustedImm32(1), ScratchRegister);
+ Jump accNotIntConvertible = branch32(
+ NotEqual, TrustedImm32(Value::IsIntegerConvertible_Value), ScratchRegister);
// both integer
Jump failure = fastPath();
@@ -385,12 +356,13 @@ public:
: PlatformAssemblerCommon(constantTable)
{}
- void callRuntime(const char *functionName, const void *funcPtr,
- CallResultDestination dest)
+ void callRuntime(const void *funcPtr, CallResultDestination dest)
{
- PlatformAssemblerCommon::callRuntime(functionName, funcPtr);
+ PlatformAssemblerCommon::callRuntime(funcPtr);
if (dest == CallResultDestination::InAccumulator)
saveReturnValueInAccumulator();
+ else if (AccumulatorRegisterValue == ReturnValueRegisterValue)
+ loadUndefined();
}
void saveReturnValueInAccumulator()
@@ -482,8 +454,12 @@ public:
void toNumber()
{
- urshift32(AccumulatorRegisterTag, TrustedImm32(Value::QuickType_Shift - 32), ScratchRegister);
- auto isNumber = branch32(GreaterThanOrEqual, ScratchRegister, TrustedImm32(Value::QT_Int));
+ and32(TrustedImm32(Value::NumberMask >> Value::Tag_Shift),
+ AccumulatorRegisterTag, ScratchRegister);
+ auto isNumber = branch32(
+ GreaterThanOrEqual, ScratchRegister,
+ TrustedImm32(Value::NumberDiscriminator >> Value::Tag_Shift));
+
if (ArgInRegCount < 2) {
subPtr(TrustedImm32(2 * PointerSize), StackPointerRegister); // stack alignment
@@ -493,7 +469,7 @@ public:
move(AccumulatorRegisterValue, registerForArg(0));
move(AccumulatorRegisterTag, registerForArg(1));
}
- callRuntimeUnchecked("toNumberHelper", reinterpret_cast<void *>(&toNumberHelper));
+ callHelper(toNumberHelper);
saveReturnValueInAccumulator();
if (ArgInRegCount < 2)
addPtr(TrustedImm32(4 * PointerSize), StackPointerRegister);
@@ -550,7 +526,7 @@ public:
move(AccumulatorRegisterValue, registerForArg(0));
move(AccumulatorRegisterTag, registerForArg(1));
}
- callRuntimeUnchecked("toInt32Helper", reinterpret_cast<void *>(&toInt32Helper));
+ callHelper(toInt32Helper);
saveReturnValueInAccumulator();
if (ArgInRegCount < 2)
addPtr(TrustedImm32(4 * PointerSize), StackPointerRegister);
@@ -572,7 +548,7 @@ public:
move(AccumulatorRegisterValue, registerForArg(0));
move(AccumulatorRegisterTag, registerForArg(1));
}
- callRuntimeUnchecked("toInt32Helper", reinterpret_cast<void *>(&toInt32Helper));
+ callHelper(toInt32Helper);
saveReturnValueInAccumulator();
if (ArgInRegCount < 2)
addPtr(TrustedImm32(4 * PointerSize), StackPointerRegister);
@@ -632,7 +608,7 @@ public:
Jump isIntOrBool()
{
urshift32(AccumulatorRegisterTag, TrustedImm32(Value::IsIntegerOrBool_Shift - 32), ScratchRegister);
- return branch32(Equal, TrustedImm32(3), ScratchRegister);
+ return branch32(Equal, TrustedImm32(Value::IsIntegerOrBool_Value), ScratchRegister);
}
void pushValue(ReturnedValue v)
@@ -663,7 +639,8 @@ public:
{
urshift32(AccumulatorRegisterTag, TrustedImm32(Value::IsIntegerConvertible_Shift - 32),
ScratchRegister);
- auto needsConversion = branch32(NotEqual, TrustedImm32(1), ScratchRegister);
+ auto needsConversion = branch32(
+ NotEqual, TrustedImm32(Value::IsIntegerConvertible_Value), ScratchRegister);
continuation(AccumulatorRegisterValue);
Jump done = jump();
@@ -740,7 +717,7 @@ public:
void encodeDoubleIntoAccumulator(FPRegisterID src)
{
moveDoubleToInts(src, AccumulatorRegisterValue, AccumulatorRegisterTag);
- xor32(TrustedImm32(Value::NaNEncodeMask >> 32), AccumulatorRegisterTag);
+ xor32(TrustedImm32(Value::EncodeMask >> 32), AccumulatorRegisterTag);
}
void pushValueAligned(ReturnedValue v)
@@ -887,7 +864,7 @@ void BaselineAssembler::storeReg(int reg)
void BaselineAssembler::loadLocal(int index, int level)
{
Heap::CallContext ctx;
- Q_UNUSED(ctx)
+ Q_UNUSED(ctx);
pasm()->loadPointerFromValue(regAddr(CallData::Context), PlatformAssembler::ScratchRegister);
while (level) {
pasm()->loadPtr(Address(PlatformAssembler::ScratchRegister, ctx.outer.offset), PlatformAssembler::ScratchRegister);
@@ -899,7 +876,7 @@ void BaselineAssembler::loadLocal(int index, int level)
void BaselineAssembler::storeLocal(int index, int level)
{
Heap::CallContext ctx;
- Q_UNUSED(ctx)
+ Q_UNUSED(ctx);
pasm()->loadPtr(regAddr(CallData::Context), PlatformAssembler::ScratchRegister);
while (level) {
pasm()->loadPtr(Address(PlatformAssembler::ScratchRegister, ctx.outer.offset), PlatformAssembler::ScratchRegister);
@@ -926,7 +903,7 @@ void BaselineAssembler::storeHeapObject(int reg)
void BaselineAssembler::loadImport(int index)
{
Address addr = pasm()->loadCompilationUnitPtr(PlatformAssembler::ScratchRegister);
- addr.offset = offsetof(QV4::CompiledData::CompilationUnitBase, imports);
+ addr.offset = offsetof(QV4::CompilationUnitRuntimeData, imports);
pasm()->loadPtr(addr, PlatformAssembler::ScratchRegister);
addr.offset = index * int(sizeof(QV4::Value*));
pasm()->loadPtr(addr, PlatformAssembler::ScratchRegister);
@@ -943,7 +920,7 @@ void BaselineAssembler::uminus()
saveAccumulatorInFrame();
pasm()->prepareCallWithArgCount(1);
pasm()->passAccumulatorAsArg(0);
- ASM_GENERATE_RUNTIME_CALL(Runtime::method_uMinus, CallResultDestination::InAccumulator);
+ ASM_GENERATE_RUNTIME_CALL(UMinus, CallResultDestination::InAccumulator);
checkException();
}
@@ -1044,7 +1021,7 @@ void BaselineAssembler::add(int lhs)
pasm()->passAccumulatorAsArg(2);
pasm()->passJSSlotAsArg(lhs, 1);
pasm()->passEngineAsArg(0);
- ASM_GENERATE_RUNTIME_CALL(Runtime::method_add, CallResultDestination::InAccumulator);
+ ASM_GENERATE_RUNTIME_CALL(Add, CallResultDestination::InAccumulator);
checkException();
// done.
@@ -1196,7 +1173,7 @@ void BaselineAssembler::mul(int lhs)
pasm()->prepareCallWithArgCount(2);
pasm()->passAccumulatorAsArg(1);
pasm()->passJSSlotAsArg(lhs, 0);
- ASM_GENERATE_RUNTIME_CALL(Runtime::method_mul, CallResultDestination::InAccumulator);
+ ASM_GENERATE_RUNTIME_CALL(Mul, CallResultDestination::InAccumulator);
checkException();
// done.
@@ -1209,7 +1186,7 @@ void BaselineAssembler::div(int lhs)
pasm()->prepareCallWithArgCount(2);
pasm()->passAccumulatorAsArg(1);
pasm()->passJSSlotAsArg(lhs, 0);
- ASM_GENERATE_RUNTIME_CALL(Runtime::method_div, CallResultDestination::InAccumulator);
+ ASM_GENERATE_RUNTIME_CALL(Div, CallResultDestination::InAccumulator);
checkException();
}
@@ -1219,7 +1196,7 @@ void BaselineAssembler::mod(int lhs)
pasm()->prepareCallWithArgCount(2);
pasm()->passAccumulatorAsArg(1);
pasm()->passJSSlotAsArg(lhs, 0);
- ASM_GENERATE_RUNTIME_CALL(Runtime::method_mod, CallResultDestination::InAccumulator);
+ ASM_GENERATE_RUNTIME_CALL(Mod, CallResultDestination::InAccumulator);
checkException();
}
@@ -1239,7 +1216,7 @@ void BaselineAssembler::sub(int lhs)
pasm()->prepareCallWithArgCount(2);
pasm()->passAccumulatorAsArg(1);
pasm()->passJSSlotAsArg(lhs, 0);
- ASM_GENERATE_RUNTIME_CALL(Runtime::method_sub, CallResultDestination::InAccumulator);
+ ASM_GENERATE_RUNTIME_CALL(Sub, CallResultDestination::InAccumulator);
checkException();
// done.
@@ -1269,7 +1246,7 @@ void BaselineAssembler::cmpeqInt(int lhs)
else
pasm()->move(PlatformAssembler::StackPointerRegister, pasm()->registerForArg(1));
pasm()->pushAccumulatorAsArg(0);
- pasm()->callRuntimeUnchecked("Runtime::method_equal", (void*)Runtime::method_equal);
+ pasm()->callRuntimeUnchecked((void*)Runtime::Equal::call);
pasm()->saveReturnValueInAccumulator();
if (PlatformAssembler::ArgInRegCount < 2)
pasm()->addPtr(TrustedImm32(2 * PlatformAssembler::PointerSize), PlatformAssembler::StackPointerRegister);
@@ -1293,7 +1270,7 @@ void BaselineAssembler::cmpneInt(int lhs)
else
pasm()->move(PlatformAssembler::StackPointerRegister, pasm()->registerForArg(1));
pasm()->pushAccumulatorAsArg(0);
- pasm()->callRuntimeUnchecked("Runtime::method_notEqual", (void*)Runtime::method_notEqual);
+ pasm()->callRuntimeUnchecked((void*)Runtime::NotEqual::call);
pasm()->saveReturnValueInAccumulator();
if (PlatformAssembler::ArgInRegCount < 2)
pasm()->addPtr(TrustedImm32(2 * PlatformAssembler::PointerSize), PlatformAssembler::StackPointerRegister);
@@ -1307,14 +1284,13 @@ void BaselineAssembler::cmpneInt(int lhs)
done.link(pasm());
}
-void BaselineAssembler::cmp(int cond, CmpFunc function, const char *functionName, int lhs)
+void BaselineAssembler::cmp(int cond, CmpFunc function, int lhs)
{
auto c = static_cast<PlatformAssembler::RelationalCondition>(cond);
auto done = pasm()->binopBothIntPath(regAddr(lhs), [this, c](){
pasm()->compare32(c, PlatformAssembler::ScratchRegister,
PlatformAssembler::AccumulatorRegisterValue,
PlatformAssembler::AccumulatorRegisterValue);
- pasm()->setAccumulatorTag(QV4::Value::ValueTypeInternal::Boolean);
return PlatformAssembler::Jump();
});
@@ -1324,86 +1300,79 @@ void BaselineAssembler::cmp(int cond, CmpFunc function, const char *functionName
pasm()->passAccumulatorAsArg(1);
pasm()->passJSSlotAsArg(lhs, 0);
- callRuntime(functionName, reinterpret_cast<void*>(function), CallResultDestination::InAccumulator);
+ callRuntime(reinterpret_cast<void*>(function), CallResultDestination::InAccumulator);
checkException();
- pasm()->setAccumulatorTag(QV4::Value::ValueTypeInternal::Boolean);
// done.
done.link(pasm());
+ pasm()->setAccumulatorTag(QV4::Value::ValueTypeInternal::Boolean);
}
void BaselineAssembler::cmpeq(int lhs)
{
- cmp(PlatformAssembler::Equal, &Runtime::method_compareEqual,
- "Runtime::method_compareEqual", lhs);
+ cmp(PlatformAssembler::Equal, &Runtime::CompareEqual::call, lhs);
}
void BaselineAssembler::cmpne(int lhs)
{
- cmp(PlatformAssembler::NotEqual, &Runtime::method_compareNotEqual,
- "Runtime::method_compareNotEqual", lhs);
+ cmp(PlatformAssembler::NotEqual, &Runtime::CompareNotEqual::call, lhs);
}
void BaselineAssembler::cmpgt(int lhs)
{
- cmp(PlatformAssembler::GreaterThan, &Runtime::method_compareGreaterThan,
- "Runtime::method_compareGreaterThan", lhs);
+ cmp(PlatformAssembler::GreaterThan, &Runtime::CompareGreaterThan::call, lhs);
}
void BaselineAssembler::cmpge(int lhs)
{
- cmp(PlatformAssembler::GreaterThanOrEqual, &Runtime::method_compareGreaterEqual,
- "Runtime::method_compareGreaterEqual", lhs);
+ cmp(PlatformAssembler::GreaterThanOrEqual, &Runtime::CompareGreaterEqual::call, lhs);
}
void BaselineAssembler::cmplt(int lhs)
{
- cmp(PlatformAssembler::LessThan, &Runtime::method_compareLessThan,
- "Runtime::method_compareLessThan", lhs);
+ cmp(PlatformAssembler::LessThan, &Runtime::CompareLessThan::call, lhs);
}
void BaselineAssembler::cmple(int lhs)
{
- cmp(PlatformAssembler::LessThanOrEqual, &Runtime::method_compareLessEqual,
- "Runtime::method_compareLessEqual", lhs);
+ cmp(PlatformAssembler::LessThanOrEqual, &Runtime::CompareLessEqual::call, lhs);
}
void BaselineAssembler::cmpStrictEqual(int lhs)
{
- cmp(PlatformAssembler::Equal, &RuntimeHelpers::strictEqual,
- "RuntimeHelpers::strictEqual", lhs);
+ cmp(PlatformAssembler::Equal, &Runtime::CompareStrictEqual::call, lhs);
}
void BaselineAssembler::cmpStrictNotEqual(int lhs)
{
- cmp(PlatformAssembler::Equal, &RuntimeHelpers::strictEqual,
- "RuntimeHelpers::strictEqual", lhs);
- pasm()->xor32(TrustedImm32(1), PlatformAssembler::AccumulatorRegisterValue);
- pasm()->setAccumulatorTag(QV4::Value::ValueTypeInternal::Boolean);
+ cmp(PlatformAssembler::NotEqual, &Runtime::CompareStrictNotEqual::call, lhs);
}
-void BaselineAssembler::jump(int offset)
+int BaselineAssembler::jump(int offset)
{
pasm()->addJumpToOffset(pasm()->jump(), offset);
+ return offset;
}
-void BaselineAssembler::jumpTrue(int offset)
+int BaselineAssembler::jumpTrue(int offset)
{
pasm()->toBoolean([this, offset](PlatformAssembler::RegisterID resultReg) {
auto jump = pasm()->branch32(PlatformAssembler::NotEqual, TrustedImm32(0), resultReg);
pasm()->addJumpToOffset(jump, offset);
});
+ return offset;
}
-void BaselineAssembler::jumpFalse(int offset)
+int BaselineAssembler::jumpFalse(int offset)
{
pasm()->toBoolean([this, offset](PlatformAssembler::RegisterID resultReg) {
auto jump = pasm()->branch32(PlatformAssembler::Equal, TrustedImm32(0), resultReg);
pasm()->addJumpToOffset(jump, offset);
});
+ return offset;
}
-void BaselineAssembler::jumpNoException(int offset)
+int BaselineAssembler::jumpNoException(int offset)
{
auto jump = pasm()->branch32(
PlatformAssembler::Equal,
@@ -1411,13 +1380,32 @@ void BaselineAssembler::jumpNoException(int offset)
offsetof(EngineBase, hasException)),
TrustedImm32(0));
pasm()->addJumpToOffset(jump, offset);
+ return offset;
}
-void BaselineAssembler::jumpNotUndefined(int offset)
+int BaselineAssembler::jumpNotUndefined(int offset)
{
pasm()->jumpNotUndefined(offset);
+ return offset;
}
+int BaselineAssembler::jumpEqNull(int offset)
+{
+ saveAccumulatorInFrame();
+ cmpeqNull();
+
+ pasm()->toBoolean([this, offset](PlatformAssembler::RegisterID resultReg) {
+ auto isFalse = pasm()->branch32(PlatformAssembler::Equal, TrustedImm32(0), resultReg);
+ loadValue(Encode::undefined());
+ pasm()->addJumpToOffset(pasm()->jump(), offset);
+ isFalse.link(pasm());
+ loadAccumulatorFromFrame();
+ });
+
+ return offset;
+}
+
+
void BaselineAssembler::prepareCallWithArgCount(int argc)
{
pasm()->prepareCallWithArgCount(argc);
@@ -1458,9 +1446,14 @@ void BaselineAssembler::passInt32AsArg(int value, int arg)
pasm()->passInt32AsArg(value, arg);
}
-void BaselineAssembler::callRuntime(const char *functionName, const void *funcPtr, CallResultDestination dest)
+void BaselineAssembler::passPointerAsArg(void *ptr, int arg)
+{
+ pasm()->passPointerAsArg(ptr, arg);
+}
+
+void BaselineAssembler::callRuntime(const void *funcPtr, CallResultDestination dest)
{
- pasm()->callRuntime(functionName, funcPtr, dest);
+ pasm()->callRuntime(funcPtr, dest);
}
void BaselineAssembler::saveAccumulatorInFrame()
@@ -1469,9 +1462,15 @@ void BaselineAssembler::saveAccumulatorInFrame()
offsetof(CallData, accumulator)));
}
-static ReturnedValue TheJitIs__Tail_Calling__ToTheRuntimeSoTheJitFrameIsMissing(CppStackFrame *frame, ExecutionEngine *engine)
+void BaselineAssembler::loadAccumulatorFromFrame()
{
- return Runtime::method_tailCall(frame, engine);
+ pasm()->loadAccumulator(PlatformAssembler::Address(PlatformAssembler::JSStackFrameRegister,
+ offsetof(CallData, accumulator)));
+}
+
+static ReturnedValue TheJitIs__Tail_Calling__ToTheRuntimeSoTheJitFrameIsMissing(JSTypesStackFrame *frame, ExecutionEngine *engine)
+{
+ return Runtime::TailCall::call(frame, engine);
}
void BaselineAssembler::jsTailCall(int func, int thisObject, int argc, int argv)
@@ -1487,8 +1486,9 @@ void BaselineAssembler::jsTailCall(int func, int thisObject, int argc, int argv)
pasm()->storeInt32AsValue(argv, Address(tos.base, argvOffset));
pasm()->moveReg(regAddr(thisObject), Address(tos.base, thisOffset));
pasm()->moveReg(regAddr(func), Address(tos.base, funcOffset));
- pasm()->tailCallRuntime("TheJitIs__Tail_Calling__ToTheRuntimeSoTheJitFrameIsMissing",
- reinterpret_cast<void *>(TheJitIs__Tail_Calling__ToTheRuntimeSoTheJitFrameIsMissing));
+ pasm()->tailCallRuntime(
+ reinterpret_cast<void *>(TheJitIs__Tail_Calling__ToTheRuntimeSoTheJitFrameIsMissing),
+ "TheJitIs__Tail_Calling__ToTheRuntimeSoTheJitFrameIsMissing");
}
void BaselineAssembler::checkException()
@@ -1534,10 +1534,11 @@ void BaselineAssembler::setException()
noException.link(pasm());
}
-void BaselineAssembler::setUnwindHandler(int offset)
+int BaselineAssembler::setUnwindHandler(int offset)
{
auto l = pasm()->storePtrWithPatch(TrustedImmPtr(nullptr), pasm()->exceptionHandlerAddress());
pasm()->addEHTarget(l, offset);
+ return offset;
}
@@ -1549,26 +1550,27 @@ void BaselineAssembler::clearUnwindHandler()
void JIT::BaselineAssembler::unwindDispatch()
{
checkException();
- pasm()->load32(Address(PlatformAssembler::CppStackFrameRegister, offsetof(CppStackFrame, unwindLevel)), PlatformAssembler::ScratchRegister);
+ pasm()->load32(Address(PlatformAssembler::CppStackFrameRegister, offsetof(JSTypesStackFrame, unwindLevel)), PlatformAssembler::ScratchRegister);
auto noUnwind = pasm()->branch32(PlatformAssembler::Equal, PlatformAssembler::ScratchRegister, TrustedImm32(0));
pasm()->sub32(TrustedImm32(1), PlatformAssembler::ScratchRegister);
- pasm()->store32(PlatformAssembler::ScratchRegister, Address(PlatformAssembler::CppStackFrameRegister, offsetof(CppStackFrame, unwindLevel)));
+ pasm()->store32(PlatformAssembler::ScratchRegister, Address(PlatformAssembler::CppStackFrameRegister, offsetof(JSTypesStackFrame, unwindLevel)));
auto jump = pasm()->branch32(PlatformAssembler::Equal, PlatformAssembler::ScratchRegister, TrustedImm32(0));
gotoCatchException();
jump.link(pasm());
- pasm()->loadPtr(Address(PlatformAssembler::CppStackFrameRegister, offsetof(CppStackFrame, unwindLabel)), PlatformAssembler::ScratchRegister);
+ pasm()->loadPtr(Address(PlatformAssembler::CppStackFrameRegister, offsetof(JSTypesStackFrame, unwindLabel)), PlatformAssembler::ScratchRegister);
pasm()->jump(PlatformAssembler::ScratchRegister);
noUnwind.link(pasm());
}
-void JIT::BaselineAssembler::unwindToLabel(int level, int offset)
+int JIT::BaselineAssembler::unwindToLabel(int level, int offset)
{
- auto l = pasm()->storePtrWithPatch(TrustedImmPtr(nullptr), Address(PlatformAssembler::CppStackFrameRegister, offsetof(CppStackFrame, unwindLabel)));
+ auto l = pasm()->storePtrWithPatch(TrustedImmPtr(nullptr), Address(PlatformAssembler::CppStackFrameRegister, offsetof(JSTypesStackFrame, unwindLabel)));
pasm()->addEHTarget(l, offset);
- pasm()->store32(TrustedImm32(level), Address(PlatformAssembler::CppStackFrameRegister, offsetof(CppStackFrame, unwindLevel)));
+ pasm()->store32(TrustedImm32(level), Address(PlatformAssembler::CppStackFrameRegister, offsetof(JSTypesStackFrame, unwindLevel)));
gotoCatchException();
+ return offset;
}
void BaselineAssembler::pushCatchContext(int index, int name)
@@ -1576,15 +1578,14 @@ void BaselineAssembler::pushCatchContext(int index, int name)
pasm()->prepareCallWithArgCount(3);
pasm()->passInt32AsArg(name, 2);
pasm()->passInt32AsArg(index, 1);
- pasm()->passJSSlotAsArg(CallData::Context, 0);
- ASM_GENERATE_RUNTIME_CALL(Runtime::method_createCatchContext, CallResultDestination::InAccumulator);
- pasm()->storeAccumulator(pasm()->contextAddress());
+ pasm()->passEngineAsArg(0);
+ ASM_GENERATE_RUNTIME_CALL(PushCatchContext, CallResultDestination::Ignore);
}
void BaselineAssembler::popContext()
{
Heap::CallContext ctx;
- Q_UNUSED(ctx)
+ Q_UNUSED(ctx);
pasm()->loadPointerFromValue(regAddr(CallData::Context), PlatformAssembler::ScratchRegister);
pasm()->loadPtr(Address(PlatformAssembler::ScratchRegister, ctx.outer.offset), PlatformAssembler::ScratchRegister);
pasm()->storeHeapObject(PlatformAssembler::ScratchRegister, regAddr(CallData::Context));
@@ -1594,11 +1595,10 @@ void BaselineAssembler::deadTemporalZoneCheck(int offsetForSavedIP, int variable
{
auto valueIsAliveJump = pasm()->jumpNotEmpty();
storeInstructionPointer(offsetForSavedIP);
- saveAccumulatorInFrame();
prepareCallWithArgCount(2);
passInt32AsArg(variableName, 1);
passEngineAsArg(0);
- ASM_GENERATE_RUNTIME_CALL(Runtime::method_throwReferenceError, CallResultDestination::Ignore);
+ ASM_GENERATE_RUNTIME_CALL(ThrowReferenceError, CallResultDestination::Ignore);
gotoCatchException();
valueIsAliveJump.link(pasm());
}
@@ -1613,4 +1613,4 @@ void BaselineAssembler::ret()
QT_END_NAMESPACE
-#endif // V4_ENABLE_JIT
+#endif // QT_CONFIG(qml_jit)