Slightly simplify generated code for conversion to int
authorLars Knoll <lars.knoll@digia.com>
Fri, 7 Feb 2014 21:03:57 +0000 (22:03 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Sat, 22 Feb 2014 09:11:45 +0000 (10:11 +0100)
Take only one branch for integers, and save one instruction in
total.

Change-Id: I496f11fb3f080f71e9f415ebb4201228c63471b8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
src/qml/compiler/qv4isel_masm.cpp

index af4439f..c786a5c 100644 (file)
@@ -1576,10 +1576,8 @@ void InstructionSelection::convertTypeToSInt32(V4IR::Temp *source, V4IR::Temp *t
 
         // check if it's a number
         _as->urshift64(Assembler::TrustedImm32(QV4::Value::IsNumber_Shift), Assembler::ScratchRegister);
+        Assembler::Jump isInt = _as->branch32(Assembler::Equal, Assembler::ScratchRegister, Assembler::TrustedImm32(1));
         Assembler::Jump fallback = _as->branch32(Assembler::Equal, Assembler::ScratchRegister, Assembler::TrustedImm32(0));
-        // we have a number
-        _as->urshift64(Assembler::TrustedImm32(1), Assembler::ScratchRegister);
-        Assembler::Jump isInt = _as->branch32(Assembler::Equal, Assembler::ScratchRegister, Assembler::TrustedImm32(0));
 
         // it's a double
         _as->move(Assembler::TrustedImm64(QV4::Value::NaNEncodeMask), Assembler::ScratchRegister);