Revision: 14816
Author:   [email protected]
Date:     Mon May 27 02:58:46 2013
Log: Remove HCheckSmi, LCheckSmi and rename LCheckSmiAndReturn to LCheckSmi.

[email protected]

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

Modified:
 /branches/bleeding_edge/src/arm/lithium-arm.cc
 /branches/bleeding_edge/src/arm/lithium-arm.h
 /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
 /branches/bleeding_edge/src/code-stubs-hydrogen.cc
 /branches/bleeding_edge/src/hydrogen-instructions.cc
 /branches/bleeding_edge/src/hydrogen-instructions.h
 /branches/bleeding_edge/src/hydrogen.cc
 /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
 /branches/bleeding_edge/src/ia32/lithium-ia32.cc
 /branches/bleeding_edge/src/ia32/lithium-ia32.h
 /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
 /branches/bleeding_edge/src/x64/lithium-x64.cc
 /branches/bleeding_edge/src/x64/lithium-x64.h

=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc      Fri May 24 06:40:02 2013
+++ /branches/bleeding_edge/src/arm/lithium-arm.cc      Mon May 27 02:58:46 2013
@@ -1905,8 +1905,7 @@
       if (val->type().IsSmi()) {
         return DefineSameAsFirst(new(zone()) LDummyUse(value));
       }
-      return AssignEnvironment(
-          DefineSameAsFirst(new(zone()) LCheckSmiAndReturn(value)));
+ return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value)));
     } else {
       ASSERT(to.IsInteger32());
       LOperand* value = NULL;
@@ -2011,12 +2010,6 @@
LCheckPrototypeMaps* result = new(zone()) LCheckPrototypeMaps(temp1, temp2);
   return AssignEnvironment(result);
 }
-
-
-LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
-  LOperand* value = UseRegisterAtStart(instr->value());
-  return AssignEnvironment(new(zone()) LCheckSmi(value));
-}


 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.h       Fri May 24 06:40:02 2013
+++ /branches/bleeding_edge/src/arm/lithium-arm.h       Mon May 27 02:58:46 2013
@@ -76,7 +76,6 @@
   V(CheckMaps)                                  \
   V(CheckPrototypeMaps)                         \
   V(CheckSmi)                                   \
-  V(CheckSmiAndReturn)                          \
   V(ClampDToUint8)                              \
   V(ClampIToUint8)                              \
   V(ClampTToUint8)                              \
@@ -2384,7 +2383,7 @@
 };


-class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
+class LCheckSmi: public LTemplateInstruction<1, 1, 0> {
  public:
   explicit LCheckSmi(LOperand* value) {
     inputs_[0] = value;
@@ -2396,18 +2395,6 @@
 };


-class LCheckSmiAndReturn: public LTemplateInstruction<1, 1, 0> {
- public:
-  explicit LCheckSmiAndReturn(LOperand* value) {
-    inputs_[0] = value;
-  }
-
-  LOperand* value() { return inputs_[0]; }
-
-  DECLARE_CONCRETE_INSTRUCTION(CheckSmiAndReturn, "check-smi-and-return")
-};
-
-
 class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
  public:
   explicit LCheckNonSmi(LOperand* value) {
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon May 27 01:43:58 2013 +++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon May 27 02:58:46 2013
@@ -5213,13 +5213,6 @@
   __ SmiTag(result_reg, SetCC);
   DeoptimizeIf(vs, instr->environment());
 }
-
-
-void LCodeGen::DoCheckSmiAndReturn(LCheckSmiAndReturn* instr) {
-  LOperand* input = instr->value();
-  __ SmiTst(ToRegister(input));
-  DeoptimizeIf(ne, instr->environment());
-}


 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
=======================================
--- /branches/bleeding_edge/src/code-stubs-hydrogen.cc Mon May 27 01:50:52 2013 +++ /branches/bleeding_edge/src/code-stubs-hydrogen.cc Mon May 27 02:58:46 2013
@@ -639,11 +639,6 @@
       new(zone()) HArgumentsElements(false));
   HInstruction* argument = AddInstruction(new(zone()) HAccessArgumentsAt(
       argument_elements, length, key));
-
-  // Checks to prevent incompatible stores
-  if (IsFastSmiElementsKind(kind)) {
-    AddInstruction(new(zone()) HCheckSmi(argument));
-  }

   AddInstruction(new(zone()) HStoreKeyed(elements, key, argument, kind));
   builder.EndBody();
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Mon May 27 01:43:58 2013 +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Mon May 27 02:58:46 2013
@@ -2947,11 +2947,6 @@
   // TODO(kasperl): Is there any way to signal that this isn't a smi?
   return HType::Tagged();
 }
