aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@me.com>2013-09-26 14:49:44 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-30 11:28:55 +0200
commit7c3f891c454971ed0150e66c2261e6e5c36664a3 (patch)
tree067a59085a30ddf7ade38dd1cad078033a886486 /src/qml/jsruntime
parent9194779ef37187b1b38d73099747459f9f5e745c (diff)
V4: remove inplace operations
Inplace operations are expanded when building the IR, so the neither the IR, nor the instruction selection backends or runtime need to handle them. Change-Id: Id01f9544e137dd52364cf2ed2c10931c31ddfff3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4object.cpp46
-rw-r--r--src/qml/jsruntime/qv4object_p.h5
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp210
-rw-r--r--src/qml/jsruntime/qv4runtime_p.h40
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp19
5 files changed, 0 insertions, 320 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index f7401ea4a7..ed2bf09bb7 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -169,52 +169,6 @@ void Object::putValue(Property *pd, PropertyAttributes attrs, const ValueRef val
}
-void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, const StringRef name, const ValueRef rhs)
-{
- Scope scope(ctx);
- ScopedValue v(scope, get(name));
- ScopedValue result(scope, op(v, rhs));
- put(name, result);
-}
-
-void Object::inplaceBinOpValue(ExecutionContext *ctx, BinOp op, const ValueRef index, const ValueRef rhs)
-{
- Scope scope(ctx);
- uint idx = index->asArrayIndex();
- if (idx < UINT_MAX) {
- bool hasProperty = false;
- ScopedValue v(scope, getIndexed(idx, &hasProperty));
- ScopedValue result(scope, op(v, rhs));
- putIndexed(idx, result);
- return;
- }
- ScopedString name(scope, index->toString(ctx));
- inplaceBinOp(ctx, op, name, rhs);
-}
-
-void Object::inplaceBinOp(ExecutionContext *ctx, BinOpContext op, const StringRef name, const ValueRef rhs)
-{
- Scope scope(ctx);
- ScopedValue v(scope, get(name));
- ScopedValue result(scope, op(ctx, v, rhs));
- put(name, result);
-}
-
-void Object::inplaceBinOpValue(ExecutionContext *ctx, BinOpContext op, const ValueRef index, const ValueRef rhs)
-{
- Scope scope(ctx);
- uint idx = index->asArrayIndex();
- if (idx < UINT_MAX) {
- bool hasProperty = false;
- ScopedValue v(scope, getIndexed(idx, &hasProperty));
- ScopedValue result(scope, op(ctx, v, rhs));
- putIndexed(idx, result);
- return;
- }
- ScopedString name(scope, index->toString(ctx));
- inplaceBinOp(ctx, op, name, rhs);
-}
-
void Object::defineDefaultProperty(const StringRef name, ValueRef value)
{
Property *pd = insertMember(name, Attr_Data|Attr_NotEnumerable);
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index 899fcde030..c28edcae66 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -156,11 +156,6 @@ struct Q_QML_EXPORT Object: Managed {
void putValue(Property *pd, PropertyAttributes attrs, const ValueRef value);
- void inplaceBinOp(ExecutionContext *, BinOp op, const StringRef name, const ValueRef rhs);
- void inplaceBinOpValue(ExecutionContext *ctx, BinOp op, const ValueRef index, const ValueRef rhs);
- void inplaceBinOp(ExecutionContext *ctx, BinOpContext op, const StringRef name, const ValueRef rhs);
- void inplaceBinOpValue(ExecutionContext *ctx, BinOpContext op, const ValueRef index, const ValueRef rhs);
-
/* The spec default: Writable: true, Enumerable: false, Configurable: true */
void defineDefaultProperty(const StringRef name, ValueRef value);
void defineDefaultProperty(const QString &name, ValueRef value);
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 09fe578c19..8187da6556 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -314,216 +314,6 @@ QV4::ReturnedValue __qmljs_in(ExecutionContext *ctx, const ValueRef left, const
return Encode(r);
}
-static void inplaceBitOp(ExecutionContext *ctx, const StringRef name, const ValueRef value, BinOp op)
-{
- Scope scope(ctx);
- ScopedValue lhs(scope, ctx->getProperty(name));
- ScopedValue result(scope, op(lhs, value));
- ctx->setProperty(name, result);
-}
-
-
-void __qmljs_inplace_bit_and_name(ExecutionContext *ctx, const StringRef name, const ValueRef value)
-{
- inplaceBitOp(ctx, name, value, __qmljs_bit_and);
-}
-
-void __qmljs_inplace_bit_or_name(ExecutionContext *ctx, const StringRef name, const ValueRef value)
-{
- inplaceBitOp(ctx, name, value, __qmljs_bit_or);
-}
-
-void __qmljs_inplace_bit_xor_name(ExecutionContext *ctx, const StringRef name, const ValueRef value)
-{
- inplaceBitOp(ctx, name, value, __qmljs_bit_xor);
-}
-
-void __qmljs_inplace_add_name(ExecutionContext *ctx, const StringRef name, const ValueRef value)
-{
- Scope scope(ctx);
- ScopedValue lhs(scope, ctx->getProperty(name));
- ScopedValue result(scope, __qmljs_add(ctx, lhs, value));
- ctx->setProperty(name, result);
-}
-
-void __qmljs_inplace_sub_name(ExecutionContext *ctx, const StringRef name, const ValueRef value)
-{
- inplaceBitOp(ctx, name, value, __qmljs_sub);
-}
-
-void __qmljs_inplace_mul_name(ExecutionContext *ctx, const StringRef name, const ValueRef value)
-{
- inplaceBitOp(ctx, name, value, __qmljs_mul);
-}
-
-void __qmljs_inplace_div_name(ExecutionContext *ctx, const StringRef name, const ValueRef value)
-{
- inplaceBitOp(ctx, name, value, __qmljs_div);
-}
-
-void __qmljs_inplace_mod_name(ExecutionContext *ctx, const StringRef name, const ValueRef value)
-{
- inplaceBitOp(ctx, name, value, __qmljs_mod);
-}
-
-void __qmljs_inplace_shl_name(ExecutionContext *ctx, const StringRef name, const ValueRef value)
-{
- inplaceBitOp(ctx, name, value, __qmljs_shl);
-}
-
-void __qmljs_inplace_shr_name(ExecutionContext *ctx, const StringRef name, const ValueRef value)
-{
- inplaceBitOp(ctx, name, value, __qmljs_shr);
-}
-
-void __qmljs_inplace_ushr_name(ExecutionContext *ctx, const StringRef name, const ValueRef value)
-{
- inplaceBitOp(ctx, name, value, __qmljs_ushr);
-}
-
-void __qmljs_inplace_bit_and_element(ExecutionContext *ctx, const ValueRef base, const ValueRef index, const ValueRef rhs)
-{
- Object *obj = base->toObject(ctx);
- obj->inplaceBinOpValue(ctx, __qmljs_bit_and, index, rhs);
-}
-
-void __qmljs_inplace_bit_or_element(ExecutionContext *ctx, const ValueRef base, const ValueRef index, const ValueRef rhs)
-{
- Object *obj = base->toObject(ctx);
- obj->inplaceBinOpValue(ctx, __qmljs_bit_or, index, rhs);
-}
-
-void __qmljs_inplace_bit_xor_element(ExecutionContext *ctx, const ValueRef base, const ValueRef index, const ValueRef rhs)
-{
- Object *obj = base->toObject(ctx);
- obj->inplaceBinOpValue(ctx, __qmljs_bit_xor, index, rhs);
-}
-
-void __qmljs_inplace_add_element(ExecutionContext *ctx, const ValueRef base, const ValueRef index, const ValueRef rhs)
-{
- Object *obj = base->toObject(ctx);
- obj->inplaceBinOpValue(ctx, __qmljs_add, index, rhs);
-}
-
-void __qmljs_inplace_sub_element(ExecutionContext *ctx, const ValueRef base, const ValueRef index, const ValueRef rhs)
-{
- Object *obj = base->toObject(ctx);
- obj->inplaceBinOpValue(ctx, __qmljs_sub, index, rhs);
-}
-
-void __qmljs_inplace_mul_element(ExecutionContext *ctx, const ValueRef base, const ValueRef index, const ValueRef rhs)
-{
- Object *obj = base->toObject(ctx);
- obj->inplaceBinOpValue(ctx, __qmljs_mul, index, rhs);
-}
-
-void __qmljs_inplace_div_element(ExecutionContext *ctx, const ValueRef base, const ValueRef index, const ValueRef rhs)
-{
- Object *obj = base->toObject(ctx);
- obj->inplaceBinOpValue(ctx, __qmljs_div, index, rhs);
-}
-
-void __qmljs_inplace_mod_element(ExecutionContext *ctx, const ValueRef base, const ValueRef index, const ValueRef rhs)
-{
- Object *obj = base->toObject(ctx);
- obj->inplaceBinOpValue(ctx, __qmljs_mod, index, rhs);
-}
-
-void __qmljs_inplace_shl_element(ExecutionContext *ctx, const ValueRef base, const ValueRef index, const ValueRef rhs)
-{
- Object *obj = base->toObject(ctx);
- obj->inplaceBinOpValue(ctx, __qmljs_shl, index, rhs);
-}
-
-void __qmljs_inplace_shr_element(ExecutionContext *ctx, const ValueRef base, const ValueRef index, const ValueRef rhs)
-{
- Object *obj = base->toObject(ctx);
- obj->inplaceBinOpValue(ctx, __qmljs_shr, index, rhs);
-}
-
-void __qmljs_inplace_ushr_element(ExecutionContext *ctx, const ValueRef base, const ValueRef index, const ValueRef rhs)
-{
- Object *obj = base->toObject(ctx);
- obj->inplaceBinOpValue(ctx, __qmljs_ushr, index, rhs);
-}
-
-void __qmljs_inplace_bit_and_member(ExecutionContext *ctx, const ValueRef base, const StringRef name, const ValueRef rhs)
-{
- Scope scope(ctx);
- ScopedObject o(scope, base->toObject(ctx));
- o->inplaceBinOp(ctx, __qmljs_bit_and, name, rhs);
-}
-
-void __qmljs_inplace_bit_or_member(ExecutionContext *ctx, const ValueRef base, const StringRef name, const ValueRef rhs)
-{
- Scope scope(ctx);
- ScopedObject o(scope, base->toObject(ctx));
- o->inplaceBinOp(ctx, __qmljs_bit_or, name, rhs);
-}
-
-void __qmljs_inplace_bit_xor_member(ExecutionContext *ctx, const ValueRef base, const StringRef name, const ValueRef rhs)
-{
- Scope scope(ctx);
- ScopedObject o(scope, base->toObject(ctx));
- o->inplaceBinOp(ctx, __qmljs_bit_xor, name, rhs);
-}
-
-void __qmljs_inplace_add_member(ExecutionContext *ctx, const ValueRef base, const StringRef name, const ValueRef rhs)
-{
- Scope scope(ctx);
- ScopedObject o(scope, base->toObject(ctx));
- o->inplaceBinOp(ctx, __qmljs_add, name, rhs);
-}
-
-void __qmljs_inplace_sub_member(ExecutionContext *ctx, const ValueRef base, const StringRef name, const ValueRef rhs)
-{
- Scope scope(ctx);
- ScopedObject o(scope, base->toObject(ctx));
- o->inplaceBinOp(ctx, __qmljs_sub, name, rhs);
-}
-
-void __qmljs_inplace_mul_member(ExecutionContext *ctx, const ValueRef base, const StringRef name, const ValueRef rhs)
-{
- Scope scope(ctx);
- ScopedObject o(scope, base->toObject(ctx));
- o->inplaceBinOp(ctx, __qmljs_mul, name, rhs);
-}
-
-void __qmljs_inplace_div_member(ExecutionContext *ctx, const ValueRef base, const StringRef name, const ValueRef rhs)
-{
- Scope scope(ctx);
- ScopedObject o(scope, base->toObject(ctx));
- o->inplaceBinOp(ctx, __qmljs_div, name, rhs);
-}
-
-void __qmljs_inplace_mod_member(ExecutionContext *ctx, const ValueRef base, const StringRef name, const ValueRef rhs)
-{
- Scope scope(ctx);
- ScopedObject o(scope, base->toObject(ctx));
- o->inplaceBinOp(ctx, __qmljs_mod, name, rhs);
-}
-
-void __qmljs_inplace_shl_member(ExecutionContext *ctx, const ValueRef base, const StringRef name, const ValueRef rhs)
-{
- Scope scope(ctx);
- ScopedObject o(scope, base->toObject(ctx));
- o->inplaceBinOp(ctx, __qmljs_shl, name, rhs);
-}
-
-void __qmljs_inplace_shr_member(ExecutionContext *ctx, const ValueRef base, const StringRef name, const ValueRef rhs)
-{
- Scope scope(ctx);
- ScopedObject o(scope, base->toObject(ctx));
- o->inplaceBinOp(ctx, __qmljs_shr, name, rhs);
-}
-
-void __qmljs_inplace_ushr_member(ExecutionContext *ctx, const ValueRef base, const StringRef name, const ValueRef rhs)
-{
- Scope scope(ctx);
- ScopedObject o(scope, base->toObject(ctx));
- o->inplaceBinOp(ctx, __qmljs_ushr, name, rhs);
-}
-
double __qmljs_string_to_number(const QString &string)
{
QString s = string.trimmed();
diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h
index da7f98e2ca..2fb641c994 100644
--- a/src/qml/jsruntime/qv4runtime_p.h
+++ b/src/qml/jsruntime/qv4runtime_p.h
@@ -226,46 +226,6 @@ QV4::ReturnedValue __qmljs_sne(const QV4::ValueRef left, const QV4::ValueRef rig
QV4::ReturnedValue __qmljs_add_helper(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right);
-
-typedef void (*InplaceBinOpName)(QV4::ExecutionContext *ctx, const QV4::StringRef name, const QV4::ValueRef value);
-void __qmljs_inplace_bit_and_name(QV4::ExecutionContext *ctx, const QV4::StringRef name, const QV4::ValueRef value);
-void __qmljs_inplace_bit_or_name(QV4::ExecutionContext *ctx, const QV4::StringRef name, const QV4::ValueRef value);
-void __qmljs_inplace_bit_xor_name(QV4::ExecutionContext *ctx, const QV4::StringRef name, const QV4::ValueRef value);
-void __qmljs_inplace_add_name(QV4::ExecutionContext *ctx, const QV4::StringRef name, const ValueRef value);
-void __qmljs_inplace_sub_name(QV4::ExecutionContext *ctx, const QV4::StringRef name, const ValueRef value);
-void __qmljs_inplace_mul_name(QV4::ExecutionContext *ctx, const QV4::StringRef name, const ValueRef value);
-void __qmljs_inplace_div_name(QV4::ExecutionContext *ctx, const QV4::StringRef name, const ValueRef value);
-void __qmljs_inplace_mod_name(QV4::ExecutionContext *ctx, const QV4::StringRef name, const ValueRef value);
-void __qmljs_inplace_shl_name(QV4::ExecutionContext *ctx, const QV4::StringRef name, const ValueRef value);
-void __qmljs_inplace_shr_name(QV4::ExecutionContext *ctx, const QV4::StringRef name, const ValueRef value);
-void __qmljs_inplace_ushr_name(QV4::ExecutionContext *ctx, const QV4::StringRef name, const ValueRef value);
-
-typedef void (*InplaceBinOpElement)(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::ValueRef index, const QV4::ValueRef rhs);
-void __qmljs_inplace_bit_and_element(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::ValueRef index, const QV4::ValueRef rhs);
-void __qmljs_inplace_bit_or_element(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::ValueRef index, const QV4::ValueRef rhs);
-void __qmljs_inplace_bit_xor_element(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::ValueRef index, const QV4::ValueRef rhs);
-void __qmljs_inplace_add_element(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::ValueRef index, const QV4::ValueRef rhs);
-void __qmljs_inplace_sub_element(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::ValueRef index, const QV4::ValueRef rhs);
-void __qmljs_inplace_mul_element(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::ValueRef index, const QV4::ValueRef rhs);
-void __qmljs_inplace_div_element(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::ValueRef index, const QV4::ValueRef rhs);
-void __qmljs_inplace_mod_element(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::ValueRef index, const QV4::ValueRef rhs);
-void __qmljs_inplace_shl_element(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::ValueRef index, const QV4::ValueRef rhs);
-void __qmljs_inplace_shr_element(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::ValueRef index, const QV4::ValueRef rhs);
-void __qmljs_inplace_ushr_element(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::ValueRef index, const QV4::ValueRef rhs);
-
-typedef void (*InplaceBinOpMember)(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::StringRef name, const QV4::ValueRef rhs);
-void __qmljs_inplace_bit_and_member(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::StringRef name, const QV4::ValueRef rhs);
-void __qmljs_inplace_bit_or_member(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::StringRef name, const QV4::ValueRef rhs);
-void __qmljs_inplace_bit_xor_member(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::StringRef name, const QV4::ValueRef rhs);
-void __qmljs_inplace_add_member(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::StringRef name, const QV4::ValueRef rhs);
-void __qmljs_inplace_sub_member(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::StringRef name, const QV4::ValueRef rhs);
-void __qmljs_inplace_mul_member(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::StringRef name, const QV4::ValueRef rhs);
-void __qmljs_inplace_div_member(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::StringRef name, const QV4::ValueRef rhs);
-void __qmljs_inplace_mod_member(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::StringRef name, const QV4::ValueRef rhs);
-void __qmljs_inplace_shl_member(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::StringRef name, const QV4::ValueRef rhs);
-void __qmljs_inplace_shr_member(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::StringRef name, const QV4::ValueRef rhs);
-void __qmljs_inplace_ushr_member(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::StringRef name, const QV4::ValueRef rhs);
-
typedef QV4::Bool (*CmpOp)(const QV4::ValueRef left, const QV4::ValueRef right);
QV4::Bool __qmljs_cmp_gt(const QV4::ValueRef l, const QV4::ValueRef r);
QV4::Bool __qmljs_cmp_lt(const QV4::ValueRef l, const QV4::ValueRef r);
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index 2e45b2cab8..d89300f7af 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -548,25 +548,6 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *&code,
VALUE(instr.result) = context->callData->thisObject;
MOTH_END_INSTR(LoadThis)
- MOTH_BEGIN_INSTR(InplaceElementOp)
- instr.alu(context,
- VALUEPTR(instr.base),
- VALUEPTR(instr.index),
- VALUEPTR(instr.source));
- MOTH_END_INSTR(InplaceElementOp)
-
- MOTH_BEGIN_INSTR(InplaceMemberOp)
- instr.alu(context,
- VALUEPTR(instr.base),
- runtimeStrings[instr.member],
- VALUEPTR(instr.source));
- MOTH_END_INSTR(InplaceMemberOp)
-
- MOTH_BEGIN_INSTR(InplaceNameOp)
- TRACE(name, "%s", runtimeStrings[instr.name]->toQString().toUtf8().constData());
- instr.alu(context, runtimeStrings[instr.name], VALUEPTR(instr.source));
- MOTH_END_INSTR(InplaceNameOp)
-
#ifdef MOTH_THREADED_INTERPRETER
// nothing to do
#else