Revision: 15938
Author:   [email protected]
Date:     Mon Jul 29 10:07:28 2013
Log:      Smi-support for HSar.

BUG=
[email protected]

Review URL: https://chromiumcodereview.appspot.com/21049003
http://code.google.com/p/v8/source/detail?r=15938

Modified:
 /branches/bleeding_edge/src/arm/lithium-arm.cc
 /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
 /branches/bleeding_edge/src/hydrogen-instructions.h
 /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.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      Mon Jul 29 06:56:51 2013
+++ /branches/bleeding_edge/src/arm/lithium-arm.cc      Mon Jul 29 10:07:28 2013
@@ -733,7 +733,9 @@
     constant_value = constant->Integer32Value() & 0x1f;
// Left shifts can deoptimize if we shift by > 0 and the result cannot be
     // truncated to smi.
-    if (instr->representation().IsSmi() && constant_value > 0) {
+    if (instr->representation().IsSmi() &&
+        op == Token::SHL &&
+        constant_value > 0) {
       for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
         if (!it.value()->CheckFlag(HValue::kTruncatingToSmi)) {
           does_deopt = true;
@@ -752,7 +754,8 @@
       does_deopt = !instr->CheckFlag(HInstruction::kUint32);
     } else {
       for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
-        if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) {
+        if (!it.value()->CheckFlag(HValue::kTruncatingToInt32) &&
+            !it.value()->CheckFlag(HValue::kTruncatingToSmi)) {
           does_deopt = true;
           break;
         }
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon Jul 29 06:56:51 2013 +++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon Jul 29 10:07:28 2013
@@ -1725,6 +1725,9 @@
       case Token::SAR:
         if (shift_count != 0) {
           __ mov(result, Operand(left, ASR, shift_count));
+          if (instr->hydrogen_value()->representation().IsSmi()) {
+            __ and_(result, result, Operand(~kSmiTagMask));
+          }
         } else {
           __ Move(result, left);
         }
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Mon Jul 29 06:56:51 2013 +++ /branches/bleeding_edge/src/hydrogen-instructions.h Mon Jul 29 10:07:28 2013
@@ -4964,7 +4964,9 @@
   virtual void UpdateRepresentation(Representation new_rep,
                                     HInferRepresentationPhase* h_infer,
                                     const char* reason) {
-    if (new_rep.IsSmi()) new_rep = Representation::Integer32();
+    if (new_rep.IsSmi() && !right()->IsConstant()) {
+      new_rep = Representation::Integer32();
+    }
HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason);
   }

=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Mon Jul 29 06:56:51 2013 +++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Mon Jul 29 10:07:28 2013
@@ -1757,6 +1757,9 @@
       case Token::SAR:
         if (shift_count != 0) {
           __ sar(ToRegister(left), shift_count);
+          if (instr->hydrogen_value()->representation().IsSmi()) {
+            __ and_(ToRegister(left), ~kSmiTagMask);
+          }
         }
         break;
       case Token::SHR:
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Mon Jul 29 06:56:51 2013 +++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Mon Jul 29 10:07:28 2013
@@ -787,7 +787,9 @@
     constant_value = constant->Integer32Value() & 0x1f;
// Left shifts can deoptimize if we shift by > 0 and the result cannot be
     // truncated to smi.
-    if (instr->representation().IsSmi() && constant_value > 0) {
+    if (instr->representation().IsSmi() &&
+        op == Token::SHL &&
+        constant_value > 0) {
       for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
         if (!it.value()->CheckFlag(HValue::kTruncatingToSmi)) {
           does_deopt = true;
@@ -806,7 +808,8 @@
       does_deopt = !instr->CheckFlag(HInstruction::kUint32);
     } else {
       for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
-        if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) {
+        if (!it.value()->CheckFlag(HValue::kTruncatingToInt32) &&
+            !it.value()->CheckFlag(HValue::kTruncatingToSmi)) {
           does_deopt = true;
           break;
         }
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc      Mon Jul 29 06:56:51 2013
+++ /branches/bleeding_edge/src/x64/lithium-x64.cc      Mon Jul 29 10:07:28 2013
@@ -751,7 +751,8 @@
       does_deopt = !instr->CheckFlag(HInstruction::kUint32);
     } else {
       for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
-        if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) {
+        if (!it.value()->CheckFlag(HValue::kTruncatingToInt32) &&
+            !it.value()->CheckFlag(HValue::kTruncatingToSmi)) {
           does_deopt = true;
           break;
         }

--
--
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