Index: src/mips/lithium-mips.cc |
diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc |
index c64533cdfcbd10201c743179160bbb1efc888667..fd3fd3ad4c20f5848ca1ffdf2a25f5002b8ecb57 100644 |
--- a/src/mips/lithium-mips.cc |
+++ b/src/mips/lithium-mips.cc |
@@ -706,11 +706,6 @@ LInstruction* LChunkBuilder::DoEnvironmentMarker(HEnvironmentMarker* instr) { |
} |
-LInstruction* LChunkBuilder::DoSoftDeoptimize(HSoftDeoptimize* instr) { |
- return AssignEnvironment(new(zone()) LDeoptimize); |
-} |
- |
- |
LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) { |
return AssignEnvironment(new(zone()) LDeoptimize); |
} |
@@ -718,9 +713,9 @@ LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) { |
LInstruction* LChunkBuilder::DoShift(Token::Value op, |
HBitwiseBinaryOperation* instr) { |
- if (instr->representation().IsSmiOrTagged()) { |
- ASSERT(instr->left()->representation().IsSmiOrTagged()); |
- ASSERT(instr->right()->representation().IsSmiOrTagged()); |
+ if (instr->representation().IsTagged()) { |
+ ASSERT(instr->left()->representation().IsTagged()); |
+ ASSERT(instr->right()->representation().IsTagged()); |
LOperand* left = UseFixed(instr->left(), a1); |
LOperand* right = UseFixed(instr->right(), a0); |
@@ -728,25 +723,35 @@ LInstruction* LChunkBuilder::DoShift(Token::Value op, |
return MarkAsCall(DefineFixed(result, v0), instr); |
} |
- ASSERT(instr->representation().IsInteger32()); |
- ASSERT(instr->left()->representation().IsInteger32()); |
- ASSERT(instr->right()->representation().IsInteger32()); |
+ ASSERT(instr->representation().IsSmiOrInteger32()); |
+ ASSERT(instr->left()->representation().Equals(instr->representation())); |
+ ASSERT(instr->right()->representation().Equals(instr->representation())); |
LOperand* left = UseRegisterAtStart(instr->left()); |
HValue* right_value = instr->right(); |
LOperand* right = NULL; |
int constant_value = 0; |
+ bool does_deopt = false; |
if (right_value->IsConstant()) { |
HConstant* constant = HConstant::cast(right_value); |
right = chunk_->DefineConstantOperand(constant); |
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) { |
+ for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { |
+ if (!it.value()->CheckFlag(HValue::kTruncatingToSmi)) { |
+ does_deopt = true; |
+ break; |
+ } |
+ } |
+ } |
} else { |
right = UseRegisterAtStart(right_value); |
} |
- // Shift operations can only deoptimize if we do a logical shift |
+ // Shift operations can deoptimize if we do a logical shift |
// by 0 and the result cannot be truncated to int32. |
- bool does_deopt = false; |
if (op == Token::SHR && constant_value == 0) { |
if (FLAG_opt_safe_uint32_operations) { |
does_deopt = !instr->CheckFlag(HInstruction::kUint32); |
@@ -788,8 +793,8 @@ LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, |
op == Token::SUB); |
HValue* left = instr->left(); |
HValue* right = instr->right(); |
- ASSERT(left->representation().IsSmiOrTagged()); |
- ASSERT(right->representation().IsSmiOrTagged()); |
+ ASSERT(left->representation().IsTagged()); |
+ ASSERT(right->representation().IsTagged()); |
LOperand* left_operand = UseFixed(left, a1); |
LOperand* right_operand = UseFixed(right, a0); |
LArithmeticT* result = |
@@ -1320,17 +1325,17 @@ LInstruction* LChunkBuilder::DoShl(HShl* instr) { |
LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { |
- if (instr->representation().IsInteger32()) { |
- ASSERT(instr->left()->representation().IsInteger32()); |
- ASSERT(instr->right()->representation().IsInteger32()); |
+ if (instr->representation().IsSmiOrInteger32()) { |
+ ASSERT(instr->left()->representation().Equals(instr->representation())); |
+ ASSERT(instr->right()->representation().Equals(instr->representation())); |
LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); |
return DefineAsRegister(new(zone()) LBitI(left, right)); |
} else { |
- ASSERT(instr->representation().IsSmiOrTagged()); |
- ASSERT(instr->left()->representation().IsSmiOrTagged()); |
- ASSERT(instr->right()->representation().IsSmiOrTagged()); |
+ ASSERT(instr->representation().IsTagged()); |
+ ASSERT(instr->left()->representation().IsTagged()); |
+ ASSERT(instr->right()->representation().IsTagged()); |
LOperand* left = UseFixed(instr->left(), a1); |
LOperand* right = UseFixed(instr->right(), a0); |
@@ -1352,7 +1357,9 @@ LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { |
LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { |
if (instr->representation().IsDouble()) { |
return DoArithmeticD(Token::DIV, instr); |
- } else if (instr->representation().IsInteger32()) { |
+ } else if (instr->representation().IsSmiOrInteger32()) { |
+ ASSERT(instr->left()->representation().Equals(instr->representation())); |
+ ASSERT(instr->right()->representation().Equals(instr->representation())); |
LOperand* dividend = UseRegister(instr->left()); |
LOperand* divisor = UseRegister(instr->right()); |
LDivI* div = new(zone()) LDivI(dividend, divisor); |
@@ -1419,9 +1426,9 @@ LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { |
LInstruction* LChunkBuilder::DoMod(HMod* instr) { |
HValue* left = instr->left(); |
HValue* right = instr->right(); |
- if (instr->representation().IsInteger32()) { |
- ASSERT(left->representation().IsInteger32()); |
- ASSERT(right->representation().IsInteger32()); |
+ if (instr->representation().IsSmiOrInteger32()) { |
+ ASSERT(instr->left()->representation().Equals(instr->representation())); |
+ ASSERT(instr->right()->representation().Equals(instr->representation())); |
if (instr->HasPowerOf2Divisor()) { |
ASSERT(!right->CanBeZero()); |
LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), |
@@ -1449,7 +1456,7 @@ LInstruction* LChunkBuilder::DoMod(HMod* instr) { |
? AssignEnvironment(result) |
: result; |
} |
- } else if (instr->representation().IsSmiOrTagged()) { |
+ } else if (instr->representation().IsTagged()) { |
return DoArithmeticT(Token::MOD, instr); |
} else { |
ASSERT(instr->representation().IsDouble()); |
@@ -1465,9 +1472,9 @@ LInstruction* LChunkBuilder::DoMod(HMod* instr) { |
LInstruction* LChunkBuilder::DoMul(HMul* instr) { |
- if (instr->representation().IsInteger32()) { |
- ASSERT(instr->left()->representation().IsInteger32()); |
- ASSERT(instr->right()->representation().IsInteger32()); |
+ if (instr->representation().IsSmiOrInteger32()) { |
+ ASSERT(instr->left()->representation().Equals(instr->representation())); |
+ ASSERT(instr->right()->representation().Equals(instr->representation())); |
LOperand* left; |
LOperand* right = UseOrConstant(instr->BetterRightOperand()); |
LOperand* temp = NULL; |
@@ -1510,9 +1517,9 @@ LInstruction* LChunkBuilder::DoMul(HMul* instr) { |
LInstruction* LChunkBuilder::DoSub(HSub* instr) { |
- if (instr->representation().IsInteger32()) { |
- ASSERT(instr->left()->representation().IsInteger32()); |
- ASSERT(instr->right()->representation().IsInteger32()); |
+ if (instr->representation().IsSmiOrInteger32()) { |
+ ASSERT(instr->left()->representation().Equals(instr->representation())); |
+ ASSERT(instr->right()->representation().Equals(instr->representation())); |
LOperand* left = UseRegisterAtStart(instr->left()); |
LOperand* right = UseOrConstantAtStart(instr->right()); |
LSubI* sub = new(zone()) LSubI(left, right); |
@@ -1539,9 +1546,9 @@ LInstruction* LChunkBuilder::DoMultiplyAdd(HMul* mul, HValue* addend) { |
LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { |
- if (instr->representation().IsInteger32()) { |
- ASSERT(instr->left()->representation().IsInteger32()); |
- ASSERT(instr->right()->representation().IsInteger32()); |
+ if (instr->representation().IsSmiOrInteger32()) { |
+ ASSERT(instr->left()->representation().Equals(instr->representation())); |
+ ASSERT(instr->right()->representation().Equals(instr->representation())); |
LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); |
LAddI* add = new(zone()) LAddI(left, right); |
@@ -1562,7 +1569,7 @@ LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { |
} |
return DoArithmeticD(Token::ADD, instr); |
} else { |
- ASSERT(instr->representation().IsSmiOrTagged()); |
+ ASSERT(instr->representation().IsTagged()); |
return DoArithmeticT(Token::ADD, instr); |
} |
} |
@@ -1571,9 +1578,9 @@ LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { |
LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { |
LOperand* left = NULL; |
LOperand* right = NULL; |
- if (instr->representation().IsInteger32()) { |
- ASSERT(instr->left()->representation().IsInteger32()); |
- ASSERT(instr->right()->representation().IsInteger32()); |
+ if (instr->representation().IsSmiOrInteger32()) { |
+ ASSERT(instr->left()->representation().Equals(instr->representation())); |
+ ASSERT(instr->right()->representation().Equals(instr->representation())); |
left = UseRegisterAtStart(instr->BetterLeftOperand()); |
right = UseOrConstantAtStart(instr->BetterRightOperand()); |
} else { |
@@ -1652,13 +1659,6 @@ LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( |
} |
-LInstruction* LChunkBuilder::DoCompareConstantEqAndBranch( |
- HCompareConstantEqAndBranch* instr) { |
- return new(zone()) LCmpConstantEqAndBranch( |
- UseRegisterAtStart(instr->value())); |
-} |
- |
- |
LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { |
ASSERT(instr->value()->representation().IsTagged()); |
LOperand* temp = TempRegister(); |
@@ -1956,9 +1956,14 @@ LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) { |
LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) { |
- LUnallocated* temp1 = TempRegister(); |
- LOperand* temp2 = TempRegister(); |
+ LUnallocated* temp1 = NULL; |
+ LOperand* temp2 = NULL; |
+ if (!instr->CanOmitPrototypeChecks()) { |
+ temp1 = TempRegister(); |
+ temp2 = TempRegister(); |
+ } |
LCheckPrototypeMaps* result = new(zone()) LCheckPrototypeMaps(temp1, temp2); |
+ if (instr->CanOmitPrototypeChecks()) return result; |
return AssignEnvironment(result); |
} |
@@ -1970,8 +1975,10 @@ LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) { |
LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) { |
- LOperand* value = UseRegisterAtStart(instr->value()); |
+ LOperand* value = NULL; |
+ if (!instr->CanOmitMapChecks()) value = UseRegisterAtStart(instr->value()); |
LInstruction* result = new(zone()) LCheckMaps(value); |
+ if (instr->CanOmitMapChecks()) return result; |
return AssignEnvironment(result); |
} |
@@ -2128,8 +2135,7 @@ LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( |
LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
- ASSERT(instr->key()->representation().IsInteger32() || |
- instr->key()->representation().IsSmi()); |
+ ASSERT(instr->key()->representation().IsSmiOrInteger32()); |
ElementsKind elements_kind = instr->elements_kind(); |
LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
LLoadKeyed* result = NULL; |
@@ -2239,21 +2245,12 @@ LInstruction* LChunkBuilder::DoTransitionElementsKind( |
if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) { |
LOperand* new_map_reg = TempRegister(); |
LTransitionElementsKind* result = |
- new(zone()) LTransitionElementsKind(object, new_map_reg, NULL); |
+ new(zone()) LTransitionElementsKind(object, new_map_reg); |
return result; |
- } else if (FLAG_compiled_transitions) { |
- LTransitionElementsKind* result = |
- new(zone()) LTransitionElementsKind(object, NULL, NULL); |
- return AssignPointerMap(result); |
} else { |
- LOperand* object = UseFixed(instr->object(), a0); |
- LOperand* fixed_object_reg = FixedTemp(a2); |
- LOperand* new_map_reg = FixedTemp(a3); |
LTransitionElementsKind* result = |
- new(zone()) LTransitionElementsKind(object, |
- new_map_reg, |
- fixed_object_reg); |
- return MarkAsCall(result, instr); |
+ new(zone()) LTransitionElementsKind(object, NULL); |
+ return AssignPointerMap(result); |
} |
} |