Commit 4b0f9cd4 authored by palfia@homejinni.com's avatar palfia@homejinni.com

MIPS: Tag length of FixedArrayBase and smi-array[x] as smi representation

Port r14778 (c7fdf61b)

BUG=

Review URL: https://codereview.chromium.org/15927005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14786 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 31080249
...@@ -4958,6 +4958,13 @@ void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) { ...@@ -4958,6 +4958,13 @@ void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) {
} }
void LCodeGen::DoCheckSmiAndReturn(LCheckSmiAndReturn* instr) {
LOperand* input = instr->value();
__ And(at, ToRegister(input), Operand(kSmiTagMask));
DeoptimizeIf(ne, instr->environment(), at, Operand(zero_reg));
}
void LCodeGen::DoCheckSmi(LCheckSmi* instr) { void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
LOperand* input = instr->value(); LOperand* input = instr->value();
__ And(at, ToRegister(input), Operand(kSmiTagMask)); __ And(at, ToRegister(input), Operand(kSmiTagMask));
......
...@@ -1763,6 +1763,12 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) { ...@@ -1763,6 +1763,12 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
if (from.IsSmi()) { if (from.IsSmi()) {
if (to.IsTagged()) { if (to.IsTagged()) {
LOperand* value = UseRegister(instr->value()); LOperand* value = UseRegister(instr->value());
// For now, always deopt on hole.
if (instr->value()->IsLoadKeyed() &&
HLoadKeyed::cast(instr->value())->UsesMustHandleHole()) {
return AssignEnvironment(
DefineSameAsFirst(new(zone()) LCheckSmiAndReturn(value)));
}
return DefineSameAsFirst(new(zone()) LDummyUse(value)); return DefineSameAsFirst(new(zone()) LDummyUse(value));
} }
from = Representation::Tagged(); from = Representation::Tagged();
...@@ -1775,9 +1781,9 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) { ...@@ -1775,9 +1781,9 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
return AssignEnvironment(DefineAsRegister(res)); return AssignEnvironment(DefineAsRegister(res));
} else if (to.IsSmi()) { } else if (to.IsSmi()) {
HValue* val = instr->value(); HValue* val = instr->value();
LOperand* value = UseRegisterAtStart(val); LOperand* value = UseRegister(val);
return AssignEnvironment( return AssignEnvironment(
DefineSameAsFirst(new(zone()) LCheckSmi(value))); DefineSameAsFirst(new(zone()) LCheckSmiAndReturn(value)));
} else { } else {
ASSERT(to.IsInteger32()); ASSERT(to.IsInteger32());
LOperand* value = NULL; LOperand* value = NULL;
......
...@@ -76,6 +76,7 @@ class LCodeGen; ...@@ -76,6 +76,7 @@ class LCodeGen;
V(CheckNonSmi) \ V(CheckNonSmi) \
V(CheckPrototypeMaps) \ V(CheckPrototypeMaps) \
V(CheckSmi) \ V(CheckSmi) \
V(CheckSmiAndReturn) \
V(ClampDToUint8) \ V(ClampDToUint8) \
V(ClampIToUint8) \ V(ClampIToUint8) \
V(ClampTToUint8) \ V(ClampTToUint8) \
...@@ -2328,7 +2329,7 @@ class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> { ...@@ -2328,7 +2329,7 @@ class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> {
}; };
class LCheckSmi: public LTemplateInstruction<1, 1, 0> { class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
public: public:
explicit LCheckSmi(LOperand* value) { explicit LCheckSmi(LOperand* value) {
inputs_[0] = value; inputs_[0] = value;
...@@ -2340,6 +2341,18 @@ class LCheckSmi: public LTemplateInstruction<1, 1, 0> { ...@@ -2340,6 +2341,18 @@ class LCheckSmi: public LTemplateInstruction<1, 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> { class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
public: public:
explicit LCheckNonSmi(LOperand* value) { explicit LCheckNonSmi(LOperand* value) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment