| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 if (right_value->IsConstant()) { | 851 if (right_value->IsConstant()) { |
| 852 HConstant* constant = HConstant::cast(right_value); | 852 HConstant* constant = HConstant::cast(right_value); |
| 853 right = chunk_->DefineConstantOperand(constant); | 853 right = chunk_->DefineConstantOperand(constant); |
| 854 constant_value = constant->Integer32Value() & 0x1f; | 854 constant_value = constant->Integer32Value() & 0x1f; |
| 855 } else { | 855 } else { |
| 856 right = UseRegister(right_value); | 856 right = UseRegister(right_value); |
| 857 } | 857 } |
| 858 | 858 |
| 859 // Shift operations can only deoptimize if we do a logical shift | 859 // Shift operations can only deoptimize if we do a logical shift |
| 860 // by 0 and the result cannot be truncated to int32. | 860 // by 0 and the result cannot be truncated to int32. |
| 861 bool can_deopt = (op == Token::SHR && constant_value == 0); | 861 bool can_deopt = op == Token::SHR && |
| 862 if (can_deopt) { | 862 constant_value == 0 && |
| 863 bool can_truncate = true; | 863 !instr->representation().Equals(Representation::TruncatedInteger32()); |
| 864 for (int i = 0; i < instr->uses()->length(); i++) { | |
| 865 if (!instr->uses()->at(i)->CheckFlag(HValue::kTruncatingToInt32)) { | |
| 866 can_truncate = false; | |
| 867 break; | |
| 868 } | |
| 869 } | |
| 870 can_deopt = !can_truncate; | |
| 871 } | |
| 872 | 864 |
| 873 LInstruction* result = | 865 LInstruction* result = |
| 874 DefineSameAsFirst(new LShiftI(op, left, right, can_deopt)); | 866 DefineSameAsFirst(new LShiftI(op, left, right, can_deopt)); |
| 875 if (can_deopt) AssignEnvironment(result); | 867 if (can_deopt) AssignEnvironment(result); |
| 876 return result; | 868 return result; |
| 877 } | 869 } |
| 878 | 870 |
| 879 | 871 |
| 880 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, | 872 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, |
| 881 HArithmeticBinaryOperation* instr) { | 873 HArithmeticBinaryOperation* instr) { |
| (...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2132 | 2124 |
| 2133 | 2125 |
| 2134 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2126 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 2135 HEnvironment* outer = current_block_->last_environment()->outer(); | 2127 HEnvironment* outer = current_block_->last_environment()->outer(); |
| 2136 current_block_->UpdateEnvironment(outer); | 2128 current_block_->UpdateEnvironment(outer); |
| 2137 return NULL; | 2129 return NULL; |
| 2138 } | 2130 } |
| 2139 | 2131 |
| 2140 | 2132 |
| 2141 } } // namespace v8::internal | 2133 } } // namespace v8::internal |
| OLD | NEW |