diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-04-07 14:48:56 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-04-07 12:53:23 +0000 |
commit | 017350a8a9b4ac866c9b79186bf5a1dd6f6f06ec (patch) | |
tree | f98070d9bf0bd5659d34355b5eb9647637874187 /src/qml/jsruntime | |
parent | b361a59c699fca02379c149cf0b9c59490a1ba62 (diff) | |
parent | 67d1d7843ab5e1c904c8f0f76eadb9fc3f1bbb17 (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
src/qml/jit/qv4assembler.cpp
src/qml/jit/qv4assembler_p.h
src/qml/jit/qv4isel_masm.cpp
src/qml/jsruntime/qv4vme_moth.cpp
Change-Id: I865d794e550a263387a39ca8d051ebf48b70cbc0
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4globalobject.cpp | 1 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4scopedvalue_p.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4value_p.h | 58 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4vme_moth.cpp | 29 |
5 files changed, 54 insertions, 38 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index dd8cb177b4..806a614e95 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -524,7 +524,7 @@ void ExecutionEngine::initRootContext() sizeof(GlobalContext::Data) + sizeof(CallData))); r->d_unchecked()->init(this); r->d()->callData = reinterpret_cast<CallData *>(r->d() + 1); - r->d()->callData->tag = QV4::Value::Integer_Type_Internal; + r->d()->callData->tag = quint32(Value::ValueTypeInternal::Integer); r->d()->callData->argc = 0; r->d()->callData->thisObject = globalObject; r->d()->callData->args[0] = Encode::undefined(); diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index 1bc91f832b..f0630660d4 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -394,6 +394,7 @@ void EvalFunction::evalCall(Scope &scope, CallData *callData, bool directCall) c // set the correct strict mode flag on the context ctx->d()->strictMode = false; ctx->d()->compilationUnit = function->compilationUnit; + ctx->d()->constantTable = function->compilationUnit->constants; scope.result = Q_V4_PROFILE(ctx->engine(), function); } diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h index 894434be16..e9dcc9172f 100644 --- a/src/qml/jsruntime/qv4scopedvalue_p.h +++ b/src/qml/jsruntime/qv4scopedvalue_p.h @@ -368,7 +368,7 @@ struct ScopedCallData { { int size = qMax(argc, QV4::Global::ReservedArgumentCount + int(offsetof(QV4::CallData, args)/sizeof(QV4::Value))); ptr = reinterpret_cast<CallData *>(scope.alloc(size)); - ptr->tag = QV4::Value::Integer_Type_Internal; + ptr->tag = quint32(QV4::Value::ValueTypeInternal::Integer); ptr->argc = argc; } diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index 56b4ec44a2..50cecb6598 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -207,23 +207,23 @@ public: } QML_NEARLY_ALWAYS_INLINE void setInt_32(int i) { - setTagValue(Integer_Type_Internal, quint32(i)); + setTagValue(quint32(ValueTypeInternal::Integer), quint32(i)); } QML_NEARLY_ALWAYS_INLINE uint uint_32() const { return value(); } QML_NEARLY_ALWAYS_INLINE void setEmpty() { - setTagValue(Empty_Type_Internal, value()); + setTagValue(quint32(ValueTypeInternal::Empty), value()); } QML_NEARLY_ALWAYS_INLINE void setEmpty(int i) { - setTagValue(Empty_Type_Internal, quint32(i)); + setTagValue(quint32(ValueTypeInternal::Empty), quint32(i)); } QML_NEARLY_ALWAYS_INLINE void setEmpty(quint32 i) { - setTagValue(Empty_Type_Internal, i); + setTagValue(quint32(ValueTypeInternal::Empty), i); } QML_NEARLY_ALWAYS_INLINE quint32 emptyValue() @@ -266,8 +266,17 @@ public: IsDoubleTag_Shift = IsDouble_Shift - Tag_Shift, Managed_Type_Internal_64 = 0 }; + static const quint64 Immediate_Mask_64 = 0x00020000u; // bit 49 + enum class ValueTypeInternal_64 { + Empty = Immediate_Mask_64| 0, + ConvertibleToInt = Immediate_Mask_64| 0x10000u, // bit 48 + Null = ConvertibleToInt | 0x08000u, + Boolean = ConvertibleToInt | 0x04000u, + Integer = ConvertibleToInt | 0x02000u + }; + // Used only by 32-bit encoding enum Masks { SilentNaNBit = 0x00040000, @@ -275,6 +284,14 @@ public: }; static const quint64 Immediate_Mask_32 = NotDouble_Mask | 0x00020000u | SilentNaNBit; + enum class ValueTypeInternal_32 { + Empty = Immediate_Mask_32| 0, + ConvertibleToInt = Immediate_Mask_32| 0x10000u, // bit 48 + Null = ConvertibleToInt | 0x08000u, + Boolean = ConvertibleToInt | 0x04000u, + Integer = ConvertibleToInt | 0x02000u + }; + enum { Managed_Type_Internal_32 = NotDouble_Mask }; @@ -284,28 +301,23 @@ public: Managed_Type_Internal = Managed_Type_Internal_64 }; static const quint64 Immediate_Mask = Immediate_Mask_64; + using ValueTypeInternal = ValueTypeInternal_64; #else enum { Managed_Type_Internal = Managed_Type_Internal_32 }; static const quint64 Immediate_Mask = Immediate_Mask_32; + using ValueTypeInternal = ValueTypeInternal_32; #endif enum { NaN_Mask = 0x7ff80000, }; - enum ValueTypeInternal { - Empty_Type_Internal = Immediate_Mask | 0, - ConvertibleToInt = Immediate_Mask | 0x10000u, // bit 48 - Null_Type_Internal = ConvertibleToInt | 0x08000u, - Boolean_Type_Internal = ConvertibleToInt | 0x04000u, - Integer_Type_Internal = ConvertibleToInt | 0x02000u - }; // used internally in property - inline bool isEmpty() const { return tag() == Empty_Type_Internal; } - inline bool isNull() const { return tag() == Null_Type_Internal; } - inline bool isBoolean() const { return tag() == Boolean_Type_Internal; } - inline bool isInteger() const { return tag() == Integer_Type_Internal; } + inline bool isEmpty() const { return tag() == quint32(ValueTypeInternal::Empty); } + inline bool isNull() const { return tag() == quint32(ValueTypeInternal::Null); } + inline bool isBoolean() const { return tag() == quint32(ValueTypeInternal::Boolean); } + inline bool isInteger() const { return tag() == quint32(ValueTypeInternal::Integer); } inline bool isNullOrUndefined() const { return isNull() || isUndefined(); } inline bool isNumber() const { return isDouble() || isInteger(); } @@ -330,9 +342,9 @@ public: inline bool isDouble() const { return (tag() & NotDouble_Mask) != NotDouble_Mask; } inline bool isManaged() const { return tag() == Managed_Type_Internal && !isUndefined(); } inline bool isManagedOrUndefined() const { return tag() == Managed_Type_Internal; } - inline bool integerCompatible() const { return (tag() & ConvertibleToInt) == ConvertibleToInt; } + inline bool integerCompatible() const { return (tag() & quint32(ValueTypeInternal::ConvertibleToInt)) == quint32(ValueTypeInternal::ConvertibleToInt); } static inline bool integerCompatible(Value a, Value b) { - return ((a.tag() & b.tag()) & ConvertibleToInt) == ConvertibleToInt; + return ((a.tag() & b.tag()) & quint32(ValueTypeInternal::ConvertibleToInt)) == quint32(ValueTypeInternal::ConvertibleToInt); } static inline bool bothDouble(Value a, Value b) { return ((a.tag() | b.tag()) & NotDouble_Mask) != NotDouble_Mask; @@ -359,7 +371,7 @@ public: inline bool isString() const; inline bool isObject() const; inline bool isInt32() { - if (tag() == Integer_Type_Internal) + if (tag() == quint32(ValueTypeInternal::Integer)) return true; if (isDouble()) { double d = doubleValue(); @@ -372,7 +384,7 @@ public: return false; } double asDouble() const { - if (tag() == Integer_Type_Internal) + if (tag() == quint32(ValueTypeInternal::Integer)) return int_32(); return doubleValue(); } @@ -427,7 +439,7 @@ public: inline bool tryIntegerConversion() { bool b = integerCompatible(); if (b) - setTagValue(Integer_Type_Internal, value()); + setTagValue(quint32(ValueTypeInternal::Integer), value()); return b; } @@ -610,14 +622,14 @@ inline Primitive Primitive::emptyValue(uint e) inline Primitive Primitive::nullValue() { Primitive v; - v.setTagValue(Null_Type_Internal, 0); + v.setTagValue(quint32(ValueTypeInternal::Null), 0); return v; } inline Primitive Primitive::fromBoolean(bool b) { Primitive v; - v.setTagValue(Boolean_Type_Internal, b); + v.setTagValue(quint32(ValueTypeInternal::Boolean), b); return v; } @@ -639,7 +651,7 @@ inline Primitive Primitive::fromUInt32(uint i) { Primitive v; if (i < INT_MAX) { - v.setTagValue(Integer_Type_Internal, i); + v.setTagValue(quint32(ValueTypeInternal::Integer), i); } else { v.setDouble(i); } diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index 8d523f17e9..e16df8dc60 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -251,6 +251,9 @@ int qt_v4DebuggerHook(const char *json) static void qt_v4CheckForBreak(QV4::ExecutionContext *context) { + if (!qt_v4IsStepping && !qt_v4Breakpoints.size()) + return; + const int lineNumber = context->d()->lineNumber; QV4::Function *function = qt_v4ExtractFunction(context); QString engineName = function->sourceFile(); @@ -585,7 +588,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code #endif // DO_TRACE_INSTR Q_ASSERT(instr.callData + instr.argc + offsetof(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize); QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData); - callData->tag = QV4::Value::Integer_Type_Internal; + callData->tag = quint32(Value::ValueTypeInternal::Integer); callData->argc = instr.argc; callData->thisObject = QV4::Primitive::undefinedValue(); STOREVALUE(instr.result, Runtime::method_callValue(engine, VALUE(instr.dest), callData)); @@ -595,7 +598,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code TRACE(property name, "%s, args=%u, argc=%u, this=%s", qPrintable(runtimeStrings[instr.name]->toQString()), instr.callData, instr.argc, (VALUE(instr.base)).toString(context)->toQString().toUtf8().constData()); Q_ASSERT(instr.callData + instr.argc + offsetof(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize); QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData); - callData->tag = QV4::Value::Integer_Type_Internal; + callData->tag = quint32(Value::ValueTypeInternal::Integer); callData->argc = instr.argc; callData->thisObject = VALUE(instr.base); STOREVALUE(instr.result, Runtime::method_callProperty(engine, instr.name, callData)); @@ -604,7 +607,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code MOTH_BEGIN_INSTR(CallPropertyLookup) Q_ASSERT(instr.callData + instr.argc + offsetof(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize); QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData); - callData->tag = QV4::Value::Integer_Type_Internal; + callData->tag = quint32(Value::ValueTypeInternal::Integer); callData->argc = instr.argc; callData->thisObject = VALUE(instr.base); STOREVALUE(instr.result, Runtime::method_callPropertyLookup(engine, instr.lookupIndex, callData)); @@ -614,7 +617,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code TRACE(property name, "%s, args=%u, argc=%u, this=%s", qPrintable(runtimeStrings[instr.name]->toQString()), instr.callData, instr.argc, (VALUE(instr.base)).toString(context)->toQString().toUtf8().constData()); Q_ASSERT(instr.callData + instr.argc + offsetof(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize); QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData); - callData->tag = QV4::Value::Integer_Type_Internal; + callData->tag = quint32(Value::ValueTypeInternal::Integer); callData->argc = instr.argc; callData->thisObject = VALUE(instr.base); STOREVALUE(instr.result, Runtime::method_callQmlScopeObjectProperty(engine, instr.index, callData)); @@ -624,7 +627,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code TRACE(property name, "%s, args=%u, argc=%u, this=%s", qPrintable(runtimeStrings[instr.name]->toQString()), instr.callData, instr.argc, (VALUE(instr.base)).toString(context)->toQString().toUtf8().constData()); Q_ASSERT(instr.callData + instr.argc + offsetof(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize); QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData); - callData->tag = QV4::Value::Integer_Type_Internal; + callData->tag = quint32(Value::ValueTypeInternal::Integer); callData->argc = instr.argc; callData->thisObject = VALUE(instr.base); STOREVALUE(instr.result, Runtime::method_callQmlContextObjectProperty(engine, instr.index, callData)); @@ -633,7 +636,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code MOTH_BEGIN_INSTR(CallElement) Q_ASSERT(instr.callData + instr.argc + offsetof(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize); QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData); - callData->tag = QV4::Value::Integer_Type_Internal; + callData->tag = quint32(Value::ValueTypeInternal::Integer); callData->argc = instr.argc; callData->thisObject = VALUE(instr.base); STOREVALUE(instr.result, Runtime::method_callElement(engine, VALUE(instr.index), callData)); @@ -642,7 +645,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code MOTH_BEGIN_INSTR(CallActivationProperty) Q_ASSERT(instr.callData + instr.argc + offsetof(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize); QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData); - callData->tag = QV4::Value::Integer_Type_Internal; + callData->tag = quint32(Value::ValueTypeInternal::Integer); callData->argc = instr.argc; callData->thisObject = QV4::Primitive::undefinedValue(); STOREVALUE(instr.result, Runtime::method_callActivationProperty(engine, instr.name, callData)); @@ -651,7 +654,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code MOTH_BEGIN_INSTR(CallGlobalLookup) Q_ASSERT(instr.callData + instr.argc + offsetof(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize); QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData); - callData->tag = QV4::Value::Integer_Type_Internal; + callData->tag = quint32(Value::ValueTypeInternal::Integer); callData->argc = instr.argc; callData->thisObject = QV4::Primitive::undefinedValue(); STOREVALUE(instr.result, Runtime::method_callGlobalLookup(engine, instr.index, callData)); @@ -757,7 +760,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code MOTH_BEGIN_INSTR(CreateValue) Q_ASSERT(instr.callData + instr.argc + offsetof(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize); QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData); - callData->tag = QV4::Value::Integer_Type_Internal; + callData->tag = quint32(Value::ValueTypeInternal::Integer); callData->argc = instr.argc; callData->thisObject = QV4::Primitive::undefinedValue(); STOREVALUE(instr.result, Runtime::method_constructValue(engine, VALUE(instr.func), callData)); @@ -766,7 +769,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code MOTH_BEGIN_INSTR(CreateProperty) Q_ASSERT(instr.callData + instr.argc + offsetof(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize); QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData); - callData->tag = QV4::Value::Integer_Type_Internal; + callData->tag = quint32(Value::ValueTypeInternal::Integer); callData->argc = instr.argc; callData->thisObject = VALUE(instr.base); STOREVALUE(instr.result, Runtime::method_constructProperty(engine, instr.name, callData)); @@ -775,7 +778,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code MOTH_BEGIN_INSTR(ConstructPropertyLookup) Q_ASSERT(instr.callData + instr.argc + offsetof(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize); QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData); - callData->tag = QV4::Value::Integer_Type_Internal; + callData->tag = quint32(Value::ValueTypeInternal::Integer); callData->argc = instr.argc; callData->thisObject = VALUE(instr.base); STOREVALUE(instr.result, Runtime::method_constructPropertyLookup(engine, instr.index, callData)); @@ -784,7 +787,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code MOTH_BEGIN_INSTR(CreateActivationProperty) Q_ASSERT(instr.callData + instr.argc + offsetof(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize); QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData); - callData->tag = QV4::Value::Integer_Type_Internal; + callData->tag = quint32(Value::ValueTypeInternal::Integer); callData->argc = instr.argc; callData->thisObject = QV4::Primitive::undefinedValue(); STOREVALUE(instr.result, Runtime::method_constructActivationProperty(engine, instr.name, callData)); @@ -793,7 +796,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code MOTH_BEGIN_INSTR(ConstructGlobalLookup) Q_ASSERT(instr.callData + instr.argc + offsetof(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize); QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData); - callData->tag = QV4::Value::Integer_Type_Internal; + callData->tag = quint32(Value::ValueTypeInternal::Integer); callData->argc = instr.argc; callData->thisObject = QV4::Primitive::undefinedValue(); STOREVALUE(instr.result, Runtime::method_constructGlobalLookup(engine, instr.index, callData)); |