| 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 may_deopt = (op == Token::SHR && constant_value == 0); |
| 862 if (can_deopt) { | 862 bool does_deopt = false; |
| 863 bool can_truncate = true; | 863 if (may_deopt) { |
| 864 for (int i = 0; i < instr->uses()->length(); i++) { | 864 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { |
| 865 if (!instr->uses()->at(i)->CheckFlag(HValue::kTruncatingToInt32)) { | 865 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { |
| 866 can_truncate = false; | 866 does_deopt = true; |
| 867 break; | 867 break; |
| 868 } | 868 } |
| 869 } | 869 } |
| 870 can_deopt = !can_truncate; | |
| 871 } | 870 } |
| 872 | 871 |
| 873 LInstruction* result = | 872 LInstruction* result = |
| 874 DefineSameAsFirst(new LShiftI(op, left, right, can_deopt)); | 873 DefineSameAsFirst(new LShiftI(op, left, right, does_deopt)); |
| 875 if (can_deopt) AssignEnvironment(result); | 874 return does_deopt ? AssignEnvironment(result) : result; |
| 876 return result; | |
| 877 } | 875 } |
| 878 | 876 |
| 879 | 877 |
| 880 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, | 878 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, |
| 881 HArithmeticBinaryOperation* instr) { | 879 HArithmeticBinaryOperation* instr) { |
| 882 ASSERT(instr->representation().IsDouble()); | 880 ASSERT(instr->representation().IsDouble()); |
| 883 ASSERT(instr->left()->representation().IsDouble()); | 881 ASSERT(instr->left()->representation().IsDouble()); |
| 884 ASSERT(instr->right()->representation().IsDouble()); | 882 ASSERT(instr->right()->representation().IsDouble()); |
| 885 ASSERT(op != Token::MOD); | 883 ASSERT(op != Token::MOD); |
| 886 LOperand* left = UseRegisterAtStart(instr->left()); | 884 LOperand* left = UseRegisterAtStart(instr->left()); |
| (...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2132 | 2130 |
| 2133 | 2131 |
| 2134 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2132 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 2135 HEnvironment* outer = current_block_->last_environment()->outer(); | 2133 HEnvironment* outer = current_block_->last_environment()->outer(); |
| 2136 current_block_->UpdateEnvironment(outer); | 2134 current_block_->UpdateEnvironment(outer); |
| 2137 return NULL; | 2135 return NULL; |
| 2138 } | 2136 } |
| 2139 | 2137 |
| 2140 | 2138 |
| 2141 } } // namespace v8::internal | 2139 } } // namespace v8::internal |
| OLD | NEW |