aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jit/qv4assemblercommon_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jit/qv4assemblercommon_p.h')
-rw-r--r--src/qml/jit/qv4assemblercommon_p.h93
1 files changed, 34 insertions, 59 deletions
diff --git a/src/qml/jit/qv4assemblercommon_p.h b/src/qml/jit/qv4assemblercommon_p.h
index 729d0fc53d..e83608ae23 100644
--- a/src/qml/jit/qv4assemblercommon_p.h
+++ b/src/qml/jit/qv4assemblercommon_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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) 2018 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
#ifndef QV4PLATFORMASSEMBLER_P_H
#define QV4PLATFORMASSEMBLER_P_H
@@ -52,13 +16,16 @@
//
#include <private/qv4engine_p.h>
-#include <private/qv4global_p.h>
#include <private/qv4function_p.h>
-#include <QHash>
+#include <private/qv4global_p.h>
+#include <private/qv4stackframe_p.h>
+
#include <wtf/Vector.h>
#include <assembler/MacroAssembler.h>
-#ifdef V4_ENABLE_JIT
+#include <QtCore/qhash.h>
+
+#if QT_CONFIG(qml_jit)
QT_BEGIN_NAMESPACE
@@ -66,14 +33,14 @@ namespace QV4 {
namespace JIT {
#if defined(Q_PROCESSOR_X86_64) || defined(ENABLE_ALL_ASSEMBLERS_FOR_REFACTORING_PURPOSES)
-#if defined(Q_OS_LINUX) || defined(Q_OS_QNX) || defined(Q_OS_FREEBSD) || defined(Q_OS_DARWIN)
+#if defined(Q_OS_LINUX) || defined(Q_OS_QNX) || defined(Q_OS_FREEBSD) || defined(Q_OS_DARWIN) || defined(Q_OS_SOLARIS) || defined(Q_OS_VXWORKS)
class PlatformAssembler_X86_64_SysV : public JSC::MacroAssembler<JSC::MacroAssemblerX86_64>
{
public:
static constexpr int NativeStackAlignment = 16;
- static const RegisterID NoRegister = RegisterID(-1);
+ static const RegisterID NoRegister = RegisterID::none;
static const RegisterID ReturnValueRegister = RegisterID::eax;
static const RegisterID ReturnValueRegisterValue = ReturnValueRegister;
@@ -160,7 +127,7 @@ typedef PlatformAssembler_X86_64_SysV PlatformAssemblerBase;
class PlatformAssembler_Win64 : public JSC::MacroAssembler<JSC::MacroAssemblerX86_64>
{
public:
- static const RegisterID NoRegister = RegisterID(-1);
+ static const RegisterID NoRegister = RegisterID::none;
static const RegisterID ReturnValueRegister = RegisterID::eax;
static const RegisterID ReturnValueRegisterValue = ReturnValueRegister;
@@ -250,7 +217,7 @@ typedef PlatformAssembler_Win64 PlatformAssemblerBase;
class PlatformAssembler_X86_All : public JSC::MacroAssembler<JSC::MacroAssemblerX86>
{
public:
- static const RegisterID NoRegister = RegisterID(-1);
+ static const RegisterID NoRegister = RegisterID::none;
static const RegisterID ReturnValueRegisterValue = RegisterID::eax;
static const RegisterID ReturnValueRegisterTag = RegisterID::edx;
@@ -340,7 +307,7 @@ typedef PlatformAssembler_X86_All PlatformAssemblerBase;
class PlatformAssembler_ARM64 : public JSC::MacroAssembler<JSC::MacroAssemblerARM64>
{
public:
- static const RegisterID NoRegister = RegisterID(-1);
+ static const RegisterID NoRegister = RegisterID::none;
static const RegisterID ReturnValueRegister = JSC::ARM64Registers::x0;
static const RegisterID ReturnValueRegisterValue = ReturnValueRegister;
@@ -439,7 +406,7 @@ typedef PlatformAssembler_ARM64 PlatformAssemblerBase;
class PlatformAssembler_ARM32 : public JSC::MacroAssembler<JSC::MacroAssemblerARMv7>
{
public:
- static const RegisterID NoRegister = RegisterID(-1);
+ static const RegisterID NoRegister = RegisterID::none;
static const RegisterID ReturnValueRegisterValue = JSC::ARMRegisters::r0;
static const RegisterID ReturnValueRegisterTag = JSC::ARMRegisters::r1;
@@ -449,7 +416,7 @@ public:
// r6 is used by MacroAssemblerARMv7
static const RegisterID JSStackFrameRegister = JSC::ARMRegisters::r8;
static const RegisterID CppStackFrameRegister = JSC::ARMRegisters::r10;
-#if CPU(ARM_THUMB2) || defined(V4_BOOTSTRAP)
+#if CPU(ARM_THUMB2)
static const RegisterID FramePointerRegister = JSC::ARMRegisters::r7;
static const RegisterID EngineRegister = JSC::ARMRegisters::r11;
#else // Thumbs down
@@ -579,7 +546,7 @@ public:
Address loadFunctionPtr(RegisterID target)
{
- Address addr(CppStackFrameRegister, offsetof(CppStackFrame, v4Function));
+ Address addr(CppStackFrameRegister, offsetof(JSTypesStackFrame, v4Function));
loadPtr(addr, target);
return Address(target);
}
@@ -587,7 +554,7 @@ public:
Address loadCompilationUnitPtr(RegisterID target)
{
Address addr = loadFunctionPtr(target);
- addr.offset = offsetof(QV4::Function, compilationUnit);
+ addr.offset = offsetof(QV4::FunctionData, compilationUnit);
loadPtr(addr, target);
return Address(target);
}
@@ -595,7 +562,7 @@ public:
Address loadConstAddress(int constIndex, RegisterID baseReg = ScratchRegister)
{
Address addr = loadCompilationUnitPtr(baseReg);
- addr.offset = offsetof(QV4::CompiledData::CompilationUnitBase, constants);
+ addr.offset = offsetof(QV4::CompilationUnitRuntimeData, constants);
loadPtr(addr, baseReg);
addr.offset = constIndex * int(sizeof(QV4::Value));
return addr;
@@ -604,7 +571,7 @@ public:
Address loadStringAddress(int stringId)
{
Address addr = loadCompilationUnitPtr(ScratchRegister);
- addr.offset = offsetof(QV4::CompiledData::CompilationUnitBase, runtimeStrings);
+ addr.offset = offsetof(QV4::CompilationUnitRuntimeData, runtimeStrings);
loadPtr(addr, ScratchRegister);
return Address(ScratchRegister, stringId * PointerSize);
}
@@ -619,11 +586,14 @@ public:
for (Jump j : catchyJumps)
j.link(this);
+ // We don't need to check for isInterrupted here because if that is set,
+ // then the first checkException() in any exception handler will find another "exception"
+ // and jump out of the exception handler.
loadPtr(exceptionHandlerAddress(), ScratchRegister);
Jump exitFunction = branchPtr(Equal, ScratchRegister, TrustedImmPtr(0));
+ loadUndefined();
jump(ScratchRegister);
exitFunction.link(this);
- loadUndefined();
if (functionExit.isSet())
jump(functionExit);
@@ -633,6 +603,8 @@ public:
void checkException()
{
+ // This actually reads 4 bytes, starting at hasException.
+ // Therefore, it also reads the isInterrupted flag, and triggers an exception on that.
addCatchyJump(
branch32(NotEqual,
Address(EngineRegister, offsetof(EngineBase, hasException)),
@@ -648,7 +620,8 @@ public:
void generateFunctionEntry()
{
generatePlatformFunctionEntry();
- loadPtr(Address(CppStackFrameRegister, offsetof(CppStackFrame, jsFrame)), JSStackFrameRegister);
+ loadPtr(Address(CppStackFrameRegister, offsetof(JSTypesStackFrame, jsFrame)),
+ JSStackFrameRegister);
allocateStackSpace();
}
@@ -670,7 +643,8 @@ public:
void addLabelForOffset(int offset)
{
- labelForOffset.insert(offset, label());
+ if (!labelForOffset.contains(offset))
+ labelForOffset.insert(offset, label());
}
void addJumpToOffset(const Jump &jump, int offset)
@@ -699,9 +673,10 @@ public:
void passAddressAsArg(Address addr, int arg);
void passCppFrameAsArg(int arg);
void passInt32AsArg(int value, int arg);
- void callRuntime(const char *functionName, const void *funcPtr);
- void callRuntimeUnchecked(const char *functionName, const void *funcPtr);
- void tailCallRuntime(const char *functionName, const void *funcPtr);
+ void passPointerAsArg(void *ptr, int arg);
+ void callRuntime(const void *funcPtr, const char *functionName = nullptr);
+ void callRuntimeUnchecked(const void *funcPtr, const char *functionName = nullptr);
+ void tailCallRuntime(const void *funcPtr, const char *functionName = nullptr);
void setTailCallArg(RegisterID src, int arg);
Address jsAlloca(int slotCount);
void storeInt32AsValue(int srcInt, Address destAddr);
@@ -733,6 +708,6 @@ private:
QT_END_NAMESPACE
-#endif // V4_ENABLE_JIT
+#endif // QT_CONFIG(qml_jit)
#endif // QV4PLATFORMASSEMBLER_P_H