Index: src/ia32/lithium-ia32.cc |
diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc |
index aebe26b78560b98a8894ca98fae0a25e4c295eae..875f6082d7d87b9aa40b21ab21d5223759a3867e 100644 |
--- a/src/ia32/lithium-ia32.cc |
+++ b/src/ia32/lithium-ia32.cc |
@@ -754,11 +754,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); |
} |
@@ -766,7 +761,7 @@ LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) { |
LInstruction* LChunkBuilder::DoShift(Token::Value op, |
HBitwiseBinaryOperation* instr) { |
- if (instr->representation().IsSmiOrTagged()) { |
+ if (instr->representation().IsTagged()) { |
ASSERT(instr->left()->representation().IsSmiOrTagged()); |
ASSERT(instr->right()->representation().IsSmiOrTagged()); |
@@ -777,25 +772,35 @@ LInstruction* LChunkBuilder::DoShift(Token::Value op, |
return MarkAsCall(DefineFixed(result, eax), 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 = UseFixed(right_value, ecx); |
} |
// Shift operations can only 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); |
@@ -837,8 +842,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* context = UseFixed(instr->context(), esi); |
LOperand* left_operand = UseFixed(left, edx); |
LOperand* right_operand = UseFixed(right, eax); |
@@ -1404,9 +1409,10 @@ 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().IsSmiOrInteger32()); |
+ ASSERT(instr->right()->representation().Equals( |
+ instr->left()->representation())); |
LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); |
@@ -1439,7 +1445,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())); |
if (instr->HasPowerOf2Divisor()) { |
ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); |
LOperand* value = UseRegisterAtStart(instr->left()); |
@@ -1455,7 +1463,7 @@ LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { |
LDivI* result = new(zone()) LDivI(dividend, divisor, temp); |
return AssignEnvironment(DefineFixed(result, eax)); |
} else { |
- ASSERT(instr->representation().IsSmiOrTagged()); |
+ ASSERT(instr->representation().IsTagged()); |
return DoArithmeticT(Token::DIV, instr); |
} |
} |
@@ -1521,9 +1529,10 @@ 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(left->representation().IsSmiOrInteger32()); |
+ ASSERT(right->representation().Equals(left->representation())); |
+ |
if (instr->HasPowerOf2Divisor()) { |
ASSERT(!right->CanBeZero()); |
LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), |
@@ -1572,9 +1581,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 = UseRegisterAtStart(instr->BetterLeftOperand()); |
LOperand* right = UseOrConstant(instr->BetterRightOperand()); |
LOperand* temp = NULL; |
@@ -1590,16 +1599,17 @@ LInstruction* LChunkBuilder::DoMul(HMul* instr) { |
} else if (instr->representation().IsDouble()) { |
return DoArithmeticD(Token::MUL, instr); |
} else { |
- ASSERT(instr->representation().IsSmiOrTagged()); |
+ ASSERT(instr->representation().IsTagged()); |
return DoArithmeticT(Token::MUL, 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().IsSmiOrInteger32()); |
+ ASSERT(instr->right()->representation().Equals( |
+ instr->left()->representation())); |
LOperand* left = UseRegisterAtStart(instr->left()); |
LOperand* right = UseOrConstantAtStart(instr->right()); |
LSubI* sub = new(zone()) LSubI(left, right); |
@@ -1618,14 +1628,15 @@ LInstruction* LChunkBuilder::DoSub(HSub* instr) { |
LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { |
- if (instr->representation().IsInteger32()) { |
+ if (instr->representation().IsSmiOrInteger32()) { |
+ ASSERT(instr->left()->representation().IsSmiOrInteger32()); |
+ ASSERT(instr->right()->representation().Equals( |
+ instr->left()->representation())); |
// Check to see if it would be advantageous to use an lea instruction rather |
// than an add. This is the case when no overflow check is needed and there |
// are multiple uses of the add's inputs, so using a 3-register add will |
// preserve all input values for later uses. |
bool use_lea = LAddI::UseLea(instr); |
- ASSERT(instr->left()->representation().IsInteger32()); |
- ASSERT(instr->right()->representation().IsInteger32()); |
LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); |
HValue* right_candidate = instr->BetterRightOperand(); |
LOperand* right = use_lea |
@@ -1652,9 +1663,10 @@ 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().IsSmiOrInteger32()); |
+ ASSERT(instr->right()->representation().Equals( |
+ instr->left()->representation())); |
left = UseRegisterAtStart(instr->BetterLeftOperand()); |
right = UseOrConstantAtStart(instr->BetterRightOperand()); |
} else { |
@@ -1741,13 +1753,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().IsSmiOrTagged()); |
LOperand* temp = TempRegister(); |
@@ -2063,8 +2068,10 @@ LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) { |
LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) { |
- LUnallocated* temp = TempRegister(); |
+ LUnallocated* temp = NULL; |
+ if (!instr->CanOmitPrototypeChecks()) temp = TempRegister(); |
LCheckPrototypeMaps* result = new(zone()) LCheckPrototypeMaps(temp); |
+ if (instr->CanOmitPrototypeChecks()) return result; |
return AssignEnvironment(result); |
} |
@@ -2081,8 +2088,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()); |
LCheckMaps* result = new(zone()) LCheckMaps(value); |
+ if (instr->CanOmitMapChecks()) return result; |
return AssignEnvironment(result); |
} |
@@ -2261,8 +2270,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(); |
bool clobbers_key = ExternalArrayOpRequiresTemp( |
instr->key()->representation(), elements_kind); |
@@ -2407,21 +2415,11 @@ LInstruction* LChunkBuilder::DoTransitionElementsKind( |
new(zone()) LTransitionElementsKind(object, NULL, |
new_map_reg, temp_reg); |
return result; |
- } else if (FLAG_compiled_transitions) { |
+ } else { |
LOperand* context = UseRegister(instr->context()); |
LTransitionElementsKind* result = |
new(zone()) LTransitionElementsKind(object, context, NULL, NULL); |
return AssignPointerMap(result); |
- } else { |
- LOperand* object = UseFixed(instr->object(), eax); |
- LOperand* fixed_object_reg = FixedTemp(edx); |
- LOperand* new_map_reg = FixedTemp(ebx); |
- LTransitionElementsKind* result = |
- new(zone()) LTransitionElementsKind(object, |
- NULL, |
- new_map_reg, |
- fixed_object_reg); |
- return MarkAsCall(result, instr); |
} |
} |