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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 HValue* right_value = instr->right(); | 726 HValue* right_value = instr->right(); |
727 LOperand* right = NULL; | 727 LOperand* right = NULL; |
728 int constant_value = 0; | 728 int constant_value = 0; |
729 bool does_deopt = false; | 729 bool does_deopt = false; |
730 if (right_value->IsConstant()) { | 730 if (right_value->IsConstant()) { |
731 HConstant* constant = HConstant::cast(right_value); | 731 HConstant* constant = HConstant::cast(right_value); |
732 right = chunk_->DefineConstantOperand(constant); | 732 right = chunk_->DefineConstantOperand(constant); |
733 constant_value = constant->Integer32Value() & 0x1f; | 733 constant_value = constant->Integer32Value() & 0x1f; |
734 // Left shifts can deoptimize if we shift by > 0 and the result cannot be | 734 // Left shifts can deoptimize if we shift by > 0 and the result cannot be |
735 // truncated to smi. | 735 // truncated to smi. |
736 if (instr->representation().IsSmi() && constant_value > 0) { | 736 if (instr->representation().IsSmi() && |
| 737 op == Token::SHL && |
| 738 constant_value > 0) { |
737 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 739 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { |
738 if (!it.value()->CheckFlag(HValue::kTruncatingToSmi)) { | 740 if (!it.value()->CheckFlag(HValue::kTruncatingToSmi)) { |
739 does_deopt = true; | 741 does_deopt = true; |
740 break; | 742 break; |
741 } | 743 } |
742 } | 744 } |
743 } | 745 } |
744 } else { | 746 } else { |
745 right = UseRegisterAtStart(right_value); | 747 right = UseRegisterAtStart(right_value); |
746 } | 748 } |
747 | 749 |
748 // Shift operations can only deoptimize if we do a logical shift | 750 // Shift operations can only deoptimize if we do a logical shift |
749 // by 0 and the result cannot be truncated to int32. | 751 // by 0 and the result cannot be truncated to int32. |
750 if (op == Token::SHR && constant_value == 0) { | 752 if (op == Token::SHR && constant_value == 0) { |
751 if (FLAG_opt_safe_uint32_operations) { | 753 if (FLAG_opt_safe_uint32_operations) { |
752 does_deopt = !instr->CheckFlag(HInstruction::kUint32); | 754 does_deopt = !instr->CheckFlag(HInstruction::kUint32); |
753 } else { | 755 } else { |
754 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 756 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { |
755 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { | 757 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32) && |
| 758 !it.value()->CheckFlag(HValue::kTruncatingToSmi)) { |
756 does_deopt = true; | 759 does_deopt = true; |
757 break; | 760 break; |
758 } | 761 } |
759 } | 762 } |
760 } | 763 } |
761 } | 764 } |
762 | 765 |
763 LInstruction* result = | 766 LInstruction* result = |
764 DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt)); | 767 DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt)); |
765 return does_deopt ? AssignEnvironment(result) : result; | 768 return does_deopt ? AssignEnvironment(result) : result; |
(...skipping 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2637 | 2640 |
2638 | 2641 |
2639 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2642 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2640 LOperand* object = UseRegister(instr->object()); | 2643 LOperand* object = UseRegister(instr->object()); |
2641 LOperand* index = UseRegister(instr->index()); | 2644 LOperand* index = UseRegister(instr->index()); |
2642 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2645 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2643 } | 2646 } |
2644 | 2647 |
2645 | 2648 |
2646 } } // namespace v8::internal | 2649 } } // namespace v8::internal |
OLD | NEW |