diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-01-31 14:03:51 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-03-09 08:58:34 +0000 |
commit | 91714e004e0c91527e7049ff43565dda682fc2bd (patch) | |
tree | bd5ff925acf6c8e1b98667c0b18028576cf94662 /src/qml | |
parent | 518e258d59adc976e2e8aa9a7f9ef36d8b8cdb66 (diff) |
Make all write operations to Pointer<> types go through a set() method
The new set() method also taked an ExecutionEngine pointer. This makes
it trivial to now add a write barrier for those operations.
Change-Id: I321eccfe6fb279cc240b5c84910e6854f71759f6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/jsruntime/qv4argumentsobject.cpp | 7 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4context.cpp | 14 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4context_p.h | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4dataview.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4errorobject.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 14 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4object_p.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4qmlcontext.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4regexpobject.cpp | 15 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4stringobject.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4typedarray.cpp | 16 | ||||
-rw-r--r-- | src/qml/memory/qv4heap_p.h | 7 | ||||
-rw-r--r-- | src/qml/memory/qv4mm.cpp | 2 | ||||
-rw-r--r-- | src/qml/memory/qv4mm_p.h | 12 | ||||
-rw-r--r-- | src/qml/qml/qqmlcomponent.cpp | 4 | ||||
-rw-r--r-- | src/qml/qml/qqmlxmlhttprequest.cpp | 2 |
19 files changed, 63 insertions, 58 deletions
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp index 33cda59b72..bc832c3349 100644 --- a/src/qml/jsruntime/qv4argumentsobject.cpp +++ b/src/qml/jsruntime/qv4argumentsobject.cpp @@ -48,12 +48,13 @@ DEFINE_OBJECT_VTABLE(ArgumentsObject); void Heap::ArgumentsObject::init(QV4::CallContext *context) { + ExecutionEngine *v4 = context->d()->engine; + Object::init(); fullyCreated = false; - this->context = context->d(); + this->context.set(v4, context->d()); Q_ASSERT(vtable() == QV4::ArgumentsObject::staticVTable()); - ExecutionEngine *v4 = context->d()->engine; Scope scope(v4); Scoped<QV4::ArgumentsObject> args(scope, this); @@ -89,7 +90,7 @@ void ArgumentsObject::fullyCreate() Scope scope(engine()); Scoped<MemberData> md(scope, d()->mappedArguments); if (numAccessors) { - d()->mappedArguments = md->allocate(engine(), numAccessors); + d()->mappedArguments.set(scope.engine, md->allocate(engine(), numAccessors)); for (uint i = 0; i < numAccessors; ++i) { d()->mappedArguments->values[i] = context()->callData->args[i]; arraySet(i, context()->engine->argumentsAccessors + i, Attr_Accessor); diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp index ec11422c15..3918d25326 100644 --- a/src/qml/jsruntime/qv4context.cpp +++ b/src/qml/jsruntime/qv4context.cpp @@ -72,7 +72,7 @@ Heap::CallContext *ExecutionContext::newCallContext(Function *function, CallData c->v4Function = function; c->strictMode = function->isStrict(); - c->outer = this->d(); + c->outer.set(d()->engine, this->d()); c->compilationUnit = function->compilationUnit; c->lookups = c->compilationUnit->runtimeLookups; @@ -119,7 +119,7 @@ void ExecutionContext::createMutableBinding(String *name, bool deletable) Heap::SimpleCallContext *c = static_cast<Heap::SimpleCallContext *>(ctx->d()); if (!activation) { if (!c->activation) - c->activation = scope.engine->newObject(); + c->activation.set(scope.engine, scope.engine->newObject()); activation = c->activation; } break; @@ -153,21 +153,21 @@ void ExecutionContext::createMutableBinding(String *name, bool deletable) void Heap::GlobalContext::init(ExecutionEngine *eng) { Heap::ExecutionContext::init(eng, Heap::ExecutionContext::Type_GlobalContext); - global = eng->globalObject->d(); + global.set(eng, eng->globalObject->d()); } void Heap::CatchContext::init(ExecutionContext *outerContext, String *exceptionVarName, const Value &exceptionValue) { Heap::ExecutionContext::init(outerContext->engine, Heap::ExecutionContext::Type_CatchContext); - outer = outerContext; + outer.set(engine, outerContext); strictMode = outer->strictMode; callData = outer->callData; lookups = outer->lookups; constantTable = outer->constantTable; compilationUnit = outer->compilationUnit; - this->exceptionVarName = exceptionVarName; + this->exceptionVarName.set(engine, exceptionVarName); this->exceptionValue = exceptionValue; } @@ -252,7 +252,7 @@ void ExecutionContext::call(Scope &scope, CallData *callData, Function *function Scoped<CallContext> ctx(scope, newCallContext(function, callData)); if (f) - ctx->d()->function = f->d(); + ctx->d()->function.set(scope.engine, f->d()); scope.engine->pushContext(ctx); scope.result = Q_V4_PROFILE(scope.engine, function); @@ -276,7 +276,7 @@ void QV4::ExecutionContext::simpleCall(Scope &scope, CallData *callData, Functio ctx->compilationUnit = function->compilationUnit; ctx->lookups = function->compilationUnit->runtimeLookups; ctx->constantTable = function->compilationUnit->constants; - ctx->outer = this->d(); + ctx->outer.set(scope.engine, this->d()); for (int i = callData->argc; i < (int)function->nFormals; ++i) callData->args[i] = Encode::undefined(); diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index f544821729..a405da0f57 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -189,13 +189,13 @@ DECLARE_HEAP_OBJECT(WithContext, ExecutionContext) { void init(ExecutionContext *outerContext, Object *with) { Heap::ExecutionContext::init(outerContext->engine, Heap::ExecutionContext::Type_WithContext); - outer = outerContext; + outer.set(engine, outerContext); callData = outer->callData; lookups = outer->lookups; constantTable = outer->constantTable; compilationUnit = outer->compilationUnit; - withObject = with; + withObject.set(engine, with); } }; V4_ASSERT_IS_TRIVIAL(WithContext) diff --git a/src/qml/jsruntime/qv4dataview.cpp b/src/qml/jsruntime/qv4dataview.cpp index aa7d01d16c..f1405e08ee 100644 --- a/src/qml/jsruntime/qv4dataview.cpp +++ b/src/qml/jsruntime/qv4dataview.cpp @@ -73,7 +73,7 @@ void DataViewCtor::construct(const Managed *, Scope &scope, CallData *callData) } Scoped<DataView> a(scope, scope.engine->memoryManager->allocObject<DataView>()); - a->d()->buffer = buffer->d(); + a->d()->buffer.set(scope.engine, buffer->d()); a->d()->byteLength = byteLength; a->d()->byteOffset = byteOffset; scope.result = a.asReturnedValue(); diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index bc618e3e7a..f38580e5f8 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -398,7 +398,7 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) // // set up the global object // - rootContext()->d()->global = globalObject->d(); + rootContext()->d()->global.set(scope.engine, globalObject->d()); rootContext()->d()->callData->thisObject = globalObject; Q_ASSERT(globalObject->d()->vtable()); @@ -605,7 +605,7 @@ Heap::ArrayObject *ExecutionEngine::newArrayObject(const Value *values, int leng d->values.alloc = length; d->values.size = length; memcpy(&d->values.v, values, length*sizeof(Value)); - a->d()->arrayData = d; + a->d()->arrayData.set(this, d); a->setArrayLengthUnchecked(length); } return a->d(); diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp index 798a14086d..daa4f2d9a6 100644 --- a/src/qml/jsruntime/qv4errorobject.cpp +++ b/src/qml/jsruntime/qv4errorobject.cpp @@ -168,7 +168,7 @@ void ErrorObject::method_get_stack(const BuiltinFunction *, Scope &scope, CallDa if (frame.line >= 0) trace += QLatin1Char(':') + QString::number(frame.line); } - This->d()->stack = scope.engine->newString(trace); + This->d()->stack.set(scope.engine, scope.engine->newString(trace)); } scope.result = This->d()->stack; } diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 9afea01141..a2433e7471 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -75,7 +75,7 @@ void Heap::FunctionObject::init(QV4::ExecutionContext *scope, QV4::String *name, { Object::init(); function = nullptr; - this->scope = scope->d(); + this->scope.set(scope->engine(), scope->d()); Scope s(scope->engine()); ScopedFunctionObject f(s, this); f->init(name, createProto); @@ -86,7 +86,7 @@ void Heap::FunctionObject::init(QV4::ExecutionContext *scope, Function *function Object::init(); this->function = function; function->compilationUnit->addref(); - this->scope = scope->d(); + this->scope.set(scope->engine(), scope->d()); Scope s(scope->engine()); ScopedString name(s, function->name()); ScopedFunctionObject f(s, this); @@ -104,7 +104,7 @@ void Heap::FunctionObject::init() { Object::init(); function = nullptr; - this->scope = internalClass->engine->rootContext()->d(); + this->scope.set(internalClass->engine, internalClass->engine->rootContext()->d()); Q_ASSERT(internalClass && internalClass->find(internalClass->engine->id_prototype()) == Index_Prototype); *propertyData(Index_Prototype) = Encode::undefined(); } @@ -413,7 +413,7 @@ void ScriptFunction::call(const Managed *that, Scope &scope, CallData *callData) void Heap::ScriptFunction::init(QV4::ExecutionContext *scope, Function *function) { FunctionObject::init(); - this->scope = scope->d(); + this->scope.set(scope->engine(), scope->d()); this->function = function; function->compilationUnit->addref(); @@ -536,12 +536,12 @@ DEFINE_OBJECT_VTABLE(BoundFunction); void Heap::BoundFunction::init(QV4::ExecutionContext *scope, QV4::FunctionObject *target, const Value &boundThis, QV4::MemberData *boundArgs) { + Scope s(scope); Heap::FunctionObject::init(scope, QStringLiteral("__bound function__")); - this->target = target->d(); - this->boundArgs = boundArgs ? boundArgs->d() : 0; + this->target.set(s.engine, target->d()); + this->boundArgs.set(s.engine, boundArgs ? boundArgs->d() : 0); this->boundThis = boundThis; - Scope s(scope); ScopedObject f(s, this); ScopedValue l(s, target->get(s.engine->id_length())); diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index cb7ce03c5c..006615e580 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -63,7 +63,7 @@ void Object::setInternalClass(InternalClass *ic) d()->internalClass = ic; bool hasMD = d()->memberData != nullptr; if ((!hasMD && ic->size) || (hasMD && d()->memberData->values.size < ic->size)) - d()->memberData = MemberData::allocate(ic->engine, ic->size, d()->memberData); + d()->memberData.set(engine(), MemberData::allocate(ic->engine, ic->size, d()->memberData)); } void Object::getProperty(uint index, Property *p, PropertyAttributes *attrs) const @@ -89,7 +89,7 @@ bool Object::setPrototype(Object *proto) return false; pp = pp->prototype; } - d()->prototype = proto ? proto->d() : 0; + d()->prototype.set(engine(), proto ? proto->d() : 0); return true; } diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h index 63b132c2e6..df987c88f9 100644 --- a/src/qml/jsruntime/qv4object_p.h +++ b/src/qml/jsruntime/qv4object_p.h @@ -198,7 +198,7 @@ struct Q_QML_EXPORT Object: Managed { Value *propertyData(uint index) { return d()->propertyData(index); } Heap::ArrayData *arrayData() const { return d()->arrayData; } - void setArrayData(ArrayData *a) { d()->arrayData = a->d(); } + void setArrayData(ArrayData *a) { d()->arrayData.set(engine(), a->d()); } void getProperty(uint index, Property *p, PropertyAttributes *attrs) const; void setProperty(uint index, const Property *p); diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp index cdc29c8b9c..56ecc9f682 100644 --- a/src/qml/jsruntime/qv4qmlcontext.cpp +++ b/src/qml/jsruntime/qv4qmlcontext.cpp @@ -298,14 +298,14 @@ bool QmlContextWrapper::put(Managed *m, String *name, const Value &value) void Heap::QmlContext::init(QV4::ExecutionContext *outerContext, QV4::QmlContextWrapper *qml) { Heap::ExecutionContext::init(outerContext->engine(), Heap::ExecutionContext::Type_QmlContext); - outer = outerContext->d(); + outer.set(engine, outerContext->d()); strictMode = false; callData = outer->callData; lookups = outer->lookups; constantTable = outer->constantTable; compilationUnit = outer->compilationUnit; - this->qml = qml->d(); + this->qml.set(engine, qml->d()); } Heap::QmlContext *QmlContext::createWorkerContext(ExecutionContext *parent, const QUrl &source, Value *sendFunction) diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index deea893632..4f6c179026 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -1704,7 +1704,7 @@ ReturnedValue QObjectMethod::create(ExecutionContext *scope, const QQmlValueType Scoped<QObjectMethod> method(valueScope, valueScope.engine->memoryManager->allocObject<QObjectMethod>(scope)); method->d()->setPropertyCache(valueType->d()->propertyCache()); method->d()->index = index; - method->d()->valueTypeWrapper = valueType->d(); + method->d()->valueTypeWrapper.set(valueScope.engine, valueType->d()); return method.asReturnedValue(); } diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index ca893839ef..3ec24edb5d 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -74,7 +74,7 @@ void Heap::RegExpObject::init() Object::init(); Scope scope(internalClass->engine); Scoped<QV4::RegExpObject> o(scope, this); - o->d()->value = QV4::RegExp::create(scope.engine, QString(), false, false); + o->d()->value.set(scope.engine, QV4::RegExp::create(scope.engine, QString(), false, false)); o->d()->global = false; o->initProperties(); } @@ -82,9 +82,9 @@ void Heap::RegExpObject::init() void Heap::RegExpObject::init(QV4::RegExp *value, bool global) { Object::init(); - this->global = global; - this->value = value->d(); Scope scope(internalClass->engine); + this->global = global; + this->value.set(scope.engine, value->d()); Scoped<QV4::RegExpObject> o(scope, this); o->initProperties(); } @@ -137,7 +137,8 @@ void Heap::RegExpObject::init(const QRegExp &re) Scope scope(internalClass->engine); Scoped<QV4::RegExpObject> o(scope, this); - o->d()->value = QV4::RegExp::create(scope.engine, pattern, re.caseSensitivity() == Qt::CaseInsensitive, false); + o->d()->value.set(scope.engine, + QV4::RegExp::create(scope.engine, pattern, re.caseSensitivity() == Qt::CaseInsensitive, false)); o->initProperties(); } @@ -220,7 +221,7 @@ void Heap::RegExpCtor::init(QV4::ExecutionContext *scope) void Heap::RegExpCtor::clearLastMatch() { lastMatch = Primitive::nullValue(); - lastInput = internalClass->engine->id_empty()->d(); + lastInput.set(internalClass->engine, internalClass->engine->id_empty()->d()); lastMatchStart = 0; lastMatchEnd = 0; } @@ -377,7 +378,7 @@ void RegExpPrototype::method_exec(const BuiltinFunction *, Scope &scope, CallDat RegExpCtor::Data *dd = regExpCtor->d(); dd->lastMatch = array; - dd->lastInput = str->d(); + dd->lastInput.set(scope.engine, str->d()); dd->lastMatchStart = matchOffsets[0]; dd->lastMatchEnd = matchOffsets[1]; @@ -414,7 +415,7 @@ void RegExpPrototype::method_compile(const BuiltinFunction *, Scope &scope, Call scope.engine->regExpCtor()->as<FunctionObject>()->construct(scope, cData); Scoped<RegExpObject> re(scope, scope.result.asReturnedValue()); - r->d()->value = re->value(); + r->d()->value.set(scope.engine, re->value()); r->d()->global = re->global(); RETURN_UNDEFINED(); } diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index c6cc5a4639..628c220bae 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -77,14 +77,14 @@ void Heap::StringObject::init() { Object::init(); Q_ASSERT(vtable() == QV4::StringObject::staticVTable()); - string = internalClass->engine->id_empty()->d(); + string.set(internalClass->engine, internalClass->engine->id_empty()->d()); *propertyData(LengthPropertyIndex) = Primitive::fromInt32(0); } void Heap::StringObject::init(const QV4::String *str) { Object::init(); - string = str->d(); + string.set(internalClass->engine, str->d()); *propertyData(LengthPropertyIndex) = Primitive::fromInt32(length()); } diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp index e936158ab1..a34a8922e1 100644 --- a/src/qml/jsruntime/qv4typedarray.cpp +++ b/src/qml/jsruntime/qv4typedarray.cpp @@ -229,8 +229,8 @@ void TypedArrayCtor::construct(const Managed *m, Scope &scope, CallData *callDat return; } - Scoped<TypedArray > array(scope, TypedArray::create(scope.engine, that->d()->type)); - array->d()->buffer = buffer->d(); + Scoped<TypedArray> array(scope, TypedArray::create(scope.engine, that->d()->type)); + array->d()->buffer.set(scope.engine, buffer->d()); array->d()->byteLength = byteLength; array->d()->byteOffset = 0; @@ -252,8 +252,8 @@ void TypedArrayCtor::construct(const Managed *m, Scope &scope, CallData *callDat return; } - Scoped<TypedArray > array(scope, TypedArray::create(scope.engine, that->d()->type)); - array->d()->buffer = newBuffer->d(); + Scoped<TypedArray> array(scope, TypedArray::create(scope.engine, that->d()->type)); + array->d()->buffer.set(scope.engine, newBuffer->d()); array->d()->byteLength = destByteLength; array->d()->byteOffset = 0; @@ -311,8 +311,8 @@ void TypedArrayCtor::construct(const Managed *m, Scope &scope, CallData *callDat byteLength = (uint)l; } - Scoped<TypedArray > array(scope, TypedArray::create(scope.engine, that->d()->type)); - array->d()->buffer = buffer->d(); + Scoped<TypedArray> array(scope, TypedArray::create(scope.engine, that->d()->type)); + array->d()->buffer.set(scope.engine, buffer->d()); array->d()->byteLength = byteLength; array->d()->byteOffset = byteOffset; scope.result = array.asReturnedValue(); @@ -335,8 +335,8 @@ void TypedArrayCtor::construct(const Managed *m, Scope &scope, CallData *callDat return; } - Scoped<TypedArray > array(scope, TypedArray::create(scope.engine, that->d()->type)); - array->d()->buffer = newBuffer->d(); + Scoped<TypedArray> array(scope, TypedArray::create(scope.engine, that->d()->type)); + array->d()->buffer.set(scope.engine, newBuffer->d()); array->d()->byteLength = l * elementSize; array->d()->byteOffset = 0; diff --git a/src/qml/memory/qv4heap_p.h b/src/qml/memory/qv4heap_p.h index b3dfa407f8..2cf3e721f9 100644 --- a/src/qml/memory/qv4heap_p.h +++ b/src/qml/memory/qv4heap_p.h @@ -167,15 +167,18 @@ V4_ASSERT_IS_TRIVIAL(Base) template <typename T, size_t o> struct Pointer { static Q_CONSTEXPR size_t offset = o; - static Q_CONSTEXPR quint64 markBits = Mark_Pointer << (o >> 2); T operator->() const { return ptr; } operator T () const { return ptr; } - Pointer &operator =(T t) { ptr = t; return *this; } + void set(ExecutionEngine *e, T newVal) { + Q_UNUSED(e); + ptr = newVal; + } template <typename Type> Type *cast() { return static_cast<Type *>(ptr); } +private: T ptr; }; typedef Pointer<char *, 0> V4PointerCheck; diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp index edd26cf982..39272850b4 100644 --- a/src/qml/memory/qv4mm.cpp +++ b/src/qml/memory/qv4mm.cpp @@ -731,7 +731,7 @@ Heap::Object *MemoryManager::allocObjectWithMemberData(std::size_t size, uint nM else m = *blockAllocator.allocate(memberSize, true); memset(m, 0, memberSize); - o->memberData = static_cast<Heap::MemberData *>(m); + o->memberData.set(engine, static_cast<Heap::MemberData *>(m)); o->memberData->setVtable(MemberData::staticVTable()); o->memberData->values.alloc = static_cast<uint>((memberSize - sizeof(Heap::MemberData) + sizeof(Value))/sizeof(Value)); o->memberData->values.size = o->memberData->values.alloc; diff --git a/src/qml/memory/qv4mm_p.h b/src/qml/memory/qv4mm_p.h index 0bd9229792..6e9303acb6 100644 --- a/src/qml/memory/qv4mm_p.h +++ b/src/qml/memory/qv4mm_p.h @@ -245,7 +245,7 @@ public: o->setVtable(ObjectType::staticVTable()); Object *prototype = ObjectType::defaultPrototype(engine); o->internalClass = ic; - o->prototype = prototype->d(); + o->prototype.set(engine, prototype->d()); return static_cast<typename ObjectType::Data *>(o); } @@ -272,7 +272,7 @@ public: { Scope scope(engine); Scoped<ObjectType> t(scope, allocateObject<ObjectType>(ic)); - t->d_unchecked()->prototype = prototype->d(); + t->d_unchecked()->prototype.set(engine, prototype->d()); t->d_unchecked()->init(); return t->d(); } @@ -282,7 +282,7 @@ public: { Scope scope(engine); Scoped<ObjectType> t(scope, allocateObject<ObjectType>(ic)); - t->d_unchecked()->prototype = prototype->d(); + t->d_unchecked()->prototype.set(engine, prototype->d()); t->d_unchecked()->init(arg1); return t->d(); } @@ -292,7 +292,7 @@ public: { Scope scope(engine); Scoped<ObjectType> t(scope, allocateObject<ObjectType>(ic)); - t->d_unchecked()->prototype = prototype->d(); + t->d_unchecked()->prototype.set(engine, prototype->d()); t->d_unchecked()->init(arg1, arg2); return t->d(); } @@ -302,7 +302,7 @@ public: { Scope scope(engine); Scoped<ObjectType> t(scope, allocateObject<ObjectType>(ic)); - t->d_unchecked()->prototype = prototype->d(); + t->d_unchecked()->prototype.set(engine, prototype->d()); t->d_unchecked()->init(arg1, arg2, arg3); return t->d(); } @@ -312,7 +312,7 @@ public: { Scope scope(engine); Scoped<ObjectType> t(scope, allocateObject<ObjectType>(ic)); - t->d_unchecked()->prototype = prototype->d(); + t->d_unchecked()->prototype.set(engine, prototype->d()); t->d_unchecked()->init(arg1, arg2, arg3, arg4); return t->d(); } diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index c1a0637d00..993ad10639 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1377,7 +1377,7 @@ void QQmlComponent::incubateObject(QQmlV4Function *args) if (!valuemap->isUndefined()) r->d()->valuemap = valuemap; - r->d()->qmlContext = v4->qmlContext(); + r->d()->qmlContext.set(scope.engine, v4->qmlContext()); r->d()->parent = parent; QQmlIncubator *incubator = r->d()->incubator; @@ -1476,7 +1476,7 @@ void QV4::Heap::QmlIncubatorObject::init(QQmlIncubator::IncubationMode m) valuemap = QV4::Primitive::undefinedValue(); statusChanged = QV4::Primitive::undefinedValue(); parent.init(); - qmlContext = nullptr; + qmlContext.set(internalClass->engine, nullptr); incubator = new QQmlComponentIncubator(this, m); } diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 502a693d5c..b18904fc73 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -1683,7 +1683,7 @@ void QQmlXMLHttpRequestCtor::setupProto() ExecutionEngine *v4 = engine(); Scope scope(v4); ScopedObject p(scope, v4->newObject()); - d()->proto = p->d(); + d()->proto.set(scope.engine, p->d()); // Methods p->defineDefaultProperty(QStringLiteral("open"), method_open); |