-
-
-HType HCheckSmi::CalculateInferredType() {
-  return HType::Smi();
-}


 HType HPhi::CalculateInferredType() {
@@ -3649,12 +3644,6 @@
   HInstruction::Verify();
   ASSERT(HasAstId());
 }
-
-
-void HCheckSmi::Verify() {
-  HInstruction::Verify();
-  ASSERT(HasNoUses());
-}


 void HCheckNonSmi::Verify() {
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Mon May 27 01:43:58 2013 +++ /branches/bleeding_edge/src/hydrogen-instructions.h Mon May 27 02:58:46 2013
@@ -92,7 +92,6 @@
   V(CheckMaps)                                 \
   V(CheckNonSmi)                               \
   V(CheckPrototypeMaps)                        \
-  V(CheckSmi)                                  \
   V(ClampToUint8)                              \
   V(ClassOfTestAndBranch)                      \
   V(CompareIDAndBranch)                        \
@@ -1714,7 +1713,8 @@
           bool is_truncating,
           bool deoptimize_on_undefined)
       : HUnaryOperation(value) {
-    ASSERT(!value->representation().IsNone() && !to.IsNone());
+    ASSERT(!value->representation().IsNone());
+    ASSERT(!to.IsNone());
     ASSERT(!value->representation().Equals(to));
     set_representation(to);
     SetFlag(kUseGVN);
@@ -2928,29 +2928,6 @@
 };


-class HCheckSmi: public HUnaryOperation {
- public:
-  explicit HCheckSmi(HValue* value) : HUnaryOperation(value) {
-    set_representation(Representation::Tagged());
-    SetFlag(kUseGVN);
-  }
-
-  virtual Representation RequiredInputRepresentation(int index) {
-    return Representation::Tagged();
-  }
-  virtual HType CalculateInferredType();
-
-#ifdef DEBUG
-  virtual void Verify();
-#endif
-
-  DECLARE_CONCRETE_INSTRUCTION(CheckSmi)
-
- protected:
-  virtual bool DataEquals(HValue* other) { return true; }
-};
-
-
 class HPhi: public HValue {
  public:
   HPhi(int merged_index, Zone* zone)
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Mon May 27 01:50:52 2013
+++ /branches/bleeding_edge/src/hydrogen.cc     Mon May 27 02:58:46 2013
@@ -1098,11 +1098,6 @@
     switch (elements_kind) {
       case FAST_SMI_ELEMENTS:
       case FAST_HOLEY_SMI_ELEMENTS:
-        if (!val->type().IsSmi()) {
-          // Smi-only arrays need a smi check.
-          AddInstruction(new(zone) HCheckSmi(val));
-        }
-        // Fall through.
       case FAST_ELEMENTS:
       case FAST_HOLEY_ELEMENTS:
       case FAST_DOUBLE_ELEMENTS:
@@ -1289,14 +1284,17 @@
          fast_elements ||
          IsFastDoubleElementsKind(elements_kind));

+ // In case val is stored into a fast smi array, assure that the value is a smi
+  // before manipulating the backing store. Otherwise the actual store may
+  // deopt, leaving the backing store in an invalid state.
   if (is_store && IsFastSmiElementsKind(elements_kind) &&
       !val->type().IsSmi()) {
-    AddInstruction(new(zone) HCheckSmi(val));
+    val = AddInstruction(new(zone) HForceRepresentation(
+        val, Representation::Smi()));
   }

   if (IsGrowStoreMode(store_mode)) {
     NoObservableSideEffectsScope no_effects(this);
-
     elements = BuildCheckForCapacityGrow(object, elements, elements_kind,
                                          length, key, is_js_array);
     checked_key = key;
@@ -6937,11 +6935,6 @@
     switch (boilerplate_elements_kind) {
       case FAST_SMI_ELEMENTS:
       case FAST_HOLEY_SMI_ELEMENTS:
-        if (!value->type().IsSmi()) {
-          // Smi-only arrays need a smi check.
-          AddInstruction(new(zone()) HCheckSmi(value));
-          // Fall through.
-        }
       case FAST_ELEMENTS:
       case FAST_HOLEY_ELEMENTS:
       case FAST_DOUBLE_ELEMENTS:
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Mon May 27 01:43:58 2013 +++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Mon May 27 02:58:46 2013
@@ -5685,13 +5685,6 @@
   __ SmiTag(result_reg);
   DeoptimizeIf(overflow, instr->environment());
 }
-
-
-void LCodeGen::DoCheckSmiAndReturn(LCheckSmiAndReturn* instr) {
-  LOperand* input = instr->value();
-  __ test(ToOperand(input), Immediate(kSmiTagMask));
-  DeoptimizeIf(not_zero, instr->environment());
-}


 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Fri May 24 06:40:02 2013 +++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Mon May 27 02:58:46 2013
@@ -1936,8 +1936,7 @@
       if (val->type().IsSmi()) {
         return DefineSameAsFirst(new(zone()) LDummyUse(value));
       }
-      return AssignEnvironment(
-          DefineSameAsFirst(new(zone()) LCheckSmiAndReturn(value)));
+ return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value)));
     } else {
       ASSERT(to.IsInteger32());
       if (instr->value()->type().IsSmi()) {
@@ -2047,12 +2046,6 @@
   LCheckPrototypeMaps* result = new(zone()) LCheckPrototypeMaps(temp);
   return AssignEnvironment(result);
 }
-
-
-LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
-  LOperand* value = UseAtStart(instr->value());
-  return AssignEnvironment(new(zone()) LCheckSmi(value));
-}


 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.h     Fri May 24 06:40:02 2013
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.h     Mon May 27 02:58:46 2013
@@ -70,7 +70,6 @@
   V(CheckNonSmi)                                \
   V(CheckPrototypeMaps)                         \
   V(CheckSmi)                                   \
