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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 if (right_value->IsConstant()) { | 713 if (right_value->IsConstant()) { |
714 HConstant* constant = HConstant::cast(right_value); | 714 HConstant* constant = HConstant::cast(right_value); |
715 right = chunk_->DefineConstantOperand(constant); | 715 right = chunk_->DefineConstantOperand(constant); |
716 constant_value = constant->Integer32Value() & 0x1f; | 716 constant_value = constant->Integer32Value() & 0x1f; |
717 } else { | 717 } else { |
718 right = UseFixed(right_value, rcx); | 718 right = UseFixed(right_value, rcx); |
719 } | 719 } |
720 | 720 |
721 // Shift operations can only deoptimize if we do a logical shift by 0 and | 721 // Shift operations can only deoptimize if we do a logical shift by 0 and |
722 // the result cannot be truncated to int32. | 722 // the result cannot be truncated to int32. |
723 bool may_deopt = (op == Token::SHR && constant_value == 0); | |
724 bool does_deopt = false; | 723 bool does_deopt = false; |
725 if (may_deopt) { | 724 if (FLAG_opt_safe_uint32_operations) { |
726 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 725 does_deopt = !instr->CheckFlag(HInstruction::kUint32); |
727 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { | 726 } else { |
728 does_deopt = true; | 727 bool may_deopt = (op == Token::SHR && constant_value == 0); |
729 break; | 728 if (may_deopt) { |
| 729 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { |
| 730 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { |
| 731 does_deopt = true; |
| 732 break; |
| 733 } |
730 } | 734 } |
731 } | 735 } |
732 } | 736 } |
733 | 737 |
734 LInstruction* result = | 738 LInstruction* result = |
735 DefineSameAsFirst(new(zone()) LShiftI(op, left, right, does_deopt)); | 739 DefineSameAsFirst(new(zone()) LShiftI(op, left, right, does_deopt)); |
736 return does_deopt ? AssignEnvironment(result) : result; | 740 return does_deopt ? AssignEnvironment(result) : result; |
737 } | 741 } |
738 | 742 |
739 | 743 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 | 882 |
879 HValue* value = hydrogen_env->values()->at(i); | 883 HValue* value = hydrogen_env->values()->at(i); |
880 LOperand* op = NULL; | 884 LOperand* op = NULL; |
881 if (value->IsArgumentsObject()) { | 885 if (value->IsArgumentsObject()) { |
882 op = NULL; | 886 op = NULL; |
883 } else if (value->IsPushArgument()) { | 887 } else if (value->IsPushArgument()) { |
884 op = new(zone()) LArgument(argument_index++); | 888 op = new(zone()) LArgument(argument_index++); |
885 } else { | 889 } else { |
886 op = UseAny(value); | 890 op = UseAny(value); |
887 } | 891 } |
888 result->AddValue(op, value->representation()); | 892 result->AddValue(op, |
| 893 value->representation(), |
| 894 value->CheckFlag(HInstruction::kUint32)); |
889 } | 895 } |
890 | 896 |
891 if (hydrogen_env->frame_type() == JS_FUNCTION) { | 897 if (hydrogen_env->frame_type() == JS_FUNCTION) { |
892 *argument_index_accumulator = argument_index; | 898 *argument_index_accumulator = argument_index; |
893 } | 899 } |
894 | 900 |
895 return result; | 901 return result; |
896 } | 902 } |
897 | 903 |
898 | 904 |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 return AssignPointerMap(Define(result, result_temp)); | 1622 return AssignPointerMap(Define(result, result_temp)); |
1617 } else { | 1623 } else { |
1618 ASSERT(to.IsInteger32()); | 1624 ASSERT(to.IsInteger32()); |
1619 LOperand* value = UseRegister(instr->value()); | 1625 LOperand* value = UseRegister(instr->value()); |
1620 return AssignEnvironment(DefineAsRegister(new(zone()) LDoubleToI(value))); | 1626 return AssignEnvironment(DefineAsRegister(new(zone()) LDoubleToI(value))); |
1621 } | 1627 } |
1622 } else if (from.IsInteger32()) { | 1628 } else if (from.IsInteger32()) { |
1623 if (to.IsTagged()) { | 1629 if (to.IsTagged()) { |
1624 HValue* val = instr->value(); | 1630 HValue* val = instr->value(); |
1625 LOperand* value = UseRegister(val); | 1631 LOperand* value = UseRegister(val); |
1626 if (val->HasRange() && val->range()->IsInSmiRange()) { | 1632 if (val->CheckFlag(HInstruction::kUint32)) { |
| 1633 LOperand* temp = FixedTemp(xmm1); |
| 1634 LNumberTagU* result = new(zone()) LNumberTagU(value, temp); |
| 1635 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
| 1636 } else if (val->HasRange() && val->range()->IsInSmiRange()) { |
1627 return DefineSameAsFirst(new(zone()) LSmiTag(value)); | 1637 return DefineSameAsFirst(new(zone()) LSmiTag(value)); |
1628 } else { | 1638 } else { |
1629 LNumberTagI* result = new(zone()) LNumberTagI(value); | 1639 LNumberTagI* result = new(zone()) LNumberTagI(value); |
1630 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1640 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
1631 } | 1641 } |
1632 } else { | 1642 } else { |
1633 ASSERT(to.IsDouble()); | 1643 if (instr->value()->CheckFlag(HInstruction::kUint32)) { |
1634 LOperand* value = Use(instr->value()); | 1644 LOperand* temp = FixedTemp(xmm1); |
1635 return DefineAsRegister(new(zone()) LInteger32ToDouble(value)); | 1645 return DefineAsRegister( |
| 1646 new(zone()) LUint32ToDouble(UseRegister(instr->value()), temp)); |
| 1647 } else { |
| 1648 ASSERT(to.IsDouble()); |
| 1649 LOperand* value = Use(instr->value()); |
| 1650 return DefineAsRegister(new(zone()) LInteger32ToDouble(value)); |
| 1651 } |
1636 } | 1652 } |
1637 } | 1653 } |
1638 UNREACHABLE(); | 1654 UNREACHABLE(); |
1639 return NULL; | 1655 return NULL; |
1640 } | 1656 } |
1641 | 1657 |
1642 | 1658 |
1643 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) { | 1659 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) { |
1644 LOperand* value = UseRegisterAtStart(instr->value()); | 1660 LOperand* value = UseRegisterAtStart(instr->value()); |
1645 return AssignEnvironment(new(zone()) LCheckNonSmi(value)); | 1661 return AssignEnvironment(new(zone()) LCheckNonSmi(value)); |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2299 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2315 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2300 LOperand* object = UseRegister(instr->object()); | 2316 LOperand* object = UseRegister(instr->object()); |
2301 LOperand* index = UseTempRegister(instr->index()); | 2317 LOperand* index = UseTempRegister(instr->index()); |
2302 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2318 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2303 } | 2319 } |
2304 | 2320 |
2305 | 2321 |
2306 } } // namespace v8::internal | 2322 } } // namespace v8::internal |
2307 | 2323 |
2308 #endif // V8_TARGET_ARCH_X64 | 2324 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |