| Index: src/hydrogen-instructions.cc
|
| diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
|
| index c47351d1aafa3c4a7856a40dbfeda4cb1e3a9f32..84949c09aa1df1b3038f20d6ab2a8c6a45e267ae 100644
|
| --- a/src/hydrogen-instructions.cc
|
| +++ b/src/hydrogen-instructions.cc
|
| @@ -521,19 +521,12 @@ bool HValue::CanReplaceWithDummyUses() {
|
|
|
|
|
| bool HValue::IsInteger32Constant() {
|
| - HValue* value_to_check = IsForceRepresentation()
|
| - ? HForceRepresentation::cast(this)->value()
|
| - : this;
|
| - return value_to_check->IsConstant() &&
|
| - HConstant::cast(value_to_check)->HasInteger32Value();
|
| + return IsConstant() && HConstant::cast(this)->HasInteger32Value();
|
| }
|
|
|
|
|
| int32_t HValue::GetInteger32Constant() {
|
| - HValue* constant_value = IsForceRepresentation()
|
| - ? HForceRepresentation::cast(this)->value()
|
| - : this;
|
| - return HConstant::cast(constant_value)->Integer32Value();
|
| + return HConstant::cast(this)->Integer32Value();
|
| }
|
|
|
|
|
| @@ -1342,6 +1335,23 @@ void HTypeof::PrintDataTo(StringStream* stream) {
|
| }
|
|
|
|
|
| +HInstruction* HForceRepresentation::New(Zone* zone, HValue* context,
|
| + HValue* value, Representation required_representation) {
|
| + if (FLAG_fold_constants && value->IsConstant()) {
|
| + HConstant* c = HConstant::cast(value);
|
| + if (c->HasNumberValue()) {
|
| + double double_res = c->DoubleValue();
|
| + if (TypeInfo::IsInt32Double(double_res)) {
|
| + return HConstant::New(zone, context,
|
| + static_cast<int32_t>(double_res),
|
| + required_representation);
|
| + }
|
| + }
|
| + }
|
| + return new(zone) HForceRepresentation(value, required_representation);
|
| +}
|
| +
|
| +
|
| void HForceRepresentation::PrintDataTo(StringStream* stream) {
|
| stream->Add("%s ", representation().Mnemonic());
|
| value()->PrintNameTo(stream);
|
|
|