| 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() && | 790 if (instr->representation().IsSmi() && constant_value > 0) { |
| 791 op == Token::SHL && | |
| 792 constant_value > 0) { | |
| 793 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 791 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { |
| 794 if (!it.value()->CheckFlag(HValue::kTruncatingToSmi)) { | 792 if (!it.value()->CheckFlag(HValue::kTruncatingToSmi)) { |
| 795 does_deopt = true; | 793 does_deopt = true; |
| 796 break; | 794 break; |
| 797 } | 795 } |
| 798 } | 796 } |
| 799 } | 797 } |
| 800 } else { | 798 } else { |
| 801 right = UseFixed(right_value, ecx); | 799 right = UseFixed(right_value, ecx); |
| 802 } | 800 } |
| 803 | 801 |
| 804 // Shift operations can only deoptimize if we do a logical shift by 0 and | 802 // Shift operations can only deoptimize if we do a logical shift by 0 and |
| 805 // the result cannot be truncated to int32. | 803 // the result cannot be truncated to int32. |
| 806 if (op == Token::SHR && constant_value == 0) { | 804 if (op == Token::SHR && constant_value == 0) { |
| 807 if (FLAG_opt_safe_uint32_operations) { | 805 if (FLAG_opt_safe_uint32_operations) { |
| 808 does_deopt = !instr->CheckFlag(HInstruction::kUint32); | 806 does_deopt = !instr->CheckFlag(HInstruction::kUint32); |
| 809 } else { | 807 } else { |
| 810 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 808 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { |
| 811 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32) && | 809 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { |
| 812 !it.value()->CheckFlag(HValue::kTruncatingToSmi)) { | |
| 813 does_deopt = true; | 810 does_deopt = true; |
| 814 break; | 811 break; |
| 815 } | 812 } |
| 816 } | 813 } |
| 817 } | 814 } |
| 818 } | 815 } |
| 819 | 816 |
| 820 LInstruction* result = | 817 LInstruction* result = |
| 821 DefineSameAsFirst(new(zone()) LShiftI(op, left, right, does_deopt)); | 818 DefineSameAsFirst(new(zone()) LShiftI(op, left, right, does_deopt)); |
| 822 return does_deopt ? AssignEnvironment(result) : result; | 819 return does_deopt ? AssignEnvironment(result) : result; |
| (...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2780 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2777 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2781 LOperand* object = UseRegister(instr->object()); | 2778 LOperand* object = UseRegister(instr->object()); |
| 2782 LOperand* index = UseTempRegister(instr->index()); | 2779 LOperand* index = UseTempRegister(instr->index()); |
| 2783 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2780 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2784 } | 2781 } |
| 2785 | 2782 |
| 2786 | 2783 |
| 2787 } } // namespace v8::internal | 2784 } } // namespace v8::internal |
| 2788 | 2785 |
| 2789 #endif // V8_TARGET_ARCH_IA32 | 2786 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |