diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-16 22:02:27 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-22 01:06:20 +0200 |
commit | e441692b0b8f8fffdfdfa8a21c570adcd5cbae7a (patch) | |
tree | 9b764401d87682012328c46dc947721f47b428b2 /src/qml/jsruntime/qv4context_p.h | |
parent | a0f8be4021caa9bb5055923f0eea3bee0e345235 (diff) |
Further work towards an exact GC
Add some more convenience in the helper classes
in qscopedvalue_p.h
Make accesses to CallData safer, and change
ExecutionEngine::newObject() to return a safe
pointer.
Change-Id: I980909754ce9681cf6faa1355bab3a1e5d6dd186
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4context_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4context_p.h | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index 0c3b189401..fe15a53fd2 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -148,8 +148,6 @@ struct Q_QML_EXPORT ExecutionContext ReturnedValue getPropertyAndBase(String *name, Object **base); bool deleteProperty(String *name); - inline Value argument(unsigned int index = 0); - void mark(); inline CallContext *asCallContext(); @@ -160,9 +158,13 @@ struct SimpleCallContext : public ExecutionContext { void initSimpleCallContext(ExecutionEngine *engine); FunctionObject *function; - Value *arguments; + SafeValue *arguments; unsigned int realArgumentCount; unsigned int argumentCount; + + ReturnedValue argument(uint i) { + return i < argumentCount ? arguments[i].asReturnedValue() : Value::undefinedValue().asReturnedValue(); + } }; struct CallContext : public SimpleCallContext @@ -196,16 +198,6 @@ struct WithContext : public ExecutionContext void initWithContext(ExecutionContext *p, Object *with); }; -inline Value ExecutionContext::argument(unsigned int index) -{ - if (type >= Type_SimpleCallContext) { - CallContext *ctx = static_cast<CallContext *>(this); - if (index < ctx->argumentCount) - return ctx->arguments[index]; - } - return Value::undefinedValue(); -} - inline CallContext *ExecutionContext::asCallContext() { return type >= Type_CallContext ? static_cast<CallContext *>(this) : 0; |