void __qmljs_llvm_uplus(ExecutionContext *ctx, Value *result, const Value *value)
{
- *result = __qmljs_uplus(*value, ctx);
+ __qmljs_uplus(result, *value, ctx);
}
void __qmljs_llvm_uminus(ExecutionContext *ctx, Value *result, const Value *value)
{
- *result = __qmljs_uminus(*value, ctx);
+ __qmljs_uminus(result, *value, ctx);
}
void __qmljs_llvm_compl(ExecutionContext *ctx, Value *result, const Value *value)
{
- *result = __qmljs_compl(*value, ctx);
+ __qmljs_compl(result, *value, ctx);
}
void __qmljs_llvm_not(ExecutionContext *ctx, Value *result, const Value *value)
{
- *result = __qmljs_not(*value, ctx);
+ __qmljs_not(result, *value, ctx);
}
void __qmljs_llvm_inplace_bit_and_name(ExecutionContext *ctx, String *dest, Value *src)
o->__defineOwnProperty__(ctx, name, &pd);
}
-Value __qmljs_increment(const Value &value, ExecutionContext *ctx)
+void __qmljs_increment(Value *result, const Value &value, ExecutionContext *ctx)
{
TRACE1(value);
if (value.isInteger())
- return Value::fromInt32(value.integerValue() + 1);
-
- double d = __qmljs_to_number(value, ctx);
- return Value::fromDouble(d + 1);
+ *result = Value::fromInt32(value.integerValue() + 1);
+ else {
+ double d = __qmljs_to_number(value, ctx);
+ *result = Value::fromDouble(d + 1);
+ }
}
-Value __qmljs_decrement(const Value &value, ExecutionContext *ctx)
+void __qmljs_decrement(Value *result, const Value &value, ExecutionContext *ctx)
{
TRACE1(value);
if (value.isInteger())
- return Value::fromInt32(value.integerValue() - 1);
-
- double d = __qmljs_to_number(value, ctx);
- return Value::fromDouble(d - 1);
+ *result = Value::fromInt32(value.integerValue() - 1);
+ else {
+ double d = __qmljs_to_number(value, ctx);
+ *result = Value::fromDouble(d - 1);
+ }
}
} // extern "C"
Bool __qmljs_strict_equal(const Value &x, const Value &y);
// unary operators
-typedef Value (*UnaryOpName)(const Value &, ExecutionContext* ctx);
-Value __qmljs_uplus(const Value &value, ExecutionContext *ctx);
-Value __qmljs_uminus(const Value &value, ExecutionContext *ctx);
-Value __qmljs_compl(const Value &value, ExecutionContext *ctx);
-Value __qmljs_not(const Value &value, ExecutionContext *ctx);
-Value __qmljs_increment(const Value &value, ExecutionContext *ctx);
-Value __qmljs_decrement(const Value &value, ExecutionContext *ctx);
+typedef void (*UnaryOpName)(Value *, const Value &, ExecutionContext* ctx);
+void __qmljs_uplus(Value *result, const Value &value, ExecutionContext *ctx);
+void __qmljs_uminus(Value *result, const Value &value, ExecutionContext *ctx);
+void __qmljs_compl(Value *result, const Value &value, ExecutionContext *ctx);
+void __qmljs_not(Value *result, const Value &value, ExecutionContext *ctx);
+void __qmljs_increment(Value *result, const Value &value, ExecutionContext *ctx);
+void __qmljs_decrement(Value *result, const Value &value, ExecutionContext *ctx);
Value __qmljs_delete_subscript(ExecutionContext *ctx, const Value &base, Value index);
Value __qmljs_delete_member(ExecutionContext *ctx, const Value &base, String *name);
}
-inline Value __qmljs_uplus(const Value &value, ExecutionContext *ctx)
+inline void __qmljs_uplus(Value *result, const Value &value, ExecutionContext *ctx)
{
TRACE1(value);
- Value copy = value;
- if (copy.tryIntegerConversion())
- return copy;
+ *result = value;
+ if (result->tryIntegerConversion())
+ return;
double n = __qmljs_to_number(value, ctx);
- return Value::fromDouble(n);
+ *result = Value::fromDouble(n);
}
-inline Value __qmljs_uminus(const Value &value, ExecutionContext *ctx)
+inline void __qmljs_uminus(Value *result, const Value &value, ExecutionContext *ctx)
{
TRACE1(value);
// +0 != -0, so we need to convert to double when negating 0
if (value.isInteger() && value.integerValue())
- return Value::fromInt32(-value.integerValue());
- double n = __qmljs_to_number(value, ctx);
- return Value::fromDouble(-n);
+ *result = Value::fromInt32(-value.integerValue());
+ else {
+ double n = __qmljs_to_number(value, ctx);
+ *result = Value::fromDouble(-n);
+ }
}
-inline Value __qmljs_compl(const Value &value, ExecutionContext *ctx)
+inline void __qmljs_compl(Value *result, const Value &value, ExecutionContext *ctx)
{
TRACE1(value);
else
n = Value::toInt32(__qmljs_to_number(value, ctx));
- return Value::fromInt32(~n);
+ *result = Value::fromInt32(~n);
}
-inline Value __qmljs_not(const Value &value, ExecutionContext *ctx)
+inline void __qmljs_not(Value *result, const Value &value, ExecutionContext *ctx)
{
TRACE1(value);
bool b = __qmljs_to_boolean(value, ctx);
- return Value::fromBoolean(!b);
+ *result = Value::fromBoolean(!b);
}
// binary operators
void InstructionSelection::unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *targetTemp)
{
- Value (*op)(const Value& value, ExecutionContext *ctx) = 0;
+ VM::UnaryOpName op = 0;
const char *opName = 0;
switch (oper) {
case IR::OpIfTrue: assert(!"unreachable"); break;
} // switch
if (op)
- _as->generateFunctionCallImp(targetTemp, opName, op, Assembler::PointerToValue(sourceTemp),
+ _as->generateFunctionCallImp(Assembler::Void, opName, op, Assembler::PointerToValue(targetTemp), Assembler::PointerToValue(sourceTemp),
Assembler::ContextRegister);
}