void __qmljs_llvm_inplace_bit_and_name(ExecutionContext *ctx, String *dest, Value *src)
{
- __qmljs_inplace_bit_and_name(*src, dest, ctx);
+ __qmljs_inplace_bit_and_name(ctx, dest, src);
}
void __qmljs_llvm_inplace_bit_or_name(ExecutionContext *ctx, String *dest, Value *src)
{
- __qmljs_inplace_bit_or_name(*src, dest, ctx);
+ __qmljs_inplace_bit_or_name(ctx, dest, src);
}
void __qmljs_llvm_inplace_bit_xor_name(ExecutionContext *ctx, String *dest, Value *src)
{
- __qmljs_inplace_bit_xor_name(*src, dest, ctx);
+ __qmljs_inplace_bit_xor_name(ctx, dest, src);
}
void __qmljs_llvm_inplace_add_name(ExecutionContext *ctx, String *dest, Value *src)
{
- __qmljs_inplace_add_name(*src, dest, ctx);
+ __qmljs_inplace_add_name(ctx, dest, src);
}
void __qmljs_llvm_inplace_sub_name(ExecutionContext *ctx, String *dest, Value *src)
{
- __qmljs_inplace_sub_name(*src, dest, ctx);
+ __qmljs_inplace_sub_name(ctx, dest, src);
}
void __qmljs_llvm_inplace_mul_name(ExecutionContext *ctx, String *dest, Value *src)
{
- __qmljs_inplace_mul_name(*src, dest, ctx);
+ __qmljs_inplace_mul_name(ctx, dest, src);
}
void __qmljs_llvm_inplace_div_name(ExecutionContext *ctx, String *dest, Value *src)
{
- __qmljs_inplace_div_name(*src, dest, ctx);
+ __qmljs_inplace_div_name(ctx, dest, src);
}
void __qmljs_llvm_inplace_mod_name(ExecutionContext *ctx, String *dest, Value *src)
{
- __qmljs_inplace_mod_name(*src, dest, ctx);
+ __qmljs_inplace_mod_name(ctx, dest, src);
}
void __qmljs_llvm_inplace_shl_name(ExecutionContext *ctx, String *dest, Value *src)
{
- __qmljs_inplace_shl_name(*src, dest, ctx);
+ __qmljs_inplace_shl_name(ctx, dest, src);
}
void __qmljs_llvm_inplace_shr_name(ExecutionContext *ctx, String *dest, Value *src)
{
- __qmljs_inplace_shr_name(*src, dest, ctx);
+ __qmljs_inplace_shr_name(ctx, dest, src);
}
void __qmljs_llvm_inplace_ushr_name(ExecutionContext *ctx, String *dest, Value *src)
{
- __qmljs_inplace_ushr_name(*src, dest, ctx);
+ __qmljs_inplace_ushr_name(ctx, dest, src);
}
void __qmljs_llvm_inplace_bit_and_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
- __qmljs_inplace_bit_and_element(*base, *index, *value, ctx);
+ __qmljs_inplace_bit_and_element(ctx, base, index, value);
}
void __qmljs_llvm_inplace_bit_or_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
- __qmljs_inplace_bit_or_element(*base, *index, *value, ctx);
+ __qmljs_inplace_bit_or_element(ctx, base, index, value);
}
void __qmljs_llvm_inplace_bit_xor_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
- __qmljs_inplace_bit_xor_element(*base, *index, *value, ctx);
+ __qmljs_inplace_bit_xor_element(ctx, base, index, value);
}
void __qmljs_llvm_inplace_add_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
- __qmljs_inplace_add_element(*base, *index, *value, ctx);
+ __qmljs_inplace_add_element(ctx, base, index, value);
}
void __qmljs_llvm_inplace_sub_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
- __qmljs_inplace_sub_element(*base, *index, *value, ctx);
+ __qmljs_inplace_sub_element(ctx, base, index, value);
}
void __qmljs_llvm_inplace_mul_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
- __qmljs_inplace_mul_element(*base, *index, *value, ctx);
+ __qmljs_inplace_mul_element(ctx, base, index, value);
}
void __qmljs_llvm_inplace_div_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
- __qmljs_inplace_div_element(*base, *index, *value, ctx);
+ __qmljs_inplace_div_element(ctx, base, index, value);
}
void __qmljs_llvm_inplace_mod_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
- __qmljs_inplace_mod_element(*base, *index, *value, ctx);
+ __qmljs_inplace_mod_element(ctx, base, index, value);
}
void __qmljs_llvm_inplace_shl_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
- __qmljs_inplace_shl_element(*base, *index, *value, ctx);
+ __qmljs_inplace_shl_element(ctx, base, index, value);
}
void __qmljs_llvm_inplace_shr_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
- __qmljs_inplace_shr_element(*base, *index, *value, ctx);
+ __qmljs_inplace_shr_element(ctx, base, index, value);
}
void __qmljs_llvm_inplace_ushr_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
- __qmljs_inplace_ushr_element(*base, *index, *value, ctx);
+ __qmljs_inplace_ushr_element(ctx, base, index, value);
}
void __qmljs_llvm_inplace_bit_and_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
- __qmljs_inplace_bit_and_member(*value, *base, member, ctx);
+ __qmljs_inplace_bit_and_member(ctx, base, member, value);
}
void __qmljs_llvm_inplace_bit_or_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
- __qmljs_inplace_bit_or_member(*value, *base, member, ctx);
+ __qmljs_inplace_bit_or_member(ctx, base, member, value);
}
void __qmljs_llvm_inplace_bit_xor_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
- __qmljs_inplace_bit_xor_member(*value, *base, member, ctx);
+ __qmljs_inplace_bit_xor_member(ctx, base, member, value);
}
void __qmljs_llvm_inplace_add_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
- __qmljs_inplace_add_member(*value, *base, member, ctx);
+ __qmljs_inplace_add_member(ctx, base, member, value);
}
void __qmljs_llvm_inplace_sub_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
- __qmljs_inplace_sub_member(*value, *base, member, ctx);
+ __qmljs_inplace_sub_member(ctx, base, member, value);
}
void __qmljs_llvm_inplace_mul_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
- __qmljs_inplace_mul_member(*value, *base, member, ctx);
+ __qmljs_inplace_mul_member(ctx, base, member, value);
}
void __qmljs_llvm_inplace_div_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
- __qmljs_inplace_div_member(*value, *base, member, ctx);
+ __qmljs_inplace_div_member(ctx, base, member, value);
}
void __qmljs_llvm_inplace_mod_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
- __qmljs_inplace_mod_member(*value, *base, member, ctx);
+ __qmljs_inplace_mod_member(ctx, base, member, value);
}
void __qmljs_llvm_inplace_shl_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
- __qmljs_inplace_shl_member(*value, *base, member, ctx);
+ __qmljs_inplace_shl_member(ctx, base, member, value);
}
void __qmljs_llvm_inplace_shr_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
- __qmljs_inplace_shr_member(*value, *base, member, ctx);
+ __qmljs_inplace_shr_member(ctx, base, member, value);
}
void __qmljs_llvm_inplace_ushr_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
- __qmljs_inplace_ushr_member(*value, *base, member, ctx);
+ __qmljs_inplace_ushr_member(ctx, base, member, value);
}
String *__qmljs_llvm_identifier_from_utf8(ExecutionContext *ctx, const char *str)
};
struct instr_inplaceElementOp {
MOTH_INSTR_HEADER
- void (*alu)(VM::Value, VM::Value, VM::Value, VM::ExecutionContext *);
+ VM::InplaceBinOpElement alu;
Param base;
Param index;
Param source;
};
struct instr_inplaceMemberOp {
MOTH_INSTR_HEADER
- void (*alu)(VM::Value, VM::Value, VM::String *, VM::ExecutionContext *);
+ VM::InplaceBinOpMember alu;
VM::String *member;
Param base;
Param source;
};
struct instr_inplaceNameOp {
MOTH_INSTR_HEADER
- void (*alu)(VM::Value, VM::String *, VM::ExecutionContext *);
+ VM::InplaceBinOpName alu;
VM::String *name;
Param source;
};
addInstruction(binop);
}
-void InstructionSelection::inplaceNameOp(IR::AluOp oper, IR::Expr *sourceExpr, const QString &targetName)
+void InstructionSelection::inplaceNameOp(IR::AluOp oper, IR::Temp *rightSource, const QString &targetName)
{
- void (*op)(VM::Value value, VM::String *name, VM::ExecutionContext *ctx) = 0;
+ VM::InplaceBinOpName op = 0;
switch (oper) {
case IR::OpBitAnd: op = VM::__qmljs_inplace_bit_and_name; break;
case IR::OpBitOr: op = VM::__qmljs_inplace_bit_or_name; break;
Instruction::InplaceNameOp ieo;
ieo.alu = op;
ieo.name = identifier(targetName);
- ieo.source = getParam(sourceExpr);
+ ieo.source = getParam(rightSource);
addInstruction(ieo);
}
}
-void InstructionSelection::inplaceElementOp(IR::AluOp oper, IR::Expr *sourceExpr, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp)
+void InstructionSelection::inplaceElementOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp)
{
- void (*op)(VM::Value base, VM::Value index, VM::Value value, VM::ExecutionContext *ctx) = 0;
+ VM::InplaceBinOpElement op = 0;
switch (oper) {
case IR::OpBitAnd: op = VM::__qmljs_inplace_bit_and_element; break;
case IR::OpBitOr: op = VM::__qmljs_inplace_bit_or_element; break;
ieo.alu = op;
ieo.base = getParam(targetBaseTemp);
ieo.index = getParam(targetIndexTemp);
- ieo.source = getParam(sourceExpr);
+ ieo.source = getParam(source);
addInstruction(ieo);
}
-void InstructionSelection::inplaceMemberOp(IR::AluOp oper, IR::Expr *source, IR::Temp *targetBase, const QString &targetName)
+void InstructionSelection::inplaceMemberOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBase, const QString &targetName)
{
- void (*op)(VM::Value value, VM::Value base, VM::String *name, VM::ExecutionContext *ctx) = 0;
+ VM::InplaceBinOpMember op = 0;
switch (oper) {
case IR::OpBitAnd: op = VM::__qmljs_inplace_bit_and_member; break;
case IR::OpBitOr: op = VM::__qmljs_inplace_bit_or_member; break;
virtual void copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp);
virtual void unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *targetTemp);
virtual void binop(IR::AluOp oper, IR::Temp *leftSource, IR::Temp *rightSource, IR::Temp *target);
- virtual void inplaceNameOp(IR::AluOp oper, IR::Expr *sourceExpr, const QString &targetName);
- virtual void inplaceElementOp(IR::AluOp oper, IR::Expr *sourceExpr, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp);
- virtual void inplaceMemberOp(IR::AluOp oper, IR::Expr *source, IR::Temp *targetBase, const QString &targetName);
+ virtual void inplaceNameOp(IR::AluOp oper, IR::Temp *rightSource, const QString &targetName);
+ virtual void inplaceElementOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp);
+ virtual void inplaceMemberOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBase, const QString &targetName);
private:
struct Instruction {
MOTH_END_INSTR(LoadThis)
MOTH_BEGIN_INSTR(InplaceElementOp)
- instr.alu(VALUE(instr.base),
- VALUE(instr.index),
- VALUE(instr.source),
- context);
+ instr.alu(context,
+ VALUEPTR(instr.base),
+ VALUEPTR(instr.index),
+ VALUEPTR(instr.source));
MOTH_END_INSTR(InplaceElementOp)
MOTH_BEGIN_INSTR(InplaceMemberOp)
- instr.alu(VALUE(instr.source),
- VALUE(instr.base),
+ instr.alu(context,
+ VALUEPTR(instr.base),
instr.member,
- context);
+ VALUEPTR(instr.source));
MOTH_END_INSTR(InplaceMemberOp)
MOTH_BEGIN_INSTR(InplaceNameOp)
TRACE(name, "%s", instr.name->toQString().toUtf8().constData());
- instr.alu(VALUE(instr.source),
- instr.name,
- context);
+ instr.alu(context, instr.name, VALUEPTR(instr.source));
MOTH_END_INSTR(InplaceNameOp)
#ifdef MOTH_THREADED_INTERPRETER
-void ExecutionContext::inplaceBitOp(Value value, String *name, BinOp op)
+void ExecutionContext::inplaceBitOp(String *name, const Value *value, BinOp op)
{
Value lhs = getProperty(name);
Value result;
- op(this, &result, &lhs, &value);
+ op(this, &result, &lhs, value);
setProperty(name, result);
}
Value getProperty(String *name);
Value getPropertyNoThrow(String *name);
Value getPropertyAndBase(String *name, Object **base);
- void inplaceBitOp(Value value, String *name, BinOp op);
+ void inplaceBitOp(String *name, const QQmlJS::VM::Value *value, BinOp op);
bool deleteProperty(String *name);
inline Value argument(unsigned int index = 0)
*result = Value::fromBoolean(r);
}
-void __qmljs_inplace_bit_and_name(Value value, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_bit_and_name(ExecutionContext *ctx, String *name, const Value *value)
{
- ctx->inplaceBitOp(value, name, __qmljs_bit_and);
+ ctx->inplaceBitOp(name, value, __qmljs_bit_and);
}
-void __qmljs_inplace_bit_or_name(Value value, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_bit_or_name(ExecutionContext *ctx, String *name, const Value *value)
{
- ctx->inplaceBitOp(value, name, __qmljs_bit_or);
+ ctx->inplaceBitOp(name, value, __qmljs_bit_or);
}
-void __qmljs_inplace_bit_xor_name(Value value, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_bit_xor_name(ExecutionContext *ctx, String *name, const Value *value)
{
- ctx->inplaceBitOp(value, name, __qmljs_bit_xor);
+ ctx->inplaceBitOp(name, value, __qmljs_bit_xor);
}
-void __qmljs_inplace_add_name(Value value, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_add_name(ExecutionContext *ctx, String *name, const Value *value)
{
- ctx->inplaceBitOp(value, name, __qmljs_add);
+ ctx->inplaceBitOp(name, value, __qmljs_add);
}
-void __qmljs_inplace_sub_name(Value value, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_sub_name(ExecutionContext *ctx, String *name, const Value *value)
{
- ctx->inplaceBitOp(value, name, __qmljs_sub);
+ ctx->inplaceBitOp(name, value, __qmljs_sub);
}
-void __qmljs_inplace_mul_name(Value value, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_mul_name(ExecutionContext *ctx, String *name, const Value *value)
{
- ctx->inplaceBitOp(value, name, __qmljs_mul);
+ ctx->inplaceBitOp(name, value, __qmljs_mul);
}
-void __qmljs_inplace_div_name(Value value, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_div_name(ExecutionContext *ctx, String *name, const Value *value)
{
- ctx->inplaceBitOp(value, name, __qmljs_div);
+ ctx->inplaceBitOp(name, value, __qmljs_div);
}
-void __qmljs_inplace_mod_name(Value value, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_mod_name(ExecutionContext *ctx, String *name, const Value *value)
{
- ctx->inplaceBitOp(value, name, __qmljs_mod);
+ ctx->inplaceBitOp(name, value, __qmljs_mod);
}
-void __qmljs_inplace_shl_name(Value value, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_shl_name(ExecutionContext *ctx, String *name, const Value *value)
{
- ctx->inplaceBitOp(value, name, __qmljs_shl);
+ ctx->inplaceBitOp(name, value, __qmljs_shl);
}
-void __qmljs_inplace_shr_name(Value value, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_shr_name(ExecutionContext *ctx, String *name, const Value *value)
{
- ctx->inplaceBitOp(value, name, __qmljs_shr);
+ ctx->inplaceBitOp(name, value, __qmljs_shr);
}
-void __qmljs_inplace_ushr_name(Value value, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_ushr_name(ExecutionContext *ctx, String *name, const Value *value)
{
- ctx->inplaceBitOp(value, name, __qmljs_ushr);
+ ctx->inplaceBitOp(name, value, __qmljs_ushr);
}
-void __qmljs_inplace_bit_and_element(Value base, Value index, Value value, ExecutionContext *ctx)
+void __qmljs_inplace_bit_and_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs)
{
- Object *obj = base.toObject(ctx).objectValue();
- obj->inplaceBinOp(value, index, __qmljs_bit_and, ctx);
+ Object *obj = base->toObject(ctx).objectValue();
+ obj->inplaceBinOp(ctx, __qmljs_bit_and, index, rhs);
}
-void __qmljs_inplace_bit_or_element(Value base, Value index, Value value, ExecutionContext *ctx)
+void __qmljs_inplace_bit_or_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs)
{
- Object *obj = base.toObject(ctx).objectValue();
- obj->inplaceBinOp(value, index, __qmljs_bit_or, ctx);
+ Object *obj = base->toObject(ctx).objectValue();
+ obj->inplaceBinOp(ctx, __qmljs_bit_or, index, rhs);
}
-void __qmljs_inplace_bit_xor_element(Value base, Value index, Value value, ExecutionContext *ctx)
+void __qmljs_inplace_bit_xor_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs)
{
- Object *obj = base.toObject(ctx).objectValue();
- obj->inplaceBinOp(value, index, __qmljs_bit_xor, ctx);
+ Object *obj = base->toObject(ctx).objectValue();
+ obj->inplaceBinOp(ctx, __qmljs_bit_xor, index, rhs);
}
-void __qmljs_inplace_add_element(Value base, Value index, Value value, ExecutionContext *ctx)
+void __qmljs_inplace_add_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs)
{
- Object *obj = base.toObject(ctx).objectValue();
- obj->inplaceBinOp(value, index, __qmljs_add, ctx);
+ Object *obj = base->toObject(ctx).objectValue();
+ obj->inplaceBinOp(ctx, __qmljs_add, index, rhs);
}
-void __qmljs_inplace_sub_element(Value base, Value index, Value value, ExecutionContext *ctx)
+void __qmljs_inplace_sub_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs)
{
- Object *obj = base.toObject(ctx).objectValue();
- obj->inplaceBinOp(value, index, __qmljs_sub, ctx);
+ Object *obj = base->toObject(ctx).objectValue();
+ obj->inplaceBinOp(ctx, __qmljs_sub, index, rhs);
}
-void __qmljs_inplace_mul_element(Value base, Value index, Value value, ExecutionContext *ctx)
+void __qmljs_inplace_mul_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs)
{
- Object *obj = base.toObject(ctx).objectValue();
- obj->inplaceBinOp(value, index, __qmljs_mul, ctx);
+ Object *obj = base->toObject(ctx).objectValue();
+ obj->inplaceBinOp(ctx, __qmljs_mul, index, rhs);
}
-void __qmljs_inplace_div_element(Value base, Value index, Value value, ExecutionContext *ctx)
+void __qmljs_inplace_div_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs)
{
- Object *obj = base.toObject(ctx).objectValue();
- obj->inplaceBinOp(value, index, __qmljs_div, ctx);
+ Object *obj = base->toObject(ctx).objectValue();
+ obj->inplaceBinOp(ctx, __qmljs_div, index, rhs);
}
-void __qmljs_inplace_mod_element(Value base, Value index, Value value, ExecutionContext *ctx)
+void __qmljs_inplace_mod_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs)
{
- Object *obj = base.toObject(ctx).objectValue();
- obj->inplaceBinOp(value, index, __qmljs_mod, ctx);
+ Object *obj = base->toObject(ctx).objectValue();
+ obj->inplaceBinOp(ctx, __qmljs_mod, index, rhs);
}
-void __qmljs_inplace_shl_element(Value base, Value index, Value value, ExecutionContext *ctx)
+void __qmljs_inplace_shl_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs)
{
- Object *obj = base.toObject(ctx).objectValue();
- obj->inplaceBinOp(value, index, __qmljs_shl, ctx);
+ Object *obj = base->toObject(ctx).objectValue();
+ obj->inplaceBinOp(ctx, __qmljs_shl, index, rhs);
}
-void __qmljs_inplace_shr_element(Value base, Value index, Value value, ExecutionContext *ctx)
+void __qmljs_inplace_shr_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs)
{
- Object *obj = base.toObject(ctx).objectValue();
- obj->inplaceBinOp(value, index, __qmljs_shr, ctx);
+ Object *obj = base->toObject(ctx).objectValue();
+ obj->inplaceBinOp(ctx, __qmljs_shr, index, rhs);
}
-void __qmljs_inplace_ushr_element(Value base, Value index, Value value, ExecutionContext *ctx)
+void __qmljs_inplace_ushr_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs)
{
- Object *obj = base.toObject(ctx).objectValue();
- obj->inplaceBinOp(value, index, __qmljs_ushr, ctx);
+ Object *obj = base->toObject(ctx).objectValue();
+ obj->inplaceBinOp(ctx, __qmljs_ushr, index, rhs);
}
-void __qmljs_inplace_bit_and_member(Value value, Value base, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_bit_and_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs)
{
- Object *o = base.toObject(ctx).objectValue();
- o->inplaceBinOp(value, name, __qmljs_bit_and, ctx);
+ Object *o = base->toObject(ctx).objectValue();
+ o->inplaceBinOp(ctx, __qmljs_bit_and, name, rhs);
}
-void __qmljs_inplace_bit_or_member(Value value, Value base, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_bit_or_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs)
{
- Object *o = base.toObject(ctx).objectValue();
- o->inplaceBinOp(value, name, __qmljs_bit_or, ctx);
+ Object *o = base->toObject(ctx).objectValue();
+ o->inplaceBinOp(ctx, __qmljs_bit_or, name, rhs);
}
-void __qmljs_inplace_bit_xor_member(Value value, Value base, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_bit_xor_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs)
{
- Object *o = base.toObject(ctx).objectValue();
- o->inplaceBinOp(value, name, __qmljs_bit_xor, ctx);
+ Object *o = base->toObject(ctx).objectValue();
+ o->inplaceBinOp(ctx, __qmljs_bit_xor, name, rhs);
}
-void __qmljs_inplace_add_member(Value value, Value base, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_add_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs)
{
- Object *o = base.toObject(ctx).objectValue();
- o->inplaceBinOp(value, name, __qmljs_add, ctx);
+ Object *o = base->toObject(ctx).objectValue();
+ o->inplaceBinOp(ctx, __qmljs_add, name, rhs);
}
-void __qmljs_inplace_sub_member(Value value, Value base, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_sub_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs)
{
- Object *o = base.toObject(ctx).objectValue();
- o->inplaceBinOp(value, name, __qmljs_sub, ctx);
+ Object *o = base->toObject(ctx).objectValue();
+ o->inplaceBinOp(ctx, __qmljs_sub, name, rhs);
}
-void __qmljs_inplace_mul_member(Value value, Value base, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_mul_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs)
{
- Object *o = base.toObject(ctx).objectValue();
- o->inplaceBinOp(value, name, __qmljs_mul, ctx);
+ Object *o = base->toObject(ctx).objectValue();
+ o->inplaceBinOp(ctx, __qmljs_mul, name, rhs);
}
-void __qmljs_inplace_div_member(Value value, Value base, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_div_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs)
{
- Object *o = base.toObject(ctx).objectValue();
- o->inplaceBinOp(value, name, __qmljs_div, ctx);
+ Object *o = base->toObject(ctx).objectValue();
+ o->inplaceBinOp(ctx, __qmljs_div, name, rhs);
}
-void __qmljs_inplace_mod_member(Value value, Value base, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_mod_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs)
{
- Object *o = base.toObject(ctx).objectValue();
- o->inplaceBinOp(value, name, __qmljs_mod, ctx);
+ Object *o = base->toObject(ctx).objectValue();
+ o->inplaceBinOp(ctx, __qmljs_mod, name, rhs);
}
-void __qmljs_inplace_shl_member(Value value, Value base, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_shl_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs)
{
- Object *o = base.toObject(ctx).objectValue();
- o->inplaceBinOp(value, name, __qmljs_shl, ctx);
+ Object *o = base->toObject(ctx).objectValue();
+ o->inplaceBinOp(ctx, __qmljs_shl, name, rhs);
}
-void __qmljs_inplace_shr_member(Value value, Value base, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_shr_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs)
{
- Object *o = base.toObject(ctx).objectValue();
- o->inplaceBinOp(value, name, __qmljs_shr, ctx);
+ Object *o = base->toObject(ctx).objectValue();
+ o->inplaceBinOp(ctx, __qmljs_shr, name, rhs);
}
-void __qmljs_inplace_ushr_member(Value value, Value base, String *name, ExecutionContext *ctx)
+void __qmljs_inplace_ushr_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs)
{
- Object *o = base.toObject(ctx).objectValue();
- o->inplaceBinOp(value, name, __qmljs_ushr, ctx);
+ Object *o = base->toObject(ctx).objectValue();
+ o->inplaceBinOp(ctx, __qmljs_ushr, name, rhs);
}
String *__qmljs_string_from_utf8(ExecutionContext *ctx, const char *s)
void __qmljs_add_helper(ExecutionContext *ctx, Value *result, const Value *left, const Value *right);
-void __qmljs_inplace_bit_and_name(Value value, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_bit_or_name(Value value, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_bit_xor_name(Value value, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_add_name(Value value, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_sub_name(Value value, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_mul_name(Value value, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_div_name(Value value, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_mod_name(Value value, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_shl_name(Value value, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_shr_name(Value value, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_ushr_name(Value value, String *name, ExecutionContext *ctx);
-
-void __qmljs_inplace_bit_and_element(Value base, Value index, Value value, ExecutionContext *ctx);
-void __qmljs_inplace_bit_or_element(Value base, Value index, Value value, ExecutionContext *ctx);
-void __qmljs_inplace_bit_xor_element(Value base, Value index, Value value, ExecutionContext *ctx);
-void __qmljs_inplace_add_element(Value base, Value index, Value value, ExecutionContext *ctx);
-void __qmljs_inplace_sub_element(Value base, Value index, Value value, ExecutionContext *ctx);
-void __qmljs_inplace_mul_element(Value base, Value index, Value value, ExecutionContext *ctx);
-void __qmljs_inplace_div_element(Value base, Value index, Value value, ExecutionContext *ctx);
-void __qmljs_inplace_mod_element(Value base, Value index, Value value, ExecutionContext *ctx);
-void __qmljs_inplace_shl_element(Value base, Value index, Value value, ExecutionContext *ctx);
-void __qmljs_inplace_shr_element(Value base, Value index, Value value, ExecutionContext *ctx);
-void __qmljs_inplace_ushr_element(Value base, Value index, Value value, ExecutionContext *ctx);
-
-void __qmljs_inplace_bit_and_member(Value value, Value base, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_bit_or_member(Value value, Value base, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_bit_xor_member(Value value, Value base, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_add_member(Value value, Value base, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_sub_member(Value value, Value base, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_mul_member(Value value, Value base, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_div_member(Value value, Value base, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_mod_member(Value value, Value base, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_shl_member(Value value, Value base, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_shr_member(Value value, Value base, String *name, ExecutionContext *ctx);
-void __qmljs_inplace_ushr_member(Value value, Value base, String *name, ExecutionContext *ctx);
+
+typedef void (*InplaceBinOpName)(ExecutionContext *ctx, String *name, const Value *value);
+void __qmljs_inplace_bit_and_name(ExecutionContext *ctx, String *name, const Value *value);
+void __qmljs_inplace_bit_or_name(ExecutionContext *ctx, String *name, const Value *value);
+void __qmljs_inplace_bit_xor_name(ExecutionContext *ctx, String *name, const Value *value);
+void __qmljs_inplace_add_name(ExecutionContext *ctx, String *name, const Value *value);
+void __qmljs_inplace_sub_name(ExecutionContext *ctx, String *name, const Value *value);
+void __qmljs_inplace_mul_name(ExecutionContext *ctx, String *name, const Value *value);
+void __qmljs_inplace_div_name(ExecutionContext *ctx, String *name, const Value *value);
+void __qmljs_inplace_mod_name(ExecutionContext *ctx, String *name, const Value *value);
+void __qmljs_inplace_shl_name(ExecutionContext *ctx, String *name, const Value *value);
+void __qmljs_inplace_shr_name(ExecutionContext *ctx, String *name, const Value *value);
+void __qmljs_inplace_ushr_name(ExecutionContext *ctx, String *name, const Value *value);
+
+typedef void (*InplaceBinOpElement)(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs);
+void __qmljs_inplace_bit_and_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs);
+void __qmljs_inplace_bit_or_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs);
+void __qmljs_inplace_bit_xor_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs);
+void __qmljs_inplace_add_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs);
+void __qmljs_inplace_sub_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs);
+void __qmljs_inplace_mul_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs);
+void __qmljs_inplace_div_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs);
+void __qmljs_inplace_mod_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs);
+void __qmljs_inplace_shl_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs);
+void __qmljs_inplace_shr_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs);
+void __qmljs_inplace_ushr_element(ExecutionContext *ctx, const Value *base, const Value *index, const Value *rhs);
+
+typedef void (*InplaceBinOpMember)(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs);
+void __qmljs_inplace_bit_and_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs);
+void __qmljs_inplace_bit_or_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs);
+void __qmljs_inplace_bit_xor_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs);
+void __qmljs_inplace_add_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs);
+void __qmljs_inplace_sub_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs);
+void __qmljs_inplace_mul_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs);
+void __qmljs_inplace_div_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs);
+void __qmljs_inplace_mod_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs);
+void __qmljs_inplace_shl_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs);
+void __qmljs_inplace_shr_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs);
+void __qmljs_inplace_ushr_member(ExecutionContext *ctx, const Value *base, String *name, const Value *rhs);
Bool __qmljs_cmp_gt(Value left, Value right, ExecutionContext *ctx);
Bool __qmljs_cmp_lt(Value left, Value right, ExecutionContext *ctx);
}
}
-void InstructionSelection::inplaceNameOp(IR::AluOp oper, IR::Expr *sourceExpr, const QString &targetName)
+void InstructionSelection::inplaceNameOp(IR::AluOp oper, IR::Temp *rightSource, const QString &targetName)
{
const char *opName = 0;
switch (oper) {
if (opName) {
llvm::Value *dst = getIdentifier(targetName);
- llvm::Value *src = toValuePtr(sourceExpr);
+ llvm::Value *src = toValuePtr(rightSource);
CreateCall3(getRuntimeFunction(opName),
_llvmFunction->arg_begin(), dst, src);
return;
}
}
-void InstructionSelection::inplaceElementOp(IR::AluOp oper, IR::Expr *sourceExpr, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp)
+void InstructionSelection::inplaceElementOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp)
{
const char *opName = 0;
switch (oper) {
if (opName) {
llvm::Value *base = getLLVMTemp(targetBaseTemp);
llvm::Value *index = getLLVMTemp(targetIndexTemp);
- llvm::Value *value = toValuePtr(sourceExpr);
+ llvm::Value *value = toValuePtr(source);
CreateCall4(getRuntimeFunction(opName),
_llvmFunction->arg_begin(), base, index, value);
}
}
-void InstructionSelection::inplaceMemberOp(IR::AluOp oper, IR::Expr *source, IR::Temp *targetBase, const QString &targetName)
+void InstructionSelection::inplaceMemberOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBase, const QString &targetName)
{
const char *opName = 0;
switch (oper) {
virtual void copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp);
virtual void unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *targetTemp);
virtual void binop(IR::AluOp oper, IR::Temp *leftSource, IR::Temp *rightSource, IR::Temp *target);
- virtual void inplaceNameOp(IR::AluOp oper, IR::Expr *sourceExpr, const QString &targetName);
- virtual void inplaceElementOp(IR::AluOp oper, IR::Expr *sourceExpr, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp);
- virtual void inplaceMemberOp(IR::AluOp oper, IR::Expr *source, IR::Temp *targetBase, const QString &targetName);
+ virtual void inplaceNameOp(IR::AluOp oper, IR::Temp *rightSource, const QString &targetName);
+ virtual void inplaceElementOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp);
+ virtual void inplaceMemberOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBase, const QString &targetName);
public: // visitor methods for StmtVisitor:
virtual void visitJump(IR::Jump *);
_as->generateBinOp(oper, target, leftSource, rightSource);
}
-void InstructionSelection::inplaceNameOp(IR::AluOp oper, IR::Expr *sourceExpr, const QString &targetName)
+void InstructionSelection::inplaceNameOp(IR::AluOp oper, IR::Temp *rightSource, const QString &targetName)
{
- void (*op)(const Value value, String *name, ExecutionContext *ctx) = 0;
+ VM::InplaceBinOpName op = 0;
const char *opName = 0;
switch (oper) {
case IR::OpBitAnd: setOp(op, opName, __qmljs_inplace_bit_and_name); break;
break;
}
if (op) {
- _as->generateFunctionCallImp(Assembler::Void, opName, op, sourceExpr, identifier(targetName), Assembler::ContextRegister);
+ _as->generateFunctionCallImp(Assembler::Void, opName, op, Assembler::ContextRegister, identifier(targetName), Assembler::PointerToValue(rightSource));
}
}
-void InstructionSelection::inplaceElementOp(IR::AluOp oper, IR::Expr *sourceExpr, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp)
+void InstructionSelection::inplaceElementOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp)
{
- void (*op)(Value base, Value index, Value value, ExecutionContext *ctx) = 0;
+ VM::InplaceBinOpElement op = 0;
const char *opName = 0;
switch (oper) {
case IR::OpBitAnd: setOp(op, opName, __qmljs_inplace_bit_and_element); break;
}
if (op) {
- _as->generateFunctionCallImp(Assembler::Void, opName, op, targetBaseTemp, targetIndexTemp, sourceExpr, Assembler::ContextRegister);
+ _as->generateFunctionCallImp(Assembler::Void, opName, op, Assembler::ContextRegister,
+ Assembler::PointerToValue(targetBaseTemp), Assembler::PointerToValue(targetIndexTemp),
+ Assembler::PointerToValue(source));
}
}
-void InstructionSelection::inplaceMemberOp(IR::AluOp oper, IR::Expr *source, IR::Temp *targetBase, const QString &targetName)
+void InstructionSelection::inplaceMemberOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBase, const QString &targetName)
{
- void (*op)(Value value, Value base, String *name, ExecutionContext *ctx) = 0;
+ VM::InplaceBinOpMember op = 0;
const char *opName = 0;
switch (oper) {
case IR::OpBitAnd: setOp(op, opName, __qmljs_inplace_bit_and_member); break;
if (op) {
String* member = identifier(targetName);
- _as->generateFunctionCallImp(Assembler::Void, opName, op, source, targetBase, member, Assembler::ContextRegister);
+ _as->generateFunctionCallImp(Assembler::Void, opName, op, Assembler::ContextRegister,
+ Assembler::PointerToValue(targetBase), identifier(targetName),
+ Assembler::PointerToValue(source));
}
}
virtual void copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp);
virtual void unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *targetTemp);
virtual void binop(IR::AluOp oper, IR::Temp *leftSource, IR::Temp *rightSource, IR::Temp *target);
- virtual void inplaceNameOp(IR::AluOp oper, IR::Expr *sourceExpr, const QString &targetName);
- virtual void inplaceElementOp(IR::AluOp oper, IR::Expr *sourceExpr, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp);
- virtual void inplaceMemberOp(IR::AluOp oper, IR::Expr *source, IR::Temp *targetBase, const QString &targetName);
+ virtual void inplaceNameOp(IR::AluOp oper, IR::Temp *rightSource, const QString &targetName);
+ virtual void inplaceElementOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp);
+ virtual void inplaceMemberOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBase, const QString &targetName);
typedef Assembler::Address Address;
typedef Assembler::Pointer Pointer;
return;
}
} else if (IR::Name *n = s->target->asName()) {
- if (s->source->asTemp() || s->source->asConst()) {
- inplaceNameOp(s->op, s->source, *n->id);
+ if (s->source->asTemp()) {
+ inplaceNameOp(s->op, s->source->asTemp(), *n->id);
return;
}
} else if (IR::Subscript *ss = s->target->asSubscript()) {
- if (s->source->asTemp() || s->source->asConst()) {
- inplaceElementOp(s->op, s->source, ss->base->asTemp(),
+ if (s->source->asTemp()) {
+ inplaceElementOp(s->op, s->source->asTemp(), ss->base->asTemp(),
ss->index->asTemp());
return;
}
} else if (IR::Member *m = s->target->asMember()) {
- if (s->source->asTemp() || s->source->asConst()) {
- inplaceMemberOp(s->op, s->source, m->base->asTemp(), *m->name);
+ if (s->source->asTemp()) {
+ inplaceMemberOp(s->op, s->source->asTemp(), m->base->asTemp(), *m->name);
return;
}
}
virtual void copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp) = 0;
virtual void unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *targetTemp) = 0;
virtual void binop(IR::AluOp oper, IR::Temp *leftSource, IR::Temp *rightSource, IR::Temp *target) = 0;
- virtual void inplaceNameOp(IR::AluOp oper, IR::Expr *sourceExpr, const QString &targetName) = 0;
- virtual void inplaceElementOp(IR::AluOp oper, IR::Expr *sourceExpr, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp) = 0;
- virtual void inplaceMemberOp(IR::AluOp oper, IR::Expr *source, IR::Temp *targetBase, const QString &targetName) = 0;
+ virtual void inplaceNameOp(IR::AluOp oper, IR::Temp *rightSource, const QString &targetName) = 0;
+ virtual void inplaceElementOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp) = 0;
+ virtual void inplaceMemberOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBase, const QString &targetName) = 0;
private:
void callBuiltin(IR::Call *c, IR::Temp *temp);
}
-void Object::inplaceBinOp(Value rhs, String *name, BinOp op, ExecutionContext *ctx)
+void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, String *name, const Value *rhs)
{
bool hasProperty = false;
Value v = __get__(ctx, name, &hasProperty);
Value result;
- op(ctx, &result, &v, &rhs);
+ op(ctx, &result, &v, rhs);
__put__(ctx, name, result);
}
-void Object::inplaceBinOp(Value rhs, Value index, BinOp op, ExecutionContext *ctx)
+void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, const Value *index, const Value *rhs)
{
- uint idx = index.asArrayIndex();
+ uint idx = index->asArrayIndex();
if (idx < UINT_MAX) {
bool hasProperty = false;
Value v = __get__(ctx, idx, &hasProperty);
Value result;
- op(ctx, &result, &v, &rhs);
+ op(ctx, &result, &v, rhs);
__put__(ctx, idx, result);
return;
}
- String *name = index.toString(ctx);
+ String *name = index->toString(ctx);
assert(name);
- inplaceBinOp(rhs, name, op, ctx);
+ inplaceBinOp(ctx, op, name, rhs);
}
void Object::defineDefaultProperty(String *name, Value value)
void putValue(ExecutionContext *ctx, PropertyDescriptor *pd, Value value);
- void inplaceBinOp(Value rhs, String *name, BinOp op, ExecutionContext *ctx);
- void inplaceBinOp(Value rhs, Value index, BinOp op, ExecutionContext *ctx);
+ void inplaceBinOp(ExecutionContext *ctx, BinOp op, String *name, const Value *rhs);
+ void inplaceBinOp(ExecutionContext *ctx, BinOp op, const Value *index, const Value *rhs);
/* The spec default: Writable: true, Enumerable: false, Configurable: true */
void defineDefaultProperty(String *name, Value value);