Convert inplace binops to pointer based calling convention
authorLars Knoll <lars.knoll@digia.com>
Wed, 13 Feb 2013 20:14:17 +0000 (21:14 +0100)
committerSimon Hausmann <simon.hausmann@digia.com>
Thu, 14 Feb 2013 06:03:53 +0000 (07:03 +0100)
Change-Id: Ie39fb9160573c79ea765466fc9750e2f50b52ab3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
17 files changed:
src/v4/llvm_runtime.cpp
src/v4/moth/qv4instr_moth_p.h
src/v4/moth/qv4isel_moth.cpp
src/v4/moth/qv4isel_moth_p.h
src/v4/moth/qv4vme_moth.cpp
src/v4/qmljs_environment.cpp
src/v4/qmljs_environment.h
src/v4/qmljs_runtime.cpp
src/v4/qmljs_runtime.h
src/v4/qv4isel_llvm.cpp
src/v4/qv4isel_llvm_p.h
src/v4/qv4isel_masm.cpp
src/v4/qv4isel_masm_p.h
src/v4/qv4isel_p.cpp
src/v4/qv4isel_p.h
src/v4/qv4object.cpp
src/v4/qv4object.h

index 635d9c0..3009da6 100644 (file)
@@ -230,167 +230,167 @@ void __qmljs_llvm_not(ExecutionContext *ctx, Value *result, const Value *value)
 
 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)
index 9c85228..f600ae8 100644 (file)
@@ -417,21 +417,21 @@ union Instr
     };
     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;
     };
index d4ff709..c0c282b 100644 (file)
@@ -515,9 +515,9 @@ void InstructionSelection::binop(IR::AluOp oper, IR::Temp *leftSource, IR::Temp
     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;
@@ -537,14 +537,14 @@ void InstructionSelection::inplaceNameOp(IR::AluOp oper, IR::Expr *sourceExpr, c
         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;
@@ -564,13 +564,13 @@ void InstructionSelection::inplaceElementOp(IR::AluOp oper, IR::Expr *sourceExpr
     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;
index 89d7a5b..8a859d1 100644 (file)
@@ -75,9 +75,9 @@ protected:
     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 {
index 05e30a6..880f2f3 100644 (file)
@@ -424,24 +424,22 @@ VM::Value VME::operator()(QQmlJS::VM::ExecutionContext *context, const uchar *co
     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
index 1b1a753..1d61a1b 100644 (file)
@@ -503,11 +503,11 @@ Value ExecutionContext::getPropertyAndBase(String *name, Object **base)
 
 
 
-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);
 }
 
index f118c63..a3af53a 100644 (file)
@@ -134,7 +134,7 @@ struct ExecutionContext
     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)
index c995e4e..200388f 100644 (file)
@@ -253,191 +253,191 @@ void __qmljs_in(ExecutionContext *ctx, Value *result, const Value *left, const V
     *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)
index 70ac132..f47c6e6 100644 (file)
@@ -245,41 +245,45 @@ void __qmljs_sne(ExecutionContext *ctx, Value *result, const Value *left, const
 
 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);
index 744f500..26411d8 100644 (file)
@@ -714,7 +714,7 @@ void InstructionSelection::binop(IR::AluOp oper, IR::Temp *leftSource, IR::Temp
     }
 }
 
-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) {
@@ -736,14 +736,14 @@ void InstructionSelection::inplaceNameOp(IR::AluOp oper, IR::Expr *sourceExpr, c
 
     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) {
@@ -766,13 +766,13 @@ void InstructionSelection::inplaceElementOp(IR::AluOp oper, IR::Expr *sourceExpr
     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) {
index 36b1c21..3f6dc47 100644 (file)
@@ -119,9 +119,9 @@ public: // methods from InstructionSelection:
     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 *);
index 7de1b08..1378b3d 100644 (file)
@@ -754,9 +754,9 @@ void InstructionSelection::binop(IR::AluOp oper, IR::Temp *leftSource, IR::Temp
     _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;
@@ -775,13 +775,13 @@ void InstructionSelection::inplaceNameOp(IR::AluOp oper, IR::Expr *sourceExpr, c
         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;
@@ -801,13 +801,15 @@ void InstructionSelection::inplaceElementOp(IR::AluOp oper, IR::Expr *sourceExpr
     }
 
     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;
@@ -828,7 +830,9 @@ void InstructionSelection::inplaceMemberOp(IR::AluOp oper, IR::Expr *source, IR:
 
     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));
     }
 }
 
index fb075cd..75b5deb 100644 (file)
@@ -718,9 +718,9 @@ protected:
     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;
index 8c79c32..eed2d0b 100644 (file)
@@ -164,19 +164,19 @@ void InstructionSelection::visitMove(IR::Move *s)
                 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;
             }
         }
index 9e55a97..d41bd78 100644 (file)
@@ -135,9 +135,9 @@ public: // to implement by subclasses:
     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);
index e28a5fb..0081aea 100644 (file)
@@ -137,29 +137,29 @@ void Object::putValue(ExecutionContext *ctx, PropertyDescriptor *pd, Value value
 
 }
 
-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)
index 6991a39..9bb43cd 100644 (file)
@@ -150,8 +150,8 @@ struct Q_V4_EXPORT Object: Managed {
 
     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);