diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-30 15:41:24 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-02 16:07:33 +0200 |
commit | 1e454c8aa6ad0782eee1c8c94ac2780954a08351 (patch) | |
tree | e3be185e878972ff018e9610fea15248877ca499 /src/qml/compiler | |
parent | 430dfd326cb9d8dab8ebd11e83dd52e6d55c4229 (diff) |
Remove more uses of Value
Change-Id: I889e760f75b485a28e1f2a2c26b2337ae9bfafac
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 7 | ||||
-rw-r--r-- | src/qml/compiler/qv4compileddata_p.h | 2 | ||||
-rw-r--r-- | src/qml/compiler/qv4instr_moth_p.h | 4 | ||||
-rw-r--r-- | src/qml/compiler/qv4isel_masm.cpp | 36 | ||||
-rw-r--r-- | src/qml/compiler/qv4isel_masm_p.h | 24 | ||||
-rw-r--r-- | src/qml/compiler/qv4isel_moth_p.h | 2 | ||||
-rw-r--r-- | src/qml/compiler/qv4isel_util_p.h | 4 | ||||
-rw-r--r-- | src/qml/compiler/qv4ssa.cpp | 8 |
8 files changed, 43 insertions, 44 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index 4139a7ee0d..5c1c41814d 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -81,9 +81,9 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) for (int i = 0; i < data->stringTableSize; ++i) runtimeStrings[i] = engine->newIdentifier(data->stringAt(i)); - runtimeRegularExpressions = new QV4::Value[data->regexpTableSize]; + runtimeRegularExpressions = new QV4::SafeValue[data->regexpTableSize]; // memset the regexps to 0 in case a GC run happens while we're within the loop below - memset(runtimeRegularExpressions, 0, data->regexpTableSize * sizeof(QV4::Value)); + memset(runtimeRegularExpressions, 0, data->regexpTableSize * sizeof(QV4::SafeValue)); for (int i = 0; i < data->regexpTableSize; ++i) { const CompiledData::RegExp *re = data->regexpAt(i); int flags = 0; @@ -93,8 +93,7 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) flags |= QQmlJS::V4IR::RegExp::RegExp_IgnoreCase; if (re->flags & CompiledData::RegExp::RegExp_Multiline) flags |= QQmlJS::V4IR::RegExp::RegExp_Multiline; - QV4::RegExpObject *obj = engine->newRegExpObject(data->stringAt(re->stringIndex), flags)->getPointer(); - runtimeRegularExpressions[i] = QV4::Value::fromObject(obj); + runtimeRegularExpressions[i] = engine->newRegExpObject(data->stringAt(re->stringIndex), flags); } if (data->lookupTableSize) { diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h index 5159ac5a06..6784707607 100644 --- a/src/qml/compiler/qv4compileddata_p.h +++ b/src/qml/compiler/qv4compileddata_p.h @@ -467,7 +467,7 @@ struct Q_QML_EXPORT CompilationUnit QV4::SafeString *runtimeStrings; // Array QV4::Lookup *runtimeLookups; - QV4::Value *runtimeRegularExpressions; + QV4::SafeValue *runtimeRegularExpressions; QV4::InternalClass **runtimeClasses; QVector<QV4::Function *> runtimeFunctions; // QVector<QV4::Function *> runtimeFunctionsSortedByAddress; diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h index 100b6f65a6..f8ccfff92f 100644 --- a/src/qml/compiler/qv4instr_moth_p.h +++ b/src/qml/compiler/qv4instr_moth_p.h @@ -130,7 +130,7 @@ struct Param { TempType = 3, ScopedLocalType = 4 }; - QV4::Value value; + QV4::Primitive value; unsigned type : 3; unsigned scope : 29; unsigned index; @@ -141,7 +141,7 @@ struct Param { bool isTemp() const { return type == TempType; } bool isScopedLocal() const { return type == ScopedLocalType; } - static Param createValue(const QV4::Value &v) + static Param createValue(const QV4::Primitive &v) { Param p; p.type = ValueType; diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp index b7ce1cc86e..6dabbce5f8 100644 --- a/src/qml/compiler/qv4isel_masm.cpp +++ b/src/qml/compiler/qv4isel_masm.cpp @@ -280,12 +280,12 @@ Assembler::Pointer Assembler::loadTempAddress(RegisterID reg, V4IR::Temp *t) case V4IR::Temp::Formal: case V4IR::Temp::ScopedFormal: { loadPtr(Address(context, qOffsetOf(CallContext, callData)), reg); - offset = sizeof(CallData) + (t->index - 1) * sizeof(Value); + offset = sizeof(CallData) + (t->index - 1) * sizeof(SafeValue); } break; case V4IR::Temp::Local: case V4IR::Temp::ScopedLocal: { loadPtr(Address(context, qOffsetOf(CallContext, locals)), reg); - offset = t->index * sizeof(Value); + offset = t->index * sizeof(SafeValue); } break; case V4IR::Temp::StackSlot: { return stackSlotPointer(t); @@ -351,14 +351,14 @@ void Assembler::copyValue(Result result, V4IR::Expr* source) storeDouble(FPGpr0, result); #endif } else if (V4IR::Const *c = source->asConst()) { - QV4::Value v = convertToValue(c); + QV4::Primitive v = convertToValue(c); storeValue(v, result); } else { Q_UNREACHABLE(); } } -void Assembler::storeValue(QV4::Value value, V4IR::Temp* destination) +void Assembler::storeValue(QV4::Primitive value, V4IR::Temp* destination) { Address addr = loadTempAddress(ScratchRegister, destination); storeValue(value, addr); @@ -664,7 +664,7 @@ void InstructionSelection::run(int functionIndex) const int locals = _as->stackLayout().calculateJSStackFrameSize(); _as->loadPtr(Address(Assembler::ContextRegister, qOffsetOf(ExecutionContext, engine)), Assembler::ScratchRegister); _as->loadPtr(Address(Assembler::ScratchRegister, qOffsetOf(ExecutionEngine, jsStackTop)), Assembler::LocalsRegister); - _as->addPtr(Assembler::TrustedImm32(sizeof(QV4::Value)*locals), Assembler::LocalsRegister); + _as->addPtr(Assembler::TrustedImm32(sizeof(QV4::SafeValue)*locals), Assembler::LocalsRegister); _as->storePtr(Assembler::LocalsRegister, Address(Assembler::ScratchRegister, qOffsetOf(ExecutionEngine, jsStackTop))); for (int i = 0, ei = _function->basicBlocks.size(); i != ei; ++i) { @@ -1189,19 +1189,19 @@ void InstructionSelection::swapValues(V4IR::Temp *sourceTemp, V4IR::Temp *target _as->load32(addr, Assembler::ScratchRegister); _as->store32((Assembler::RegisterID) registerTemp->index, addr); addr.offset += 4; - QV4::Value tag; + quint32 tag; switch (registerTemp->type) { case V4IR::BoolType: - tag = QV4::Primitive::fromBoolean(false); + tag = QV4::Value::_Boolean_Type; break; case V4IR::SInt32Type: - tag = QV4::Primitive::fromInt32(0); + tag = QV4::Value::_Integer_Type; break; default: - tag = QV4::Primitive::undefinedValue(); + tag = QV4::Value::Undefined_Type; Q_UNREACHABLE(); } - _as->store32(Assembler::TrustedImm32(tag.tag), addr); + _as->store32(Assembler::TrustedImm32(tag), addr); _as->move(Assembler::ScratchRegister, (Assembler::RegisterID) registerTemp->index); } } @@ -1774,19 +1774,19 @@ void InstructionSelection::visitRet(V4IR::Ret *s) } else { _as->zeroExtend32ToPtr((Assembler::RegisterID) t->index, Assembler::ReturnValueRegister); - QV4::Value upper; + quint64 tag; switch (t->type) { case V4IR::SInt32Type: - upper = QV4::Primitive::fromInt32(0); + tag = QV4::Value::_Integer_Type; break; case V4IR::BoolType: - upper = QV4::Primitive::fromBoolean(false); + tag = QV4::Value::_Boolean_Type; break; default: - upper = QV4::Primitive::undefinedValue(); + tag = QV4::Value::Undefined_Type; Q_UNREACHABLE(); } - _as->or64(Assembler::TrustedImm64(((int64_t) upper.tag) << 32), + _as->or64(Assembler::TrustedImm64(tag << 32), Assembler::ReturnValueRegister); } } else { @@ -1794,7 +1794,7 @@ void InstructionSelection::visitRet(V4IR::Ret *s) } #endif } else if (V4IR::Const *c = s->expr->asConst()) { - QV4::Value retVal = convertToValue(c); + QV4::Primitive retVal = convertToValue(c); #if CPU(X86) _as->move(Assembler::TrustedImm32(retVal.int_32), JSC::X86Registers::eax); _as->move(Assembler::TrustedImm32(retVal.tag), JSC::X86Registers::edx); @@ -1810,7 +1810,7 @@ void InstructionSelection::visitRet(V4IR::Ret *s) } const int locals = _as->stackLayout().calculateJSStackFrameSize(); - _as->subPtr(Assembler::TrustedImm32(sizeof(QV4::Value)*locals), Assembler::LocalsRegister); + _as->subPtr(Assembler::TrustedImm32(sizeof(QV4::SafeValue)*locals), Assembler::LocalsRegister); _as->loadPtr(Address(Assembler::ContextRegister, qOffsetOf(ExecutionContext, engine)), Assembler::ScratchRegister); _as->storePtr(Assembler::LocalsRegister, Address(Assembler::ScratchRegister, qOffsetOf(ExecutionEngine, jsStackTop))); @@ -1847,7 +1847,7 @@ int InstructionSelection::prepareCallData(V4IR::ExprList* args, V4IR::Expr *this } Pointer p = _as->stackLayout().callDataAddress(qOffsetOf(CallData, tag)); - _as->store32(Assembler::TrustedImm32(QV4::Value::Integer_Type), p); + _as->store32(Assembler::TrustedImm32(QV4::Value::_Integer_Type), p); p = _as->stackLayout().callDataAddress(qOffsetOf(CallData, argc)); _as->store32(Assembler::TrustedImm32(argc), p); p = _as->stackLayout().callDataAddress(qOffsetOf(CallData, thisObject)); diff --git a/src/qml/compiler/qv4isel_masm_p.h b/src/qml/compiler/qv4isel_masm_p.h index fd84b03b77..20b0c1b7e8 100644 --- a/src/qml/compiler/qv4isel_masm_p.h +++ b/src/qml/compiler/qv4isel_masm_p.h @@ -323,8 +323,8 @@ public: int calculateJSStackFrameSize() const { - const int locals = (localCount + sizeof(QV4::CallData)/sizeof(QV4::Value) - 1 + maxOutgoingArgumentCount) + 1; - int frameSize = locals * sizeof(QV4::Value); + const int locals = (localCount + sizeof(QV4::CallData)/sizeof(QV4::SafeValue) - 1 + maxOutgoingArgumentCount) + 1; + int frameSize = locals * sizeof(QV4::SafeValue); return frameSize; } @@ -334,7 +334,7 @@ public: Q_ASSERT(idx < localCount); Pointer addr = callDataAddress(0); - addr.offset -= sizeof(QV4::Value) * (idx + 1); + addr.offset -= sizeof(QV4::SafeValue) * (idx + 1); return addr; } @@ -346,11 +346,11 @@ public: Q_ASSERT(argument < maxOutgoingArgumentCount); const int index = maxOutgoingArgumentCount - argument; - return Pointer(Assembler::LocalsRegister, sizeof(QV4::Value) * (-index)); + return Pointer(Assembler::LocalsRegister, sizeof(QV4::SafeValue) * (-index)); } Pointer callDataAddress(int offset = 0) const { - return Pointer(Assembler::LocalsRegister, -(sizeof(QV4::CallData) + sizeof(QV4::Value) * (maxOutgoingArgumentCount - 1)) + offset); + return Pointer(Assembler::LocalsRegister, -(sizeof(QV4::CallData) + sizeof(QV4::SafeValue) * (maxOutgoingArgumentCount - 1)) + offset); } Address savedRegPointer(int offset) const @@ -358,7 +358,7 @@ public: Q_ASSERT(offset >= 0); Q_ASSERT(offset < savedRegCount); - const int off = offset * sizeof(QV4::Value); + const int off = offset * sizeof(QV4::SafeValue); return Address(Assembler::StackFrameRegister, - calleeSavedRegisterSpace() - off); } @@ -610,7 +610,7 @@ public: void storeUInt32ReturnValue(RegisterID dest) { - Pointer tmp(StackPointerRegister, -int(sizeof(QV4::Value))); + Pointer tmp(StackPointerRegister, -int(sizeof(QV4::SafeValue))); storeReturnValue(tmp); toUInt32Register(tmp, dest); } @@ -622,7 +622,7 @@ public: xor64(ScratchRegister, ReturnValueRegister); move64ToDouble(ReturnValueRegister, dest); #else - Pointer tmp(StackPointerRegister, -int(sizeof(QV4::Value))); + Pointer tmp(StackPointerRegister, -int(sizeof(QV4::SafeValue))); storeReturnValue(tmp); loadDouble(tmp, dest); #endif @@ -817,14 +817,14 @@ public: JSC::MacroAssembler::storeDouble(FPGpr0, target); } - void storeValue(QV4::Value value, RegisterID destination) + void storeValue(QV4::Primitive value, RegisterID destination) { Q_UNUSED(value); Q_UNUSED(destination); Q_UNREACHABLE(); } - void storeValue(QV4::Value value, Address destination) + void storeValue(QV4::Primitive value, Address destination) { #ifdef VALUE_FITS_IN_REGISTER store64(TrustedImm64(value.val), destination); @@ -835,7 +835,7 @@ public: #endif } - void storeValue(QV4::Value value, V4IR::Temp* temp); + void storeValue(QV4::Primitive value, V4IR::Temp* temp); void enterStandardStackFrame(); void leaveStandardStackFrame(); @@ -1120,7 +1120,7 @@ public: Address tagAddr = addr; tagAddr.offset += 4; - QV4::Value v = convertToValue(c); + QV4::Primitive v = convertToValue(c); store32(TrustedImm32(v.int_32), addr); store32(TrustedImm32(v.tag), tagAddr); return Pointer(addr); diff --git a/src/qml/compiler/qv4isel_moth_p.h b/src/qml/compiler/qv4isel_moth_p.h index 8482e358e2..ca03c5fa30 100644 --- a/src/qml/compiler/qv4isel_moth_p.h +++ b/src/qml/compiler/qv4isel_moth_p.h @@ -154,7 +154,7 @@ private: int scratchTempIndex() const { return _function->tempCount; } int callDataStart() const { return scratchTempIndex() + 1; } - int outgoingArgumentTempStart() const { return callDataStart() + qOffsetOf(QV4::CallData, args)/sizeof(QV4::Value); } + int outgoingArgumentTempStart() const { return callDataStart() + qOffsetOf(QV4::CallData, args)/sizeof(QV4::SafeValue); } int frameSize() const { return outgoingArgumentTempStart() + _function->maxNumberOfArguments; } template <int Instr> diff --git a/src/qml/compiler/qv4isel_util_p.h b/src/qml/compiler/qv4isel_util_p.h index 12a606e70c..5084de8ec9 100644 --- a/src/qml/compiler/qv4isel_util_p.h +++ b/src/qml/compiler/qv4isel_util_p.h @@ -63,11 +63,11 @@ inline bool canConvertToUnsignedInteger(double value) return uval == value && !(value == 0 && isNegative(value)); } -inline QV4::Value convertToValue(V4IR::Const *c) +inline QV4::Primitive convertToValue(V4IR::Const *c) { switch (c->type) { case V4IR::MissingType: - return QV4::Value::emptyValue(); + return QV4::Primitive::emptyValue(); case V4IR::NullType: return QV4::Primitive::nullValue(); case V4IR::UndefinedType: diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 3d6cd442fd..deadf471ea 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -2223,8 +2223,8 @@ bool tryOptimizingComparison(Expr *&expr) if (!rightConst || rightConst->type == StringType || rightConst->type == VarType) return false; - QV4::Value l = convertToValue(leftConst); - QV4::Value r = convertToValue(rightConst); + QV4::Primitive l = convertToValue(leftConst); + QV4::Primitive r = convertToValue(rightConst); switch (b->op) { case OpGt: @@ -2439,8 +2439,8 @@ void optimizeSSA(Function *function, DefUsesCalculator &defUses) if (!rightConst || rightConst->type == StringType || rightConst->type == VarType) continue; - QV4::Value lc = convertToValue(leftConst); - QV4::Value rc = convertToValue(rightConst); + QV4::Primitive lc = convertToValue(leftConst); + QV4::Primitive rc = convertToValue(rightConst); double l = __qmljs_to_number(&lc); double r = __qmljs_to_number(&rc); |