Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 608545c172e8bec851dcb91693a99b179d8b4e28..009547c79fc401b94d6fbd8aa627067b6c04d827 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -579,13 +579,25 @@ HConstant* HGraph::GetConstant(SetOncePointer<HConstant>* pointer, |
} |
+HConstant* HGraph::GetConstantInt32(SetOncePointer<HConstant>* pointer, |
+ int32_t value) { |
+ if (!pointer->is_set()) { |
+ HConstant* constant = |
+ new(zone()) HConstant(value, Representation::Integer32()); |
+ constant->InsertAfter(GetConstantUndefined()); |
+ pointer->set(constant); |
+ } |
+ return pointer->get(); |
+} |
+ |
+ |
HConstant* HGraph::GetConstant1() { |
- return GetConstant(&constant_1_, Handle<Smi>(Smi::FromInt(1))); |
+ return GetConstantInt32(&constant_1_, 1); |
} |
HConstant* HGraph::GetConstantMinus1() { |
- return GetConstant(&constant_minus1_, Handle<Smi>(Smi::FromInt(-1))); |
+ return GetConstantInt32(&constant_minus1_, -1); |
} |
@@ -3378,8 +3390,7 @@ class BoundsCheckBbData: public ZoneObject { |
Representation representation, |
int32_t new_offset) { |
HConstant* new_constant = new(BasicBlock()->zone()) |
- HConstant(Handle<Object>(Smi::FromInt(new_offset)), |
- Representation::Integer32()); |
+ HConstant(new_offset, Representation::Integer32()); |
if (*add == NULL) { |
new_constant->InsertBefore(check); |
*add = new(BasicBlock()->zone()) HAdd(NULL, |
@@ -7908,8 +7919,8 @@ HInstruction* HGraphBuilder::BuildBinaryOperation(BinaryOperation* expr, |
// for a smi operation. If one of the operands is a constant string |
// do not generate code assuming it is a smi operation. |
if (info.IsSmi() && |
- ((left->IsConstant() && HConstant::cast(left)->HasStringValue()) || |
- (right->IsConstant() && HConstant::cast(right)->HasStringValue()))) { |
+ ((left->IsConstant() && HConstant::cast(left)->handle()->IsString()) || |
+ (right->IsConstant() && HConstant::cast(right)->handle()->IsString()))) { |
return instr; |
} |
Representation rep = ToRepresentation(info); |
@@ -8127,7 +8138,7 @@ static bool MatchLiteralCompareTypeof(HValue* left, |
if (left->IsTypeof() && |
Token::IsEqualityOp(op) && |
right->IsConstant() && |
- HConstant::cast(right)->HasStringValue()) { |
+ HConstant::cast(right)->handle()->IsString()) { |
*typeof_expr = HTypeof::cast(left); |
*check = Handle<String>::cast(HConstant::cast(right)->handle()); |
return true; |