diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-19 10:33:59 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-22 01:06:20 +0200 |
commit | f64cd3f5d3fb4e466598a07aa4b9385ef93822d3 (patch) | |
tree | b8915bc4784285c021968faa290804927a1a26d0 /src/qml/jsruntime/qv4object.cpp | |
parent | 383fa29f95a595be4d6f4da113dff3b0dca79343 (diff) |
Convert Object::inplaceBinOp to be GC safe
Change-Id: I98a8591f4b556cc1d00271e6b389dc0d2c16e6ec
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4object.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 1e45334e3a..7b9074edd5 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -169,16 +169,15 @@ void Object::putValue(Property *pd, PropertyAttributes attrs, const Value &value } -void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, String *name, const ValueRef rhs) +void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, const StringRef name, const ValueRef rhs) { Scope scope(ctx); - ScopedString n(scope, name); - ScopedValue v(scope, get(n)); + ScopedValue v(scope, get(name)); ScopedValue result(scope, op(v, rhs)); - put(n, result); + put(name, result); } -void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, const ValueRef index, const ValueRef rhs) +void Object::inplaceBinOpValue(ExecutionContext *ctx, BinOp op, const ValueRef index, const ValueRef rhs) { Scope scope(ctx); uint idx = index->asArrayIndex(); @@ -189,21 +188,19 @@ void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, const ValueRef index, putIndexed(idx, result); return; } - String *name = index->toString(ctx); - assert(name); + ScopedString name(scope, index->toString(ctx)); inplaceBinOp(ctx, op, name, rhs); } -void Object::inplaceBinOp(ExecutionContext *ctx, BinOpContext op, String *name, const ValueRef rhs) +void Object::inplaceBinOp(ExecutionContext *ctx, BinOpContext op, const StringRef name, const ValueRef rhs) { Scope scope(ctx); - ScopedString n(scope, name); - ScopedValue v(scope, get(n)); + ScopedValue v(scope, get(name)); ScopedValue result(scope, op(ctx, v, rhs)); - put(n, result); + put(name, result); } -void Object::inplaceBinOp(ExecutionContext *ctx, BinOpContext op, const ValueRef index, const ValueRef rhs) +void Object::inplaceBinOpValue(ExecutionContext *ctx, BinOpContext op, const ValueRef index, const ValueRef rhs) { Scope scope(ctx); uint idx = index->asArrayIndex(); @@ -214,8 +211,7 @@ void Object::inplaceBinOp(ExecutionContext *ctx, BinOpContext op, const ValueRef putIndexed(idx, result); return; } - String *name = index->toString(ctx); - assert(name); + ScopedString name(scope, index->toString(ctx)); inplaceBinOp(ctx, op, name, rhs); } |