| Index: src/mips/lithium-mips.cc
|
| diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc
|
| index c9a50641fad437220d483062958f9403f9fbc061..ff296740a784e19aa64d70eea6020f9b35b18576 100644
|
| --- a/src/mips/lithium-mips.cc
|
| +++ b/src/mips/lithium-mips.cc
|
| @@ -704,15 +704,20 @@ LInstruction* LChunkBuilder::DoShift(Token::Value op,
|
| right = UseRegisterAtStart(right_value);
|
| }
|
|
|
| - // Shift operations can only deoptimize if we do a logical shift
|
| - // by 0 and the result cannot be truncated to int32.
|
| - bool may_deopt = (op == Token::SHR && constant_value == 0);
|
| bool does_deopt = false;
|
| - if (may_deopt) {
|
| - for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
|
| - if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) {
|
| - does_deopt = true;
|
| - break;
|
| +
|
| + if (FLAG_opt_safe_uint32_operations) {
|
| + does_deopt = !instr->CheckFlag(HInstruction::kUint32);
|
| + } else {
|
| + // Shift operations can only deoptimize if we do a logical shift
|
| + // by 0 and the result cannot be truncated to int32.
|
| + bool may_deopt = (op == Token::SHR && constant_value == 0);
|
| + if (may_deopt) {
|
| + for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
|
| + if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) {
|
| + does_deopt = true;
|
| + break;
|
| + }
|
| }
|
| }
|
| }
|
| @@ -1579,7 +1584,10 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
|
| if (to.IsTagged()) {
|
| HValue* val = instr->value();
|
| LOperand* value = UseRegisterAtStart(val);
|
| - if (val->HasRange() && val->range()->IsInSmiRange()) {
|
| + if (val->CheckFlag(HInstruction::kUint32)) {
|
| + LNumberTagU* result = new(zone()) LNumberTagU(value);
|
| + return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
|
| + } else if (val->HasRange() && val->range()->IsInSmiRange()) {
|
| return DefineAsRegister(new(zone()) LSmiTag(value));
|
| } else {
|
| LNumberTagI* result = new(zone()) LNumberTagI(value);
|
| @@ -1587,8 +1595,13 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
|
| }
|
| } else {
|
| ASSERT(to.IsDouble());
|
| - LOperand* value = Use(instr->value());
|
| - return DefineAsRegister(new(zone()) LInteger32ToDouble(value));
|
| + if (instr->value()->CheckFlag(HInstruction::kUint32)) {
|
| + return DefineAsRegister(
|
| + new(zone()) LUint32ToDouble(UseRegister(instr->value())));
|
| + } else {
|
| + return DefineAsRegister(
|
| + new(zone()) LInteger32ToDouble(Use(instr->value())));
|
| + }
|
| }
|
| }
|
| UNREACHABLE();
|
|
|