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 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 LOperand* right = NULL; | 844 LOperand* right = NULL; |
845 int constant_value = 0; | 845 int constant_value = 0; |
846 if (right_value->IsConstant()) { | 846 if (right_value->IsConstant()) { |
847 HConstant* constant = HConstant::cast(right_value); | 847 HConstant* constant = HConstant::cast(right_value); |
848 right = chunk_->DefineConstantOperand(constant); | 848 right = chunk_->DefineConstantOperand(constant); |
849 constant_value = constant->Integer32Value() & 0x1f; | 849 constant_value = constant->Integer32Value() & 0x1f; |
850 } else { | 850 } else { |
851 right = UseFixed(right_value, rcx); | 851 right = UseFixed(right_value, rcx); |
852 } | 852 } |
853 | 853 |
854 // Shift operations can only deoptimize if we do a logical shift | 854 // Shift operations can only deoptimize if we do a logical shift by 0 and |
855 // by 0 and the result cannot be truncated to int32. | 855 // the result cannot be truncated to int32. |
856 bool can_deopt = (op == Token::SHR && constant_value == 0); | 856 bool may_deopt = (op == Token::SHR && constant_value == 0); |
857 if (can_deopt) { | 857 bool does_deopt = false; |
858 bool can_truncate = true; | 858 if (may_deopt) { |
859 for (int i = 0; i < instr->uses()->length(); i++) { | 859 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { |
860 if (!instr->uses()->at(i)->CheckFlag(HValue::kTruncatingToInt32)) { | 860 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { |
861 can_truncate = false; | 861 does_deopt = true; |
862 break; | 862 break; |
863 } | 863 } |
864 } | 864 } |
865 can_deopt = !can_truncate; | |
866 } | 865 } |
867 | 866 |
868 LShiftI* result = new LShiftI(op, left, right, can_deopt); | 867 LInstruction* result = |
869 return can_deopt | 868 DefineSameAsFirst(new LShiftI(op, left, right, does_deopt)); |
870 ? AssignEnvironment(DefineSameAsFirst(result)) | 869 return does_deopt ? AssignEnvironment(result) : result; |
871 : DefineSameAsFirst(result); | |
872 } | 870 } |
873 | 871 |
874 | 872 |
875 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, | 873 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, |
876 HArithmeticBinaryOperation* instr) { | 874 HArithmeticBinaryOperation* instr) { |
877 ASSERT(instr->representation().IsDouble()); | 875 ASSERT(instr->representation().IsDouble()); |
878 ASSERT(instr->left()->representation().IsDouble()); | 876 ASSERT(instr->left()->representation().IsDouble()); |
879 ASSERT(instr->right()->representation().IsDouble()); | 877 ASSERT(instr->right()->representation().IsDouble()); |
880 ASSERT(op != Token::MOD); | 878 ASSERT(op != Token::MOD); |
881 LOperand* left = UseRegisterAtStart(instr->left()); | 879 LOperand* left = UseRegisterAtStart(instr->left()); |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2128 | 2126 |
2129 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2127 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
2130 HEnvironment* outer = current_block_->last_environment()->outer(); | 2128 HEnvironment* outer = current_block_->last_environment()->outer(); |
2131 current_block_->UpdateEnvironment(outer); | 2129 current_block_->UpdateEnvironment(outer); |
2132 return NULL; | 2130 return NULL; |
2133 } | 2131 } |
2134 | 2132 |
2135 } } // namespace v8::internal | 2133 } } // namespace v8::internal |
2136 | 2134 |
2137 #endif // V8_TARGET_ARCH_X64 | 2135 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |