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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 LOperand* right = NULL; | 731 LOperand* right = NULL; |
732 int constant_value = 0; | 732 int constant_value = 0; |
733 if (right_value->IsConstant()) { | 733 if (right_value->IsConstant()) { |
734 HConstant* constant = HConstant::cast(right_value); | 734 HConstant* constant = HConstant::cast(right_value); |
735 right = chunk_->DefineConstantOperand(constant); | 735 right = chunk_->DefineConstantOperand(constant); |
736 constant_value = constant->Integer32Value() & 0x1f; | 736 constant_value = constant->Integer32Value() & 0x1f; |
737 } else { | 737 } else { |
738 right = UseFixed(right_value, ecx); | 738 right = UseFixed(right_value, ecx); |
739 } | 739 } |
740 | 740 |
| 741 // Shift operations can only deoptimize if we do a logical shift by 0 and |
| 742 // the result cannot be truncated to int32. |
741 bool does_deopt = false; | 743 bool does_deopt = false; |
742 if (FLAG_opt_safe_uint32_operations) { | 744 if (op == Token::SHR && constant_value == 0) { |
743 does_deopt = !instr->CheckFlag(HInstruction::kUint32); | 745 if (FLAG_opt_safe_uint32_operations) { |
744 } else { | 746 does_deopt = !instr->CheckFlag(HInstruction::kUint32); |
745 // Shift operations can only deoptimize if we do a logical shift by 0 and | 747 } else { |
746 // the result cannot be truncated to int32. | |
747 bool may_deopt = (op == Token::SHR && constant_value == 0 && | |
748 !instr->CheckFlag(HInstruction::kUint32)); | |
749 if (may_deopt) { | |
750 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 748 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { |
751 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { | 749 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { |
752 does_deopt = true; | 750 does_deopt = true; |
753 break; | 751 break; |
754 } | 752 } |
755 } | 753 } |
756 } | 754 } |
757 } | 755 } |
758 | 756 |
759 LInstruction* result = | 757 LInstruction* result = |
(...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2433 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2431 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2434 LOperand* object = UseRegister(instr->object()); | 2432 LOperand* object = UseRegister(instr->object()); |
2435 LOperand* index = UseTempRegister(instr->index()); | 2433 LOperand* index = UseTempRegister(instr->index()); |
2436 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2434 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2437 } | 2435 } |
2438 | 2436 |
2439 | 2437 |
2440 } } // namespace v8::internal | 2438 } } // namespace v8::internal |
2441 | 2439 |
2442 #endif // V8_TARGET_ARCH_IA32 | 2440 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |