Revision: 16362
Author:   [email protected]
Date:     Tue Aug 27 14:02:08 2013 UTC
Log:      Eliminate Smi check when changing from Smi to Integer32

BUG=
[email protected]

Review URL: https://chromiumcodereview.appspot.com/22824003

Patch from Weiliang Lin <[email protected]>.
http://code.google.com/p/v8/source/detail?r=16362

Modified:
 /branches/bleeding_edge/src/arm/lithium-arm.cc
 /branches/bleeding_edge/src/ia32/lithium-ia32.cc
 /branches/bleeding_edge/src/x64/lithium-x64.cc

=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc Tue Aug 27 11:55:08 2013 UTC +++ /branches/bleeding_edge/src/arm/lithium-arm.cc Tue Aug 27 14:02:08 2013 UTC
@@ -1925,11 +1925,12 @@
       ASSERT(to.IsInteger32());
       LOperand* value = NULL;
       LInstruction* res = NULL;
-      if (instr->value()->type().IsSmi()) {
-        value = UseRegisterAtStart(instr->value());
+      HValue* val = instr->value();
+      if (val->type().IsSmi() || val->representation().IsSmi()) {
+        value = UseRegisterAtStart(val);
         res = DefineAsRegister(new(zone()) LSmiUntag(value, false));
       } else {
-        value = UseRegister(instr->value());
+        value = UseRegister(val);
         LOperand* temp1 = TempRegister();
         LOperand* temp2 = FixedTemp(d11);
         res = DefineSameAsFirst(new(zone()) LTaggedToI(value,
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Tue Aug 27 11:55:08 2013 UTC +++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Tue Aug 27 14:02:08 2013 UTC
@@ -1945,13 +1945,14 @@
return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value)));
     } else {
       ASSERT(to.IsInteger32());
-      if (instr->value()->type().IsSmi()) {
-        LOperand* value = UseRegister(instr->value());
+      HValue* val = instr->value();
+      if (val->type().IsSmi() || val->representation().IsSmi()) {
+        LOperand* value = UseRegister(val);
         return DefineSameAsFirst(new(zone()) LSmiUntag(value, false));
       } else {
         bool truncating = instr->CanTruncateToInt32();
         if (CpuFeatures::IsSafeForSnapshot(SSE2)) {
-          LOperand* value = UseRegister(instr->value());
+          LOperand* value = UseRegister(val);
           LOperand* xmm_temp =
               (truncating && CpuFeatures::IsSupported(SSE3))
               ? NULL
@@ -1959,7 +1960,7 @@
           LTaggedToI* res = new(zone()) LTaggedToI(value, xmm_temp);
           return AssignEnvironment(DefineSameAsFirst(res));
         } else {
-          LOperand* value = UseFixed(instr->value(), ecx);
+          LOperand* value = UseFixed(val, ecx);
           LTaggedToINoSSE2* res =
               new(zone()) LTaggedToINoSSE2(value, TempRegister(),
                                            TempRegister(), TempRegister());
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc Tue Aug 27 11:55:08 2013 UTC +++ /branches/bleeding_edge/src/x64/lithium-x64.cc Tue Aug 27 14:02:08 2013 UTC
@@ -1843,8 +1843,9 @@
return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value)));
     } else {
       ASSERT(to.IsInteger32());
-      LOperand* value = UseRegister(instr->value());
-      if (instr->value()->type().IsSmi()) {
+      HValue* val = instr->value();
+      LOperand* value = UseRegister(val);
+      if (val->type().IsSmi() || val->representation().IsSmi()) {
         return DefineSameAsFirst(new(zone()) LSmiUntag(value, false));
       } else {
         bool truncating = instr->CanTruncateToInt32();

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to