diff options
author | Lars Knoll <[email protected]> | 2017-02-03 21:05:43 +0100 |
---|---|---|
committer | Lars Knoll <[email protected]> | 2017-03-09 08:58:52 +0000 |
commit | 1a61d609345b0222c41f93f445a6fd517a76cf48 (patch) | |
tree | a46cd6d9e5d4dfe557d0de931c8253f43d21a0b0 /src/qml/jsruntime/qv4context.cpp | |
parent | d7aa952e143accc18d54707d956d019272197078 (diff) |
move locals over to be write barrier safe
Change-Id: I56b1dab62ff432273ee8549b0496bd0f3fc655ea
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4context.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4context.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp index 667b8dbb24..be53b14786 100644 --- a/src/qml/jsruntime/qv4context.cpp +++ b/src/qml/jsruntime/qv4context.cpp @@ -82,10 +82,15 @@ Heap::CallContext *ExecutionContext::newCallContext(Function *function, CallData uint nLocals = compiledFunction->nLocals; c->locals.size = nLocals; c->locals.alloc = localsAndFormals; +#if QT_POINTER_SIZE == 8 + // memory allocated from the JS heap is 0 initialized, so skip the std::fill() below + Q_ASSERT(Primitive::undefinedValue().asReturnedValue() == 0); +#else if (nLocals) - std::fill(c->locals.v, c->locals.v + nLocals, Primitive::undefinedValue()); + std::fill(c->locals.values, c->locals.values + nLocals, Primitive::undefinedValue()); +#endif - c->callData = reinterpret_cast<CallData *>(c->locals.v + nLocals); + c->callData = reinterpret_cast<CallData *>(c->locals.values + nLocals); ::memcpy(c->callData, callData, sizeof(CallData) - sizeof(Value) + static_cast<uint>(callData->argc) * sizeof(Value)); if (callData->argc < static_cast<int>(compiledFunction->nFormals)) std::fill(c->callData->args + c->callData->argc, c->callData->args + compiledFunction->nFormals, Primitive::undefinedValue()); @@ -330,7 +335,7 @@ void ExecutionContext::setProperty(String *name, const Value &value) } else { Q_ASSERT(c->type = Heap::ExecutionContext::Type_CallContext); index -= c->v4Function->nFormals; - static_cast<Heap::CallContext *>(c)->locals[index] = value; + static_cast<Heap::CallContext *>(c)->locals.set(scope.engine, index, value); } return; } |