Remove HCheckSmi, LCheckSmi and rename LCheckSmiAndReturn to LCheckSmi.

R=jkummerow@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14816 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
verwaest@chromium.org 2013-05-27 09:58:46 +00:00
parent 8fc2101ce0
commit a64b7f926f
13 changed files with 13 additions and 140 deletions

View File

@ -1905,8 +1905,7 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
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;
@ -2013,12 +2012,6 @@ LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) {
}
LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
LOperand* value = UseRegisterAtStart(instr->value());
return AssignEnvironment(new(zone()) LCheckSmi(value));
}
LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
LOperand* value = UseRegisterAtStart(instr->value());
return AssignEnvironment(new(zone()) LCheckFunction(value));

View File

@ -76,7 +76,6 @@ class LCodeGen;
V(CheckMaps) \
V(CheckPrototypeMaps) \
V(CheckSmi) \
V(CheckSmiAndReturn) \
V(ClampDToUint8) \
V(ClampIToUint8) \
V(ClampTToUint8) \
@ -2384,7 +2383,7 @@ class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> {
};
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 LCheckSmi: public LTemplateInstruction<0, 1, 0> {
};
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) {

View File

@ -5215,13 +5215,6 @@ void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) {
}
void LCodeGen::DoCheckSmiAndReturn(LCheckSmiAndReturn* instr) {
LOperand* input = instr->value();
__ SmiTst(ToRegister(input));
DeoptimizeIf(ne, instr->environment());
}
void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
LOperand* input = instr->value();
__ SmiTst(ToRegister(input));

View File

@ -640,11 +640,6 @@ HValue* CodeStubGraphBuilder<ArrayNArgumentsConstructorStub>::BuildCodeStub() {
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();
return new_object;

View File

@ -2949,11 +2949,6 @@ HType HCheckNonSmi::CalculateInferredType() {
}
HType HCheckSmi::CalculateInferredType() {
return HType::Smi();
}
HType HPhi::CalculateInferredType() {
HType result = HType::Uninitialized();
for (int i = 0; i < OperandCount(); ++i) {
@ -3651,12 +3646,6 @@ void HSimulate::Verify() {
}
void HCheckSmi::Verify() {
HInstruction::Verify();
ASSERT(HasNoUses());
}
void HCheckNonSmi::Verify() {
HInstruction::Verify();
ASSERT(HasNoUses());

View File

@ -92,7 +92,6 @@ class LChunkBuilder;
V(CheckMaps) \
V(CheckNonSmi) \
V(CheckPrototypeMaps) \
V(CheckSmi) \
V(ClampToUint8) \
V(ClassOfTestAndBranch) \
V(CompareIDAndBranch) \
@ -1714,7 +1713,8 @@ class HChange: public HUnaryOperation {
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 HCheckPrototypeMaps: public HTemplateInstruction<0> {
};
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)

View File

@ -1098,11 +1098,6 @@ HInstruction* HGraphBuilder::BuildFastElementAccess(
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 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess(
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 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
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:

View File

@ -5687,13 +5687,6 @@ void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) {
}
void LCodeGen::DoCheckSmiAndReturn(LCheckSmiAndReturn* instr) {
LOperand* input = instr->value();
__ test(ToOperand(input), Immediate(kSmiTagMask));
DeoptimizeIf(not_zero, instr->environment());
}
void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
LOperand* input = instr->value();
__ test(ToOperand(input), Immediate(kSmiTagMask));

View File

@ -1936,8 +1936,7 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
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()) {
@ -2049,12 +2048,6 @@ LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) {
}
LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
LOperand* value = UseAtStart(instr->value());
return AssignEnvironment(new(zone()) LCheckSmi(value));
}
LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
// If the target is in new space, we'll emit a global cell compare and so
// want the value in a register. If the target gets promoted before we

View File

@ -70,7 +70,6 @@ class LCodeGen;
V(CheckNonSmi) \
V(CheckPrototypeMaps) \
V(CheckSmi) \
V(CheckSmiAndReturn) \
V(ClampDToUint8) \
V(ClampIToUint8) \
V(ClampTToUint8) \
@ -2458,7 +2457,7 @@ class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 1> {
};
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 LCheckSmi: public LTemplateInstruction<0, 1, 0> {
};
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) {

View File

@ -4903,13 +4903,6 @@ void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) {
}
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) {
LOperand* input = instr->value();
Condition cc = masm()->CheckSmi(ToRegister(input));

View File

@ -1833,8 +1833,7 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
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());
@ -1928,12 +1927,6 @@ LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) {
}
LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
LOperand* value = UseRegisterAtStart(instr->value());
return AssignEnvironment(new(zone()) LCheckSmi(value));
}
LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
LOperand* value = UseRegisterAtStart(instr->value());
return AssignEnvironment(new(zone()) LCheckFunction(value));

View File

@ -76,7 +76,6 @@ class LCodeGen;
V(CheckNonSmi) \
V(CheckPrototypeMaps) \
V(CheckSmi) \
V(CheckSmiAndReturn) \
V(ClampDToUint8) \
V(ClampIToUint8) \
V(ClampTToUint8) \
@ -2291,7 +2290,7 @@ class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 1> {
};
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 LCheckSmi: public LTemplateInstruction<0, 1, 0> {
};
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) {