diff options
| author | Lars Knoll <lars.knoll@qt.io> | 2016-12-22 21:24:27 +0100 |
|---|---|---|
| committer | Lars Knoll <lars.knoll@qt.io> | 2017-01-25 08:30:36 +0000 |
| commit | a325b21e1bd51263551829089e9f31e2156bc641 (patch) | |
| tree | 9df265b8821254a01e66abef31e4009b18a37c4c /src/qml/jsruntime/qv4functionobject.cpp | |
| parent | 90f055dbb44846b9ed37be8b9114573fcf2cd8ff (diff) | |
Allocate simple call contexts from a special allocator
We used to allocate those on the C stack, but this doesn't work
anymore with the new GC, as the mark bit is not stored inside the
object anymore.
Instead use a special allocator for these contexts that operates like a
stack.
Change-Id: I381ac3914ca866945312a1e79883aefe72662d2c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 64f7b98618..1ac0e28a1b 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -484,13 +484,14 @@ void BuiltinFunction::call(const Managed *that, Scope &scope, CallData *callData ExecutionContextSaver ctxSaver(scope); - CallContext::Data ctx = CallContext::Data::createOnStack(v4); - ctx.strictMode = f->scope()->strictMode; // ### needed? scope or parent context? - ctx.callData = callData; - v4->pushContext(&ctx); - Q_ASSERT(v4->current == &ctx); + CallContext::Data *ctx = CallContext::Data::createSimpleContext(v4); + ctx->strictMode = f->scope()->strictMode; // ### needed? scope or parent context? + ctx->callData = callData; + v4->pushContext(ctx); + Q_ASSERT(v4->current == ctx); scope.result = f->d()->code(static_cast<QV4::CallContext *>(v4->currentContext)); + ctx->freeSimpleCallContext(); } void IndexedBuiltinFunction::call(const Managed *that, Scope &scope, CallData *callData) @@ -505,13 +506,14 @@ void IndexedBuiltinFunction::call(const Managed *that, Scope &scope, CallData *c ExecutionContextSaver ctxSaver(scope); - CallContext::Data ctx = CallContext::Data::createOnStack(v4); - ctx.strictMode = f->scope()->strictMode; // ### needed? scope or parent context? - ctx.callData = callData; - v4->pushContext(&ctx); - Q_ASSERT(v4->current == &ctx); + CallContext::Data *ctx = CallContext::Data::createSimpleContext(v4); + ctx->strictMode = f->scope()->strictMode; // ### needed? scope or parent context? + ctx->callData = callData; + v4->pushContext(ctx); + Q_ASSERT(v4->current == ctx); scope.result = f->d()->code(static_cast<QV4::CallContext *>(v4->currentContext), f->d()->index); + ctx->freeSimpleCallContext(); } DEFINE_OBJECT_VTABLE(IndexedBuiltinFunction); |
