OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 LOperand* right = NULL; | 706 LOperand* right = NULL; |
707 int constant_value = 0; | 707 int constant_value = 0; |
708 if (right_value->IsConstant()) { | 708 if (right_value->IsConstant()) { |
709 HConstant* constant = HConstant::cast(right_value); | 709 HConstant* constant = HConstant::cast(right_value); |
710 right = chunk_->DefineConstantOperand(constant); | 710 right = chunk_->DefineConstantOperand(constant); |
711 constant_value = constant->Integer32Value() & 0x1f; | 711 constant_value = constant->Integer32Value() & 0x1f; |
712 } else { | 712 } else { |
713 right = UseRegisterAtStart(right_value); | 713 right = UseRegisterAtStart(right_value); |
714 } | 714 } |
715 | 715 |
716 // Shift operations can only deoptimize if we do a logical shift | |
717 // by 0 and the result cannot be truncated to int32. | |
718 bool may_deopt = (op == Token::SHR && constant_value == 0); | |
719 bool does_deopt = false; | 716 bool does_deopt = false; |
720 if (may_deopt) { | 717 |
721 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 718 if (FLAG_opt_safe_uint32_operations) { |
722 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { | 719 does_deopt = !instr->CheckFlag(HInstruction::kUint32); |
723 does_deopt = true; | 720 } else { |
724 break; | 721 // Shift operations can only deoptimize if we do a logical shift |
| 722 // by 0 and the result cannot be truncated to int32. |
| 723 bool may_deopt = (op == Token::SHR && constant_value == 0); |
| 724 if (may_deopt) { |
| 725 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { |
| 726 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { |
| 727 does_deopt = true; |
| 728 break; |
| 729 } |
725 } | 730 } |
726 } | 731 } |
727 } | 732 } |
728 | 733 |
729 LInstruction* result = | 734 LInstruction* result = |
730 DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt)); | 735 DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt)); |
731 return does_deopt ? AssignEnvironment(result) : result; | 736 return does_deopt ? AssignEnvironment(result) : result; |
732 } | 737 } |
733 | 738 |
734 | 739 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 | 878 |
874 HValue* value = hydrogen_env->values()->at(i); | 879 HValue* value = hydrogen_env->values()->at(i); |
875 LOperand* op = NULL; | 880 LOperand* op = NULL; |
876 if (value->IsArgumentsObject()) { | 881 if (value->IsArgumentsObject()) { |
877 op = NULL; | 882 op = NULL; |
878 } else if (value->IsPushArgument()) { | 883 } else if (value->IsPushArgument()) { |
879 op = new(zone()) LArgument(argument_index++); | 884 op = new(zone()) LArgument(argument_index++); |
880 } else { | 885 } else { |
881 op = UseAny(value); | 886 op = UseAny(value); |
882 } | 887 } |
883 result->AddValue(op, value->representation()); | 888 result->AddValue(op, |
| 889 value->representation(), |
| 890 value->CheckFlag(HInstruction::kUint32)); |
884 } | 891 } |
885 | 892 |
886 if (hydrogen_env->frame_type() == JS_FUNCTION) { | 893 if (hydrogen_env->frame_type() == JS_FUNCTION) { |
887 *argument_index_accumulator = argument_index; | 894 *argument_index_accumulator = argument_index; |
888 } | 895 } |
889 | 896 |
890 return result; | 897 return result; |
891 } | 898 } |
892 | 899 |
893 | 900 |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 LOperand* value = UseRegister(instr->value()); | 1649 LOperand* value = UseRegister(instr->value()); |
1643 LOperand* temp1 = TempRegister(); | 1650 LOperand* temp1 = TempRegister(); |
1644 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() : NULL; | 1651 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() : NULL; |
1645 LDoubleToI* res = new(zone()) LDoubleToI(value, temp1, temp2); | 1652 LDoubleToI* res = new(zone()) LDoubleToI(value, temp1, temp2); |
1646 return AssignEnvironment(DefineAsRegister(res)); | 1653 return AssignEnvironment(DefineAsRegister(res)); |
1647 } | 1654 } |
1648 } else if (from.IsInteger32()) { | 1655 } else if (from.IsInteger32()) { |
1649 if (to.IsTagged()) { | 1656 if (to.IsTagged()) { |
1650 HValue* val = instr->value(); | 1657 HValue* val = instr->value(); |
1651 LOperand* value = UseRegisterAtStart(val); | 1658 LOperand* value = UseRegisterAtStart(val); |
1652 if (val->HasRange() && val->range()->IsInSmiRange()) { | 1659 if (val->CheckFlag(HInstruction::kUint32)) { |
| 1660 LNumberTagU* result = new(zone()) LNumberTagU(value); |
| 1661 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
| 1662 } else if (val->HasRange() && val->range()->IsInSmiRange()) { |
1653 return DefineAsRegister(new(zone()) LSmiTag(value)); | 1663 return DefineAsRegister(new(zone()) LSmiTag(value)); |
1654 } else { | 1664 } else { |
1655 LNumberTagI* result = new(zone()) LNumberTagI(value); | 1665 LNumberTagI* result = new(zone()) LNumberTagI(value); |
1656 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 1666 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
1657 } | 1667 } |
1658 } else { | 1668 } else { |
1659 ASSERT(to.IsDouble()); | 1669 ASSERT(to.IsDouble()); |
1660 LOperand* value = Use(instr->value()); | 1670 if (instr->value()->CheckFlag(HInstruction::kUint32)) { |
1661 return DefineAsRegister(new(zone()) LInteger32ToDouble(value)); | 1671 return DefineAsRegister( |
| 1672 new(zone()) LUint32ToDouble(UseRegister(instr->value()))); |
| 1673 } else { |
| 1674 return DefineAsRegister( |
| 1675 new(zone()) LInteger32ToDouble(Use(instr->value()))); |
| 1676 } |
1662 } | 1677 } |
1663 } | 1678 } |
1664 UNREACHABLE(); | 1679 UNREACHABLE(); |
1665 return NULL; | 1680 return NULL; |
1666 } | 1681 } |
1667 | 1682 |
1668 | 1683 |
1669 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) { | 1684 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) { |
1670 LOperand* value = UseRegisterAtStart(instr->value()); | 1685 LOperand* value = UseRegisterAtStart(instr->value()); |
1671 return AssignEnvironment(new(zone()) LCheckNonSmi(value)); | 1686 return AssignEnvironment(new(zone()) LCheckNonSmi(value)); |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2299 | 2314 |
2300 | 2315 |
2301 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2316 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2302 LOperand* object = UseRegister(instr->object()); | 2317 LOperand* object = UseRegister(instr->object()); |
2303 LOperand* index = UseRegister(instr->index()); | 2318 LOperand* index = UseRegister(instr->index()); |
2304 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2319 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2305 } | 2320 } |
2306 | 2321 |
2307 | 2322 |
2308 } } // namespace v8::internal | 2323 } } // namespace v8::internal |
OLD | NEW |