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 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 HValue* right_value = instr->right(); | 780 HValue* right_value = instr->right(); |
781 LOperand* right = NULL; | 781 LOperand* right = NULL; |
782 int constant_value = 0; | 782 int constant_value = 0; |
783 bool does_deopt = false; | 783 bool does_deopt = false; |
784 if (right_value->IsConstant()) { | 784 if (right_value->IsConstant()) { |
785 HConstant* constant = HConstant::cast(right_value); | 785 HConstant* constant = HConstant::cast(right_value); |
786 right = chunk_->DefineConstantOperand(constant); | 786 right = chunk_->DefineConstantOperand(constant); |
787 constant_value = constant->Integer32Value() & 0x1f; | 787 constant_value = constant->Integer32Value() & 0x1f; |
788 // Left shifts can deoptimize if we shift by > 0 and the result cannot be | 788 // Left shifts can deoptimize if we shift by > 0 and the result cannot be |
789 // truncated to smi. | 789 // truncated to smi. |
790 if (instr->representation().IsSmi() && constant_value > 0) { | 790 if (instr->representation().IsSmi() && |
| 791 op == Token::SHL && |
| 792 constant_value > 0) { |
791 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 793 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { |
792 if (!it.value()->CheckFlag(HValue::kTruncatingToSmi)) { | 794 if (!it.value()->CheckFlag(HValue::kTruncatingToSmi)) { |
793 does_deopt = true; | 795 does_deopt = true; |
794 break; | 796 break; |
795 } | 797 } |
796 } | 798 } |
797 } | 799 } |
798 } else { | 800 } else { |
799 right = UseFixed(right_value, ecx); | 801 right = UseFixed(right_value, ecx); |
800 } | 802 } |
801 | 803 |
802 // Shift operations can only deoptimize if we do a logical shift by 0 and | 804 // Shift operations can only deoptimize if we do a logical shift by 0 and |
803 // the result cannot be truncated to int32. | 805 // the result cannot be truncated to int32. |
804 if (op == Token::SHR && constant_value == 0) { | 806 if (op == Token::SHR && constant_value == 0) { |
805 if (FLAG_opt_safe_uint32_operations) { | 807 if (FLAG_opt_safe_uint32_operations) { |
806 does_deopt = !instr->CheckFlag(HInstruction::kUint32); | 808 does_deopt = !instr->CheckFlag(HInstruction::kUint32); |
807 } else { | 809 } else { |
808 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 810 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { |
809 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { | 811 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32) && |
| 812 !it.value()->CheckFlag(HValue::kTruncatingToSmi)) { |
810 does_deopt = true; | 813 does_deopt = true; |
811 break; | 814 break; |
812 } | 815 } |
813 } | 816 } |
814 } | 817 } |
815 } | 818 } |
816 | 819 |
817 LInstruction* result = | 820 LInstruction* result = |
818 DefineSameAsFirst(new(zone()) LShiftI(op, left, right, does_deopt)); | 821 DefineSameAsFirst(new(zone()) LShiftI(op, left, right, does_deopt)); |
819 return does_deopt ? AssignEnvironment(result) : result; | 822 return does_deopt ? AssignEnvironment(result) : result; |
(...skipping 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2765 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2768 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2766 LOperand* object = UseRegister(instr->object()); | 2769 LOperand* object = UseRegister(instr->object()); |
2767 LOperand* index = UseTempRegister(instr->index()); | 2770 LOperand* index = UseTempRegister(instr->index()); |
2768 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2771 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2769 } | 2772 } |
2770 | 2773 |
2771 | 2774 |
2772 } } // namespace v8::internal | 2775 } } // namespace v8::internal |
2773 | 2776 |
2774 #endif // V8_TARGET_ARCH_IA32 | 2777 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |