diff options
author | Lars Knoll <lars.knoll@digia.com> | 2012-12-12 20:34:31 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-12-12 11:49:14 +0100 |
commit | 5cf108e7a530229f4c9fa2751ec0aac42924fea6 (patch) | |
tree | 3f017801f431315831dd21d9d0ee3ce87bb13a5b /qv4isel_masm.cpp | |
parent | 47b01bb7e5ac8812470d5840534aeaa2eb342164 (diff) |
Correctly handle negative 0
-0 and +0 are two distinct numbers. Since integers only
have one 0 value, we need to convert the number to double
when negating a 0
Change-Id: I915c4bd7168eece947fa91c6b65137a873d4f75a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'qv4isel_masm.cpp')
-rw-r--r-- | qv4isel_masm.cpp | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/qv4isel_masm.cpp b/qv4isel_masm.cpp index d107a6be0c..b3d7b781e3 100644 --- a/qv4isel_masm.cpp +++ b/qv4isel_masm.cpp @@ -634,30 +634,7 @@ void InstructionSelection::visitMove(IR::Move *s) return; } else if (IR::Const *c = s->source->asConst()) { Address dest = _asm->loadTempAddress(Assembler::ScratchRegister, t); - Value v; - switch (c->type) { - case IR::NullType: - v = Value::nullValue(); - break; - case IR::UndefinedType: - v = Value::undefinedValue(); - break; - case IR::BoolType: - v = Value::fromBoolean(c->value != 0); - break; - case IR::NumberType: { - int ival = (int)c->value; - if (ival == c->value) { - v = Value::fromInt32(ival); - } else { - v = Value::fromDouble(c->value); - } - } - break; - default: - Q_UNIMPLEMENTED(); - assert(!"TODO"); - } + Value v = convertToValue(c); _asm->storeValue(v, dest); return; } else if (IR::Temp *t2 = s->source->asTemp()) { |