MIPS: Fix hole handling, and ensure smi representation is handled properly
Port r14807 (c26f44d6) BUG= Review URL: https://codereview.chromium.org/15821007 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14812 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
eff0995922
commit
eaa793604f
@ -3644,7 +3644,10 @@ void LCodeGen::DoPower(LPower* instr) {
|
||||
ASSERT(ToDoubleRegister(instr->left()).is(f2));
|
||||
ASSERT(ToDoubleRegister(instr->result()).is(f0));
|
||||
|
||||
if (exponent_type.IsTagged()) {
|
||||
if (exponent_type.IsSmi()) {
|
||||
MathPowStub stub(MathPowStub::TAGGED);
|
||||
__ CallStub(&stub);
|
||||
} else if (exponent_type.IsTagged()) {
|
||||
Label no_deopt;
|
||||
__ JumpIfSmi(a2, &no_deopt);
|
||||
__ lw(t3, FieldMemOperand(a2, HeapObject::kMapOffset));
|
||||
@ -4648,22 +4651,6 @@ void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
|
||||
__ And(scratch, input, Operand(kHeapObjectTag));
|
||||
__ SmiUntag(result, input);
|
||||
DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg));
|
||||
} else if (instr->hydrogen()->value()->IsLoadKeyed()) {
|
||||
HLoadKeyed* load = HLoadKeyed::cast(instr->hydrogen()->value());
|
||||
if (load->UsesMustHandleHole()) {
|
||||
__ And(scratch, input, Operand(kHeapObjectTag));
|
||||
__ SmiUntag(result, input);
|
||||
if (load->hole_mode() == ALLOW_RETURN_HOLE) {
|
||||
Label done;
|
||||
__ Branch(&done, eq, scratch, Operand(zero_reg));
|
||||
__ li(result, Operand(Smi::FromInt(0)));
|
||||
__ bind(&done);
|
||||
} else {
|
||||
DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg));
|
||||
}
|
||||
} else {
|
||||
__ SmiUntag(result, input);
|
||||
}
|
||||
} else {
|
||||
__ SmiUntag(result, input);
|
||||
}
|
||||
|
@ -714,9 +714,9 @@ LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
|
||||
|
||||
LInstruction* LChunkBuilder::DoShift(Token::Value op,
|
||||
HBitwiseBinaryOperation* instr) {
|
||||
if (instr->representation().IsTagged()) {
|
||||
ASSERT(instr->left()->representation().IsTagged());
|
||||
ASSERT(instr->right()->representation().IsTagged());
|
||||
if (instr->representation().IsSmiOrTagged()) {
|
||||
ASSERT(instr->left()->representation().IsSmiOrTagged());
|
||||
ASSERT(instr->right()->representation().IsSmiOrTagged());
|
||||
|
||||
LOperand* left = UseFixed(instr->left(), a1);
|
||||
LOperand* right = UseFixed(instr->right(), a0);
|
||||
@ -784,8 +784,8 @@ LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op,
|
||||
op == Token::SUB);
|
||||
HValue* left = instr->left();
|
||||
HValue* right = instr->right();
|
||||
ASSERT(left->representation().IsTagged());
|
||||
ASSERT(right->representation().IsTagged());
|
||||
ASSERT(left->representation().IsSmiOrTagged());
|
||||
ASSERT(right->representation().IsSmiOrTagged());
|
||||
LOperand* left_operand = UseFixed(left, a1);
|
||||
LOperand* right_operand = UseFixed(right, a0);
|
||||
LArithmeticT* result =
|
||||
@ -1304,9 +1304,9 @@ LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
|
||||
LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
|
||||
return DefineAsRegister(new(zone()) LBitI(left, right));
|
||||
} else {
|
||||
ASSERT(instr->representation().IsTagged());
|
||||
ASSERT(instr->left()->representation().IsTagged());
|
||||
ASSERT(instr->right()->representation().IsTagged());
|
||||
ASSERT(instr->representation().IsSmiOrTagged());
|
||||
ASSERT(instr->left()->representation().IsSmiOrTagged());
|
||||
ASSERT(instr->right()->representation().IsSmiOrTagged());
|
||||
|
||||
LOperand* left = UseFixed(instr->left(), a1);
|
||||
LOperand* right = UseFixed(instr->right(), a0);
|
||||
@ -1377,7 +1377,7 @@ LInstruction* LChunkBuilder::DoMod(HMod* instr) {
|
||||
} else {
|
||||
return DefineAsRegister(mod);
|
||||
}
|
||||
} else if (instr->representation().IsTagged()) {
|
||||
} else if (instr->representation().IsSmiOrTagged()) {
|
||||
return DoArithmeticT(Token::MOD, instr);
|
||||
} else {
|
||||
ASSERT(instr->representation().IsDouble());
|
||||
@ -1490,7 +1490,7 @@ LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
|
||||
}
|
||||
return DoArithmeticD(Token::ADD, instr);
|
||||
} else {
|
||||
ASSERT(instr->representation().IsTagged());
|
||||
ASSERT(instr->representation().IsSmiOrTagged());
|
||||
return DoArithmeticT(Token::ADD, instr);
|
||||
}
|
||||
}
|
||||
@ -1762,12 +1762,6 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
|
||||
if (from.IsSmi()) {
|
||||
if (to.IsTagged()) {
|
||||
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));
|
||||
}
|
||||
from = Representation::Tagged();
|
||||
@ -1793,13 +1787,6 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
|
||||
if (instr->value()->type().IsSmi()) {
|
||||
value = UseRegisterAtStart(instr->value());
|
||||
res = DefineAsRegister(new(zone()) LSmiUntag(value, false));
|
||||
if (instr->value()->IsLoadKeyed()) {
|
||||
HLoadKeyed* load_keyed = HLoadKeyed::cast(instr->value());
|
||||
if (load_keyed->UsesMustHandleHole() &&
|
||||
load_keyed->hole_mode() == NEVER_RETURN_HOLE) {
|
||||
res = AssignEnvironment(res);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
value = UseRegister(instr->value());
|
||||
LOperand* temp1 = TempRegister();
|
||||
|
@ -2069,7 +2069,6 @@ class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
|
||||
LOperand* value() { return inputs_[0]; }
|
||||
bool needs_check() const { return needs_check_; }
|
||||
|
||||
DECLARE_HYDROGEN_ACCESSOR(Change);
|
||||
DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user