-  V(CheckSmiAndReturn)                          \
   V(ClampDToUint8)                              \
   V(ClampIToUint8)                              \
   V(ClampTToUint8)                              \
@@ -2458,7 +2457,7 @@
 };


-class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
+class LCheckSmi: public LTemplateInstruction<1, 1, 0> {
  public:
   explicit LCheckSmi(LOperand* value) {
     inputs_[0] = value;
@@ -2470,18 +2469,6 @@
 };


-class LCheckSmiAndReturn: public LTemplateInstruction<1, 1, 0> {
- public:
-  explicit LCheckSmiAndReturn(LOperand* value) {
-    inputs_[0] = value;
-  }
-
-  LOperand* value() { return inputs_[0]; }
-
-  DECLARE_CONCRETE_INSTRUCTION(CheckSmiAndReturn, "check-smi-and-return")
-};
-
-
 class LClampDToUint8: public LTemplateInstruction<1, 1, 0> {
  public:
   explicit LClampDToUint8(LOperand* value) {
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Mon May 27 01:43:58 2013 +++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Mon May 27 02:58:46 2013
@@ -4901,13 +4901,6 @@
   __ Integer32ToSmi(result_reg, result_reg);
   DeoptimizeIf(overflow, instr->environment());
 }
-
-
-void LCodeGen::DoCheckSmiAndReturn(LCheckSmiAndReturn* instr) {
-  LOperand* input = instr->value();
-  Condition cc = masm()->CheckSmi(ToRegister(input));
-  DeoptimizeIf(NegateCondition(cc), instr->environment());
-}


 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc      Fri May 24 06:40:02 2013
+++ /branches/bleeding_edge/src/x64/lithium-x64.cc      Mon May 27 02:58:46 2013
@@ -1833,8 +1833,7 @@
       if (val->type().IsSmi()) {
         return DefineSameAsFirst(new(zone()) LDummyUse(value));
       }
-      return AssignEnvironment(
-          DefineSameAsFirst(new(zone()) LCheckSmiAndReturn(value)));
+ return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value)));
     } else {
       ASSERT(to.IsInteger32());
       LOperand* value = UseRegister(instr->value());
@@ -1926,12 +1925,6 @@
   LCheckPrototypeMaps* result = new(zone()) LCheckPrototypeMaps(temp);
   return AssignEnvironment(result);
 }
-
-
-LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
-  LOperand* value = UseRegisterAtStart(instr->value());
-  return AssignEnvironment(new(zone()) LCheckSmi(value));
-}


 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.h       Fri May 24 06:40:02 2013
+++ /branches/bleeding_edge/src/x64/lithium-x64.h       Mon May 27 02:58:46 2013
@@ -76,7 +76,6 @@
   V(CheckNonSmi)                                \
   V(CheckPrototypeMaps)                         \
   V(CheckSmi)                                   \
-  V(CheckSmiAndReturn)                          \
   V(ClampDToUint8)                              \
   V(ClampIToUint8)                              \
   V(ClampTToUint8)                              \
@@ -2291,7 +2290,7 @@
 };


-class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
+class LCheckSmi: public LTemplateInstruction<1, 1, 0> {
  public:
   explicit LCheckSmi(LOperand* value) {
     inputs_[0] = value;
@@ -2303,18 +2302,6 @@
 };


-class LCheckSmiAndReturn: public LTemplateInstruction<1, 1, 0> {
- public:
-  explicit LCheckSmiAndReturn(LOperand* value) {
-    inputs_[0] = value;
-  }
-
-  LOperand* value() { return inputs_[0]; }
-
-  DECLARE_CONCRETE_INSTRUCTION(CheckSmiAndReturn, "check-smi-and-return")
-};
-
-
 class LClampDToUint8: public LTemplateInstruction<1, 1, 0> {
  public:
   explicit LClampDToUint8(LOperand* unclamped) {

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