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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 LOperand* right = NULL; | 716 LOperand* right = NULL; |
717 int constant_value = 0; | 717 int constant_value = 0; |
718 bool does_deopt = false; | 718 bool does_deopt = false; |
719 if (right_value->IsConstant()) { | 719 if (right_value->IsConstant()) { |
720 HConstant* constant = HConstant::cast(right_value); | 720 HConstant* constant = HConstant::cast(right_value); |
721 right = chunk_->DefineConstantOperand(constant); | 721 right = chunk_->DefineConstantOperand(constant); |
722 constant_value = constant->Integer32Value() & 0x1f; | 722 constant_value = constant->Integer32Value() & 0x1f; |
723 // Left shifts can deoptimize if we shift by > 0 and the result cannot be | 723 // Left shifts can deoptimize if we shift by > 0 and the result cannot be |
724 // truncated to smi. | 724 // truncated to smi. |
725 if (instr->representation().IsSmi() && constant_value > 0) { | 725 if (instr->representation().IsSmi() && constant_value > 0) { |
726 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 726 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToSmi); |
727 if (!it.value()->CheckFlag(HValue::kTruncatingToSmi)) { | |
728 does_deopt = true; | |
729 break; | |
730 } | |
731 } | |
732 } | 727 } |
733 } else { | 728 } else { |
734 right = UseRegisterAtStart(right_value); | 729 right = UseRegisterAtStart(right_value); |
735 } | 730 } |
736 | 731 |
737 // Shift operations can deoptimize if we do a logical shift | 732 // Shift operations can deoptimize if we do a logical shift |
738 // by 0 and the result cannot be truncated to int32. | 733 // by 0 and the result cannot be truncated to int32. |
739 if (op == Token::SHR && constant_value == 0) { | 734 if (op == Token::SHR && constant_value == 0) { |
740 if (FLAG_opt_safe_uint32_operations) { | 735 if (FLAG_opt_safe_uint32_operations) { |
741 does_deopt = !instr->CheckFlag(HInstruction::kUint32); | 736 does_deopt = !instr->CheckFlag(HInstruction::kUint32); |
742 } else { | 737 } else { |
743 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 738 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToInt32); |
744 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { | |
745 does_deopt = true; | |
746 break; | |
747 } | |
748 } | |
749 } | 739 } |
750 } | 740 } |
751 | 741 |
752 LInstruction* result = | 742 LInstruction* result = |
753 DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt)); | 743 DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt)); |
754 return does_deopt ? AssignEnvironment(result) : result; | 744 return does_deopt ? AssignEnvironment(result) : result; |
755 } | 745 } |
756 | 746 |
757 | 747 |
758 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, | 748 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, |
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2520 | 2510 |
2521 | 2511 |
2522 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2512 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2523 LOperand* object = UseRegister(instr->object()); | 2513 LOperand* object = UseRegister(instr->object()); |
2524 LOperand* index = UseRegister(instr->index()); | 2514 LOperand* index = UseRegister(instr->index()); |
2525 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2515 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2526 } | 2516 } |
2527 | 2517 |
2528 | 2518 |
2529 } } // namespace v8::internal | 2519 } } // namespace v8::internal |
OLD | NEW |