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